← All posts
SOC 2 secrets managementSOC 2 API key rotationSOC 2 access control

SOC 2 Secrets Management: Inventory, Rotation, and Leak Response

SOC 2 names no secrets manager or rotation interval. Inventory your API keys and machine credentials, set rotation triggers, plan for leaks, and keep Type 2 evidence.

A secrets control names each machine credential, its owner, where it lives, and when it gets replaced.
A secrets control names each machine credential, its owner, where it lives, and when it gets replaced.

SOC 2 has no secrets management checklist. The Trust Services Criteria never name a secrets manager, a vault, or a rotation interval. What they do say, in CC6.1 and CC6.2 points of focus, is that credentials for infrastructure and software are authorized before they are issued, removed when no longer needed, and reviewed, and that cryptographic keys are protected through their whole life. For a SaaS team that means four things you can show: a list of every machine credential with an owner, a safe place for each one, a rule for when it gets replaced, and a plan for when one leaks. Then keep the records that prove those rules ran during the report period.

TL;DR

  • The criteria require controlled credentials, not a particular tool. Your approved policy sets the rules. The CPA firm judges whether they fit your risks and tests whether you followed them.
  • Start with an inventory: API keys, database passwords, cloud access keys, CI deploy tokens, signing keys, webhook secrets, and TLS private keys. Record names, owners, and locations, never values.
  • Plaintext secrets do not belong in source code, tickets, chat, or logs, including in a private repository.
  • No rotation interval is required. Rotate on events (owner leaves, suspected exposure, vendor breach), pick a schedule you will meet for the rest, and replace stored keys with short-lived credentials where you can.
  • When a secret leaks, revoke or rotate it first, then investigate.

What do the SOC 2 criteria say about secrets?

The AICPA Trust Services Criteria never mention secrets management. The relevant text is about credentials and keys. Points of focus describe what a control might address. They are not a checklist where each line is required, so your CPA firm looks at whether your controls fit your risks.

Criterion Point of focus What it means for secrets
CC6.1 Manages Credentials for Infrastructure and Software Register and authorize a system before it gets credentials, and remove them when it is retired
CC6.1 Protects Cryptographic Keys Protect keys during generation, storage, use, and destruction
CC6.1 Identifies and Authenticates Users Authenticate infrastructure and software, not only people
CC6.2 Creates Access Credentials to Protected Information Assets Credentials for systems and software need an owner’s authorization
CC6.2 Reviews Validity of Access Credentials Review credentials for validity and look for inappropriate system or service accounts
CC6.2 Prevents the Use of Credentials When No Longer Valid Disable or destroy credentials that are no longer valid
CC6.6 Protects Identification and Authentication Credentials Protect credentials in transit outside the system boundary

Read together, they ask a simple question: for every credential a machine uses to reach your systems or data, can you say who approved it, who owns it, who or what can read it, and how it stops working?

What counts as a secret?

In this guide, a secret is any value that grants access or proves identity without a person typing it each time. In a typical SaaS stack that includes:

  • cloud access keys and service account keys;
  • database and cache passwords and connection strings;
  • third-party API keys, such as payments, email, and model providers;
  • CI and deploy tokens, package registry tokens, and Git deploy keys;
  • OAuth client secrets and webhook signing secrets;
  • TLS private keys, code signing keys, and encryption keys;
  • SSH keys for servers or bastions;
  • recovery codes and break-glass credentials.

Human passwords are a separate rule set. The password requirements guide covers them, and the MFA requirements guide covers how service accounts fit an authentication control.

Build a secrets inventory

You can’t rotate or revoke a credential you don’t know exists. An inventory is also what lets you answer “which keys did this person have access to?” on the day someone leaves. Keep one row per secret and never record the value. Leave the last-rotated date in the secrets manager’s version history, where it can’t go stale. Where the store keeps no version history, such as a CI secret store or a password manager, keep the rotation ticket or an exported audit log entry as the rotation record. In “Read by,” count everyone who can get the value: named readers, roles or groups that can read it, admins of the store, and for CI secrets anyone who can change a workflow that uses them.

Field Example
Name payments-api-live
Purpose Charges cards from the billing service
System Production SaaS service, billing component
Owner Priya Shah, platform lead
Stored in Cloud secrets manager, path prod/billing/payments
Read by Billing service role, admins Priya Shah and Sam Ortiz
Issued by Payments provider dashboard
Rotation trigger Owner or admin leaves, suspected exposure, provider breach, yearly
How to revoke Roll key in provider dashboard, then update secret version

Build the first version from the places secrets actually live: your secrets manager’s list, your CI secret settings, your cloud provider’s key and service account lists, your password manager’s shared vaults, and a scan of your repositories. The gaps between those lists are your first findings. Review the inventory on a schedule and when systems change, because CC6.2 points to periodic review of credential validity. The access review guide shows how to run and record that kind of review.

Where should secrets live?

The OWASP Secrets Management Cheat Sheet recommends centralizing and standardizing secrets storage, and it notes that this can mean more than one system, such as a cloud provider’s secrets manager plus a password manager. A workable split for a small team:

  • Application and infrastructure secrets go in your cloud provider’s secrets manager or a dedicated secrets system.
  • CI secrets go in the CI platform’s secret store, scoped to the environment that needs them.
  • Secrets that people must handle by hand, such as a provider’s admin recovery codes, go in a shared vault in your password manager with named members.

Plaintext secrets should not appear in source files, committed .env files, tickets, chat, logs, or documents. A private repository does not change this, because every clone, fork, and CI job gets a copy, and Git keeps old commits. Encrypted secrets in Git can work if the encryption method is approved, the decryption key lives in a separate secrets system, repository access alone cannot decrypt them, and you control who can decrypt and when values change. The encryption requirements guide covers key ownership and key lifecycle in more depth.

To catch mistakes before they land, turn on secret scanning in your Git host. GitHub’s push protection blocks pushes that contain supported secret types, and generic patterns such as private keys need to be enabled in the repository’s security settings. Check what your plan includes: GitHub’s page says repository push protection is off by default and needs GitHub Secret Protection, and the per-user default only covers public repositories and does not create alerts when someone bypasses it. If your host doesn’t scan private repositories, run a secret scanner in a pre-commit hook, which catches a secret before it leaves the laptop, or in CI. A CI finding means the secret already reached the remote, so handle it as a leak with the runbook below. Treat a bypass as an event someone reviews, not as routine.

Does SOC 2 require secret rotation?

No interval is required. Your policy sets the rule, and the CPA firm tests whether you followed the rule you wrote. If you write “every 90 days” and miss it, that becomes an exception even though SOC 2 never asked for 90 days.

OWASP’s cheat sheet says secrets should be rotated regularly so a stolen one only works for a short time, and that lifetimes depend on what the secret protects. It also says user credentials are excluded from regular rotation, following NIST. I’d write the rule in three parts:

  1. Rotate on events. When a person with read access to a secret leaves or changes role, when a secret may have been exposed, and when the issuing provider reports a breach, rotate it and note which event triggered it.
  2. Replace stored keys with short-lived credentials where the platform allows. AWS’s IAM best practices say to require workloads to use temporary credentials with IAM roles. GitHub Actions can use OpenID Connect to get a short-lived cloud token for each job, so no cloud key is stored in CI at all. A credential that expires on its own needs no rotation record, but the cloud role’s trust policy now decides who can get one. Scope it to the specific repository, branch, or environment, review it like any other access grant, and keep that configuration as evidence.
  3. Put the remaining long-lived secrets on a schedule you will actually meet. This is a judgment call. A yearly rotation that you perform beats a 30-day rule you skip. Set the schedule as a rotation policy, expiry date, or reminder in the secrets manager or at the provider, so a due rotation shows up without someone checking dates by hand.

The event trigger matters most in practice. Add “rotate shared secrets this person could read” to your offboarding steps, and use the inventory’s “Read by” column to find them. The onboarding and offboarding checklist shows where that step fits.

What to do when a secret leaks

GitHub’s guide to removing sensitive data says the first step for a leaked password, token, or credential is to revoke or rotate it, and that rewriting history may not be needed after that. I’d still remove the value where copies could spread. A short runbook:

  1. Revoke or rotate the secret at the issuing system and deploy the new value. Make sure the old value stops working now. If the provider keeps the old key valid during a roll, expire or deactivate it right away.
  2. Check that system’s logs for use of the old value from the first commit or push that exposed it, not from when you found it, through the rotation. Then watch for later attempts to use the old value.
  3. Find where else the value appeared: other repositories, CI logs, tickets, chat, or a model provider’s prompt history.
  4. Remove the value from history and other copies where that reduces risk.
  5. Record the event, the timeline, and the fix through your incident process, and confirm the secrets manager’s version history shows the rotation, so you can export it as evidence.

A leaked key that someone used is a security incident. The incident response evidence guide covers what to keep. Coding agents raise the same question from a different direction, since an agent with a long-lived token can leak or misuse it. The AI coding agents guide covers scoping those credentials.

What evidence shows the control operated?

A Type 2 report looks at a period, so a screenshot from the week before the audit is weak on its own. Plan to keep:

  • the approved policy or procedure that states your secrets rules;
  • the inventory, with dated reviews during the period;
  • the secrets manager’s access policy export and audit log, which OWASP says should show who requested a secret, whether the request was approved, and when it was used;
  • rotation or revocation records for each trigger event in the period, such as a departure or an exposure;
  • secret scanning settings and the disposition of each alert or push protection bypass;
  • change records when a credential’s access or storage changed. The change management evidence guide covers those.

Export audit logs on a schedule shorter than the tool’s log retention, or the early part of the period may be gone by the time the auditor asks. The CPA firm decides which samples it needs and whether the evidence is enough.

Common gaps auditors find

  • A former engineer’s personal access token still works because nobody owned it.
  • A production database password sits in a CI variable with no owner and no rotation rule.
  • The policy says 90-day rotation, but the provider dashboard shows keys older than a year.
  • An offboarding ticket removed the person’s accounts but left the shared secrets they could read.
  • A secret was committed, the commit was reverted, and the key was never rotated.
  • Secret scanning alerts were closed with no note about what happened.

If one of these turns into an audit exception, the audit exceptions guide explains what it means for the report.

Record the secrets control in FileGRC

FileGRC is a Git-native GRC workspace for SOC 2 work. JSON holds structured records, Markdown holds long-form work, and Git supplies the change history. A new workspace includes a proposed Information Security Policy with a “Cryptography, Encryption, Key, and Secrets Management Policy” section. It says keys and secrets need named ownership and least-privilege access, protected storage, controlled distribution, rotation or replacement based on risk and events, revocation when access or trust ends, and recovery where needed. It also says plaintext credentials, private keys, tokens, and recovery codes must not appear in source files, tickets, chat, logs, or other business records.

The workspace also includes a proposed encryption and secure transmission control (DATA-02) mapped to CC6.1 and CC6.7, whose activity covers key generation, storage, distribution, rotation, revocation, and recovery. The strong authentication control (IAM-02) covers credential protection. Starter records are proposals, not compliance claims, so edit them until they match how you run secrets.

Check what the control still needs:

npx filegrc get control control-encryption-transmission
npx filegrc program-readiness --control control-encryption-transmission

On a new workspace, the readiness output asks you to check encryption and who can manage keys for each system holding sensitive data, to link in-scope Systems, to write the current procedure in the control’s Record Markdown with its revision and effective date, and to link a Component that can produce Data Protection Configuration (data-handling) evidence.

Add a secrets section to that procedure file, data/controls/control-encryption-transmission.md, next to the encryption procedure. Create the file if it doesn’t exist yet. The section should say where each kind of secret lives, the rotation triggers and schedule, the leak runbook, and how often you review the inventory. That file is the control’s procedure, so change it only when the rules change, and record the new revision and effective date on the control in procedureRevision and procedureEffectiveOn.

Record accounts and other secrets in different places. FileGRC’s service-account record is for non-human identities and their credentials, such as a cloud role, a CI deploy identity, or an API account at a provider. It holds the account’s purpose, owners, Systems, authentication method, privilege, expiry, last review date, and next review date. Its optional Markdown file, data/service-accounts/<id>.md, holds the rest of the inventory row: where the credential is stored, who can read it, who issued it, its rotation triggers, and how to revoke it. Secrets that are not accounts, such as TLS private keys, signing keys, and webhook secrets, go in a short table in the Record Markdown of your secrets manager’s Component, which the next steps have you create. Keep that list out of the control’s procedure, so adding a secret doesn’t count as a procedure revision. The service account records are your account inventory, so you don’t need a second register for those accounts. In both places, write names and paths only, never values. As in the inventory above, the last-rotated date stays in the secrets manager.

A service account requires at least one System ID. In FileGRC a System is the whole bounded system you’re examining, usually one record for your production service, not one per app or provider. A new workspace has none, so define that scope first. The SOC 2 scope guide covers how to draw it. Then scaffold a service account into a private temporary folder outside the repository:

tmp="$(umask 077; mktemp -d)"
npx filegrc scaffold service-account --title "Payments provider API account" > "$tmp/service-account.json"

Fill in purpose, ownerIds, and systemIds, and add accountIdentifier, authenticationMethod, privileged, reviewDueOn, and either expiresOn or nonExpiringRationale. To write the Markdown file in the same step, add a content object with a record string holding the Markdown. Then preview and create it. The preview rejects a record with missing fields or unknown IDs:

npx filegrc preview-mutation "$tmp/service-account.json" --json
npx filegrc create "$tmp/service-account.json" --json && rm -rf "$tmp"
npm run validate

Never put a key, token, or password in any field. Use accountIdentifier for a name, key ID, or role name, never the secret itself. Keep rotation dates where the rotation happens, in the secrets manager’s version history and the provider’s logs, and export them as evidence. Review the diff before you commit. A commit does not show management approval by itself, so keep the approval record with the evidence.

Other starter controls cover the rest of the service account lifecycle. System inventory and secure configuration (OPS-01) keeps the inventory that service accounts belong to. Access authorization and least privilege (IAM-01) covers approving a new service account, and access review and offboarding (IAM-03) covers review and removal. The starter also includes two proposed obligation rules: one under IAM-01 to authorize and review each new service account, and one under IAM-03 to disable or renew an expired one. They create no work until you activate them.

To link your secrets manager as an evidence source, follow the Component steps in the endpoint security guide, but link the Component to control-encryption-transmission instead of control-endpoint-protection and set evidenceSourceKinds to ["data-handling"]. Readiness only counts an active Component. The secrets manager is one evidence source for this control, not all of it. The encryption settings of each in-scope System still need their own source, which the encryption requirements guide covers.

When you name a person as the owner, an agent with access to the repository can compare service accounts with the people records and flag an account whose owner has an end date, one past its review date, or one with no expiry and no nonExpiringRationale. It works from the records you wrote, so it never needs the secret values.

FileGRC does not store, scan for, or rotate secrets. Your secrets manager, cloud provider, CI platform, and Git host do that work and produce the logs. Your team writes the rules, runs the rotations, and exports the proof. An independent CPA firm performs the SOC 2 examination and judges whether the control was designed and operated well.

Open source · MIT

Run your SOC 2 program as files in Git.

Keep policies, controls, work, and evidence indexes in a repository your team and agents can inspect. Add optional FileGRC Autopilot email and Slack reminders to keep work moving.

Frequently asked questions

Does SOC 2 require a secrets manager?

No. The AICPA Trust Services Criteria do not name any tool. CC6.1 points of focus say credentials for infrastructure and software are authorized before issue and removed when no longer needed, and that cryptographic keys are protected during generation, storage, use, and destruction. A secrets manager is a common way to meet that, but you choose the method. The CPA firm judges whether your controls fit the criteria and your risks, and whether they operated as written.

How often does SOC 2 require API key rotation?

SOC 2 sets no interval. You write the rotation rule in your approved policy or procedure, and the CPA firm judges whether it fits your risks and tests whether you followed it. OWASP's Secrets Management Cheat Sheet says to rotate secrets regularly so a stolen one works only for a short time, and excludes user passwords from scheduled rotation. A practical rule uses event triggers (owner leaves, suspected exposure, vendor breach) plus a schedule you can meet, and replaces stored keys with short-lived credentials where the platform supports it.

What should we do if a secret is committed to Git?

Revoke or rotate the secret first. GitHub's documentation says this is the first step, because a revoked or rotated secret can no longer be used for access. Check that the provider ended the old value rather than leaving it valid during a grace period. Then check the provider's logs for use of the old value, remove it from history if needed, and handle the event through your incident process with a record of each step.

Can secrets be stored in a private Git repository?

Not as plaintext. A private repository still gives every reader, fork, clone, and CI job a copy. Encrypted secrets in Git can work when the encryption method is approved, the decryption key lives in a separate secrets system, repository access alone cannot decrypt the values, and access and rotation are controlled.

What evidence do auditors ask for on secrets management?

Typical requests include the written rule, an inventory of machine credentials with owners, the secrets manager's access policy and audit log, rotation or revocation records for events in the period, secret scanning settings with alert dispositions, and proof that credentials were rotated when someone with access left. The CPA firm decides which samples it needs and whether the evidence is enough.

Does FileGRC store or rotate secrets?

No. Keep secret values in your secrets manager, cloud key service, CI secret store, or password manager. FileGRC is a Git-native GRC workspace for SOC 2 work. It records the control, your written procedure, service account records with owners and review dates but no secret values, and fixed evidence your team exports, with JSON for structured records, Markdown for long-form work, and Git for change history.