Start with assets and trust boundaries
A threat model describes valuable assets, possible adversaries and the boundaries crossed by data. For a document-sharing service, assets include document text, ownership records, invitations and administrative privileges. Draw the browser, API and storage service, then mark where an external claim becomes trusted input. Being inside a network does not make an input trustworthy. State whether the adversary can control a browser, steal an invitation or compromise a server, because these assumptions lead to different controls. Explicit exclusions make the remaining security claim assessable rather than absolute.
Ask identity and permission questions separately
Authentication establishes an identity claim; authorization decides whether that identity may perform a particular action on a particular resource. A valid login for Alice does not authorize editing Bob’s document. The API needs a resource-specific decision based on ownership, sharing rules and the requested operation. Hiding an edit button is useful interface design but cannot enforce that rule against a direct request. An unpredictable document identifier reduces accidental discovery; it still does not replace an authorization check. Keep the two decisions visible in code and in tests.
Trace a sharing-link decision
Suppose Alice receives a read-only invitation and submits an update request containing the document ID. Extract the authenticated subject, document and update action, then evaluate the policy: read access does not imply update access. Now revoke the invitation. A permission cache may continue authorizing an old grant unless expiration or invalidation is designed explicitly. Also examine whether ownership can change between the check and the write. These examples show why authorization is a lifecycle problem, including revocation and concurrency, rather than a single Boolean attached permanently to a user.
Turn controls into testable claims
Least privilege limits the resources, actions and duration granted to a subject. Tests should cover anonymous access, another owner’s resource, expired invitations, attempts to turn viewing into editing and administrative revocation. Record enough decision context to investigate failures without copying secrets into audit logs. Stronger authentication can reduce account takeover but does not repair missing resource-level authorization. Revisit the model when a new sharing mode or data path is introduced. A useful outcome is a set of explicit, testable claims connecting each mitigation to a stated threat and assumption.
Compare three principals against one document
Let A own document D, B have read-only access, and C have no grant. First write a decision table: A may read and update; B may read but not update; C may not read. Knowing that D exists does not authorize an operation. A denied read must not return text, and a denied write must leave stored content unchanged.
If B adds user_id=A to a request, the authenticated principal remains B. Separate a caller's self-description from identity established through a validated session. The permission-boundary experiment tests these combinations through a self-owned HTTP service. Its fixed-session fixture deliberately simplifies authentication and is not a production authentication scheme. Keep that simplified identity mechanism distinct from the resource-specific authorization decisions being tested.
| Principal | Resource | Operation | Expected outcome |
|---|---|---|---|
| A, owner | D | Read/update | Allow |
| B, reader | D | Read | Allow |
| B, reader | D | Update | Deny; content unchanged |
| C, no grant | D | Read | Deny; no document text |
| B, after revocation | D | Read | Deny |
Repeat the same request across revocation
After revoking B's grant, repeat the same read request and require rejection. A document disappearing from the screen does not prove that direct API access stopped. If permission information is cached, define when revocation takes effect and what happens to work already in progress. Do not extend that promise into recovering text already delivered to a user's device.
Ownership changes, invitation expiry, and administrative-role changes also affect permission over time. A check made only when a resource is created cannot reflect those later states. Specify which policy information is read before an operation and which state the decision uses. Record success before revocation, the revocation action, and rejection afterward as an ordered sequence. That connects evidence to the lifecycle requirement more clearly than a lone 403 response.
Compare delegated authority with centrally enforced policy
The capability guide examines passing a reference restricted to an object and operation. Mandatory access control examines a central policy, for example over subject and object labels, that ordinary user discretion cannot simply broaden. These are related authority questions, not interchangeable mechanism names. Identify where policy is defined and which paths enforce it.
The file-descriptor experiment verifies that the operating system rejects writing through a read-only descriptor. If the process can still open the file by an ordinary path, it has not been fully confined. Examine environmental authority alongside delegated references. Similarly, a Python decision table over labels is a model, not proof that an operating system enforces that policy. Compare the entry point actually restricted with the entry points that remain.
Extend the same model to a new distribution path
When adding updates or external integrations, return to principal, asset, and operation. A signed-update feature introduces an update-authorizing key, artifact, persisted version, and installation target. Separate successful signature computation from authority granted to that key. An AI retrieval service similarly needs to decide which requesting principal may receive a retrieved document.
A new arrow in an architecture diagram may bypass an existing control. A protected document-read route does not automatically protect exports or audit screens returning the same text. Attach the asset's requirements to each new entry point and extend allowed, denied, and revoked cases. The asset-driven threat-model guide and signed-update guide provide worked examples for these design changes. Reusing a question is useful; assuming an old check covers every new path is not.