Repository navigation
providers/oauth2: only expose URL-based avatars as picture claim - #26080
Merged
BeryJu merged 1 commit intoSep 13, 2026
Merged
Conversation
The stock 'profile' scope mapping emitted the user's avatar as the picture claim unconditionally. With the default tenant avatar settings (gravatar,initials), any user without a Gravatar falls back to avatar_mode_generated, which returns the avatar inline as a base64 SVG data URI. Every issued ID and access token for such users carried hundreds of bytes of SVG, and there was no way to exclude it. The OIDC Core spec defines picture as the URL of the End-User's profile picture and recommends HTTPS. Only emit the claim when the avatar is an actual http(s) URL; generated data-URI avatars stay out of tokens. Gravatar and custom URL avatar modes keep working, and admins who want the data URIs can clone the mapping and customize it. Fixes #25978
✅ Deploy Preview for authentik-docs ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
BeryJu
approved these changes
Sep 13, 2026
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #26080 +/- ##
==========================================
- Coverage 91.88% 91.85% -0.03%
==========================================
Files 1171 1171
Lines 75601 75601
Branches 4054 4054
==========================================
- Hits 69467 69445 -22
- Misses 6092 6114 +22
Partials 42 42
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. |
Contributor
|
🍒 Cherry-pick to |
BeryJu
pushed a commit
that referenced
this pull request
Sep 14, 2026
…rry-pick #26080 to version-2026.8) (#26089) providers/oauth2: only expose URL-based avatars as picture claim (#26080) The stock 'profile' scope mapping emitted the user's avatar as the picture claim unconditionally. With the default tenant avatar settings (gravatar,initials), any user without a Gravatar falls back to avatar_mode_generated, which returns the avatar inline as a base64 SVG data URI. Every issued ID and access token for such users carried hundreds of bytes of SVG, and there was no way to exclude it. The OIDC Core spec defines picture as the URL of the End-User's profile picture and recommends HTTPS. Only emit the claim when the avatar is an actual http(s) URL; generated data-URI avatars stay out of tokens. Gravatar and custom URL avatar modes keep working, and admins who want the data URIs can clone the mapping and customize it. Fixes #25978 Co-authored-by: Mohd Quamar Tyagi <[email protected]>
1 task
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.
Fixes #25978
Problem
The stock
profilescope mapping (goauthentik.io/providers/oauth2/scope-profile) emits the user's avatar as thepictureclaim unconditionally. With the default tenant avatar settings (gravatar,initials), any user whose email has no Gravatar falls through toavatar_mode_generated, which returns the avatar inline as a base64 SVG data URI. Every ID and access token for such users carries hundreds of bytes of inline SVG, and there is currently no way to exclude the claim from tokens while keeping the default mapping.Fix
The stock mapping now only emits
picturewhen the avatar is an actual http(s) URL:pictureas "URL of the End-User's profile picture" (SHOULD be HTTPS).picturecan clone the mapping and customize it; the stock mapping stays lean and spec-compliant.Testing
test_userinfo.py: the two userinfo tests assertedpicture: self.user.avatar(a data URI in the test environment); they now assert the claim is absent, with a comment explaining why.uv sync --frozen):authentik.providers.oauth2.tests.test_userinfo.py2/2 pass;test_token_cc_standard.py+test_token_exchange.py(the other tests exercising profile-scope claims) 46/46 pass;ruff checkandruff format --checkclean on the changed file.