Identity & Zero Trust for Platform Engineers›11 · Compliance as code

Lesson 11 of 14 · Assurance and response

Compliance as code

Turn security frameworks into platform features. Understand what SOC 2, ISO 27001 and FedRAMP-style programmes ask of an engineering platform, map their controls to guard-rails you already run, and generate audit evidence automatically instead of collecting screenshots.

Advanced → Architect
Key wordscompliance as codeSOC 2ISO 27001FedRAMPNIST SP 800-53controlsevidencecontinuous monitoringPOA&MFIPS 140authorization boundarypolicy as codeOSCAL

What the frameworks want, in engineering terms

Framework What it is What the platform must show
SOC 2 An auditor's report on controls (security, availability, confidentiality, processing integrity, privacy). Type II covers a period. Access control and reviews, change management, encryption, monitoring, incident response, backup and DR tests
ISO 27001 A certified information security management system: risk process plus Annex A controls Similar controls, plus a documented risk process and continual improvement
FedRAMP (US government cloud) Authorisation against NIST SP 800-53 baselines (Low, Moderate, High) A defined authorisation boundary, FIPS 140-validated cryptography, hardened baselines, continuous monitoring and strict remediation timelines

They overlap heavily. Build one set of platform controls and map it to each framework, instead of one project per audit.

Instead of tidying your room only when an inspector is coming, you set up the room so mess can't happen: toys go in labelled boxes, the door logs who comes in, and a camera records it. When the inspector arrives, you just show the log.

From control to guard-rail to evidence

Control (simplified) Guard-rail in the platform Evidence, automatically
Least privilege, access reviewed IdP groups, standard roles, JIT Group history, JIT records, review campaigns
Changes are authorised and tested GitOps; protected branches; required reviews; CI tests Merged pull requests with approvals; pipeline runs
Only approved software runs Signed images verified at admission Admission policy reports, signatures, SBOMs
Systems are hardened CIS baseline, Pod Security restricted, immutable nodes kube-bench results, policy reports
Data encrypted in transit and at rest TLS everywhere, strict mTLS, KMS encryption mTLS coverage metrics, KMS key configuration
Vulnerabilities fixed on time Scanning in CI and in registries, base-image rebuilds Scan results with ages; remediation tickets
Activity is logged and monitored Audit logs to a central store, alerting Log retention settings, alert history
Recovery works Backups, tested restores, DR drills Restore-test reports with timings

The pattern: the golden path makes the compliant way the default, policy blocks the non-compliant way, and every check emits a record.

FedRAMP-style environments in practice

  • Boundary first: dedicated accounts or subscriptions, often dedicated government regions, separate clusters or cells, separate CI runners and registries, so nothing shared drags commercial systems into scope.
  • Same platform, different parameters: one codebase; the regulated environment uses FIPS-enabled images and endpoints, stricter policies and approved services only.
  • Continuous monitoring: regular vulnerability scans of everything in the boundary, findings tracked in a Plan of Action and Milestones (POA&M) with deadlines by severity (commonly 30 days for high, 90 for moderate, 180 for low).
  • Significant changes need assessment before release, which fits naturally with the last-ring rollout: regulated environments receive a change only after it has proven itself elsewhere.
  • Personnel and access rules may restrict who can operate the environment; JIT and audit logging make that enforceable.

Drift between environments

Hand-made fixes in the regulated environment ("just this once, because of the audit") turn into a second platform nobody can upgrade. Every change goes through the same code and pipeline, with drift detection on both sides.

Make evidence a product

  • Collect evidence continuously into one store: policy reports, scan results, benchmark runs, access reviews, restore tests, change records.
  • Map each item to the controls it supports, once. Some teams use OSCAL (NIST's machine-readable format for controls and evidence) to automate this mapping.
  • Give auditors read-only dashboards and exports rather than screenshots.
  • Track exceptions in Git, each with an owner and an expiry date.

Going deeper

Policy as code can run in three places: in CI on rendered manifests and Terraform plans (Conftest, Kyverno CLI), at admission in the cluster, and in cloud governance (AWS SCPs and Config rules, Azure Policy, GCP Organization Policies). Using the same rule in all three gives fast feedback to developers and enforcement that can't be skipped.

Try it

On a test cluster with Kyverno, install the Pod Security restricted policies in Audit mode, run kube-bench, and sign one image with cosign. Export the policy reports, the benchmark JSON and the signature verification output into a folder named by date. That folder is a minimal, automated evidence package for three controls.

Recap

  • SOC 2, ISO 27001 and FedRAMP overlap: build one set of platform controls and map it to each.
  • Control → guard-rail → evidence: enforce through the golden path and policy, record every result automatically.
  • Regulated environments get a tight boundary, the same code with stricter parameters, continuous monitoring, and the last ring of every rollout.

This site is a public version of my personal engineering knowledge hub. It intentionally excludes confidential company information and internal operational details.