Guide
Access control · 6 minute read
Testing an API's access control without documentation
Access control cannot be deduced from documentation: it is measured by comparing what two different accounts receive for the same resource. Here is the method, and what tells an observation from a proof.
Documentation describes intent, never authorisation
An OpenAPI schema lists routes and fields. It does not say who may read what. Authorisation lives in the code, in middleware, in forgotten joins: that is exactly where it breaks.
What a scanner sees, and what it does not
A scanner recognises known responses: an error page, an identifier that changes owner, a diverging HTTP code. It produces alerts. An alert is not a proof: it asks a human to triage it, replay it, and often to drop it.
The method, in four steps
- Map the references. Numeric identifiers, UUIDs, slugs, references nested inside an order, a folder, a message. Every reference is a promise about authorisation.
- Build the role × object × action matrix. Three columns are enough: who asks, which object, which operation. The matrix is filled by observation, not assumption.
- Vary one element only. Two test accounts, the same request, the other account's identifier. One variable changes, so one result is interpretable.
- Replay the deviation. The request that returned someone else's resource is kept as it is: method, path, relevant headers, body if needed. It becomes the certificate.
What an admissible proof looks like
Two real accounts, an identifier that does not belong to the calling account, a response that contains the resource, and a request short enough to be copied. Without all four, what remains is an intuition.
The three places where it breaks most often
Child objects: the order is protected, its lines are not always. Sequential identifiers: when an identifier increments, the neighbour's is within reach. Export or sharing routes, added later and allowed by default.
What Catoptrix automates in this work
The crawl learns the application's real behaviour, the differential isolates what does not match the declared specification, and replay produces the minimal request that shows the deviation. The rest, judging whether the deviation matters, stays human.
