Security: recap and quiz
The module in five sentences
Section titled “The module in five sentences”- Authentication and authorization. Authentication says who is calling and happens at sign-in, and authorization says whether they may do this and happens on every request, for the specific object.
- Sessions and tokens. A session cookie, a JWT checked locally and an opaque token that is introspected cost 340, 500 and 520 ms for the first request at the starting settings, and a local check cannot take a token back before it expires.
- TLS and encryption. TLS protects data between the two ends of a connection, encryption at rest protects a stolen disk, and neither protects against a caller that the application serves.
- Secrets and least privilege. A leaked credential does damage equal to what it reaches times the time it stays valid, so keep secrets out of code, rotate them, and give each caller only what it needs.
- Zero trust. No request is trusted for the network it comes from, every access is decided on identity and policy, and the aim is to bound what a breach can reach.
What each one does not do
Section titled “What each one does not do”| Control | What it gives | What it does not give |
|---|---|---|
| Authentication | Who is calling | What they may do |
| Authorization | What this caller may do | Proof that the caller is who they say |
| TLS | Confidentiality and integrity on the wire | Protection after the data arrives, or of the next hop |
| Encryption at rest | A stolen disk is unreadable | Protection from the application’s own credentials |
| Local token check | No round trip to check | Revocation before the token expires |
| Least privilege | A smaller reach for a leak | Prevention of the leak |
| Zero trust | Every access decided, a smaller trust zone | A product to buy, or a complete defence |
A checklist for reviewing a request path
Section titled “A checklist for reviewing a request path”Each question points back to the lesson that answers it.
- Is every connection protected by TLS, and where does a TLS connection end? A proxy that ends it leaves the next hop to protect on its own. (TLS and encryption)
- What proves who is calling, and how long does that proof stay valid? (Sessions and tokens)
- If an account is disabled now, when does its last token stop working? Name the window, in seconds. (Sessions and tokens)
- Does each request check what the caller may do with this object, and is the default a refusal? (Authentication and authorization)
- Does a failed check say 401 or 403 for the right reason? (Authentication and authorization)
- Where does each secret live, who can read it, how often does it change, and what do you do the minute it leaks? (Secrets and least privilege)
- What does one leaked credential reach, in tables or operations? If the answer is everything, split it. (Secrets and least privilege)
- What does encryption at rest protect against here, and where is its key? (TLS and encryption)
- Would a request from inside the network get anything a request from outside would not? (Zero trust)
Check your understanding
Section titled “Check your understanding”Nine questions cover the whole module. Every option is explained, whether it is right or wrong.
Security: module quiz
This quiz needs JavaScript to check your answers.
Where this goes next
Section titled “Where this goes next”This module covered the controls on the request path. It does not cover attacks such as injection or cross-site scripting, and it does not make a system safe on its own: it gives the vocabulary and the cost of each control, so that a review can ask the right questions. The deployment module comes next, and with it the question of how a change reaches production.
Your progress
Built by GhaziAlibi.
© ShardCraft. All rights reserved.