Repository navigation
fix(uploads): reject dot-segment storage keys before authorization and Azure Blob - #10314
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
[High impact] The PR appears safe to merge. SummaryRejects dot-segment storage keys before file access checks, context classification, and Azure Blob calls.
Reviews (4) · Last reviewed commit: "test(files): pass a route context in the..." · Reviewed by Greptile |
There was a problem hiding this comment.
All reported issues were addressed across 7 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
|
@cubic-dev-ai review this PR |
@waleedlatif1 I have started the AI code review. It will take a few minutes to complete. |
There was a problem hiding this comment.
All reported issues were addressed across 7 files
Tip: Get a Slack DM when cubic finishes reviewing your PRs. Connect Slack
Turn on auto-fix | Re-trigger cubic
…d Azure Blob A caller-authored serve URL could decode to a key like og-images/../workspace/<id>/<file>. Prefix-based checks classified it as a public context and skipped authorization, and the Azure Blob SDK collapses dot segments when it builds the request URL, so the read landed on another workspace's blob or a sibling container. - tryInferContextFromKey answers null for a key with a . or .. segment, so no prefix check (serve route, verifyFileAccess, classifiers) trusts an escaped prefix - verifyFileAccess denies such keys up front - every Azure block blob client is built through one guard that refuses them
…nt rejection in the file-utils mock
bb93073 to
232ec2b
Compare
|
@cubic-dev-ai review this PR |
@waleedlatif1 I have started the AI code review. It will take a few minutes to complete. |
|
@cubic-dev-ai review this PR |
@waleedlatif1 I have started the AI code review. It will take a few minutes to complete. |
Summary
tryInferContextFromKeyreturns null for any key with a./..segment, so prefix-based public checks (serve route,verifyFileAccess, key classifiers) can't be satisfied by a key that escapes its prefixverifyFileAccessdenies dot-segment keys up frontog-images/../workspace/...addressed a different blob (or a sibling container). S3/GCS keep keys literal; local storage already threw insanitizeFileKey, which now shares the samehasDotSegmenthelperType of Change
Testing
@azure/storage-blob@12.34.0authorization.test.ts,blob/client.test.ts,context-prefix.test.ts; each goes red with its guard revertedauthorization,blob/client,context-prefix,file,file.server, serve route suites: 123 passingChecklist
test-auditauthoring gate)