Remove AppSec::instrumentation::Gateway#pushed?#5487
Conversation
|
✅ Tests 🎉 All green!❄️ No new flaky tests detected 🎯 Code Coverage (details) 🔗 Commit SHA: 39f93b3 | Docs | Datadog PR Page | Was this helpful? React with 👍/👎 or give us feedback! |
BenchmarksBenchmark execution time: 2026-03-23 16:36:12 Comparing candidate commit 39f93b3 in PR branch Found 0 performance improvements and 0 performance regressions! Performance is the same for 46 metrics, 0 unstable metrics.
|
spec/datadog/appsec/integration/contrib/devise/signin_multi_user_tracking_spec.rb
Show resolved
Hide resolved
spec/datadog/appsec/integration/contrib/rack/request_headers_collection_for_identity_spec.rb
Outdated
Show resolved
Hide resolved
spec/datadog/appsec/integration/contrib/devise/signin_multi_user_tracking_spec.rb
Show resolved
Hide resolved
6819dea to
20ef4b8
Compare
spec/datadog/appsec/integration/contrib/rack/request_headers_collection_for_identity_spec.rb
Outdated
Show resolved
Hide resolved
4489ca1 to
39f93b3
Compare
What does this PR do?
Moves identity event tracking from the global
Gatewaysingleton to the per-request AppSec Context. RemovesGateway#pushed?and@pushed_eventsentirely.The fix adds an identity_event_collected flag to the per-request
Context#statehash, set by the identity watchers (watch_user_id,watch_user_login), and read bywatch_request_finish. This correctly scopes header collection to the request that triggered the identity event.Motivation:
Gateway#pushed?tracked events on a process-lifetime singleton that was never reset between requests. Once any request pushed an identity event (e.g. a Devise login),pushed?returnedtruefor all subsequent requests forever. This caused watch_request_finish to collect identity headers on every request after the first login, rather than only on requests where an identity event actually occurred.Change log entry
None.
Additional Notes:
Related to #5466
How to test the change?
CI and manual testing