Skip to content

Commit

Permalink
TEMP!: hardcode RASP SSRF rule & span tag for staging
Browse files Browse the repository at this point in the history
Signed-off-by: Eliott Bouhana <eliott.bouhana@datadoghq.com>
  • Loading branch information
eliottness authored and Hellzy committed May 23, 2024
1 parent fb1fd87 commit 89209f0
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 0 deletions.
1 change: 1 addition & 0 deletions contrib/net/http/roundtripper.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ func (rt *roundTripper) RoundTrip(req *http.Request) (res *http.Response, err er
}
}
if appsec.Enabled() {
span.SetTag("_dd.appsec.rasp", "1")
res, err = httpsec.RoundTrip(httpsec.RoundTripArgs{
Ctx: ctx,
Req: r2,
Expand Down
51 changes: 51 additions & 0 deletions internal/appsec/waf.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,57 @@ func (a *appsec) swapWAF(rules config.RulesFragment) (err error) {
return nil
}

const raspSSRFRule = `
{
"id": "rasp-934-100",
"name": "Server-side request forgery exploit",
"tags": {
"type": "ssrf",
"category": "vulnerability_trigger",
"cwe": "918",
"capec": "1000/225/115/664",
"confidence": "0",
"module": "rasp"
},
"conditions": [
{
"parameters": {
"resource": [
{
"address": "server.io.net.url"
}
],
"params": [
{
"address": "server.request.query"
},
{
"address": "server.request.body"
},
{
"address": "server.request.path_params"
},
{
"address": "grpc.server.request.message"
},
{
"address": "graphql.server.all_resolvers"
},
{
"address": "graphql.server.resolver"
}
]
},
"operator": "ssrf_detector"
}
],
"transformers": [],
"on_match": [
"stack_trace"
]
}
`

type wafEventListener func(*waf.Handle, *config.Config, limiter.Limiter, dyngo.Operation)

// wafEventListeners is the global list of event listeners registered by contribs at init time. This
Expand Down

0 comments on commit 89209f0

Please sign in to comment.