0
0
Fork 0
mirror of https://github.com/discourse/discourse.git synced 2026-08-09 21:45:25 +08:00
discourse/app/jobs
Alan Guo Xiang Tan eff53af263 SECURITY: Authorize secure-upload hotlink downloads against post user [backport 2026.1]
Backport of #705 to release/2026.1.

---

Advisory: https://github.com/discourse/discourse/security/advisories/GHSA-3876-w96v-8v38

When a post embeds an `<img>` pointing at a secure-uploads URL whose upload is owned by an access-controlled post (for example a private category), `Jobs::PullHotlinkedImages` would resolve the presigned S3 URL and attach a fresh local copy of the upload to the embedding post regardless of whether its author could see the original. A user could hotlink the secure-uploads URL of media they should not have access to into a post they authored, and `Jobs::PullHotlinkedImages` would create a fresh local copy attached to their post.

This commit gates `Jobs::PullHotlinkedImages#should_download_image?` on a new `can_see_upload?` helper. For secure uploads the helper checks the post author against the upload's `access_control_post` with `user.guardian.can_see_post?`. When the author cannot see the access-control post, the job leaves the original secure URL in place and does not create a local copy.
2026-06-30 16:27:06 +02:00
..
concerns DEV: Update rubocop-discourse to 3.13 and autofix issues (#35073) 2025-10-06 16:11:01 +02:00
onceoff DEV: Hand-pick Rails/WhereNot autofixes (#35117) 2025-10-03 13:29:22 +02:00
regular SECURITY: Authorize secure-upload hotlink downloads against post user [backport 2026.1] 2026-06-30 16:27:06 +02:00
scheduled FIX: Match webhook-related messagebus audience to controller audience [backport 2026.1] (#40700) 2026-06-09 18:22:10 +01:00
base.rb DEV: Update rubocop-discourse to 3.13 and autofix issues (#35073) 2025-10-06 16:11:01 +02:00