Repository navigation
fix(object-storage): stop GET_PRESIGNED_URL leaking another member's home folder - #7976
Merged
Merged
Conversation
…home folder GET_PRESIGNED_URL hands back a presigned download URL for any key in the org's bucket, including `_fs/home/users/<id>/...` — the Library's object-storage addressing for org-fs bytes. That bypasses the personal-home carve-out the `/api/:org/fs` routes and PUT_PRESIGNED_URL already enforce (org-fs.ts's ACL note: every member reads/writes every volume except another member's `home/users/<id>/` folder), letting any org member read a teammate's private notes by presigning the raw key instead of going through the fs read route. Reject `_fs/` keys whose path falls inside another member's personal home, mirroring the `requireOrgFsWrite` guard PUT_PRESIGNED_URL already applies on the write side (see #7885). Reviewer: run `bun test apps/api/src/tools/object-storage/get-presigned-url.test.ts`. Verified locally: `bun run fmt`, `tsc --noEmit` in apps/api, the targeted test file above (3 pass), and `oxlint` on the three changed files (clean). Full CI validates the rest.
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.
GET_PRESIGNED_URL hands back a presigned download URL for any key in the org's bucket, including
_fs/home/users/<id>/...— the Library's object-storage addressing for org-fs bytes. That bypasses the personal-home carve-out the/api/:org/fsroutes (and PUT_PRESIGNED_URL, fixed in #7885) already enforce: org-fs.ts's ACL note says every member reads/writes every volume except another member'shome/users/<id>/folder. Before this fix, any org member could callGET_PRESIGNED_URLwith a teammate's_fs/home/users/<other-id>/notes.mdkey and get a working download URL for their private notes, with no other guardrail in the way.Fix: reject
_fs/keys whose path falls inside another member's personal home, by applying the samecanReadPersonalcheck the fs routes use — mirroring therequireOrgFsWriteguard PUT_PRESIGNED_URL already applies on the write side.Failure scenario: org member A calls
GET_PRESIGNED_URLwithkey: "_fs/home/users/<B's user id>/notes.md"and receives a presigned URL that serves B's private file bytes directly from S3, with no further check.Reviewer: run
bun test apps/api/src/tools/object-storage/get-presigned-url.test.ts— it covers both the rejected cross-member read and that the caller's own home files / shared volumes still presign normally.Verified locally:
bun run fmt,bunx tsc --noEmitin apps/api (clean), the targeted test file above (3 pass), andoxlinton the three changed files (clean, no×/⚠). Full CI validates the rest.🤖 Generated with Claude Code
Summary by cubic
Fixes
GET_PRESIGNED_URLso org members can no longer obtain presigned download URLs for another member's private Library home folder. The tool previously presigned any key in the bucket, including_fs/home/users/<id>/..., bypassing the personal-home carve-out that the/api/:org/fsroutes andPUT_PRESIGNED_URLalready enforce._fs/keys that fall inside another member's personal home are now rejected with a forbidden error, while the caller's own home files and shared volumes still presign normally.Written for commit 7b3205a. Summary will update on new commits.