Controls & Evidence
Controls & Evidence
Auditors do not trust assertions — they trust evidence. When a SOC 2 auditor, a PCI QSA, or an internal security team asks "how do you know your systems are compliant?", the answer cannot be "we follow best practices." It must be a timestamped, tamper-evident artifact that proves a specific control operated correctly at a specific time. This lesson teaches you to think like that auditor, design control frameworks that are auditable by construction, and automate the evidence pipeline so that the work of compliance does not land entirely on your team the week before an audit.
What Is a Control?
A control is a safeguard or countermeasure that addresses a specific risk. Every major compliance framework — SOC 2, ISO 27001, PCI DSS, HIPAA, FedRAMP — is ultimately a catalog of controls, each with a control objective: a statement of the desired state the control is meant to maintain. Understanding this vocabulary is prerequisite to automating compliance work.
- Control objective — the outcome the control must achieve. Example: "All administrative access to production databases must require multi-factor authentication." This is the what.
- Control activity — the specific action or configuration that achieves the objective. Example: "The RDS cluster is in a VPC with no public endpoint; access is through an IAM-authenticated bastion that enforces MFA via hardware token." This is the how.
- Evidence — the artifact that proves the control operated as designed during a given period. Example: CloudTrail logs showing every DB connection originated from the bastion ARN, IAM Access Analyzer confirming no public access, and the bastion's MFA enforcement policy version history.
In practice, controls are classified by their nature. Preventive controls stop bad things from happening (an IAM policy that denies s3:PutBucketPublicAccessBlock false). Detective controls notice when something went wrong (a CloudWatch alarm when a security group rule is added with 0.0.0.0/0). Corrective controls repair the damage automatically (an AWS Config auto-remediation that removes a public bucket ACL within seconds of detection). A mature compliance program layers all three.
Control Objectives in Engineering Terms
The gap between a compliance framework's abstract language and what an engineer actually configures is where most compliance debt accumulates. Let us walk through a concrete mapping for a common SOC 2 Common Criteria control — CC6.6, which requires that logical access is removed in a timely manner when no longer authorized:
- Objective: Deprovision access within 24 hours of termination.
- Engineering control: SCIM provisioning between your HR system (Workday, BambooHR) and your IdP (Okta, Azure AD). Okta deactivates the account upon the HR system's offboarding webhook. Okta is federated to AWS, GCP, and all SaaS tools via SAML/OIDC — deactivating the Okta account cascades access removal everywhere.
- Evidence artifacts: (1) Okta system log export showing the deactivation event and timestamp, (2) AWS CloudTrail showing the last console login before deactivation, (3) a monthly Okta inactive-user report showing no active accounts for terminated employees, (4) your SCIM configuration screenshot proving the integration is live.
This is the translation work. Every control in your framework needs this same decomposition — objective, engineering implementation, and a list of the evidence artifacts that prove it operated correctly during the audit period.
Automating Evidence Collection
Manual evidence collection is the hidden cost of compliance. Teams that collect evidence by hand — exporting CSVs, screenshotting dashboards, writing one-off scripts — spend weeks before every audit in a fire drill. At Google-scale, the alternative is a continuous evidence pipeline: infrastructure that generates compliance artifacts as a natural side-effect of normal operations, stores them immutably, and feeds them into an audit-ready repository.
The components of such a pipeline are:
- Event sources — CloudTrail, AWS Config, GCP Audit Logs, Kubernetes Audit Log, Okta System Log, GitHub Audit Log. Every privileged action produces a machine-readable event.
- Central log sink — S3 + Athena, GCS + BigQuery, or a SIEM (Splunk, Elastic). Logs are written with object-lock (WORM — Write Once Read Many) so they cannot be altered retroactively.
- Evidence queries — pre-written SQL or Athena queries that answer specific control questions on demand.
- Scheduled evidence jobs — cron jobs (or Lambda functions triggered by EventBridge Scheduler) that run the queries and write the output as a dated artifact in an evidence bucket.
- Evidence registry — a metadata file (often a YAML manifest in a Git repo) that maps each control to its evidence artifacts, owner, and last-verified timestamp.
Practical: AWS Config + Athena Evidence Query
AWS Config continuously records the configuration state of every resource. Combined with Athena, you can query that history to answer specific control questions. The following setup ships evidence for a control like "no S3 bucket has public access enabled" covering any 90-day window — queryable on demand.
If the query returns zero rows, you have machine-generated evidence that no S3 bucket had public access during that quarter. Export the result as a CSV, store it in s3://evidence-bucket/cc6.1/2025-q1-no-public-s3.csv, and record that path in your control registry. That is one control, fully evidenced, with zero manual effort at audit time.
s3://evidence/<framework>/<control-id>/<YYYY-MM>-<description>.<ext>. This makes it trivial to retrieve all evidence for a given control across all months, and auditors can self-serve without asking your team for files. Pair it with a Git-tracked controls.yaml manifest that links control ID to evidence S3 paths, owner, and last review date.
Kubernetes Audit Log Evidence
In a Kubernetes environment, the API server audit log is the equivalent of CloudTrail. Every kubectl exec, every secret read, every privilege escalation attempt is recorded. For compliance controls like "no privileged containers run in production" or "only authorized users can exec into pods," the audit log is your evidence source.
--audit-log-maxage=30 or allow your CloudTrail S3 bucket to expire logs after 30 days, you will fail the evidence retention control even if every other control is perfect. Set retention to at minimum your audit period plus 30 days buffer, ship logs to an object-locked bucket, and add a Config rule or a Lambda that alerts if the bucket lifecycle policy is changed.
Building a Control Registry
A control registry is the authoritative mapping between compliance requirements and the engineering controls that satisfy them. At scale, it lives in a Git repository alongside your Infrastructure as Code — this makes control changes go through pull request review, gives you a history of when controls changed, and lets your CI pipeline validate that referenced evidence artifacts actually exist.
A minimal controls.yaml entry looks like this — one entry per control objective:
This registry, automated evidence generation scripts in queries/, and a CI job that validates last_generated dates are within the required window together form the operational foundation of a continuously-compliant system. When the auditor arrives, you run a script, not a fire drill.