HELM
Ch 15 · Security & Compliance
Chapter 15 · Defence in depth

Security & Compliance — the controls you own as a tech lead

You won't be the CISO. But you'll set the controls that 90% of the team's daily security posture depends on. This chapter is the practical baseline.

15.1 · The threat model stance

The right mental model
"Assume breach." Design so the blast radius of a stolen credential, a compromised dependency, or a leaked key is small. Defence in depth + least privilege + observable everything.

15.2 · OWASP Top-10 (2021, refresh 2025) — what each one is and the fix

#RiskPrimary defence
A01Broken Access ControlDeny by default; tested authz; row-level security.
A02Cryptographic FailuresTLS 1.3 everywhere; AES-GCM; KMS-managed keys.
A03Injection (SQL, NoSQL, command, LDAP)Parameterised queries; never interpolate.
A04Insecure DesignThreat model; security reqs in story acceptance.
A05Security MisconfigurationCIS Benchmarks; IaC; admission control.
A06Vulnerable / Outdated ComponentsSBOM + Renovate + scanning gate in CI.
A07Identification & AuthN FailuresOAuth/OIDC; passkeys; MFA; rate-limit login.
A08Software & Data Integrity FailuresSigstore / Cosign; verify in admission.
A09Security Logging & Monitoring FailuresTamper-evident logs; alerting; SIEM.
A10SSRFOutbound allow-list; metadata-service block; egress proxy.

15.3 · Authentication

  • OAuth 2.1 + OIDC for federated identity. Use Auth0, WorkOS, Clerk, Cognito, Keycloak, Ory.
  • Passkeys (WebAuthn) — phishing-resistant, biometric, default by 2026.
  • MFA at minimum (TOTP, push, hardware key). SMS is last resort.
  • JWTs — short-lived access + rotated refresh + revocation list. Never store in localStorage if you can avoid it; use HttpOnly Secure cookies.
  • Session-based auth still fine for first-party apps; simpler than JWT.

15.4 · Authorization

ModelDefinitionUse when
RBACRoles → permissions. "Admin can delete."Small surface; few roles.
ABACAttributes (user, resource, context) → policy.Complex rules ("doctors can read patients in their hospital").
ReBACRelationships (Google Zanzibar). "X is owner of Y".Sharing, multi-tenant, graphs of permissions.
Policy-as-codeRego (OPA), Cedar (AWS), Topaz, Oso.Decisions outside the app; auditable.

15.5 · Encryption & key management

  • In transit: TLS 1.3, HSTS, secure ciphers, OCSP stapling.
  • At rest: envelope encryption with cloud KMS (AWS / GCP / Azure) or HashiCorp Vault Transit.
  • Field-level: for very sensitive columns (SSNs, card data) — pgcrypto or a tokenisation service.
  • Never invent crypto. Use libsodium / WebCrypto / cloud KMS.

15.6 · Network — mTLS, Zero Trust

  • mTLS between services (service mesh handles it).
  • Zero Trust — verify every request; never trust the network. BeyondCorp / Cloudflare Access / Tailscale / Twingate.
  • Egress control — squid proxy, NetworkPolicy, allow-list outbound.
  • WAF — Cloudflare, AWS WAF, Fastly Next-Gen.
  • DDoS — cloud-provider native; layer-7 rules.

15.7 · Supply chain

See Ch 13 (Supply chain). Add: signed commits (Sigstore Gitsign); two-person review on prod-touching infra; org-level allow-list of npm/pip/Maven sources.

15.8 · Secrets management

  • Vault, AWS Secrets Manager, GCP Secret Manager, Doppler, SOPS.
  • Rotation policy in code; rotate quarterly minimum.
  • Pre-commit scanning (gitleaks, trufflehog) plus org-wide push-protection.
  • Alert on retrieval anomalies; audit every fetch.

15.9 · Compliance frameworks — the alphabet soup

FrameworkWhat it gives buyers
SOC 2 Type IITrust Service Criteria audit; required to sell into mid-market US.
ISO/IEC 27001Information Security Management System; widely required outside US.
ISO/IEC 42001AI Management System (the "ISO 27001 for AI").
HIPAAUS healthcare data.
PCI-DSSCard data handling.
GDPR / UK GDPREU/UK personal-data rights & obligations.
CCPA / CPRACalifornia privacy rights.
EU AI Act / NIST AI RMFAI-specific (see AI Codex Ch 16).
FedRAMP / IL5US federal cloud authorisation.
EU CRA (Cyber Resilience Act)Mandatory vulnerability disclosure + SBOM for products in EU.

Tools that make this less painful: Vanta, Drata, Sprinto, Secureframe.

15.10 · Privacy by design

  1. Collect less data.
  2. Pseudonymise / tokenise where possible.
  3. Field-level encryption for PII.
  4. Retention policy enforced by jobs, not hope.
  5. Right-to-be-forgotten runbook + tested delete API.
  6. Data residency: pick region per tenant; pin storage and processing.

15.11 · Self-check

Q1 · A vendor proposes "we trust the internal network so no mTLS between services". Right response?
Sure, less ops overhead
No — mTLS via mesh; Zero Trust posture
Use a VPN instead
Trust on first use