fix Jellyseerr avatars for locally-created users (400 from proxy/avatar) - #798
Merged
Conversation
Updated avatar URL handling to directly use absolute URLs without proxying.
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
Requests made by locally-created Jellyseerr users (accounts made inside Jellyseerr with email + password, not linked to a Jellyfin account) never show an avatar, and every render of the Requests page fires a failed request:
with
ProxyAvatar: unsafe characters in path blockedon the server side.Root cause
Jellyseerr stores two different shapes in
user.avatar:avatarvalue/avatarproxy/<jellyfinUserId>?v=<n>(relative)server/routes/auth.ts:232,server/routes/user/index.ts:788https://gravatar.com/avatar/<md5>?default=mm&size=200(absolute)server/routes/user/index.ts:197JellyfinEnhancedController.cs:9046wrapped both in the proxy unconditionally, butProxyAvatardeliberately rejects anything containing://(line 10174) and then requires the path to start with/avatar/,/avatarproxy/or/api/v1/avatar/(line 10185). Both guards are correct as SSRF protection — the bug is that absolute URLs were being sent into an endpoint that only accepts relative ones.The fix
Absolute HTTPS avatar URLs are passed to the client untouched; relative paths keep going through the proxy exactly as before. This is safe on the client side because:
<img src>needs no CORS, so the "avoid CORS" reason for proxying doesn't apply;resolveProtectedAvatarUrl(js/enhanced/helpers.js:63) already returns any non-proxy URL as-is, andisSafeAvatarUrlalready validates the scheme — so no client change is needed.Non-HTTPS absolute URLs still take the old path (and still 400), which is unchanged behaviour rather than a new regression.
Alternative considered
Instead of bypassing the proxy,
ProxyAvatarcould accept absolute URLs whose host is on a small allowlist (gravatar.com,www.gravatar.com,secure.gravatar.com) and fetch those directly rather than prefixingjellyseerrUrl. That keeps avatars server-side (viewers' IPs never reach Automattic) at the cost of widening the proxy's input surface. Happy to switch to that shape if you'd prefer it.Testing
Implementation Notes
This PR was developed with AI assistance (Claude). I have reviewed and tested all changes and understand the implementation.