Repository navigation
Conversation
Keep requests running when a Spring user provider throws. Continue invoking later providers, but discard all provider-derived identity and install an empty user so inherited identity cannot leak into the event. Co-Authored-By: Claude <noreply@anthropic.com>
📲 Install BuildsAndroid
|
…ndling-spring-user-provider
adinauer
commented
Oct 9, 2026
| } | ||
| } | ||
| scopes.setUser(user); | ||
| scopes.setUser(providerFailed ? new User() : user); |
Member
Author
There was a problem hiding this comment.
overriding with an empty user seems safer in terms of PII leak risk compared to taking last good state or ignoring failing providers and using the others as it might be a data stripping provider that failed
lbloder
approved these changes
Oct 9, 2026
lbloder
left a comment
Collaborator
There was a problem hiding this comment.
small suggestion regarding log, otherwise LGTM
| scopes | ||
| .getOptions() | ||
| .getLogger() | ||
| .log(SentryLevel.ERROR, "The SentryUserProvider callback threw an exception.", e); |
Collaborator
There was a problem hiding this comment.
(l) should we log the name of the provider that failed? (provider.getClass().getName())?
Identify which SentryUserProvider failed when multiple providers are configured, making callback failures actionable across all Spring variants. Refs GH-6240 Co-Authored-By: Claude <noreply@anthropic.com>
…ndling-spring-user-provider
adinauer
marked this pull request as ready for review
October 9, 2026 14:38
adinauer
requested review from
0xadam-brown,
markushi,
romtsn and
runningcode
as code owners
October 9, 2026 14:38
Contributor
Instructions and example for changelogPlease add an entry to Example: ## Unreleased
### Fixes
- Handle user provider failures ([#6240](https://github.com/getsentry/sentry-java/pull/6240))If none of the above apply, you can opt out of this check by adding |
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
Handle exceptions from
SentryUserProviderimplementations across the Spring, Spring Jakarta, and Spring 7 integrations. Later providers and the request continue running, but any provider failure causes the accumulated identity to be discarded and an empty user to be set.💡 Motivation and Context
A custom user provider currently can interrupt request processing. Retaining identity from providers that ran before or after a failure could also attach incomplete or unintended PII. Failing closed shadows inherited scope users while preserving request availability.
💚 How did you test it?
./gradlew spotlessApply apiDump./gradlew :sentry-spring:test :sentry-spring-jakarta:test :sentry-spring-7:test📝 Checklist
sendDefaultPIIis enabled.🔮 Next steps
None.