fix: bind build start/cancel actions to build job ownership#1691
fix: bind build start/cancel actions to build job ownership#1691
Conversation
|
Warning Rate limit exceeded
⌛ 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. 📒 Files selected for processing (2)
✨ 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 |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: dd8b32dbfb
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if (!buildRequest) { | ||
| throw quickError(404, 'build_request_not_found', 'Build request not found') |
There was a problem hiding this comment.
Preserve unauthorized response for inaccessible build jobs
This changes the cross-app error contract from 400 { error: 'unauthorized' } to 404 { error: 'build_request_not_found' } when a caller provides a job ID they cannot access, because inaccessible rows under RLS now hit this branch directly. Existing behavior is still asserted in tests/build-job-scope.test.ts for /build/start/:jobId and /build/cancel/:jobId, so old clients/tests keyed on the unauthorized path will break unless this is version-gated or kept backward compatible.
Useful? React with 👍 / 👎.
f340093 to
e959d0b
Compare
|


Summary (AI generated)
/build/start/:jobIdand/build/cancel/:jobIdactions to the targetbuild_requestsrow resolved frombuilder_job_id.app_idfrom start/cancel routes so action routing cannot mix arbitrary app IDs with foreign job IDs.404when job is not found before builder/API-key actions.app_idand avoid mutating unrelated build rows with generic failure states.failedon controlled API errors.Motivation (AI generated)
Prevent cross-tenant build sabotage by ensuring start/cancel commands are authorized against the actual job being targeted, not a caller-controlled app ID payload.
Business Impact (AI generated)
Stops unauthorized control of other tenants' build jobs (start/cancel), reducing security and billing exposure in the builder surface and improving tenant isolation.
Test Plan (AI generated)
bun lint supabase/functions/_backend/public/build/start.ts supabase/functions/_backend/public/build/cancel.ts supabase/functions/_backend/public/build/index.tsjobIdwith validapp_idbody returning404and not calling builder