Skip to content

Commit

Permalink
don't update waf version if it dosn't exist (#4801)
Browse files Browse the repository at this point in the history
  • Loading branch information
simon-id authored Oct 18, 2024
1 parent 4f62b5a commit 5e4900d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
4 changes: 3 additions & 1 deletion packages/dd-trace/src/appsec/waf/waf_manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,9 @@ class WAFManager {
update (newRules) {
this.ddwaf.update(newRules)

this.rulesVersion = this.ddwaf.diagnostics.ruleset_version
if (this.ddwaf.diagnostics.ruleset_version) {
this.rulesVersion = this.ddwaf.diagnostics.ruleset_version
}

Reporter.reportWafUpdate(this.ddwafVersion, this.rulesVersion)
}
Expand Down
1 change: 1 addition & 0 deletions packages/dd-trace/test/appsec/waf/index.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,7 @@ describe('WAF Manager', () => {
waf.update(rules)

expect(DDWAF.prototype.update).to.be.calledOnceWithExactly(rules)
expect(Reporter.reportWafUpdate).to.be.calledOnceWithExactly(wafVersion, '1.0.0')
})

it('should call Reporter.reportWafUpdate', () => {
Expand Down

0 comments on commit 5e4900d

Please sign in to comment.