Skip to content

Commit

Permalink
Avoid multiple subscriptions to incomingHttpRequestStart
Browse files Browse the repository at this point in the history
  • Loading branch information
iunanua committed Sep 23, 2024
1 parent 1c3677d commit 30f93ff
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions packages/dd-trace/src/appsec/rasp/lfi.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,15 @@ const { RULE_TYPES, handleResult } = require('./utils')
const { isAbsolute } = require('path')

let config
let enabled

function enable (_config) {
config = _config

if (enabled) return

enabled = true

incomingHttpRequestStart.subscribe(onFirstReceivedRequest)
}

Expand All @@ -21,6 +26,8 @@ function disable () {
if (incomingHttpRequestStart.hasSubscribers) incomingHttpRequestStart.unsubscribe(onFirstReceivedRequest)

disableFsPlugin('rasp')

enabled = false
}

function onFirstReceivedRequest () {
Expand Down

0 comments on commit 30f93ff

Please sign in to comment.