Invoice export returns another tenant's invoices when the tenant ID is changed
- Asset
- api.example.com: GET /v2/tenants/{tenantId}/invoices/export
- Caller
- Member role in Tenant B (synthetic test account)
- Standard
- OWASP API1:2023 Broken Object Level Authorization; CWE-639
Impact. Any authenticated user can download billing contacts, amounts and payment status for every tenant by enumerating tenant IDs. The IDs are sequential and appear in shared invoice links.
Fix. Derive the tenant from the authenticated session, not the path. Enforce tenant membership in the export service itself, add a regression test pairing Tenant A and Tenant B accounts, and review sibling export and report endpoints for the same pattern.
Evidence · request → response
GET /v2/tenants/tnt_4821/invoices/export?format=csv HTTP/1.1 Host: api.example.com Authorization: Bearer [redacted: Tenant B member token] Accept: text/csv
HTTP/1.1 200 OK Content-Type: text/csv X-Request-Id: syn-7f3a19c2 invoice_id,billing_email,amount_gbp,status INV-20931,[email protected],4200.00,paid INV-20932,[email protected],1180.00,overdue