GitHub APIs return private avatar URLs #147297
-
Select Topic AreaQuestion BodyHey GitHub friends! 👋 It seems that since about a week ago, GitHub has been issuing JWT-signed avatars living on the At Gitpod (the company I work at), we store the GitHub user avatar URL in our Database once after the user signs up. This has been working for the past ~7 years without issue, but started breaking for some users who are part of this Private Avatars experiment on December 11th and has been impacting user signups since. I could not find a single mention of this new domain or other changes on the changelog, BlueSky, X or anywhere else on the interwebs. My questions regarding this feature are:
|
Beta Was this translation helpful? Give feedback.
Replies: 6 comments 8 replies
-
Hello @filiptronicek! Thanks for sharing this with us! I have opened an issue with our engineering team and will be sure to reply back once I hear from them |
Beta Was this translation helpful? Give feedback.
-
Hello @filiptronicek I've heard back from our engineering team and should be able to answer your questions now.
Yes! We will keep it for third party apps that are consuming avatars. However, any EMU avatar will not be reachable from the old endpoint. Also, we have no plan currently to return old urls from API or GitHub UI. The old avatar URLs can be constructed by the third parties as well
New tokens are generated each 15 minutes. They are valid for 20 minutes after their generation. This makes them usable between 5-20 minutes depending on the retrieval time after their generation. Third party apps can use old endpoint unless they are supporting our EMUs. If they are supporting EMUs, they can use either either API to get a refreshed token or we have redirecting endpoints which will redirect to private avatar URL with a fresh token. Now, avatars are reachable from following endpoints: https://avatars.githubusercontent.com/u/<user_id> This will return avatar if the owner is not an EMU. https://private-avatars.githubusercontent.com/u/<user_id>?jwt= This will return avatar if it has valid token. https://github.com/user_avatars/<user_id> This will return a redirect to avatar URL with a fresh token. https://github.com/.png This will return a redirect to avatar URL with a fresh token.
We have implemented this change due to a bug bounty report. Avatars from EMUs were enumerable and reachable by any actor since there is no validation mechanism to protect them. This was against our contract with our customers. Because We have decided to protect all avatars by making them private. This was due to high load in our avatar system. We have started to rollout to larger portion of our users this last week. We currently serving to 5% of users. Before, this was rolled out to 0.1% users for last two months. Please let me know if there is anything else I can do to help! |
Beta Was this translation helpful? Give feedback.
-
hello all! Apologies on the delay! I'll go ahead and look into these questions and reply back once I am able |
Beta Was this translation helpful? Give feedback.
This comment was marked as off-topic.
This comment was marked as off-topic.
-
hi guys! I apologize for the huge delay! I'll get back to you shortly - it's been a busy month |
Beta Was this translation helpful? Give feedback.
-
here is the last thing from engineering: Question: What is the simplest solution? Is just storing https://github.com/user_avatars/<user_id> enough? Would it work for "old" users as well as "EMU"? Yes, these will links will redirect to actual avatar URL with fresh token of any non-EMU users for any requests (even not-logged in requests). However, they will redirect to actual avatar URLs of EMU users if the requestor is logged in and has access to avatar. Question: Would it be possible to get/construct public URL for avatar? How? Like I'm anonymous user, going to GitHub, see some discussion, see users and theirs avatars - this kind of avatar URL. https://private-avatars.githubusercontent.com/u/<user_id>?jwt= It can be constructed. The users need to replace private-avatars in the domain with avatars. They can even remove jwt query parameter. However, removing jwt is optional. We will not check it in public endpoint. Just one reminder, these public URLs won't return EMU avatars. But, any anonymous user cannot view any EMU avatar in any public discussion/issue/PR since EMU users are not allowed to contribute in public content. Question: Also, I'm curious, what the permissions does that token have? What the impact could be, if it was "stolen"? It only has permission to access specific avatar for maximum 20 minutes. It only has information about URL that it is served with. So, this token is not usable anywhere else than the avatar URL that the user receives the token with. Question: This leads me to question: "how many EMUs" does our GitHub App have? Is there a way to tell to assess impact? I have no idea about this. https://github.com/github/ecosystem-apps may have better knowledge. Reported issue: In this case, all avatars supposed to be non-EMU. Because, they are contributor of a public repository. So, the user doesn't need to deal with private avatars in this case. It would be the best for them using actual public avatar URLs. I see that they are using redirect link with user id. So, the conversion will be simpler and it will be faster for any consumer of user page since there will be no redirects. Also, it will not be rate-limited 🙂 They are using following URL format: https://github.com/user_avatars/<user_id> Basically, replacing https://github.com/user_avatars/ in given page with https://avatars.githubusercontent.com/u/ will be enough. |
Beta Was this translation helpful? Give feedback.
Hello @filiptronicek I've heard back from our engineering team and should be able to answer your questions now.
Yes! We will keep it for third party apps that are consuming avatars. However, any EMU avatar will not be reachable from the old endpoint. Also, we have no plan currently to return old urls from API or GitHub UI. The old avatar URLs can be constructed by the third parties as well