Skip to main content
Back to resources
SOC 2AI SecurityIdentity GovernanceComplianceISO 27001

Governing Non-Human Identities: How to Audit AI Agents and API Keys in SOC 2

Matt SapioAugust 8, 20266 min read

In traditional SOC 2 and ISO 27001 audits, user access reviews focused almost entirely on human employees. Auditors checked whether engineering new hires completed background checks, verified that offboarded employees lost GitHub access within 24 hours, and confirmed that multi-factor authentication was enforced across Okta or Google Workspace accounts.

That approach is no longer sufficient. In modern SaaS architectures, non-human identities (NHIs)—including service accounts, API tokens, pipeline secrets, and autonomous AI agents—outnumber human users by ten to one. Autonomous AI agents query internal databases, execute code at runtime, and invoke third-party APIs without direct human intervention.

Enterprise security reviews and SOC 2 auditors are now treating non-human identities with the same rigor as human employees. Here is why NHIs break traditional access controls and how SaaS engineering leaders can govern them without slowing development.

Why traditional IAM fails for non-human identities

Legacy Identity and Access Management (IAM) was designed around human lifecycle events: hire, role change, and termination. Human permissions are governed by static Role-Based Access Control (RBAC), and access reviews occur on quarterly or annual schedules.

Non-human identities violate every one of those operational assumptions:

  • No employment lifecycle: Service accounts and API keys do not get "offboarded" when a project ends or an engineer leaves. They linger indefinitely in production environments.
  • Over-privileged credentials: To avoid permission errors during build pipelines, engineers frequently grant non-human identities admin or wildcard access (*), violating the principle of least privilege.
  • Shared credentials & zero ownership: API keys are often hard-coded into environment variables or shared across microservices, leaving auditors unable to identify who created or owns the identity.
  • Non-deterministic AI agent behavior: Autonomous AI agents generate and execute actions dynamically based on prompt inputs, meaning static RBAC policies cannot predict or limit their blast radius.

During a SOC 2 audit, control gaps in CC6.2 (User Access Provisioning) and CC6.3 (Access Modification & Removal) regarding non-human identities map directly to failing audit observations.

The 4-step framework for governing non-human identities in SOC 2

Building an audit-ready non-human identity governance framework does not require stopping engineering work or manually reviewing thousands of API keys every month. Instead, it requires applying four structural controls across your stack:

1. Maintain a centralized non-human identity inventory

You cannot govern what you cannot see. Establish a single, auditable inventory of every service account, API token, OAuth grant, machine credential, and AI agent operating in your production environment.

Every non-human identity in your inventory must have four mandatory fields:

  • Named human owner: A designated engineer or manager accountable for the identity.
  • Business purpose: A clear description of why the identity exists and what service it powers.
  • Scope & environment: Explicit declaration of whether the identity touches production, staging, or customer data.
  • Expiration / rotation schedule: An automated expiration date or mandatory rotation cadence.

2. Enforce least-privilege scoping at runtime

Never allow AI agents or microservices to run on administrative or unconstrained service tokens. Scope non-human permissions tightly to the exact API endpoints and database tables required for their specific workflow.

For autonomous AI agents that perform write actions or handle sensitive data, enforce human-in-the-loop (HITL) approval gates for elevated actions—such as executing database updates, issuing refund transactions, or changing external security configurations.

3. Implement continuous privilege drift monitoring

Static quarterly access reviews are ineffective for non-human identities because machine access drifts rapidly as code deploys daily. Implement automated monitoring to detect unused service accounts, dormant API keys, and scope escalation.

If an API key or service credential shows zero activity for 30 consecutive days, your compliance program should automatically flag or revoke the identity. When auditors ask how you prevent orphan credentials, showing automated revocation logic satisfies SOC 2 CC6.3 requirements instantly.

4. Require cryptographic secret management and automated rotation

Hardcoded API keys in application repositories or unencrypted environment files are a major audit red flag. Store all machine credentials and AI agent API keys in a dedicated secret manager with automated rotation turned on.

Ensure that every non-human interaction generates a tamper-evident, structured audit log recording the identity ID, timestamp, requested endpoint, and action outcome.

How NHI governance simplifies ISO 27001 and SOC 2 audits

When enterprise procurement teams ask "How do you control access for AI agents and service accounts?", having a documented NHI policy, named ownership model, and automated drift detection turns a multi-week vendor risk interrogation into a quick approval.

Furthermore, controls built for non-human identities map directly across multiple compliance standards:

  • SOC 2 Trust Services Criteria: CC6.1 (Logical Access), CC6.2 (User Registration), CC6.3 (Access Revocation), and CC7.2 (System Monitoring).
  • ISO 27001:2022 Controls: A.5.15 (Access Control), A.5.18 (Access Rights), and A.8.2 (Privileged Access Rights).
  • ISO 42001 (AIMS): A.6.2 (AI System Access Control & Transparency).

By establishing a unified identity governance layer, you satisfy SOC 2, ISO 27001, and emerging AI safety regulations simultaneously.

If your team is building AI features or scaling microservices and needs to govern non-human identities for an upcoming audit, our SOC 2 and ISO 27001 readiness service builds audit-proof identity controls directly into your stack. We also provide ongoing security compliance management to keep controls monitored and fractional CISO leadership to represent your security program during enterprise sales deals.

Talk to us

Have a question this article didn't answer?

Book a free consultation and we'll talk through how this applies to your specific situation.