Consult AppSec trace rate limiter only when the WAF requests trace retention - #12482
Consult AppSec trace rate limiter only when the WAF requests trace retention#12482claponcet wants to merge 2 commits into
Conversation
…tention Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
|
🎯 Code Coverage (details) 🔗 Commit SHA: b40f2e9 | Docs | View more details | Give us feedback! |
🟢 Java Benchmark SLOs — All performance SLOs passed
PR vs. master results
Commit: Load and DaCapo benchmarks can be triggered manually in the GitLab pipeline. Results will appear in the Benchmarking Platform UI after completion. |
|
@codex review |
|
@DataDog review |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Codex Review: Didn't find any major issues. Keep them coming! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
There was a problem hiding this comment.
More details
A WAF result with keep=false no longer uses a limiter token. A result with keep=true still keeps or rate-limits the trace as before.
🤖 Datadog Autotest · Commit 945bcc4 · What is Autotest? · @DataDog review to ask questions · Any feedback? Reach out in #autotest
🛡️ Codex Security Review · Automatically triggeredSecurity review completed. No security issues were found in this pull request. Reviewed commit: Only the user who started this review can view the report in Codex. ℹ️ About Codex security reviews in GitHubThis is an experimental Codex feature. Security reviews are triggered when:
Once complete, Codex will leave suggestions, or a comment if no findings are found. |
There was a problem hiding this comment.
More details
The limiter now runs only when a WAF result requests trace retention. Event reporting and results without trace retention keep their existing behavior.
🤖 Datadog Autotest · Commit b40f2e9 · What is Autotest? · @DataDog review to ask questions · Any feedback? Reach out in #autotest
|
Good job, this correctly stops the rate limiter from being consumed by non-event matches. Not a blocker, the ticket also mentions only setting the |
|
@jandro996 my understanding is that this flag should be used with the same condition as the throttle, which is only gated on |
What Does This Do
Consults the AppSec trace rate limiter only when a WAF result actually requests trace retention (
resultWithData.keep), instead of on every WAF match.keeptrue and limiter allows: the trace is force-kept as before.keeptrue and limiter denies:setWafRateLimited()is set for non-RASP requests, as before.keepfalse: the limiter is neither consulted nor consumed.Event and attribute reporting are untouched — they were already independent of throttling.
Motivation
Solves APPSEC-69576.
ddwaf_runreturnsDDWAF_MATCHwhen attributes, actions, or events are non-empty, and the fingerprint processors evaluate unconditionally on every request. So the WAF reports a match with no event on ordinary traffic, and the rate limiter token was consumed on essentially every request. On a busy JVM the per-second budget was exhausted by non-events, and a genuine attack later in the request reused the already-throttled verdict and lost its force-keep.Additional Notes
The gate is
keeprather thanevents: the limiter governs force-keep only, so a result that reports an event without requesting retention has nothing to throttle, and events are reported either way.Also removes an
elsebranch that logged "There is no active span available" whenkeepwas false rather than when the span was actually missing.Tests: the two
keep: falsescenarios in the rule-output matrix no longer expect the limiter to be consulted, plus a new scenario covering a throttledkeep: true, event: trueresult. Attack-rule expectations are unchanged, since rules with nooutputblock default to keeping the trace.The new coverage extends the existing Spock spec instead of migrating it — the file is built entirely on Spock interaction cardinality, so migrating it would bury a small behaviour fix in an unreviewable diff. Worth a separate change.
Contributor Checklist
type:and (comp:orinst:) labels in addition to any other useful labelsclose,fix, or any linking keywords when referencing an issueUse
solvesinstead, and assign the PR milestone to the issueJira ticket: APPSEC-69576