Repository navigation
fix: enforce invoice ownership on single-invoice reads (BOLA) - #2
Merged
Merged
Conversation
GET /api/invoices/:id skipped the ownership check whenever SECURE_MODE was not 'on', so any caller could read another owner's invoice (BOLA / OWASP API1:2023 #1). Ownership is now enforced unconditionally and the env-var gate is gone, so no deployment can silently turn the hole back on. 403 for 'exists but not owned' and 404 for 'missing' are unchanged.
Adds the spec the TestSprite project is built from (invoices + health + autopsy, inline schemas) and the PRD the generated tests assert against.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
GET /api/invoices/:idskipped the ownership check wheneverSECURE_MODEwas noton, so any caller could read another owner's invoice — BOLA / OWASP API1:2023 #1.Ownership is now enforced unconditionally and the env-var gate is gone, so no deployment can silently turn the hole back on.
Behaviour
alice→inv-1001(own)bob→inv-1001(not own)bob→inv-9999(missing)x-user-id403 vs 404 is preserved so a caller who cannot read an invoice also cannot probe whether the id exists.
Also in this PR
docs/openapi.json— the contract the TestSprite suite is built from (invoices + health + autopsy, inline schemas, no$ref)docs/test-prd.md— the PRD the generated tests assert againstSECURE_MODE; there is nothing to configureVerification
Typecheck passes (
npx tsc --noEmit). The TestSprite suite pins all four rows above.