Designing against an adversary
Everything else you design for is indifferent to you. Load does not want anything; disks are not trying. An adversary is a different kind of input — they read your design, find the assumption you leaned on, and use it. This lesson is a way of thinking rather than a checklist, and it fits inside the same 45 minutes as any other design conversation.
Draw the trust boundaries first
On your architecture diagram, draw a line everywhere data crosses from something you control to something you do not: browser to API, your service to a third party, one tenant to shared infrastructure, CI to production. Those lines are where the interesting failures live, because every input crossing a boundary is attacker-controlled until you have validated it.
Most design reviews never draw them, and then reason about "the API" as though requests arrive from the client the team wrote. That client is one of the callers. It is not the caller worth designing for.
Four questions at each boundary
- What can they send? Assume the worst-shaped input that still parses — enormous, deeply nested, wrong type, hostile encoding. Validate against what you expect, not against what you have happened to see.
- What can they learn? Errors, timings and identifiers all leak. Sequential ids tell a competitor your growth rate; a login that rejects an unknown user faster than a wrong password hands over a list of who is registered.
- What can they exhaust? An endpoint that costs you a hundred times what it costs the caller is a denial-of-service primitive that you built and shipped yourself.
- What can they replay? Anything they captured, sent again. This is where idempotency keys and nonces stop being about retries and start being about defence.
Depth means assuming your control fails
Every control has a failure mode, so the useful question is what happens after it fails. If the gateway's auth check is bypassed, does the service behind it still verify? If a query escapes the tenant filter, does a row policy still catch it? Layers matter precisely because you cannot promise any single one of them.
Run the same logic backwards and assume you have already been breached: what would you see? If a credential were used from an unusual place at an unusual hour, is that in a log that anyone reads? Detection is a design property, and it is far cheaper to build in now than to reconstruct afterwards from whatever happened to be retained.
Treating security as a phase near the end. A design review that concludes "and we will do a security pass before launch" has already made the expensive decisions — where the trust boundaries sit, what the tenant key is, whether tokens can be revoked, what a leaked credential reaches. Those are architecture, not hardening, and a pass at the end can only discover the mistakes that are now costly to undo.
You are not trying to be unbreakable. You are trying to be expensive to break, quick to notice, and small to lose. Say which of those three you are optimising for and you are already having a better conversation than most design reviews manage.