Study guides · Intermediate

Build a threat model from assets and data flows

Model a shared-document service by naming assets, actors and trust boundaries, then connect specific threats to mitigations and verification evidence.

Ask Logeia about this articleTry the three questionsReview your answers

Updated

On this page
  1. State the service goal and protected assets
  2. Distinguish actors by their capabilities
  3. Trace the request and the provenance of data
  4. Derive threats by changing legitimate cases
  5. Connect each threat to an action and a test
  6. Prioritize using impact and enabling conditions
  7. Update the model when the service changes
  8. Change one operation while keeping the asset fixed
  9. Exercise: complete one revocation row
  10. Ask Logeia about this articleCheck your understanding

State the service goal and protected assets

A threat model is not complete merely because it lists familiar attack names. Begin with what the service is meant to let people do. Our fictional example lets user A create a document, grant B read access and later revoke that access. Assets include the document body, ownership information, sharing policy, login state and revision history. Keeping the body confidential is insufficient if someone else can rewrite the policy that controls it. Conversely, treating a deliberately public title and a private body as one undifferentiated secret makes the required restrictions unclear. For each asset, state who may read it, who may change it and how long it should be retained. These are original design exercises, not findings about an existing product or actual user incidents. Starting from authorized actions gives later mitigations a concrete purpose.

Distinguish actors by their capabilities

List owner A, invited reader B, uninvited user C, an unauthenticated caller and an operator. B can construct requests in a browser or another client; B is not restricted to pressing the buttons the user interface happens to display. Changing a document identifier or HTTP method therefore belongs in the model. Possession of production database-administrator privileges is a different assumption. Giving every actor every possible capability makes it difficult to identify which boundary is being tested. For the basic exercise we trust the API and database implementation but not values supplied by external callers. If operator access to plaintext must also be prevented, that is a separate extension of the model. Recording exclusions makes the conditional scope of the protection inspectable rather than pretending that every adversary has been addressed.

PathInformation crossing itBoundary check
Browser → APICookie, D, operationSession principal and input
API → policyPrincipal, D, operationCurrent grant and revocation
API → storageAuthorized read or writeTarget and result scope
Storage → responseDocument contentsNo document text after denial

Trace the request and the provenance of data

Draw the browser, API, session store, document database and sharing-policy store, then connect them with request and data flows. The browser supplies a document identifier and requested operation, but its claimed owner is not authoritative. The API obtains a verified actor from login state and reads resource policy from a trusted source before returning the body. A diagram exposes where each fact becomes trusted. A cache path that returns the body before authorization would evade a test covering only the ordinary database route. Search snippets, previews, attachments and history can provide additional paths to the same asset. Annotate arrows with the meaning and provenance of their data, not only network direction. A detailed infrastructure map is less useful here than a clear account of where identity, resource policy and protected output originate.

PrincipalResourceOperationPolicy
A, ownerDRead and updateAllow
B, readerDReadAllow
B, readerDUpdateDeny
C, no grantDReadDeny

Derive threats by changing legitimate cases

Begin with two legitimate cases: A updates A’s own document, and B reads a shared document. Change one condition at a time to obtain B requesting an update, C reading the same identifier, and B reading immediately after revocation. Describe a threat concretely: a read-only actor sends an update request and the API changes the body. That identifies the actor, resource, operation and unwanted result more precisely than saying authorization is risky. Inspect rejection bodies too; displaying an error does not excuse transmitting protected content behind it. Pairing legitimate and illegitimate cases also detects a repair that simply rejects everyone. A’s authorized update must continue working while B’s unauthorized update fails. Both halves are necessary to verify the service goal and the protection requirement together.

Connect each threat to an action and a test

For B’s update request, assign server-side authorization using actor, resource and operation on every request. For access after revocation, assign a revocation and cache-consistency policy. Unauthorized changes to stored content may require a different permission or integrity boundary. Repeating a mitigation label such as encryption across these problems does not establish the required properties. Use one row per threat with columns for mitigation, test input, expected outcome and residual assumptions. A useful row sends an update as read-only B and checks both unchanged state and absence of protected content in the response. Verify which unwanted result no longer occurs, rather than treating installation of a named mechanism as the evidence. Logging can support diagnosis, but its own content policy must avoid turning session identifiers or document bodies into another disclosure path.

Prioritize using impact and enabling conditions

Not every threat can receive identical effort. A path exposing many private document bodies has a different relationship to the service goal from a temporary delay in a display feature. Fame of an attack name is not a sufficient ranking method either. Consider required privileges, reachable inputs, affected assets and the difficulty of detection and recovery together. When a design review cannot estimate probabilities precisely, record uncertainty and the evidence that would change the decision instead of manufacturing detailed numeric scores. An operator-only setting and a public document identifier present different entry conditions. Prioritization should preserve the reason for an implementation order, making it possible to reconsider that order as features, users or stored information change. It is a decision record, not a claim that one initial ranking is permanently correct.

Update the model when the service changes

Adding public links or attachments creates flows absent from the original diagram. Testing the ordinary body API does not cover separate implementations of link expiration or preview permissions. For each change, ask whether an asset was added, an actor’s capability changed or a new flow crosses a boundary. New trusted components can also alter failure and update assumptions. Link the model and threat-to-test table to feature changes so that additional tests can be selected deliberately. This does not require rewriting an enormous document from scratch for every edit, but an obsolete diagram cannot serve as evidence about a new data path. A login badge or a test that passed for an earlier release does not demonstrate protection of newly added behavior. Match the current implementation paths to the scope of current verification.

Change one operation while keeping the asset fixed

Permission to read a document does not imply permission to delete or publish it. A collaborator might edit text without adding recipients, while an auditor reads history without changing content. Add a row that keeps principal and asset fixed but changes the operation. This often reveals an overbroad authorization rule. Preserve that operation-level distinction when comparing GET and PUT outcomes instead of compressing them into a single statement that the document is accessible.

Exercise: complete one revocation row

Add this scenario to the table: A revokes B’s read access, but B requests the document again from an old screen. The assets are the body and current sharing policy; the actor is formerly invited B; the entry point is the retrieval API. Mitigations include checking current authorization and not returning a pre-revocation cached body unconditionally. Expected evidence is rejection of the later retrieval without the body appearing in the response. This does not promise deletion of copies already delivered to B; record that residual condition explicitly. Then restore a legitimate sharing grant and verify that the allowed request works again. Rejection alone does not establish preserved functionality. Explaining the asset, operation, mitigation, test and limitation for one concrete scenario turns a threat list into something useful for implementation and verification.

Reading and practice are recorded separately in this browser, for each language.

Learn this in order

Understand the systems behind the web · STEP 19

Choose a learning path