Chapter 3 — The vocabulary that trips everyone up
In one sentence
Half of security confusion is people using the same word for different things — so here are the distinctions that actually matter.
Encoding vs Encryption vs Hashing
This is the single most important distinction in the guide. Part 2 and Part 3 exist to hammer it home.
+-----------+------------------+-------------+---------------------------+
| | PURPOSE | REVERSIBLE? | NEEDS A KEY? |
+-----------+------------------+-------------+---------------------------+
| ENCODING | make data safe | YES, by | NO -- anyone can reverse |
| | to transport | anyone | it. NOT SECURITY. |
| | (Base64, hex) | | |
+-----------+------------------+-------------+---------------------------+
| ENCRYPTION| keep data secret | YES, with | YES |
| | (AES, RSA) | the key | |
+-----------+------------------+-------------+---------------------------+
| HASHING | fingerprint data | NO, ever | NO (or optional, for HMAC)|
| | (SHA-256) | | |
+-----------+------------------+-------------+---------------------------+
Dangerous: "We Base64 the password before storing it" is a sentence that appears in real production code. Base64 is not security. It is a costume.
Authentication vs Authorization
AUTHENTICATION (authn) "Who are you?" -> proving identity
password, key, MFA, certificate
AUTHORIZATION (authz) "What may you do?" -> checking permission
roles, ACLs, policies, ownership checks
You are authenticated once; you are authorized on every single action. The most common serious web bug (OWASP #1, 22 years running) is doing the first and forgetting the second.
GET /api/orders/12345 <-- authenticated: yes, it's Alice
authorized: is order 12345 ALICE'S?
^^^ this check is what's missing
Threat vs Vulnerability vs Risk vs Exploit
THREAT something bad that could happen, and who'd do it
"a criminal group steals our customer data"
VULNERABILITY a weakness that would let it happen
"our search endpoint is vulnerable to SQL injection"
EXPLOIT the actual technique/code that abuses the vulnerability
"' OR 1=1 --"
RISK likelihood x impact -- what you actually prioritise on
"high: trivially exploitable, 2M records, GDPR fines"
You fix vulnerabilities, you defend against threats, you prioritise by risk. A vulnerability with no plausible threat is low risk; ignore it until the ones that matter are done.
Some others worth pinning down
| Term | Means |
|---|---|
| CVE | A public ID for a specific vulnerability (CVE-2021-44228 is Log4Shell) |
| CVSS | A 0–10 severity score for a CVE. A starting point, not a priority — it ignores your context. |
| Zero-day | A vulnerability with no patch available yet |
| Payload | The part of an exploit that does the attacker's actual work |
| Defence in depth | Multiple independent layers (Chapter 1) |
| Least privilege | Every user/process gets the minimum access needed |
| Fail secure / fail closed | On error, deny. (A lock that stays locked when power fails.) |
| Fail safe / fail open | On error, allow. (A fire door that unlocks.) — choose deliberately |
| Salt | Random data added before hashing, unique per record (Chapter 10) |
| Nonce | "Number used once" — must never repeat with the same key (Chapter 14) |
| IV | Initialisation vector — randomises encryption so identical plaintexts differ |
| Entropy | Genuine unpredictability. Measured in bits. |
| PKI | The whole system of certificates, CAs and trust (Chapter 29) |
| MAC | Message Authentication Code — proves integrity and authenticity with a shared key (Chapter 11) |
The fail-open/fail-closed decision
This one catches people out, so it's worth pausing on:
Your authorization service times out. What does the app do?
FAIL CLOSED: deny the request.
-> Safe. But if the service is flaky, your app is down.
FAIL OPEN: allow the request.
-> Available. But a DoS on your auth service becomes
a total authorization bypass.
For AUTHORIZATION: fail closed, always.
For a RECOMMENDATION ENGINE: fail open; show no recommendations.
Decide this explicitly for every dependency. The default in most code is "whatever the exception handler happens to do", which is how outages become breaches.
Practice (10 min)
Classify each, in notes.md, as encoding / hashing / encryption / none:
SGVsbG8gd29ybGQ=5eb63bbbe01eeed093cb22bb8f5acdc3%48%65%6C%6C%6F$2b$12$KIXxPfnK6.wLd0LJgKmZLu...U2FsdGVkX1+3xL2W...-----BEGIN PUBLIC KEY-----
Then, for one API you've built: is every endpoint doing an authorization check, or only authentication?
(Answers: Appendix F.)
Check yourself
- State the three-way difference between encoding, encryption, and hashing.
- What's the difference between authentication and authorization, and which is checked more often?
- Define threat, vulnerability, and risk in one line each.
- When should a system fail closed?
Further reading
- Glossary: NIST's Computer Security Resource Center glossary
(
csrc.nist.gov/glossary) — the authoritative definitions when someone argues. - Book: Security Engineering (Anderson), Chapter 1 — excellent on terminology and why it matters.