fix(boto3): Fix botocore SigV4 failures caused by post-sign trace propagation - #7050
Draft
pabloDeputter wants to merge 6 commits into
Draft
fix(boto3): Fix botocore SigV4 failures caused by post-sign trace propagation#7050pabloDeputter wants to merge 6 commits into
pabloDeputter wants to merge 6 commits into
Conversation
- merge Sentry baggage with existing vendor (e.g. Datadog) baggage in botocore's`before-sign` hook; avoiding post-sign header tampering that invalidates the SigV4 signature. - Skip propagation for presigned requests Fixes: #7031 & PY-2667
Contributor
Codecov Results 📊✅ 99287 passed | ⏭️ 6494 skipped | Total: 105781 | Pass Rate: 93.86% | Execution Time: 354m 38s 📊 Comparison with Base Branch
➖ Removed Tests (1)View removed tests
All tests are passing successfully. ✅ Patch coverage is 95.06%. Project has 2508 uncovered lines. Files with missing lines (2)
Coverage diff@@ Coverage Diff @@
## main #PR +/-##
==========================================
+ Coverage 89.95% 89.98% +0.03%
==========================================
Files 193 193 —
Lines 24955 25029 +74
Branches 9004 9038 +34
==========================================
+ Hits 22448 22521 +73
- Misses 2507 2508 +1
- Partials 1437 1440 +3Generated by Codecov Action |
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.
Description
Summary of what lead to this issue
pre-4.12.0 ddtrace basically behaved like Sentry does now: propagation headers were added by the HTTP client after botocore already had calculate the SigV4 signature. So
baggagewas not included inSignedHeaders. Any later modifications to the value did not invalidate the request.after 4.12.0 moves the header injection to botocore's
before-signevent. It addsbaggage, ... andx-datadog-*before signing, then suppresses its later HTTP-client injection to avoid duplicate headers.How failure happens:
before-signhandler writes the baggage to the AWS request.baggagein the SigV4 signature.baggagevalue.baggagewas modified after signing, AWS rejects the request with403 ForbiddenorSignatureDoesNotMatch.merge Sentry baggage with existing vendor (e.g. Datadog) baggage in botocore's
before-signhook; avoiding post-sign header tampering that invalidates the SigV4 signature.Skip propagation for presigned requests
Issues
Resolves: #7031 & PY-2667
Reminders
uv run ruff.feat:,fix:,ref:,meta:)