
SOC 2 gets discussed as a document exercise — an auditor, a policy binder, a badge on the website. Engineering teams tend to encounter it as a surprise sometime after a large prospect asks for the report.
That framing is wrong and expensive. SOC 2 Type II is an assertion about how your system behaves over a period of time, and satisfying it requires specific properties in the codebase. Adding those properties late typically costs two to three times what building them in would have, because several of them are cross-cutting and one of them requires historical data you did not collect.
Here is the engineering translation.
The requirement that cannot be retrofitted
Start with the one that genuinely cannot be fixed later: Type II is evaluated over an observation window, commonly three to twelve months. The auditor is not checking that controls exist today. They are checking that controls operated consistently throughout the period.
Which means if your audit log did not capture administrative access in March, no amount of engineering in September produces evidence for March. You either wait out a new observation window or accept a qualified report.
That single property is why "we'll deal with compliance when a customer asks" is a more expensive strategy than it appears. The cost is not the engineering. It is the two quarters of enterprise sales you cannot close while a window elapses.
Audit logging as a first-class subsystem
The most common retrofit failure. Application logging and audit logging are different things, and using the first as the second does not survive review.
Application logs are for debugging: verbose, sampled, rotated aggressively, often unstructured, frequently containing whatever the developer found useful at the time.
An audit log is an evidentiary record. It needs:
-
Append-only semantics. Not merely "we don't delete" — enforced, via write-once storage, an immutability policy on the bucket, or a hash chain.
-
A defined schema: actor, action, resource, timestamp, source address, outcome, and a correlation identifier. Consistent across services.
-
Coverage of the right events: authentication attempts including failures, authorization denials, privilege changes, data access to sensitive records, configuration changes, and data export.
-
Retention aligned to the observation window plus margin. Aggressive rotation destroys evidence.
-
Deliberate exclusion of secrets and sensitive payloads. An audit log containing the data it audits access to is its own problem.
Retrofitting this means finding every place in a mature codebase where an auditable action occurs — which is a full-surface sweep, and one where missing a path is invisible until an auditor samples it.
Design it as a subsystem with an explicit interface from the start. audit.record(actor, action, resource, outcome) called at the boundary. Cheap on day one.
Access control that can be evidenced
The requirement is least privilege, enforced and demonstrable. Concretely:
-
No shared accounts anywhere, including database superuser access and third-party service logins. Every action traces to an individual.
-
Role definitions in code, version-controlled and reviewable, rather than configured by hand in a console. This is what makes access reviewable rather than merely existent.
-
Time-bounded elevation for production access, with logged justification. Standing production access for the whole engineering team is the most common finding.
-
Automated deprovisioning driven by the identity provider. Manual offboarding checklists fail, and the failure is discoverable months later.
-
Periodic access review that produces an artifact. If it happens in a meeting with no output, it did not happen.
The architectural implication: authorization must be centralised enough to enumerate. A system where permission logic is scattered across route handlers cannot answer "who can read this resource type" without reading the entire codebase — which is both an audit failure and, independently, a security problem worth fixing.
Change management the pipeline enforces
The control is that changes are reviewed, tested, and traceable. In practice:
-
Branch protection preventing direct pushes to production branches
-
Required review with enforced approval, not a norm people follow when busy
-
Automated test gates that block on failure
-
Deployment traceability linking a running artifact to a commit to a reviewed PR to an identified author
-
Rollback capability that has actually been exercised
Most teams with mature CI already satisfy most of this. The gap is usually evidence: the controls operate but produce no durable record. Configure the pipeline to emit an artifact per deployment — commit, approver, test results, timestamp — and retain it.
Where AI changes the picture
Two new considerations, both genuinely recent.
Generated code and change management. The control is that changes are reviewed by a competent person. Volume rose sharply; review capacity did not. The risk is approval-in-name-only under queue pressure — a control that exists procedurally and fails substantively.
Practical response: cap PR size in CI (400 changed lines is a reasonable start), require a provenance field indicating whether a change was predominantly generated, and maintain a written list of what may not be generated at all — authentication, authorization, cryptography, ledger operations, migrations on production tables, and retention cascades. That list is directly defensible in an audit conversation, and it is good engineering independent of the audit.
Model providers as subprocessors. Any hosted inference endpoint receiving customer data is a subprocessor and belongs in your vendor management program with the same treatment as any other: risk assessment, data processing agreement, defined data flows, and periodic review. Prompt and completion logs inherit the classification of the data in them, which matters because logging is usually configured by a different team than the one that classified the data — the most reliable way this gets missed.
The economics of doing it early
Rough shape, from projects that went both ways.
Built in from the start, the incremental engineering cost is modest — audit logging as a subsystem, roles in code, pipeline evidence emission. Call it a small single-digit percentage of build cost, most of which is work you would defend on security grounds regardless.
Retrofitted into a mature system, it is two to three times that, and the multiplier comes from the cross-cutting sweeps: finding every auditable action, centralising scattered authorization, eliminating shared accounts already embedded in operational habits.
Then the observation window on top, which is not an engineering cost at all but is usually the largest number in the calculation.
The practical minimum
If you are starting a system today that will eventually sell to enterprises:
-
Audit logging as a subsystem with a defined schema and append-only storage, from the first commit.
-
Authorization centralised enough to enumerate.
-
Roles defined in version-controlled code.
-
No shared accounts, ever, including infrastructure.
-
Pipeline emitting a durable evidence artifact per deployment.
-
A written standard for what may not be AI-generated.
-
Model providers registered as subprocessors with data flows documented.
Seven items. All defensible as plain engineering practice. All dramatically cheaper before the codebase matures — and one of them, the observation window, unavailable retroactively at any price.
Full guide to US delivery models, rates, compliance costs, contract structures, and budgeting: Custom Software Development Services in USA: The 2026 Cost and Vendor Guide.

Frequently Asked Questions
Why can't SOC 2 Type II be fully retrofitted?
Because it evaluates whether controls operated consistently across an observation window of three to twelve months. Evidence for a past period cannot be created later. Engineering work done today does not produce audit records for March.
How does an audit log differ from application logging?
Application logs are debugging aids — verbose, sampled, aggressively rotated. An audit log is evidentiary: append-only, schema-defined with actor, action, resource, timestamp, outcome and correlation ID, retained for the observation window, and deliberately free of secrets.
What is the most common access control finding?
Standing production access for the entire engineering team. The expectation is time-bounded elevation with logged justification, no shared accounts anywhere including database superuser and third-party logins, and automated deprovisioning through the identity provider.
How does AI-generated code affect change management controls?
The control requires competent human review. Generation volume rose while review capacity did not, risking approval-in-name-only. Cap PR size in CI, require a provenance field, and maintain a written list of what may not be generated — authentication, cryptography, ledger operations, and production migrations.
Are AI providers subprocessors for compliance purposes?
Yes, if customer data reaches them. Include them in vendor management with risk assessment, a data processing agreement, documented data flows, and periodic review. Prompt and completion logs inherit the classification of the data they contain.
What does building compliance in early actually cost?
A small single-digit percentage of build cost, most of which is defensible security work regardless. Retrofitting runs two to three times that, driven by cross-cutting sweeps — plus the observation window, which is usually the largest cost and is not an engineering one.