A hard-to-guess record identifier does not establish permission to read the record. Every API operation that accepts a customer-record identifier needs to verify that the current actor can perform the requested action within the record's organisation.
This applies to detail pages, search, exports, attachments, bulk updates, and queued work. A single unscoped path can undo otherwise careful tenant isolation.
Bind the resource lookup to trusted context
Derive the actor from verified session information. Establish the intended organisation and current membership, then scope the resource lookup to that organisation and action. Do not trust a tenant identifier merely because the browser sent it.
For related guidance, OWASP's authorisation reference discusses checking permissions for requests and resources. The concrete test matrix below is a proposed application exercise rather than a report of a security assessment.
Test a fictional two-client request system
Create client organisations Aster and Pine, each with a service request, a customer, and an attachment. Give one test account Aster editor access and no Pine membership. Give another account Pine viewer access.
As the Aster editor, request the Pine detail URL, modify the request identifier in an update, ask for a bulk export containing both organisations, and open the Pine attachment URL. The expected result is no Pine data and no Pine mutation. Confirm the stored records remain unchanged after rejected writes.
Then test a valid Aster update to ensure the fix has not blocked all work. Negative tests alone can pass when the endpoint is simply broken. Pair denied cases with allowed cases that exercise the same operation.
Follow identifiers through indirect operations
An export endpoint may first select a job and later fetch records. Validate both the job's ownership and the records it includes. A background worker should not accept an arbitrary tenant ID from an untrusted payload and treat it as authority.
Database row security can add another boundary. The official PostgreSQL row-security documentation describes policy behaviour and bypass conditions. If you use it, test the actual runtime database role and connection context rather than assuming policy presence proves enforcement.
There is a tradeoff between centralised access helpers and local clarity. Reusing a well-defined decision can reduce omissions, but an overly broad helper that means “user is logged in” can conceal missing resource checks. Keep action and ownership requirements explicit.
The StackFlight portfolio account supplies related private-SaaS context. This Aster and Pine exercise is fictional and makes no claim about a particular implementation's security.
Questions about tenant API access
Are random identifiers sufficient protection?
No. They can reduce accidental discovery but do not replace an authorisation decision for the requested record.
Should a rejected request reveal which organisation owns the record?
Usually the response should avoid unnecessary private context. Define consistent error behaviour while retaining useful internal diagnostic references.
What should be tested first?
Start with a direct cross-tenant read and write, then expand to exports and files. Bring the allowed-and-denied matrix to a SaaS access review.