Education › Security › Stage 4: Operations & response

Compliance for engineers

SOC 2, ISO 27001, GDPR and PCI DSS: what auditors ask for and how good engineering satisfies it by default.

Advanced ~30 min read Module 15 of 16

Sooner or later a customer's procurement team sends a spreadsheet with three hundred questions, or a sales deal stalls on "do you have SOC 2?", or a regulator's letter arrives. Compliance frameworks are how organisations prove to outsiders that they manage security and privacy in a repeatable way. Engineers tend to experience them as paperwork, and badly run programs are exactly that. Well run, they are mostly a description of the controls this track has already covered, plus evidence that those controls operate. This module explains what the common frameworks actually ask for, how to map them to the technical controls you already have, how to generate evidence automatically instead of by hand, and how to talk to auditors without either bluffing or over-committing.

After this module you can
  • Explain what SOC 2, ISO 27001, GDPR and PCI DSS each cover and who asks for them
  • Map framework requirements to concrete technical controls and their owners
  • Produce audit evidence from systems automatically: logs, configuration, tickets, access reviews
  • Handle personal data the way GDPR expects: minimise, protect, retain, delete, respond to requests
  • Work with auditors: scope, sampling, findings, and what not to say

The frameworks and what they are for

Each framework serves a different audience and question. Knowing which one applies tells you what evidence matters.

FrameworkWho asksWhat it is
SOC 2US customers and partners of SaaS vendorsAn auditor's report on controls for security (plus optionally availability, confidentiality, processing integrity, privacy). Type I: designed at a point in time; Type II: operated over a period, usually 6 to 12 months.
ISO 27001International customers, tenders, regulated industriesA certifiable standard for an information security management system: risk assessment, a statement of applicability, and a set of controls (Annex A) with continuous improvement.
GDPRAnyone processing EU residents' personal data; enforced by regulatorsLaw, not a certification: lawful basis, minimisation, security, breach notification, data subject rights, records of processing.
PCI DSSCard networks and acquirers, if you store, process or transmit card dataPrescriptive technical requirements: segmentation, encryption, logging, scanning, access control around the card data environment.

Others appear by sector: HIPAA for US health data, FedRAMP for US government cloud, DORA and NIS2 in the EU for financial and critical services, CIS Controls and NIST CSF as general-purpose baselines. They overlap heavily. A control like "MFA for all administrative access" satisfies a requirement in every one of them, which is why a single well-maintained control set with a mapping to each framework is the sustainable approach.

Note

Certification is about the management system and the evidence, not about being unhackable. A certified company can still be breached; an uncertified one can be very secure. Frameworks raise the floor and make security legible to outsiders.

From requirement to control to evidence

A framework requirement is abstract ("logical access is restricted to authorised users"). A control is what you actually do ("all production access goes through SSO with phishing-resistant MFA; access is reviewed quarterly; leavers are removed within one business day"). Evidence is what proves the control operated during the period (identity provider configuration export, the quarterly review records, the leaver tickets with timestamps). Auditors sample: they will ask for evidence for five random leavers in the period, not for a policy document.

A control record in the format that makes audits fast. One control, many framework mappings, one owner, automated evidence.
text
CONTROL AC-03  Production access requires SSO + phishing-resistant MFA
  Owner:        platform lead
  Frequency:    continuous (enforced), reviewed quarterly
  Implemented:  IdP policy "prod-admins": require WebAuthn; cloud roles trust only the IdP
  Evidence:     - IdP policy export (automated, weekly, S3 evidence bucket)
                - cloud IAM trust policies (Terraform in repo, tagged release)
                - quarterly access review ticket with approvals
  Tests:        - scheduled check: no IAM user has console password or long-lived keys
  Maps to:      SOC 2 CC6.1, CC6.2 | ISO 27001 A.5.15, A.8.5 | PCI DSS 8.4 | NIST CSF PR.AA

The controls this track has covered already form most of a control set: threat modelling (risk assessment), cryptography and TLS (encryption), identity and MFA (access), hardening and patching (vulnerability management), secrets, supply chain (change management and integrity), logging and detection (monitoring), incident response, and network segmentation. Compliance work is largely writing them down in the auditor's vocabulary and proving they run.

Automate the evidence

The difference between a two-week audit and a two-month one is whether evidence is generated by systems or assembled by people from memory. Every control should have a script, a query or a pipeline that produces its evidence on a schedule into a write-once evidence store: configuration exports, scan reports, access lists, change records, backup test results, training completions. Compliance automation platforms do this against common SaaS and cloud APIs; a folder of dated exports produced by scheduled jobs works too.

Scheduled evidence collection: who has cloud access and how, with a timestamped export nobody edits by hand.
bash
STAMP=$(date -u +%Y-%m-%d)
OUT="evidence/access/$STAMP"; mkdir -p "$OUT"

# every IAM user, their MFA status and key age: the auditor's first question
aws iam generate-credential-report >/dev/null && sleep 5
aws iam get-credential-report --query Content --output text | base64 -d > "$OUT/credential-report.csv"

# who can assume the production admin role
aws iam get-role --role-name prod-admin --query 'Role.AssumeRolePolicyDocument' > "$OUT/prod-admin-trust.json"

# members of the admin group in the identity provider (example: Okta API)
curl -s -H "Authorization: SSWS $OKTA_TOKEN" \
  "https://acme.okta.com/api/v1/groups/$PROD_ADMINS_GROUP_ID/users" \
  | jq '[.[] | {id, login: .profile.login, status}]' > "$OUT/prod-admins-group.json"

sha256sum "$OUT"/* > "$OUT/SHA256SUMS"
aws s3 cp --recursive "$OUT" "s3://acme-audit-evidence/access/$STAMP/"

Tie changes to tickets and pull requests: an auditor sampling ten production changes wants to see the request, the review, the approval, the test result and the deploy record for each. If every deploy is a merged pull request with required review and a green pipeline, that evidence already exists in the repository; the DevOps track's practices are, from this angle, change management controls with automatic evidence.

Tip

Do the quarterly access review as a pull request against a file listing who has what, with the approvals in the review. It is the review, the evidence and the enforcement in one artefact.

GDPR for engineers

GDPR is different from the certifications: it is law, it applies to any personal data about EU residents wherever you are, and its principles translate directly into engineering decisions. Lawful basis and purpose: collect data for a stated reason and use it for that reason. Minimisation: do not collect or keep what you do not need; a field you never store is a field you never leak. Security: appropriate technical measures, which is this track. Retention: define how long each data class lives and delete it on schedule, including from backups and logs within a reasonable window. Rights: individuals can ask what you hold, get a copy, correct it, or have it erased, usually within a month; you need a way to find every copy of one person's data and act on it.

  • Keep a record of processing: which systems hold personal data, what kind, why, for how long, who it is shared with. This is also your data inventory for incident response.
  • Pseudonymise where you can: analytics on user ids that map to identities only in one protected system.
  • Design deletion as a feature: a job that removes or anonymises a user across services, with a report of what it did.
  • Log access to personal data at the application level; the logging module's data.export.requested event is exactly this.
  • Check the transfer rules before sending data to another region or vendor, and have data processing agreements with processors.
  • Report breaches within 72 hours; the incident module covers the clock.
Retention as a scheduled job: rows older than the documented period are erased or anonymised, and the run is recorded as evidence.
sql
-- retention policy: support tickets 24 months, then anonymise; run nightly
BEGIN;
UPDATE support_tickets
   SET requester_email = NULL,
       requester_name  = 'anonymised',
       body            = regexp_replace(body, '[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+', '[email removed]', 'g')
 WHERE created_at < now() - interval '24 months'
   AND requester_email IS NOT NULL;
INSERT INTO retention_runs (policy, rows_affected, ran_at) VALUES ('support_tickets_24m', 0, now());
COMMIT;

Working with auditors

An audit is a structured conversation with sampling. Agree the scope first (which systems, which period, which trust criteria); everything out of scope is out of the report, so be deliberate. Provide evidence that answers the question asked, no more: volunteering unrelated material creates new questions. When a control did not operate as described, say so and show the remediation; auditors expect findings, and a candid exception with a fix looks far better than a discovered inconsistency. Never fabricate or backdate evidence; that converts a finding into a much bigger problem.

Findings come in grades: an observation (improvement suggested), a deficiency (control not operating effectively) or, for SOC 2, an exception noted in the report. Most are fixable within the period if caught early, which is why an internal readiness assessment before the real audit is worth the time. After the audit, the report becomes a sales asset; before the next one, the automation you built means the evidence is already waiting.

Watch out

The most expensive words in an audit are "we always do that" when the evidence shows one quarter where you did not. Say what the evidence shows, and fix the gap.

Hands-on practice

Write five controls with automated evidence

  1. Pick five controls this track has taught you (for example: MFA for production access, dependency scanning in CI, encrypted storage, centralised logging with retention, quarterly access review). For each, write a control record in the lesson's format with owner, implementation, evidence and framework mappings.
  2. For two of them, write the evidence collection script or query and run it into a dated folder with checksums. Schedule it (cron or a CI schedule).
  3. Build a record of processing for one application: a table of data stores, personal data fields, purpose, retention period and processors. Note any field you could stop collecting.
  4. Implement one retention job (anonymise or delete) for a data class in a test database and record its run in a table.
  5. Perform a mock data subject access request: find every copy of one test user's data across the application, its logs and its backups, and write down how long it took and what you could not find.
  6. Run a 30-minute mock audit with a colleague: they pick three of your controls and ask for evidence for two random weeks in the last quarter. Note every gap.
Cheat sheet

Compliance for engineers — at a glance

Main things to focus on

  • SOC 2 = auditor's report on controls over a period; ISO 27001 = certified management system; GDPR = law on personal data; PCI DSS = prescriptive rules around card data
  • Requirement -> control -> evidence; auditors sample evidence, not policies
  • One control set with mappings to every framework; the technical controls from this track are most of it
  • Automate evidence into a write-once store on a schedule; changes are pull requests with reviews and pipeline records
  • GDPR in engineering terms: minimise, protect, define retention and delete, find and export one person's data, notify in 72 hours
  • With auditors: agree scope, answer what is asked, disclose gaps with fixes, never fabricate

Framework quick facts

SOC 2 Type I vs Type IIDesign at a point in time vs operation over 6-12 months
SOC 2 trust criteria: security (+ availability, confidentiality, processing integrity, privacy)Security is mandatory; others optional
ISO 27001: risk assessment + statement of applicability + Annex A controlsCertified by an accredited body; surveillance audits yearly
GDPR: lawful basis, minimisation, security, retention, rights, 72h breach noticeApplies to EU residents' data anywhere
PCI DSS: scope = card data environmentReduce scope with hosted checkout and tokenisation

Control records

CONTROL id, owner, frequency, implemented, evidence, tests, maps-toOne record per control
map to: SOC 2 CC6.x / ISO A.5, A.8 / PCI 8.x / NIST CSFSame control, many frameworks
evidence = system output, dated, checksummed, write-onceNot screenshots from memory
change evidence = PR + review + pipeline + deploy recordAlready in the repository
access review = PR against an access fileReview, evidence and enforcement in one

Evidence commands

aws iam get-credential-reportUsers, MFA status, key age
aws iam get-role --role-name R --query Role.AssumeRolePolicyDocumentWho can assume a role
IdP group membership export via APIWho is in the admin group
scan reports (trivy/prowler) archived per runVulnerability and config management evidence
backup restore test logAvailability criteria evidence

GDPR engineering

record of processing: system, data, purpose, retention, processorsAlso your data inventory
pseudonymous ids outside the identity systemMinimise exposure
retention job + retention_runs logDelete on schedule, prove it
DSAR: find, export, correct, erase within one monthDesign the lookup across services
DPA with every processor; check transfersVendors and regions

Common pitfalls

  • Treating the framework as the security program instead of as a description of one.
  • Assembling evidence by hand from memory two weeks before the audit.
  • Scoping carelessly so that a forgotten system is in the audit, or a critical one is out of the report.
  • Saying "always" when the evidence shows a gap; disclose and fix instead.
  • Collecting personal data because it might be useful, then discovering it in a breach.
  • Retention policies that exist on paper but no job ever runs.
Quiz

Check your understanding

5 questions · 4 to pass · answers are explained as you go. Your best score is saved on this device only.

Progress and quiz scores are saved in this browser only. Back up or restore on the hub.

Was this lesson useful? Tell me what to improve →