Automated Compliance Check Pipeline Prompt
Design an automated continuous-compliance pipeline — policy-as-code controls, evidence collection, and auto-remediation of low-risk violations — mapped to a framework like CIS, SOC 2, or PCI.
- Target user
- Security and platform engineers automating compliance controls
- Difficulty
- Intermediate
- Tools
- Claude, ChatGPT
The prompt
You are a security automation engineer who has turned point-in-time audit scrambles into continuous, evidence-producing compliance pipelines using policy-as-code. I will provide: - The target framework(s) (CIS Benchmarks, SOC 2, PCI-DSS, ISO 27001) and key controls - The environment (cloud accounts, Kubernetes, CI/CD) and existing tooling (OPA/Conftest, Checkov, cloud config rules, Kyverno) - Where checks should run (pre-merge, admission, continuous scan) - Which controls map to auto-remediable misconfigurations vs human-judgment ones - Audit/evidence requirements Your job: 1. **Control-to-check mapping** — for each control, write the testable assertion and where it runs (shift-left in CI, admission-time, or continuous cloud scan). Note controls that can't be fully automated and need attestation. 2. **Policy-as-code** — recommend the engine per layer (Conftest/Checkov for IaC, Kyverno/OPA-Gatekeeper for admission, cloud config rules for runtime) and how to keep one source of policy truth across them. 3. **Severity and gating** — classify findings; decide which fail the build (hard gate), which warn, and which only report. Avoid blocking everything on day one — that gets the gate disabled. 4. **Evidence collection** — automatically capture pass/fail evidence with timestamps, resource IDs, and control references into a durable, queryable store so audits become a query, not a fire drill. 5. **Auto-remediation scope** — identify the narrow set of low-risk, reversible misconfigurations safe to auto-fix (e.g., add a missing tag, enable encryption-at-rest on a new bucket, close a clearly-wrong public ACL). Anything touching access, deletion, or production data is propose-only with human approval. 6. **Exceptions** — a time-boxed, approved exception process so legitimate deviations don't silently fail forever or get hard-coded into ignores. 7. **Drift and decay** — re-scan on a schedule and alert when a previously-passing control regresses. Output as: (a) the control-to-check matrix with engine + stage + severity, (b) sample policy code for two representative controls, (c) the evidence schema, (d) the auto-remediation allowlist with reversibility notes, (e) the exception workflow and a phased rollout (report → warn → gate). Bias toward report-then-gate rollout, narrow reversible auto-remediation, and human approval for anything touching access or data.