Security: designing systems that are hard to misuse
Security isn't a box you add at the end; it's a property of how the boxes are connected. Most real breaches aren't clever cryptography attacks. They're an endpoint that forgot to check who owns a record, a secret in a repository, an over-privileged service account, or one customer's data reachable from another's. This module gives you the design-level toolkit: identity, permissions, secrets, encryption and isolation.
1. The idea
- Authentication (AuthN): proving who you are: passwords, passkeys, one-time codes, a service's certificate.
- Authorization (AuthZ): deciding what you may do: "can user 7 cancel booking 9?". Checked on every request, for the specific resource.
- Least privilege: every user, service and key gets only the permissions it needs, for only as long as it needs them.
- Defence in depth: several independent layers (network, identity, authorization, encryption, monitoring), so one mistake isn't a breach.
- Threat modelling: before building, ask what you're protecting, from whom, and how it could go wrong. A simple prompt list is STRIDE: spoofing, tampering, repudiation, information disclosure, denial of service, elevation of privilege.
2. How it works
Sessions and tokens
- Server-side session: after login, the server stores a session record and gives the browser a random session ID in a cookie (
HttpOnly,Secure,SameSite). Easy to revoke (delete the record); needs a shared session store when you have many servers. - Signed token (JWT): the server signs a small JSON document of claims (user ID, roles, expiry). Any service with the key (or the public key) can verify it without a database lookup. Hard to revoke before it expires, so keep access tokens short-lived (minutes) and pair them with a refresh token. Try tampering with one in section 3.
Logging in with OAuth 2.0 and OpenID Connect
OAuth 2.0 lets an app get limited access on a user's behalf without seeing their password. OpenID Connect (OIDC) adds identity on top ("Sign in with Google", corporate single sign-on). The recommended flow for web and mobile apps is the authorization code flow with PKCE. Press Play.
Authorization models
| Model | Rule looks like | Good for |
|---|---|---|
| Ownership checks | "booking.user_id must equal the caller" | The minimum for every user-owned resource |
| RBAC (role-based) | "admins may refund; support may view" | Back offices, admin tools, coarse permissions |
| ABAC (attribute-based) | "managers may approve expenses under $5,000 in their own department" | Rules that depend on properties of the user and the resource |
| ReBAC (relationship-based) | "you may edit a document if you're in a group that's an editor of its folder" | Sharing and collaboration (Google Drive-style), modelled after Google's Zanzibar; OpenFGA and SpiceDB implement it |
Services, secrets and encryption
- Service identity: services authenticate to each other with short-lived credentials, not shared passwords: cloud workload identities (IAM roles), or certificates for mutual TLS issued by a mesh or SPIFFE-based system. Authorize service calls too: the billing service may call payments; the recommendations service may not.
- Secrets (API keys, database passwords) live in a secrets manager (HashiCorp Vault, AWS Secrets Manager, Google Secret Manager, Azure Key Vault), are fetched at run time, rotated regularly, and never committed to code or logged.
- Encryption in transit: TLS everywhere, including inside the data centre. At rest: disks, databases and backups encrypted, with keys in a key management service (KMS); envelope encryption encrypts data with a data key, and the data key with a master key that never leaves the KMS.
Multi-tenant isolation
In a SaaS product, one customer must never see another's data. Options, from cheapest to strongest: a tenant_id on every row with every query filtered by it (enforce it with PostgreSQL row-level security rather than trusting every query to remember); a schema per tenant; a database per tenant; or a whole deployment (a cell) per tenant or group of tenants for the largest or most regulated customers. Isolation also means performance: rate limits and quotas per tenant stop a noisy neighbour from degrading everyone.
3. Try it yourself
Tamper with a signed token
This token is really signed in your browser with HMAC-SHA256 and a secret only the "server" knows. Edit the claims (make yourself an admin, extend the expiry) and verify it.
Signed tokens are readable by anyone (the payload is just base64): never put secrets in them. They're tamper-evident, not secret.
Who may do what?
Alice and Bob are customers; Sam is support staff. The endpoint is GET /invoices/{id}. Turn the checks on and see which requests are wrongly allowed.
4. Trade-offs
Sessions vs tokens
Sessions are easy to revoke but need a lookup; tokens scale without lookups but live until they expire. Common answer: short-lived access tokens plus revocable refresh tokens, or sessions at the edge and tokens between services.
Central vs local authorization
A central policy service (OPA, OpenFGA, Cedar-based services) keeps rules consistent and auditable, but adds a call to every request. Cache decisions briefly, and keep ownership checks close to the data.
Isolation vs cost
A database per tenant is strong isolation and easy deletion, but expensive and harder to operate at thousands of tenants. Shared tables with row-level security are cheap but one bug away from a leak. Many products mix: shared for small tenants, dedicated cells for big ones.
Security vs friction
Every extra login step loses some users. Passkeys and risk-based checks (step up only for unusual or sensitive actions) improve both security and convenience.
5. In real systems
- The OWASP Top 10:2025 lists the most common web application risks. Broken access control is A01, followed by security misconfiguration and software supply chain failures; injection, insecure design and authentication failures are still on the list.
- Identity providers (Okta, Auth0, Microsoft Entra ID, Google Identity, AWS Cognito, Keycloak) implement OAuth 2.0 and OIDC so you don't have to. OAuth 2.1, which folds in today's best practices such as mandatory PKCE, is still an IETF draft in October 2026.
- Passkeys (FIDO2/WebAuthn) replace passwords with device-held keys that can't be phished or reused, and are supported across major platforms and browsers.
- Edge protection: a web application firewall, bot detection and DDoS protection at the CDN or load balancer; rate limits per user and per IP (Module 24).
- Supply chain: pin and scan dependencies, sign build artifacts, and grant CI pipelines the least privilege they need.
- Audit logs record who did what to which resource, are append-only, and are kept separately from application logs so an attacker can't quietly edit them.
In an interview, security is usually one or two sentences unless it's the focus: "users sign in through an OIDC provider; the API gateway verifies short-lived JWTs; every endpoint checks the caller owns the resource; services use workload identity and mTLS; secrets in a secrets manager; data encrypted at rest with KMS." For multi-tenant SaaS, add the isolation model.
The technologies up close
sign-in through an OIDC provider; the gateway verifies short-lived JWTs; every endpoint checks the caller may access that resource; services authenticate with workload identity or mTLS; secrets in a secrets manager; data encrypted with KMS keys; WAF and rate limits at the edge.Go deeper on whichever part the product makes hard: sharing, multi-tenancy, or payments.
OAuth 2.0 and OpenID Connect
The default for sign-in and delegated accessOAuth 2.0 lets an app get an access token to call an API on a user's behalf without seeing their password. OpenID Connect (OIDC) adds an ID token that says who the user is, which makes it a sign-in protocol.
How it works
| Flow | Who uses it |
|---|---|
| Authorization code + PKCE | Web, mobile and single-page apps signing users in: the default for anything with a user |
| Client credentials | Service-to-service calls with no user |
| Device authorization | TVs and CLIs: "go to this URL and enter this code" |
| Refresh tokens | Getting new short-lived access tokens without signing in again |
| Deprecated: tokens in URLs, or apps handling passwords |
- PKCE: the app sends a hash of a random secret with the login, and the secret itself when exchanging the code, so a stolen code is useless.
- Scopes limit what a token can do (
orders:read); audience says which API it's for. APIs must check both.
Status today (checked October 2026)
OAuth 2.0 security best practice is RFC 9700 (January 2025). OAuth 2.1, which makes PKCE mandatory, removes the implicit and password flows and requires exact redirect-URI matching, is still an IETF draft (version 16, September 2026), though major identity providers already follow it.
Use it when
- Any sign-in: use a provider (Okta, Auth0, Entra ID, Cognito, Google, Keycloak) rather than building it
- Third-party apps acting on users' data
Skip it when
- Writing your own authorization server unless identity is your product
In the interview
Users sign in through an OIDC provider with the authorization-code flow and PKCE; the API accepts short-lived access tokens scoped to it.
- Using the ID token to call APIs (it's for the client, not the API).
- Implicit flow or tokens in URL query strings.
- Not checking audience: a token for another API works on yours.
JWTs and sessions
The default token formatA JWT is a signed JSON token: header.payload.signature in base64url. Any service with the public key can verify it locally, with no database lookup. The trade-off: a valid JWT can't easily be taken back before it expires.
How it works
- Verify properly: signature with an allow-listed algorithm (RS256, ES256, EdDSA; never
none), thenexp,issandaud. Fetch keys from the issuer's JWKS URL and cache them; rotate keys withkid. - Revocation: keep access tokens short (5–15 minutes) and refresh them; for instant logout, check a small deny-list of token IDs, or use opaque tokens checked against the auth server (introspection).
- Payload is readable by anyone: signed, not encrypted. No secrets or personal data in it.
- Browser storage: for web apps, a server-side session cookie (
HttpOnly,Secure,SameSite) is often safer than a JWT in localStorage, which any injected script can read.
Status today (checked October 2026)
JWT is RFC 7519; best practice for JWTs is RFC 8725. The "backend for frontend" pattern (tokens kept on the server, a cookie in the browser) is the recommended approach for browser apps.
Use it when
- Stateless verification at a gateway and across many services
- Short-lived access tokens
Skip it when
- Long-lived sessions that must be revocable instantly: use server sessions or opaque tokens
In the interview
The gateway verifies a 10-minute JWT against the provider's JWKS, checks audience and scope, and passes the user ID downstream; refresh tokens are rotated.
- Accepting alg: none or letting the token choose its algorithm.
- Day-long access tokens with no revocation story.
- Personal data in the payload.
Service identity and mTLS
Situational · zero-trust between servicesEvery service gets its own cryptographic identity (a short-lived certificate), and services prove who they are to each other on every connection with mutual TLS. Network location stops being proof of trust.
How it works
- SPIFFE names workloads (
spiffe://shop.example/ns/prod/sa/payments) and defines short-lived identity documents (SVIDs); SPIRE issues them after attesting what the workload really is. - Service meshes (Istio, Linkerd, Cilium) issue certificates and do mTLS in sidecars or node proxies, so app code doesn't change. Policies then say "payments may call ledger".
- Cloud workload identity (AWS IAM roles for pods, GKE Workload Identity, Azure workload identity) gives each workload short-lived cloud credentials with no stored keys.
Status today (checked October 2026)
SPIFFE and SPIRE are CNCF graduated projects. Istio's sidecar-less ambient mode has been generally available since Istio 1.24 (November 2024).
Use it when
- Many services, regulated data, or shared clusters
- Replacing long-lived API keys between services
Skip it when
- A monolith or a handful of services in one private network: start with network policies and workload identity
In the interview
Services authenticate with mesh-issued mTLS certificates, and authorization policies list which service may call which.
- "It's inside the VPC, so it's trusted".
- Long-lived shared API keys between services.
Secrets managers and envelope encryption
The default for keys and secretsSecrets (database passwords, API keys) live in a secrets manager, fetched at runtime and rotated; data is encrypted with keys held by a key management service (KMS) that never lets the master key leave it.
How it works
- Envelope encryption: for each object, generate a random data key, encrypt the data with it locally (fast, AES-256-GCM), then ask KMS to encrypt the data key with the master key. Store the encrypted data key next to the data. To read, KMS decrypts the small data key; the bulk data never travels to KMS.
- Rotation: rotating the master key only re-wraps data keys, not terabytes of data. Deleting a key makes everything under it unreadable ("crypto-shredding", useful for per-customer deletion).
- Every KMS call is logged and permissioned, so access to data becomes auditable.
Status today (checked October 2026)
AWS KMS and Secrets Manager, Google Cloud KMS and Secret Manager, Azure Key Vault; HashiCorp Vault (now under the Business Source License, IBM-owned since 2025) and its open-source fork OpenBao. Kubernetes secrets are only base64-encoded unless encryption at rest is turned on, so many teams sync from a secrets manager with the External Secrets Operator.
Use it when
- Every system: no secrets in code, images or environment files in Git
- Per-tenant keys when customers need key control or deletion guarantees
Skip it when
- Nothing to skip; only the level of key granularity varies
In the interview
Secrets come from the secrets manager at start-up and rotate automatically; data at rest uses envelope encryption with a KMS key per tenant.
- Secrets committed to Git or baked into container images.
- Sending bulk data to KMS to encrypt (slow, size-limited).
WAF, bot and DDoS protection
The default at the edgeFilters in front of your app: DDoS protection absorbs floods, a web application firewall (WAF) blocks malicious requests (SQL injection patterns, known exploits), and bot management separates people from scripts.
How it works
- Network floods (layers 3–4) are absorbed by the provider's capacity, spread across anycast sites; Cloudflare reported attacks in the tens of terabits per second in 2025. You can't absorb that yourself.
- Application floods (layer 7) look like real requests: rate limits per IP, per user and per API key, challenges, and caching protect you.
- WAF rules: managed rule sets (often based on the OWASP Core Rule Set) plus your own; start in log-only mode to measure false positives.
Status today (checked October 2026)
Cloudflare, Akamai, Fastly, AWS WAF and Shield, Google Cloud Armor, Azure Front Door. Usually bundled with the CDN.
Use it when
- Any public endpoint
- Login, sign-up and checkout pages, which attract credential stuffing and bots
Skip it when
- Relying on it instead of fixing vulnerabilities: a WAF is a layer, not a cure
In the interview
Traffic enters through the CDN with DDoS protection and a managed WAF; login has stricter per-IP and per-account rate limits.
- Origin servers reachable directly, bypassing the CDN and WAF.
- No rate limit on login.
Relationship-based authorization (Zanzibar)
Situational · sharing and permissions at scaleAuthorization as a graph of relationships: user:ana is an editor of doc:42
, doc:42 is in folder:7
, members of group:eng are viewers of folder:7
. A check asks whether a path exists. This is how Google Drive-style sharing works.
How it works
- Tuples and a schema: relationships are stored as
object#relation@subjecttuples; a schema defines rules such as "editors are also viewers" and "viewers of a folder are viewers of its documents". - Check, expand, list: "can Ana view doc 42?", "who can view it?", "which docs can Ana view?" (the hardest at scale).
- The new-enemy problem: after removing someone and then adding sensitive content, a stale check must not let them see it. Zanzibar returns a consistency token (a "zookie") with each write, and checks evaluated at least that fresh.
Status today (checked October 2026)
Google's 2019 Zanzibar paper describes a system handling trillions of access-control lists and millions of checks a second at under 10 ms p95. Open-source and hosted versions: SpiceDB (AuthZed), OpenFGA (a CNCF incubating project since October 2025, behind Auth0 FGA), Ory Keto; AWS Verified Permissions uses the Cedar policy language instead.
Use it when
- Sharing, nested folders, organisations and teams, per-object permissions
- Many services needing one consistent answer to "may X do Y?"
Skip it when
- Simple roles (admin, member): a role column and middleware is enough
In the interview
Document permissions are relationships in an OpenFGA-style service: owner, editor, viewer, inherited through folders; every API checks it, passing the consistency token after permission changes.
- Permission logic copied into every service.
- Caching "allowed" answers with no story for revocation.
Zero trust
The default security model todayThe old model trusted anything inside the network: get past the firewall or onto the VPN and you could reach every server. Zero trust drops that idea. Every request, from a laptop or from another service, must prove who it is and be allowed by policy, wherever it comes from.
How it works
- The principle, in NIST's words (SP 800-207, August 2020): move defences "from static, network-based perimeters to focus on users, assets, and resources". Being on the office network or the VPC grants nothing on its own.
- For people: an identity-aware proxy sits in front of each internal app. It checks the user's identity (single sign-on with MFA through OAuth and OIDC, above), the device's health (managed, patched, disk encrypted) and a policy for that app, on every request. Google's BeyondCorp (papers from 2014) is the best-known example; Google Cloud IAP, Cloudflare Access and Zscaler offer the same idea as products.
- For services: each workload has its own short-lived identity (SPIFFE IDs, certificates issued by a mesh) and talks over mTLS (above). An authorization policy says which service may call which endpoint. A compromised pod can't simply call the payments database because it shares a network.
- The parts NIST names: a policy engine decides, a policy administrator sets up or tears down the session, and a policy enforcement point (the proxy or sidecar) sits in the request path.
- It doesn't remove network controls: private subnets and security groups still shrink the attack surface; they just stop being the only line.
Status today (checked October 2026)
Zero trust is now the mainstream model, and US federal agencies were directed to adopt it (OMB memo M-22-09, 2022). Most companies are part-way: SSO and MFA everywhere, an access proxy for some apps, mTLS inside a service mesh. Checked against NIST SP 800-207 (October 2026).
Use it when
- Internal tools and admin panels used by remote staff
- Service-to-service calls in any system that handles money or personal data
- Any design where the interviewer asks "what if an attacker gets inside?"
Skip it when
- Don't present it as one product you buy: it's an approach made of identity, device checks, mTLS and policy
In the interview
I wouldn't trust the VPC. Internal services authenticate with mTLS identities from the mesh, and an authorization policy allows only the order service to call payments. Staff reach the admin panel through an identity-aware proxy with SSO and MFA, not a VPN.
- "It's internal, so no auth": the classic way one breach becomes total.
- A VPN as the security story for internal apps.
- Long-lived shared service passwords instead of per-workload identities.
6. Remember it
How this hook works: what "Front desk, badge, locked floors" means
What the slogan means, phrase by phrase
- "Front desk"
- Authentication: one trusted place (an identity provider) checks who you are and issues a short-lived credential.
- "badge"
- Authorization: every request is checked against the specific resource ("may this badge open this door?"), not just "is the badge valid?".
- "locked floors"
- Isolation and least privilege: tenants, services and secrets are separated, so one compromised part can't reach the rest.
Why this picture fits: everyone understands that a valid badge shouldn't open every door. That one distinction, authentication versus per-resource authorization, prevents the most common breach on the OWASP list.
The story → the concept
| Office building | System |
|---|---|
| ID check at the front desk | Authentication through an identity provider |
| The badge | A session or short-lived token |
| Floors the badge opens | Authorization rules (ownership, roles, relationships) |
| The server-room key | Privileged credentials, held by few, rotated |
| Door logs | Audit logs |
| Locked floors | Tenant isolation and network segmentation |
Watch it on an example
- A file-sharing app checks that requests have a valid token (front desk).
- A user changes
/files/1001to/files/1002in the URL and downloads someone else's file: the badge was valid, but no door was checked. - Fix: every file read checks the caller is the owner or has a share grant (badge per door), enforced in one shared authorization layer.
- Also: file IDs become unguessable, and access is logged, so probing shows up in the audit logs.
The trap it saves you from
Treating "logged in" as "allowed". Broken access control is the number-one web risk precisely because authentication alone feels like security.
It still works when…
The caller is an AI agent acting for a user (Module 29): it authenticates, but every tool call must still be authorized as that user, with only the permissions the task needs.
7. Common mistakes
8. Design exercise (30 minutes)
- Threat-model a ride-hailing app with STRIDE: one realistic threat per letter, and the control that addresses it.
- Design authorization for a document editor with owners, editors, viewers, shared folders and public links. Which model, and what does the check for "edit document 42" look like?
- Isolate tenants for a B2B SaaS app with 10,000 small customers and 20 enterprise customers who demand isolation. Draw the data layout.
- Remove secrets: list every credential in a typical web app (database, payment API, email API, signing keys) and where each should live and how it rotates.
- Write it down: AuthN vs AuthZ, and "check every door".
9. Self-check quiz
"May user 7 cancel booking 9?" is a question of…
A user edits the payload of a signed JWT to make themselves an admin. What happens?
Which OAuth flow is recommended for a mobile or single-page app?
Which risk is A01 in the OWASP Top 10:2025?
In envelope encryption, what does KMS encrypt?
Which OAuth flow should a mobile app use to sign users in?
An attacker gets a shell on one server inside your VPC. Under zero trust, what stops them calling the payments service?
What replaces the VPN for staff reaching internal apps in a zero-trust setup?
10. Go deeper
| Resource | Time | Why |
|---|---|---|
| OWASP Top 10:2025 and the OWASP Cheat Sheet Series | 1 h | The most common risks, and concise how-tos for sessions, authorization, secrets and more. |
| How OpenID Connect works and RFC 7636 (PKCE) | 45 min | The login flow and why PKCE exists. |
| Zanzibar: Google's Consistent, Global Authorization System | 1 h | Relationship-based authorization at planetary scale; the model behind OpenFGA and SpiceDB. |
| Row security policies (PostgreSQL docs) | 20 min | Enforcing tenant isolation in the database itself. |
| passkeys.dev | 20 min | How passkeys work and how to add them to an app. |
11. Under the hood (optional)
How the cryptography and browser mechanics behind authentication and authorization really work. Not needed for most interviews; open it when you want to know how the products really do it. All the deep dives are listed on the Under the hood page.
Security internalsHashes vs MACs vs password hashing with two labs, AEAD and nonce reuse, post-quantum TLS, certificate transparency, cookies and passkeys, policy engines, attack paths, 8 products comparedabout 35 min
Security designs are built from a small set of primitives: hashes, MACs, password hashes, symmetric and public-key encryption, signatures and certificates. Knowing which does what, and how each is misused, explains most real breaches and most interview follow-ups.
Hashes, MACs and password hashing
| Primitive | Answers | Examples | Never use it for |
|---|---|---|---|
| Hash | "Has this data changed?" Same input, same 256-bit fingerprint; can't be reversed | SHA-256, SHA-3, BLAKE3 | Passwords (too fast), authentication (anyone can compute it) |
| MAC | "Did someone with the key produce this?" | HMAC-SHA256, Poly1305 | Proof to third parties (both sides share the key) |
| Password hash | "Is this the password?" Deliberately slow and salted | Argon2id, scrypt, bcrypt, PBKDF2 | Anything that must be fast |
| Signature | "Did the holder of this private key sign this?" Anyone can verify | Ed25519, ECDSA, RSA-PSS | Confidentiality (it doesn't hide data) |
Passwords: store a unique random salt per user and a slow, memory-hard hash. Salts defeat precomputed (rainbow) tables and make identical passwords hash differently; slowness limits guessing speed after a database leak:
Encryption and keys
- Symmetric, authenticated (AEAD): AES-256-GCM or ChaCha20-Poly1305 encrypt and detect tampering in one step. Each key must never reuse a nonce: with GCM, a repeated nonce leaks the XOR of two plaintexts and lets attackers forge messages.
- Public-key: key exchange (ECDHE with X25519) agrees a shared secret over an open channel; that secret then keys fast symmetric encryption. RSA encryption is legacy; use it, if at all, only for signatures.
- Post-quantum: a future quantum computer could break today's key exchange, and recorded traffic could be decrypted later ("harvest now, decrypt later"). NIST standardised ML-KEM (FIPS 203) in 2024, and Chrome, Firefox and Safari now use the hybrid
X25519MLKEM768key exchange by default for TLS 1.3, secure if either half holds. - At rest: disk and database encryption with keys in a KMS (envelope encryption, up close above); end to end: only the endpoints hold keys (Signal protocol, WhatsApp), so the server can't read messages but also can't search or moderate them.
Certificates and transparency
A server certificate binds a domain to a public key, signed by an intermediate certificate authority that chains to a root in the browser's trust store. Certificate Transparency requires every publicly trusted certificate to be logged in public append-only logs (Merkle trees); browsers reject certificates without proof of logging, and domain owners can monitor the logs for certificates they didn't ask for.
Sessions, cookies and the browser
- Cookie flags:
HttpOnly(scripts can't read it, so XSS can't steal it),Secure(HTTPS only),SameSite=LaxorStrict(not sent on most cross-site requests, the main CSRF defence; browsers default to Lax-like behaviour). - CSRF tricks a logged-in browser into sending a request; defend with SameSite plus anti-CSRF tokens or checking the
Originheader on state-changing requests. - Passkeys (WebAuthn): the device creates a key pair per site; login signs a server challenge with the private key, which never leaves the device. The browser binds the signature to the real origin, so a look-alike phishing site gets nothing usable.
- JWT pitfalls beyond the lab above: accepting
alg: none; key confusion (an RS256 public key used as an HS256 secret); trusting akidorjkuheader that points at attacker-controlled keys. Allow-list algorithms and key sources.
Authorization models and policy engines
| Model | Rule looks like | Good for |
|---|---|---|
| RBAC | Admins may delete projects | A few stable roles |
| ABAC | Allow if user.department = doc.department and time is in office hours | Rules over attributes |
| ReBAC | Viewers of a folder can view its documents | Sharing, hierarchies (Zanzibar, up close above) |
Policy engines keep these rules out of application code: Open Policy Agent evaluates Rego policies as a library or sidecar; AWS's Cedar language (behind Verified Permissions) is designed to be analysable, so you can prove properties about policies.
Common attack paths
- Broken access control (OWASP's top risk): an endpoint that checks you're logged in but not that you own
/invoices/1234. Check ownership on every object, server-side. - Injection: SQL, command and template injection; always parameterise, never build queries from strings.
- SSRF: a feature that fetches a URL ("import from link", webhooks) is tricked into calling internal services or the cloud metadata endpoint for credentials. Allow-list destinations, block private ranges, and require IMDSv2-style tokens.
- Tenant isolation: every query scoped by tenant (row-level security in PostgreSQL helps), separate keys per tenant for high-value data, and tests that try cross-tenant access.
- Audit logs: append-only, separate from application logs, recording who did what to which resource.
Product by product
| Product or standard | How it works | The detail worth knowing |
|---|---|---|
| Let's Encrypt (ACME) | Automated certificates after proving domain control | Short lifetimes make automated renewal mandatory, which is the point |
| Cloud KMSs | Keys in hardware security modules; envelope encryption | Keys never leave; rotating the master key doesn't re-encrypt data |
| Vault / OpenBao | Secrets engines, including dynamic short-lived database credentials | Credentials that expire on their own limit a leak |
| Okta, Auth0, Cognito, Keycloak | OAuth 2.0, OIDC and SAML identity providers | Buy identity; design token lifetimes, scopes and sessions |
| SpiceDB, OpenFGA | Zanzibar-style relationship tuples with consistency tokens | "Can this user see this?" at scale |
| OPA, Cedar | Policy as code, evaluated by a library or sidecar | Authorization rules separate from app code |
| SPIFFE / SPIRE | Short-lived workload certificates for mTLS | Service identity without shared secrets |
| Cloudflare, AWS Shield, Cloud Armor | Anycast absorbs volumetric attacks; WAF and rate limits stop layer-7 ones | Layer-7 floods look like real users |
Say it in the interview
- "How do you store passwords?" Argon2id (or bcrypt) with a per-user salt and a cost tuned to about 100 ms per hash, plus breached-password checks and rate-limited logins; better still, passkeys.
- "How do you verify a webhook came from us?" Sign the body with HMAC-SHA256 and a per-customer secret, include a timestamp in the signed data, and have receivers compare in constant time and reject old timestamps.
- "Is our TLS quantum-safe?" Key exchange is, if both sides negotiate X25519MLKEM768 (modern browsers do by default); certificates and signatures are still classical, which matters less because they can't be attacked retroactively.
What do per-user salts achieve?
To prove an API request wasn't altered and came from a client sharing your secret, use…
What is the most dangerous mistake with AES-GCM?
Sources
- OWASP: password storage cheat sheet
- Hashcat benchmark on an RTX 4090
- RFC 9106: Argon2
- RFC 5116: authenticated encryption (AEAD)
- NIST FIPS 203: ML-KEM
- Certificate Transparency: how it works
- MDN: using HTTP cookies
- WebAuthn guide
- PortSwigger: JWT attacks
- Open Policy Agent
- Cedar policy language
- OWASP Top 10:2025
- OWASP: SSRF prevention