Repository navigation
fix(files): authorize the workspace before resolving a files/ path - #9527
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
[Medium impact] The PR appears safe to merge; no actionable defects were found. SummaryThe PR hides file-path lookup errors from callers who cannot access the workspace.
|
There was a problem hiding this comment.
All reported issues were addressed across 3 files
This PR changes authentication, authorization, or input validation. Ultrareviews find 2.4x more serious bugs than standard reviews. Comment @cubic-dev-ai ultrareview to run one.
Turn on auto-fix | Re-trigger cubic
…and refuse file-scoped delegates there Path resolution now throws a typed UnresolvedWorkspaceFileVfsPathError for a missing or ambiguous path; defineAuthorizedWorkspaceFileUseCase authorizes the asserted workspace with the operation's own options before letting it out. A resolved path keeps the single authorization the id path runs, and a delegation scoped to one file gets the same refusal for every other path.
2c4e3f8 to
ad3ce46
Compare
|
@cubic-dev-ai review this PR |
@waleedlatif1 I have started the AI code review. It will take a few minutes to complete. |
Summary
files/…VFS path inside the caller-asserted workspace before any authorization. The not-found case was concealed, but the "names more than one file whose names display alike" error was thrown pre-authorization, so a non-member who knew a workspace id could learn that look-alike names exist at a pathdefineAuthorizedWorkspaceFileUseCasenow runsauthorizeWorkspaceFileVfsPathfirst for path inputs: path syntax is still checked without touching the DB (a malformed path stays a validation error for everyone), then the asserted workspace is loaded and authorized with the operation's own minimum role — the same check the id path runs — and only then is the name looked upforbiddenbefore the lookup (normal authorize-first order; v2 conceals it the same way)Type of Change
Testing
file-path-references.integration.ts: a non-member gets the same outcome for an ambiguous, a missing and an existing path, and a dot-segment path is still a validation error. Ran locally against real Postgres: 10/10 with the fix; the new case fails on the pre-fix coderename-workspace-file.test.ts,read-workspace-file-metadata.test.ts; biome; full gate in CIChecklist
test-auditauthoring gate)