feat: add account_id to GET /api/sandboxes/file#410
feat: add account_id to GET /api/sandboxes/file#410recoup-coding-agent wants to merge 1 commit intotestfrom
Conversation
Allows the /files page to show files for an overridden account when using the email query param override flow. The AccountOverrideProvider resolves the email to an accountId, and the chat frontend passes it as account_id to this endpoint. Co-Authored-By: Paperclip <noreply@paperclip.ing>
|
Warning Rate limit exceeded
Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 8 minutes and 32 seconds. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (1)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
No issues found across 2 files
Confidence score: 5/5
- Automated review surfaced no issues in the provided summaries.
- No files require special attention.
Auto-approved: Adds optional account_id parameter to sandbox file endpoint with validation and tests, following existing patterns.
Architecture diagram
sequenceDiagram
participant Client as UI / Chat Frontend
participant Route as API Route (GET /api/sandboxes/file)
participant Val as validateGetSandboxesFileRequest
participant Auth as validateAuthContext
participant Access as buildGetSandboxesParams
Note over Client,Access: Runtime Request Flow with Account Override
Client->>Route: GET /api/sandboxes/file?path=...&account_id=...
Route->>Val: validateGetSandboxesFileRequest(request)
Val->>Val: Parse query params
opt NEW: account_id provided
Val->>Val: Validate account_id is valid UUID
end
alt Invalid Path or UUID Format
Val-->>Route: Return 400 Bad Request
else Valid Format
Val->>Auth: validateAuthContext(request)
Auth-->>Val: Returns caller accountId/authToken
Val->>Access: CHANGED: buildGetSandboxesParams({ account_id, target_account_id })
Note right of Access: Checks if caller has permission<br/>to access target_account_id
alt Access Permitted
Access-->>Val: Returns validated accountIds
Val-->>Route: Return ValidatedParams
Route->>Route: Fetch and return sandbox file data
Route-->>Client: 200 OK (File Content)
else NEW: Access Denied
Access-->>Val: Returns error ("Access denied...")
Val-->>Route: Return 403 Forbidden
Route-->>Client: 403 Forbidden
end
end
Summary
account_idquery parameter to theGET /api/sandboxes/fileendpoint (matching the existingGET /api/sandboxespattern)account_idas a UUID via Zod and passes it astarget_account_idtobuildGetSandboxesParamsfor access controlContext
Part of REC-53: when users navigate to
/files?email=..., theAccountOverrideProviderresolves the email to anaccountId. The chat frontend then passes this asaccount_idto both sandboxes endpoints. The list endpoint already supportedaccount_id— this PR adds the same to the file endpoint.Test plan
🤖 Generated with Claude Code
Summary by cubic
Add support for an optional account_id on GET /api/sandboxes/file to enable the email-based account override on /files. This mirrors the list endpoint and enforces access checks (REC-53).
Written for commit 496b778. Summary will update on new commits.