fix(starlette): Don't overwrite user set during request in AuthenticationMiddleware#6760
Open
ericapisani wants to merge 1 commit into
Open
fix(starlette): Don't overwrite user set during request in AuthenticationMiddleware#6760ericapisani wants to merge 1 commit into
ericapisani wants to merge 1 commit into
Conversation
…tionMiddleware The AuthenticationMiddleware patch added the request-derived user after calling the wrapped handler, silently overwriting any user set by the application during the request (e.g. via `sentry_sdk.set_user`). Add the user before invoking the handler so app-set user data takes precedence. Fixes PY-2596 Fixes #6756
Contributor
Codecov Results 📊✅ 90045 passed | ⏭️ 6302 skipped | Total: 96347 | Pass Rate: 93.46% | Execution Time: 311m 12s 📊 Comparison with Base Branch
All tests are passing successfully. ✅ Patch coverage is 100.00%. Project has 2437 uncovered lines. Coverage diff@@ Coverage Diff @@
## main #PR +/-##
==========================================
+ Coverage 89.76% 89.77% +0.01%
==========================================
Files 192 192 —
Lines 23823 23823 —
Branches 8226 8226 —
==========================================
+ Hits 21384 21386 +2
- Misses 2439 2437 -2
- Partials 1351 1348 -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.
The AuthenticationMiddleware patch added the request-derived user after
calling the wrapped handler, silently overwriting any user set by the
application during the request (e.g. via
sentry_sdk.set_user). Addthe user before invoking the handler so app-set user data takes
precedence.
Fixes PY-2596
Fixes #6756