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 of the Change
Users with access to the
user
REST endpoint can use that to set their avatar. Additional checks were added in the last release but a few other areas of concern came up:Note
While these changes make things more secure, this could be seen as a breaking change if someone is used to a workflow where one user uploads images and other users then set those images as their avatar via a REST request. I can't imagine that's common (if anyone is doing that at all) but worth flagging
How to test the Change
Make authenticated requests to the
user
endpoint, passing in the proper data and ensuring the avatar gets set correctly and rejected correctly. For instance, try passing in an attachment ID that doesn't exit, that does exist but isn't an image, that is an image that your user uploaded, that is an image that a different user uploaded. Ping me for full details if needed.Changelog Entry
Credits
Props @dkotter, @justus12337
Checklist: