Skip to content

Try “polymorphism”, “TCP handshake” or “git rebase”.

    Computer Basics / Security Fundamentals

    Quick Reference

    Glossary and cheat sheet for Security Fundamentals — the page to reread before an interview.

    Extra: Reference8 min read

    Glossary#

    TermPlain meaningChapter
    CIA triadconfidentiality, integrity, availability1
    threat model / attack surfacewho might attack what, and how / every point input can enter1
    defence in depth / least privilegemany independent layers / only the access needed1
    encoding / Base64reversible format change, no secrecy2
    cryptographic hash / SHA-256one-way fixed-size fingerprint / the standard choice2
    avalanche effect / collisiontiny input change → totally different hash / two inputs, same hash2
    MD5 / SHA-1broken hashes — don't use for security2
    rainbow tablepre-computed hash → password lookup3
    saltrandom per-user value mixed in before hashing3
    Argon2id / scrypt / bcryptslow, salted password-hashing functions3
    constant-time comparisoncomparing without leaking timing information3
    encryption in transit / at restprotecting moving data (TLS) / stored data4
    AES-GCM / noncestandard authenticated cipher / never-reused per-encryption value4
    KMS / envelope encryptionmanaged key service / data key wrapped by a master key4
    HMAC / webhook signaturekeyed hash proving origin and integrity / its common use4
    authentication / authorizationwho you are (401) / what you may do (403)5
    MFA / passkeytwo+ factor types / device-held key pair replacing passwords5
    RBAC / ABACpermissions by role / by attributes and rules5
    JWTsigned, Base64URL-encoded token: header.payload.signature5
    OWASP Top 10the standard list of top web security risks6
    broken access control / IDORacting beyond permissions / unchecked object IDs6
    mass assignmentaccepting fields users shouldn't set6
    injection / SQL injection / command injectiondata interpreted as code / in SQL / in shell commands7
    parameterized queryquery structure and values sent separately7
    allow-listonly explicitly permitted values accepted7, 10
    XSS (stored / reflected / DOM)attacker script running in users' browsers8
    output escaping / sanitizingmaking data display as text / stripping unsafe HTML8
    CSPheader restricting which scripts may run8
    origin / same-origin policyscheme+host+port / scripts can't read other origins' responses9
    CORS / preflightserver-granted cross-origin read access / its OPTIONS permission check9
    CSRF / CSRF tokenforged requests using the victim's cookies / per-page secret that defeats it9
    SSRF / IMDSv2server tricked into internal requests / protected AWS metadata version10
    path traversal../ escaping the intended folder10
    secret manager / rotationcontrolled secret storage / replacing secrets regularly11
    supply chain / lock file / typosquattingrisk from dependencies / pinned versions / look-alike package names11
    brute force / credential stuffing / rate limitingmany guesses / reused leaked pairs / capping attempts11
    user enumerationdiscovering valid accounts from error differences11
    LLM / promptAI text model / its input text12
    prompt injection (direct / indirect)input steering the model / hidden in processed content12
    data exfiltrationleaking data out, e.g. via image URLs12

    Cheat Sheet#

    Encoding vs hashing vs encryption

    Output
      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/MD5

    Attack → fix

    Output
      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 URLs

    Headers and settings

    Output
      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

    Output
      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 repo

    Try This Yourself#

    1. See why salts matter. Run echo -n "password123" | shasum -a 256 and 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.

    2. 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.

    3. 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.