fix(web): require an explicit share for org video downloads - #2067
Merged
Conversation
richiemcilroy
marked this pull request as ready for review
August 3, 2026 00:58
|
Bugbot is not enabled for your account, so this pull request was not reviewed. Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs. |
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.
Download access was broader than view access.
VideosPolicy.canViewgrants an org member access only through an explicitsharedVideosrow (viaOrganisationsRepo.membershipForVideo), and no video-creation path writes one, so a private recording is invisible to colleagues.canUserDownloadVideoadditionally trusted the video's ownorgId, which meant any member of the owner's organization could download any video created in that org, including ones they get a 404 on.getVideoDownloadInfois a directly invocable server action with no second guard: it authenticates, calls this helper, and returns a signed S3 URL.This drops
orgIdfrom the lookup so download requires an explicit org or space share. Owners keep access, explicit shares are unchanged, and no listing surface is affected (dashboard, folders and share page all join throughsharedVideos).One deliberate behaviour change worth a decision
For private videos this is pure over-grant removal: the people who lose download already could not open the video.
For a public video owned by an org member that was never explicitly shared, org colleagues can view it (anyone can) and today can also download it; after this change they cannot. Note that anonymous viewers of that same public video already could not download it, since the share page only offers download to signed-in users who pass this check, so the result is consistent rather than novel. If we would rather public videos stay downloadable by anyone signed in, that should be an explicit
video.publicbranch here rather than an implicit consequence of org membership.Credit to @wasim-builds, who reported and fixed this in #2052. This version takes the permission change on its own, without the unrelated sdk-recorder edit, and replaces the test (the original had a broken import path and asserted by stringifying Drizzle internals).
Validated: the new test fails 3 of 6 cases against the old logic, including the exploit case, and passes here; full web unit suite 1256/1257, the one failure a pre-existing unrelated Slack manifest test; typecheck and Biome clean.
Greptile Summary
This PR narrows video-download authorization so organization membership grants access only when the video has an explicit organization share, matching existing view authorization.
Confidence Score: 5/5
The PR appears safe to merge, with download authorization now consistently requiring ownership or an explicit organization or space share.
The changed helper matches the repository's view-policy semantics, all current callers use its new signature, and no concrete regression remains.
Important Files Changed
Reviews (1): Last reviewed commit: "fix(web): require an explicit share for ..." | Re-trigger Greptile
Context used: