Part 10
Security and Data Protection
Protect users, identities and data across the whole software lifecycle.
10.1 Security Thinking
Chapter outcomes and context
Topics covered: 158 Security fundamentals, defense in depth and threat modeling (Core)
Learning outcomes
- Apply the core properties — confidentiality, integrity, availability — and the core postures: least privilege, defense in depth (no single control is trusted alone), secure defaults.
- Run threat modeling on the design before code: what are we building → what can go wrong (STRIDE: spoofing, tampering, repudiation, information disclosure, denial of service, elevation of privilege) → what do we do about it → did we do it.
10.2 Identity and Access
Chapter outcomes and context
Topics covered: 159 Authentication and authorization (Core) · 160 Identity lifecycle: registration, password storage, MFA, account recovery, lockout and brute-force protection, device and session management (Core) · 161 OAuth 2.0 and OpenID Connect: single sign-on, identity federation (Core) · 162 JWT and session management: expiry, refresh token rotation, revocation (Core) · 163 RBAC and ABAC: resource-level authorization, privilege escalation prevention (Core)
Learning outcomes
- Separate authentication (who are you) from authorization (what may you do); the API-level basics were topic 39 — this chapter is the full system.
- Design the whole identity lifecycle, not just login: registration and verification; password storage with modern hashes (argon2, bcrypt); MFA enrollment and recovery (recovery is where accounts are stolen); lockout and brute-force protection; device and session management (list, revoke, notify).
- Implement OAuth 2.0 (delegated authorization — authorization code flow with PKCE as the default; RFC 6749) and OpenID Connect (the authentication layer: ID token); apply them to single sign-on and identity federation across organizations. OAuth alone is not an authentication protocol.
- Manage tokens honestly: expiry short, refresh token rotation (a reused rotated token signals theft), and a real revocation story — the known weakness of stateless JWTs.
- Model RBAC (roles → permissions: simple, coarse) vs. ABAC (policy over attributes: fine-grained, complex); enforce resource-level authorization on every object; design against privilege escalation (no self-service role grants; admin actions audited → 171). All five topics are exercised in Project 3.
10.3 Protecting Data
Chapter outcomes and context
Topics covered: 164 Encryption at rest and in transit (Core) · 165 Key and secrets management: rotation (Core)
Learning outcomes
- Encrypt in transit everywhere — TLS (→ 27), including service-to-service mTLS inside the perimeter — and at rest: volume encryption vs. application-level field encryption; envelope encryption (data keys wrapped by a master key in a KMS).
- Manage keys (rotation schedules, separation of duties, HSM/KMS) and secrets (primary home): no secrets in code or committed files; vaults, short-lived credentials, automatic rotation (runtime injection → 188).
10.4 Application and API Security
Chapter outcomes and context
Topics covered: 166 OWASP Top 10, 2025 edition (Core) · 167 Web and API security (Advanced)
Learning outcomes
- Know the OWASP Top 10:2025 categories and the design-level defense for each — including Software Supply Chain Failures (→ 173) and Mishandling of Exceptional Conditions. Core defenses: parameterized queries against injection; object-ownership checks against broken access control; output encoding and CSP against XSS; SameSite and tokens against CSRF; egress allow-lists against SSRF.
- (Advanced) Harden APIs: input validation, mass-assignment protection, rate limiting as a security control (→ 96), error responses that leak neither stack traces nor user existence.
10.5 Network and Architecture Security
Chapter outcomes and context
Topics covered: 168 Network security and firewalls (Advanced) · 169 Zero trust architecture (Advanced)
Learning outcomes (all Advanced)
- Segment networks: public and private subnets, security groups, firewalls, WAF, DDoS absorption at the edge (→ 89, 94).
- Apply zero trust — a security model, not a product: never trust by network location; authenticate and authorize every request and every service identity (mTLS, short-lived credentials → 176); assume breach.
10.6 Privacy, Compliance, and the Secure Lifecycle
Chapter outcomes and context
Topics covered: 170 Data privacy and governance: consent, erasure requests (Advanced) · 171 Audit logging and compliance, PCI DSS as the payments example (Advanced) · 172 Secure development lifecycle: secure design reviews, SAST, DAST, dependency scanning, secrets scanning, vulnerability remediation (Advanced) · 173 Software supply chain security: SBOM, artifact signing, provenance (Advanced)
Learning outcomes (all Advanced)
- Design privacy in: data minimization, purpose limitation, consent tracking, retention and deletion — erasure requests must reach every copy, including derived stores and backups (→ 81; Projects 10 and 20).
- Produce audit logs: immutable who-did-what-when for sensitive actions — distinct from observability logs (→ 201). Use PCI DSS as the worked compliance example: scope minimization through tokenization (Project 8).
- Run a secure development lifecycle: secure design reviews (threat model → 158), SAST (static analysis), DAST (dynamic testing), dependency scanning, secrets scanning, and a vulnerability remediation path with deadlines — wired into CI (→ 186).
- Secure the supply chain (per NIST SP 800-218): SBOM (what is in the artifact), artifact signing, and provenance (proof of where and how it was built).
Done when you can
- Threat-model a design and present the top five risks with mitigations.
- Design the full identity lifecycle — including recovery and lockout — for a real product.
- State where every secret lives and when it last rotated.
- Walk an auditor through consent, erasure, audit logs, and your pipeline's security gates.