fix(uploads): close multipart storage-quota bypass via quota-exempt contexts#5155
Conversation
…ontexts The multipart endpoint accepted the quota-exempt public-asset contexts (og-images, profile-pictures, workspace-logos), which skip checkStorageQuota, letting any authenticated writer open arbitrarily large upload sessions that never count against their plan limit. These contexts have no large-file flow: their client hooks hard-cap uploads at 5MB (image-only) and the direct-upload strategy only uses multipart above 50MB, so they always route through the presigned endpoint. Remove them from ALLOWED_UPLOAD_CONTEXTS (joining logs) so every context the multipart endpoint serves is quota-enforced.
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
PR SummaryHigh Risk Overview Those three contexts are removed from Initiate quota logic now keys off the validated Reviewed by Cursor Bugbot for commit e8ffb15. Configure here. |
|
@greptile |
|
@cursor review |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit e8ffb15. Configure here.
Summary
POST /api/files/multipart) accepted the quota-exempt public-asset contextsog-images,profile-pictures, andworkspace-logos, which skipcheckStorageQuota. Any authenticated writer — including a free-tier account — could open arbitrarily large upload sessions (100 GB+ confirmed) that never counted against their plan limit, causing unbounded untracked storage cost (CWE-770).ALLOWED_UPLOAD_CONTEXTS(joininglogs), so every context the multipart endpoint serves is quota-enforced. The bypass is now structurally impossible.Why this is the right (and backwards-compatible) fix
og-imageshas neither a client nor a server multipart write path.workspace/mothership/knowledge-base/chat/copilot/executionbehavior;workspace/mothershipkeep their existingMAX_WORKSPACE_FILE_SIZEcap.Type of Change
Testing
route.test.ts: every quota-exempt context (og-images,profile-pictures,workspace-logos,logs) now returns400 Invalid storage contextbefore any session/quota call; quota-enforced contexts still pass the quota check and initiate.bunx tsc --noEmit— 0 errors;vitestmultipart suite — 11/11 pass;bun run check:api-validation— passes.Checklist