InterviewKata
System design · Module 26 of 29 · Level 5: Production and architecture

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

An office building checks your ID at the front desk (authentication) and gives you a badge. The badge opens only the floors you're allowed on (authorization). Visitors get a day pass that expires. The server room needs a separate key held by few people (least privilege). Every door logs who opened it (audit). And the building is split into locked floors, so a fire or an intruder on one doesn't reach the others (isolation).

2. How it works

Sessions and tokens

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

ModelRule looks likeGood 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

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

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

The default answer in an interviewSecurity is usually two sentences unless it's the focus: 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 access

OAuth 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

FlowWho uses it
Authorization code + PKCEWeb, mobile and single-page apps signing users in: the default for anything with a user
Client credentialsService-to-service calls with no user
Device authorizationTVs and CLIs: "go to this URL and enter this code"
Refresh tokensGetting new short-lived access tokens without signing in again
Implicit, passwordDeprecated: 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

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.

🚩 Red flags
  • 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 format

A 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), then exp, iss and aud. Fetch keys from the issuer's JWKS URL and cache them; rotate keys with kid.
  • 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

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.

🚩 Red flags
  • 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 services

Every 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

In the interview

Services authenticate with mesh-issued mTLS certificates, and authorization policies list which service may call which.

🚩 Red flags
  • "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 secrets

Secrets (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

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.

🚩 Red flags
  • 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 edge

Filters 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

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.

🚩 Red flags
  • Origin servers reachable directly, bypassing the CDN and WAF.
  • No rate limit on login.

Relationship-based authorization (Zanzibar)

Situational · sharing and permissions at scale

Authorization 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@subject tuples; 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?"

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.

🚩 Red flags
  • Permission logic copied into every service.
  • Caching "allowed" answers with no story for revocation.

Zero trust

The default security model today

The 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?"

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.

🚩 Red flags
  • "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

Memory hook: "Front desk, badge, locked floors"Authenticate once at the front desk, authorize every door with the badge (for this person and this room), and lock floors apart so one breach stays small.
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 buildingSystem
ID check at the front deskAuthentication through an identity provider
The badgeA session or short-lived token
Floors the badge opensAuthorization rules (ownership, roles, relationships)
The server-room keyPrivileged credentials, held by few, rotated
Door logsAudit logs
Locked floorsTenant isolation and network segmentation

Watch it on an example

  1. A file-sharing app checks that requests have a valid token (front desk).
  2. A user changes /files/1001 to /files/1002 in the URL and downloads someone else's file: the badge was valid, but no door was checked.
  3. Fix: every file read checks the caller is the owner or has a share grant (badge per door), enforced in one shared authorization layer.
  4. 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

Missing per-resource checksValidating the token but not whether the caller may access this record lets anyone read anyone's data by changing an ID. Check ownership on every endpoint.
Secrets in code, config files or logsRepositories, images and log pipelines are copied widely. Use a secrets manager and redact logs.
Long-lived tokens with no revocationA leaked token valid for a month is a month-long breach. Keep access tokens short-lived; make refresh tokens revocable.
Over-privileged service accountsOne compromised service with admin rights becomes a compromised company. Scope each identity to what it actually calls.
Trusting the clientPrices, roles and user IDs sent by the client can be changed. Decide everything security-relevant on the server.

8. Design exercise (30 minutes)

  1. Threat-model a ride-hailing app with STRIDE: one realistic threat per letter, and the control that addresses it.
  2. 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?
  3. Isolate tenants for a B2B SaaS app with 10,000 small customers and 20 enterprise customers who demand isolation. Draw the data layout.
  4. 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.
  5. Write it down: AuthN vs AuthZ, and "check every door".

9. Self-check quiz

"May user 7 cancel booking 9?" is a question of…

Identity is known; the question is permission for a specific resource.

A user edits the payload of a signed JWT to make themselves an admin. What happens?

The signature covers the payload; without the key, an attacker can't produce a valid one. (They can still read it.)

Which OAuth flow is recommended for a mobile or single-page app?

PKCE ties the code to the app instance that started the login, so a stolen code is useless.

Which risk is A01 in the OWASP Top 10:2025?

Missing or wrong authorization checks are the most common serious web vulnerability.

In envelope encryption, what does KMS encrypt?

Data is encrypted locally with the data key; KMS wraps that key with the master key, which never leaves it.

Which OAuth flow should a mobile app use to sign users in?

Implicit and password flows are deprecated; PKCE protects the code exchange.

An attacker gets a shell on one server inside your VPC. Under zero trust, what stops them calling the payments service?

Zero trust grants nothing for being on the network; each call must carry an identity (for example an mTLS certificate) that policy allows.

What replaces the VPN for staff reaching internal apps in a zero-trust setup?

BeyondCorp-style proxies make every internal app reachable only through per-request identity and device checks.

10. Go deeper

ResourceTimeWhy
OWASP Top 10:2025 and the OWASP Cheat Sheet Series1 hThe most common risks, and concise how-tos for sessions, authorization, secrets and more.
How OpenID Connect works and RFC 7636 (PKCE)45 minThe login flow and why PKCE exists.
Zanzibar: Google's Consistent, Global Authorization System1 hRelationship-based authorization at planetary scale; the model behind OpenFGA and SpiceDB.
Row security policies (PostgreSQL docs)20 minEnforcing tenant isolation in the database itself.
passkeys.dev20 minHow 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

PrimitiveAnswersExamplesNever use it for
Hash"Has this data changed?" Same input, same 256-bit fingerprint; can't be reversedSHA-256, SHA-3, BLAKE3Passwords (too fast), authentication (anyone can compute it)
MAC"Did someone with the key produce this?"HMAC-SHA256, Poly1305Proof to third parties (both sides share the key)
Password hash"Is this the password?" Deliberately slow and saltedArgon2id, scrypt, bcrypt, PBKDF2Anything that must be fast
Signature"Did the holder of this private key sign this?" Anyone can verifyEd25519, ECDSA, RSA-PSSConfidentiality (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 X25519MLKEM768 key 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=Lax or Strict (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 Origin header 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 a kid or jku header that points at attacker-controlled keys. Allow-list algorithms and key sources.

Authorization models and policy engines

ModelRule looks likeGood for
RBACAdmins may delete projectsA few stable roles
ABACAllow if user.department = doc.department and time is in office hoursRules over attributes
ReBACViewers of a folder can view its documentsSharing, 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 standardHow it worksThe detail worth knowing
Let's Encrypt (ACME)Automated certificates after proving domain controlShort lifetimes make automated renewal mandatory, which is the point
Cloud KMSsKeys in hardware security modules; envelope encryptionKeys never leave; rotating the master key doesn't re-encrypt data
Vault / OpenBaoSecrets engines, including dynamic short-lived database credentialsCredentials that expire on their own limit a leak
Okta, Auth0, Cognito, KeycloakOAuth 2.0, OIDC and SAML identity providersBuy identity; design token lifetimes, scopes and sessions
SpiceDB, OpenFGAZanzibar-style relationship tuples with consistency tokens"Can this user see this?" at scale
OPA, CedarPolicy as code, evaluated by a library or sidecarAuthorization rules separate from app code
SPIFFE / SPIREShort-lived workload certificates for mTLSService identity without shared secrets
Cloudflare, AWS Shield, Cloud ArmorAnycast absorbs volumetric attacks; WAF and rate limits stop layer-7 onesLayer-7 floods look like real users

Say it in the interview

Answers that show depth
  • "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?

Slowness comes from the algorithm and its cost factor; the salt forces attackers to attack each hash separately.

To prove an API request wasn't altered and came from a client sharing your secret, use…

Anyone can compute a plain hash of modified data.

What is the most dangerous mistake with AES-GCM?

Nonce reuse breaks both confidentiality and integrity.

Sources