How do I keep AI-generated code compliant with SOC 2 and ISO 27001?

    Auditors do not ban AI-written code. They ask whether every change is still reviewed, tested and traceable. Here is how to show that when agents write much of your code.

    Key points

    • Neither SOC 2 nor ISO 27001 forbids AI-generated code. Both expect every change to be authorised, reviewed, tested and traceable, whoever wrote it.
    • The controls under most pressure are change management, secure coding, access to production and supplier management for the AI tools themselves.
    • Keeping AI-generated code compliant means putting your controls into the agent's workflow and the pull request gate, then keeping the evidence as you go.
    • Treat your coding agents as tools that need an owner, a policy and a record of what they can access.

    To keep AI-generated code compliant with SOC 2 and ISO 27001, make sure every change is still authorised, reviewed, tested and traceable, whoever or whatever wrote it. Neither framework bans AI-written code. What auditors check is whether your controls still work when an agent is producing much of the diff, and whether you can prove it.

    Is AI-generated code SOC 2 and ISO 27001 compliant?

    Code is not compliant or non-compliant on its own. Your process is. SOC 2 is an attestation report on how your controls operate, measured against the AICPA Trust Services Criteria. ISO 27001 is a certifiable standard for an information security management system. Both look at how changes reach production.

    So the honest answer is: AI-generated code is fine, as long as the controls around it still hold.

    Which controls do coding agents put under pressure?

    Area SOC 2 (Trust Services Criteria) ISO 27001:2022 Annex A What changes with agents
    Change management CC8.1 8.32 Much larger, faster diffs; review gets skimmed
    Secure development CC8.1, CC7.1 8.25, 8.28 Agents repeat insecure patterns confidently
    Access to production CC6.1 to CC6.3 8.2, 8.3 Agents may hold tokens or run commands
    Suppliers CC9.2 5.19 to 5.21 The AI tool itself processes your code
    Testing CC8.1 8.29 Agents write tests that pass but prove little

    None of these are new controls. They are old controls with a new failure mode.

    What will an auditor actually look at?

    Expect the same questions as always, with sharper follow-ups:

    1. Show me how a change gets to production. They will sample pull requests and check each had an approval from someone other than the author. If an agent opened it, the approving human is the key control.
    2. Show me the review was real. A one-second approval on a 2,000-line diff is a weak sign. Automated checks against defined criteria strengthen the story.
    3. Who can deploy, and what can the agent touch? Expect questions about tokens and permissions your agents hold.
    4. Have you assessed the AI tools? For ISO 27001 especially, the tools are suppliers.

    How to keep AI-generated code compliant: five steps

    1. Write a short AI coding policy. Which tools are approved, what data they may see, and that every agent change goes through a human-approved pull request.
    2. Give the agent your controls. Connect your coding agent to your controls through MCP, so it builds to the requirements instead of guessing. We explain how in compliance checks in Claude Code and Cursor.
    3. Gate every pull request. Run an automated review against your code-level controls on each pull request, and block on hard rules such as secrets in the change. See our AI code review checklist.
    4. Limit what agents can reach. No production credentials in agent sessions. Read-only by default.
    5. Keep evidence as you go. Each pull request that fixes a failing control is evidence. Record it when it merges rather than rebuilding it before the audit.

    Which problems matter most?

    The problems worth catching first are plain, not exotic: secrets committed in config or tests, eval or similar dynamic execution, and TLS verification switched off to get something working. These are the checks we built Keldyn's gate to flag, because they are exactly the changes a busy reviewer misses and an auditor's sample can catch.

    Where Keldyn fits

    Keldyn puts your SOC 2 and ISO 27001 controls into the coding agent through MCP, checks each pull request against them with the compliance gate, and keeps the resulting evidence ready for your auditor in evidence and audit. For the wider picture, see our SOC 2 guide.

    Frequently asked questions

    Is AI-generated code allowed under SOC 2?

    Yes. SOC 2 does not care who or what wrote the code. It cares that changes are authorised, tested and approved before release, and that you can show it.

    Do I need to tell my auditor we use AI coding agents?

    Your auditor will ask how changes are made and reviewed, so describe it honestly. Show the controls around agent use, such as required human review, pull request checks and access limits.

    Do AI coding tools count as suppliers for ISO 27001?

    Usually yes. If a tool processes your code or data, assess it like any other supplier, covering what it accesses, where data goes and the terms you have agreed.

    What is the quickest win?

    Require a human-approved pull request for every agent change, with an automated check against your code-level controls on each one.