Skip to content

Commit

Permalink
Handle request options
Browse files Browse the repository at this point in the history
  • Loading branch information
iunanua committed Oct 16, 2024
1 parent f8515ec commit df27cfe
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions packages/dd-trace/src/appsec/rasp/ssrf.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
'use strict'

const url = require('url')
const { httpClientRequestStart } = require('../channels')
const { storage } = require('../../../../datadog-core')
const addresses = require('../addresses')
Expand All @@ -20,12 +21,12 @@ function disable () {
function analyzeSsrf (ctx) {
const store = storage.getStore()
const req = store?.req
const url = ctx.args.uri
const uri = (ctx.args.options?.uri && url.format(ctx.args.options?.uri)) ?? ctx.args.uri

if (!req || !url) return
if (!req || !uri) return

const persistent = {
[addresses.HTTP_OUTGOING_URL]: url
[addresses.HTTP_OUTGOING_URL]: uri
}

const result = waf.run({ persistent }, req, RULE_TYPES.SSRF)
Expand Down

0 comments on commit df27cfe

Please sign in to comment.