[server] fix private GitHub avatars #20461
Merged
+8
−1
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
A recent GitHub change changed the way of accessing a user's avatar. Potentially as an anti-bot/spam measure, GitHub now issues JWT-signed URLs for avatars on both https://github.com and as part of their API responses to some users, making it impossible for us to continue storing them like we do now - i.e. without any refreshes ever. Additionally, these JWT signatures inflate the URL length, preventing it from fitting into our DB's
avatarUrl
column.Let's take a look at the new URL structure:
Here, we can see the
jwt
query param being used to authorize the request. If it's omitted, invalid, or when the underlying JWT expires, we get a 404.The old avatar URLs seem to still work as before, but don't get issued anymore to the users in this cohort.
What this PR does is that it simply rewrites the
private-avatars.githubusercontent.com
URL into aavatars.githubusercontent.com
if it encounters it.Related Issue(s)
Fixes CLC-1050
How to test
Try logging in into the preview environment, that's all.
https://ft-gh-public-avatars.preview.gitpod-dev.com/workspaces
/hold