Add AppSec scenarios for restart propagation behavior#5981
Draft
robertomonteromiguel wants to merge 1 commit intomainfrom
Draft
Add AppSec scenarios for restart propagation behavior#5981robertomonteromiguel wants to merge 1 commit intomainfrom
robertomonteromiguel wants to merge 1 commit intomainfrom
Conversation
Contributor
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
This PR adds two new end-to-end test scenarios to demonstrate and track a critical issue in
dd-trace-javawhen usingDD_TRACE_PROPAGATION_BEHAVIOR_EXTRACT=restartwith AppSec enabled.Problem Description
When
DD_TRACE_PROPAGATION_BEHAVIOR_EXTRACT=restartis configured, the Java tracer fails to set AppSec tags on spans, causing:_dd.appsec.enabledmetric on root spansappsec.eventtag when security events are detectedThis behavior is specific to Java - the same scenarios pass successfully for Node.js, Python, and .NET tracers.
Root Cause
The Java tracer resets propagation tags (including
_dd.p.tsfor AppSec context) to empty when inrestartmode, breaking AppSec instrumentation that depends on these tags for proper span tagging and sampling decisions.See detailed analysis:
APPSEC_RESTART_PROPAGATION_ANALYSIS.mdTesting Impact
These scenarios will:
Changes
New Scenarios Added
APPSEC_WITH_RESTART_PROPAGATION(lines 1154-1160)DD_TRACE_PROPAGATION_BEHAVIOR_EXTRACT=restartAPPSEC_WITHOUT_RESTART_PROPAGATION(lines 1161-1166)Test Coverage
Both scenarios use existing AppSec test cases from
tests/appsec/test_traces.py:Test_RetainTraces::test_appsec_event_span_tags- Validatesappsec.eventtag and sampling priorityTest_AppSecEventSpanTags::test_custom_span_tags- Validates_dd.appsec.enabledmetricTest_AppSecEventSpanTags::test_header_collection- Validates HTTP header collectionTest_AppSecEventSpanTags::test_root_span_coherence- Validates AppSec tags on correct span typesDocumentation Added
APPSEC_RESTART_PROPAGATION_ANALYSIS.mdRelated Issues
Note: This PR intentionally adds failing tests for Java to document the issue. The tests will pass once the corresponding fix is implemented in dd-trace-java.
🚀 Once your PR is reviewed and the CI green, you can merge it!
🛟 #apm-shared-testing 🛟
Reviewer checklist
tests/ormanifests/is modified ? I have the approval from R&P teambuild-XXX-imagelabel is present