Glossary#
| Term | Plain meaning | Chapter |
|---|---|---|
| CIA triad | confidentiality, integrity, availability | 1 |
| threat model / attack surface | who might attack what, and how / every point input can enter | 1 |
| defence in depth / least privilege | many independent layers / only the access needed | 1 |
| encoding / Base64 | reversible format change, no secrecy | 2 |
| cryptographic hash / SHA-256 | one-way fixed-size fingerprint / the standard choice | 2 |
| avalanche effect / collision | tiny input change → totally different hash / two inputs, same hash | 2 |
| MD5 / SHA-1 | broken hashes — don't use for security | 2 |
| rainbow table | pre-computed hash → password lookup | 3 |
| salt | random per-user value mixed in before hashing | 3 |
| Argon2id / scrypt / bcrypt | slow, salted password-hashing functions | 3 |
| constant-time comparison | comparing without leaking timing information | 3 |
| encryption in transit / at rest | protecting moving data (TLS) / stored data | 4 |
| AES-GCM / nonce | standard authenticated cipher / never-reused per-encryption value | 4 |
| KMS / envelope encryption | managed key service / data key wrapped by a master key | 4 |
| HMAC / webhook signature | keyed hash proving origin and integrity / its common use | 4 |
| authentication / authorization | who you are (401) / what you may do (403) | 5 |
| MFA / passkey | two+ factor types / device-held key pair replacing passwords | 5 |
| RBAC / ABAC | permissions by role / by attributes and rules | 5 |
| JWT | signed, Base64URL-encoded token: header.payload.signature | 5 |
| OWASP Top 10 | the standard list of top web security risks | 6 |
| broken access control / IDOR | acting beyond permissions / unchecked object IDs | 6 |
| mass assignment | accepting fields users shouldn't set | 6 |
| injection / SQL injection / command injection | data interpreted as code / in SQL / in shell commands | 7 |
| parameterized query | query structure and values sent separately | 7 |
| allow-list | only explicitly permitted values accepted | 7, 10 |
| XSS (stored / reflected / DOM) | attacker script running in users' browsers | 8 |
| output escaping / sanitizing | making data display as text / stripping unsafe HTML | 8 |
| CSP | header restricting which scripts may run | 8 |
| origin / same-origin policy | scheme+host+port / scripts can't read other origins' responses | 9 |
| CORS / preflight | server-granted cross-origin read access / its OPTIONS permission check | 9 |
| CSRF / CSRF token | forged requests using the victim's cookies / per-page secret that defeats it | 9 |
| SSRF / IMDSv2 | server tricked into internal requests / protected AWS metadata version | 10 |
| path traversal | ../ escaping the intended folder | 10 |
| secret manager / rotation | controlled secret storage / replacing secrets regularly | 11 |
| supply chain / lock file / typosquatting | risk from dependencies / pinned versions / look-alike package names | 11 |
| brute force / credential stuffing / rate limiting | many guesses / reused leaked pairs / capping attempts | 11 |
| user enumeration | discovering valid accounts from error differences | 11 |
| LLM / prompt | AI text model / its input text | 12 |
| prompt injection (direct / indirect) | input steering the model / hidden in processed content | 12 |
| data exfiltration | leaking data out, e.g. via image URLs | 12 |
Cheat Sheet#
Encoding vs hashing vs encryption
encoding anyone reverses Base64, URL-encoding — formats, never secrecy
hashing nobody reverses SHA-256 — integrity, fingerprints
encryption key reverses AES-GCM (data), RSA/ECC — secrecy
passwords salted SLOW hash Argon2id > scrypt ≈ bcrypt — never SHA-256/MD5Attack → fix
IDOR / broken access control check ownership server-side on every request; deny by default
SQL injection parameterized queries; allow-list identifiers
command injection argument lists, no shell strings
XSS escape on output · sanitize rich HTML · HttpOnly cookies · CSP
CSRF SameSite cookies · CSRF tokens · no state change on GET
CORS mistakes allow-list origins; never * or reflected Origin with credentials
SSRF allow-list hosts · block private/link-local IPs (after redirects) · IMDSv2
path traversal generated file names; verify resolved path stays inside
brute force rate limits · MFA · breached-password checks
leaked secret ROTATE first · secret manager · scanners
prompt injection scope tools to the user · output untrusted · confirm risky actions · block exfil URLsHeaders and settings
Set-Cookie: session=...; HttpOnly; Secure; SameSite=Lax
Strict-Transport-Security: max-age=31536000; includeSubDomains
Content-Security-Policy: script-src 'self'
Access-Control-Allow-Origin: https://studybuddy.app (exact origin, not *)Commands
echo -n "text" | shasum -a 256 hash · echo -n "text" | base64 / base64 -d encode/decode
pip-audit · npm audit known-vulnerable dependencies
gitleaks detect secrets in a Git repoTry This Yourself#
See why salts matter. Run
echo -n "password123" | shasum -a 256and search the result online. Then run it with a "salt" in front —echo -n "8f3a1c2bpassword123" | shasum -a 256— and search again. Explain the difference using Ch 3.Decode a JWT by hand. Take the payload part of the JWT in Chapter 5 (between the two dots) and run
echo 'eyJzdWIiOiJwcml5YSIsInJvbGUiOiJzdHVkZW50IiwiZXhwIjoxNzkwNTczNDAwfQ=' | base64 -d. (JWTs drop Base64's=padding characters; the=at the end puts it back — without it, macOS silently cuts off the final}.) You just read a token's contents without any key — which is why JWTs must never hold secrets.Threat-model a feature. Pick one StudyBuddy feature — "share a note with a classmate by link". Write down: what's being protected, who might attack it, three ways it could go wrong (use Ch 6–12), and one fix for each. This is exactly the exercise senior engineers do in design reviews.