# "How do you store and rotate secrets and API keys?": how a small SaaS team can answer it

By Vadim Nareyko, founder, Arviser. Published 2026-11-29 · Updated 2026-11-29 · Last reviewed 2026-11-29

## Facts

- Questionnaire answer: KB-Q-0007 · SaaS team security, Cloud and infrastructure
- Topic: Storage, rotation and revocation of credentials, including model provider keys and agent tokens
- Also asked as: "Where are production credentials kept?" · "How often do you rotate API keys?" · "What do you do when a key leaks?"
- Sources read on: 2026-11-29
- Review rule: Every 3 months, and at once when a cited provider changes its page or MCP publishes a new specification version

## Short answer

The buyer wants to know how long a stolen key stays useful. Answer in three parts: where secrets live and who can read them, which credentials rotate or expire and on what schedule, and how fast you revoke a key that leaked. Name the credentials that never expire.

## Before you copy anything

> **Before you copy anything.** The answers below are example wording for imagined companies. Use them to see the shape of a good answer, then write what is true for your company today. An answer that describes a control you do not have is a misstatement to your customer, and it tends to surface in the next question or in the contract. Nothing on this page says that an answer meets a standard, a law or a particular customer's requirements, and none of it is legal advice.

## Store, rotate, revoke: three separate answers

"We keep secrets in a vault" answers only the first part. A key that never changes stays valid in every copy, on a laptop or in a CI log. Rotation limits how long a copy works. Revocation at the provider ends it.

A short-lived credential needs no rotation schedule. GitHub's OpenID Connect tokens for workflows are one example: the cloud provider "issues a short-lived access token that is only valid for a single job, and then automatically expires" ([GitHub Docs, OpenID Connect](https://docs.github.com/en/actions/concepts/security/openid-connect), read 2026-11-29). AWS says to "use temporary security credentials (such as IAM roles) instead of creating long-term credentials like access keys" ([AWS, Manage access keys for IAM users](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_access-keys.html), read 2026-11-29). If most machine access works this way, lead with that.

Deleting a leaked key from code does not end it. For a password, token or credential, GitHub says "as a first step you need to revoke and/or rotate that secret" ([GitHub Docs, Removing sensitive data from a repository](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/removing-sensitive-data-from-a-repository), read 2026-11-29). The same page warns that after a history rewrite the commits may still be reachable in clones and forks.

## Defaults that leave a key valid

Providers' own statements as read on 2026-11-29. Defaults change and some differ by plan, so check the current page for your account.

- **Google Cloud service account keys.** "By default, service account keys that you create and download from IAM don't have an expiry time and stay valid until you delete them." For production Google advises against expiry: "an expired service account key could cause an accidental outage. Instead, use keys that do not expire, and manage their lifecycle with key rotation" ([Google Cloud, Best practices for managing service account keys](https://docs.cloud.google.com/iam/docs/best-practices-for-managing-service-account-keys)). Key creation is blocked by default only in organizations "created on or after May 3, 2024" and possibly in some created from February to April 2024 ([Google Cloud, Manage Google Cloud security baseline constraints](https://docs.cloud.google.com/resource-manager/docs/manage-baseline-constraints)).

- **AWS access keys and Secrets Manager.** "Access keys are long-term credentials for an IAM user or the AWS account root user", and those in the shared AWS credentials file "are stored in plaintext" ([AWS, Manage access keys for IAM users](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_access-keys.html)). Secrets Manager says "you can set up automatic rotation for your secrets". For "most managed secrets", which are secrets another AWS service such as Amazon RDS creates for you, the service "configures and manages rotation for you" ([AWS, Rotate AWS Secrets Manager secrets](https://docs.aws.amazon.com/secretsmanager/latest/userguide/rotating-secrets.html)). The page on those secrets says only that "some managed secrets include managed rotation" ([AWS, AWS Secrets Manager secrets managed by other AWS services](https://docs.aws.amazon.com/secretsmanager/latest/userguide/service-linked-secrets.html)). A secret you created yourself rotates only if you set it up, so check the rotation setting of each one.

- **GitHub push protection.** GitHub lists push protection for repositories as "disabled by default" and as needing GitHub Secret Protection. When it is on, "by default, anyone with write access to the repository can bypass push protection by specifying a bypass reason". Push protection for users "is only available on GitHub.com", is on by default, and "Stops you from pushing secrets to public repositories on GitHub" ([GitHub Docs, Push protection](https://docs.github.com/en/code-security/concepts/secret-security/push-protection)). Our reading: a private repository has no block unless you turn one on, and a secret already in history needs a scan, because push protection checks new pushes.

## Example answers

Our illustration. The companies, dates and names are invented.

**5 people, no rotation schedule yet.** A B2B form builder on one cloud account and one code host.

> Secrets are stored in our cloud provider's secret manager and passed to the application at deploy time. A scan of our repositories' full history on 2 November 2026 found no live secrets. Two founders can read production secrets. Deploys use a short-lived role, not a stored access key. We do not yet rotate keys on a schedule. We rotate a credential when someone with access leaves and at once when we suspect a leak; the last rotation was on 14 October 2026, after a contractor left. Rotation every 90 days for our database password and model provider key starts on 31 January 2027.

Why it works: the "no" covers the schedule only, and the reviewer gets the trigger, the last date and a start date.

**20 people, managed rotation and one documented exception.** A logistics platform on AWS with an AI search feature.

> Production secrets are in AWS Secrets Manager. The deployment role and three named engineers can read them; reads are logged. Database credentials rotate every 30 days through Secrets Manager rotation, which we turned on for each production database secret. CI deploys through OpenID Connect with no stored cloud keys. Our model provider is the OpenAI API: each environment has its own project key with an expiration date, and our organization sets a maximum key lifetime of 90 days. One exception: a shipping partner's API key has no expiry and no rotation API. We rotate it by hand every six months, last on 3 September 2026.

Why it works: each claim names its mechanism, and the key-lifetime setting is OpenAI's, so a copier on another provider uses what theirs offers.

**50 people, few long-lived keys left.** A data platform with enterprise customers and an assistant that reads customer documents.

> Workloads authenticate with short-lived credentials from our cloud provider's identity service. Long-lived keys are blocked by organization policy, with two exceptions on the key inventory, each with an owner and a rotation date. Remaining secrets are readable only by the workload that uses them. Push protection is on for every repository, and only the security team can approve a bypass. Our leak runbook revokes and replaces a key before any history cleanup; its last drill, on 5 November 2026, took 22 minutes. Tokens our assistant uses to reach customer systems are issued per customer, scoped to the connected workspace, and expire after one hour.

Why it works: it counts the exceptions, and the drill date with a measured time shows the revocation path was tested.

## Evidence to attach

| Evidence | What it shows | At 5 people |
| --- | --- | --- |
| Credential inventory: name, store, owner, lifetime, last rotated | Nothing is unaccounted for | A short table |
| Rotation settings or key expiry screen for each long-lived key | Rotation is configured, not intended | One screenshot per store |
| Secret scanning and push protection settings, plus the latest scan result | Private repositories are covered | Code host settings screen |
| Leak runbook with the last drill or real use | Revocation works and how long it takes | One page |

## Wording that makes a reviewer push back

| Wording | What it signals | Say instead |
| --- | --- | --- |
| "All secrets are encrypted." | Storage only; nothing on who reads or how long keys live | "Secrets are in <store>; <roles> can read them; reads are logged." |
| "We rotate keys regularly." | No schedule and no evidence | "Database credentials rotate every <n> days through <tool>; last rotated <date>." |
| "No secrets are in our code." | Not checked | "Push protection is on for all repositories; a history scan on <date> found <n> secrets, all revoked." |

## If your product has an AI feature

- **OpenAI API keys.** OpenAI says project keys "can be created with an expiration date", that administrators "can enforce a maximum API key lifetime", and that "For supported workloads" workload identity federation replaces a stored key. It says to "Set monthly spend limits for your organization or projects, and enable hard enforcement to help limit unexpected costs from a leaked key". It names the limits: "Spend alerts alone don't stop API traffic", and hard enforcement "can block legitimate requests, and spend may slightly exceed the limit" ([OpenAI Help Center, Best practices for API key safety](https://help.openai.com/en/articles/5112595-best-practices-for-api-key-safety), read 2026-11-29).

- **Anthropic API keys.** Anthropic suggests rotating "on a consistent schedule (for example, every 90 days)" and says that a Claude API key found "in a public GitHub repository" is deactivated automatically ([Claude Help Center, API key best practices: keep your keys safe and secure](https://support.claude.com/en/articles/9767949-api-key-best-practices-keep-your-keys-safe-and-secure), dated October 19, 2026, read 2026-11-29). Our reading: that covers public repositories only, not a private repository, a log or a laptop.

- **Agent and connector tokens.** The Model Context Protocol (MCP) specification, version 2025-11-25, says "MCP servers MUST NOT accept or transit any other tokens" than ones issued for them, and "MUST NOT pass through the token it received from the MCP client" to upstream APIs. Authorization servers "SHOULD issue short-lived access tokens" and, for public clients, "MUST rotate refresh tokens". The same text says "Authorization is OPTIONAL for MCP implementations", and that implementations on the STDIO transport "SHOULD NOT follow this specification, and instead retrieve credentials from the environment" ([MCP specification, Authorization](https://modelcontextprotocol.io/specification/2025-11-25/basic/authorization), read 2026-11-29).

  Our reading: a server on STDIO holds whatever key is in its environment, and none of these token rules protect it. Say which transport your MCP servers use and where their credentials come from.

> We call the model provider from our backend only, with one key per environment in our secret manager, replaced every 90 days (last on <date>). Our assistant reaches customer systems with tokens issued for our service alone, scoped to one workspace and valid for one hour. Checked on <date>.

**Next:** [How to answer an AI security questionnaire](/guides/ai-security-questionnaire)

## Related pages

- ["Do you enforce multi-factor authentication?": how a small SaaS team can answer it](/library/questionnaire/mfa-enforcement)
- ["Is customer data encrypted at rest?": how a small SaaS team can answer it](/library/questionnaire/encryption-at-rest)

## Sources

- GitHub Docs, OpenID Connect: https://docs.github.com/en/actions/concepts/security/openid-connect (accessed 2026-11-29)
- AWS, Manage access keys for IAM users: https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_access-keys.html (accessed 2026-11-29)
- AWS, Rotate AWS Secrets Manager secrets: https://docs.aws.amazon.com/secretsmanager/latest/userguide/rotating-secrets.html (accessed 2026-11-29)
- AWS, AWS Secrets Manager secrets managed by other AWS services: https://docs.aws.amazon.com/secretsmanager/latest/userguide/service-linked-secrets.html (accessed 2026-11-29)
- GitHub Docs, Removing sensitive data from a repository: https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/removing-sensitive-data-from-a-repository (accessed 2026-11-29)
- Google Cloud, Best practices for managing service account keys: https://docs.cloud.google.com/iam/docs/best-practices-for-managing-service-account-keys (accessed 2026-11-29)
- Google Cloud, Manage Google Cloud security baseline constraints: https://docs.cloud.google.com/resource-manager/docs/manage-baseline-constraints (accessed 2026-11-29)
- GitHub Docs, Push protection: https://docs.github.com/en/code-security/concepts/secret-security/push-protection (accessed 2026-11-29)
- OpenAI Help Center, Best practices for API key safety: https://help.openai.com/en/articles/5112595-best-practices-for-api-key-safety (accessed 2026-11-29)
- Claude Help Center, API key best practices: keep your keys safe and secure, October 19, 2026: https://support.claude.com/en/articles/9767949-api-key-best-practices-keep-your-keys-safe-and-secure (accessed 2026-11-29)
- Model Context Protocol, Authorization, specification version 2025-11-25: https://modelcontextprotocol.io/specification/2025-11-25/basic/authorization (accessed 2026-11-29)

## Corrections

No corrections.

How this page was made: Claude Opus 5.5, an AI model, wrote this page from the sources listed. An independent AI check compared the claims with the sources, and the page was corrected after it. Vadim Nareyko approved the family template and the sample pages on 26 November 2026, from a summary in Russian. This page was not reviewed by Vadim Nareyko. On 28 November 2026 Vadim Nareyko decided that new pages in the family are published after the linters and an independent check, without that review.

Text and data on this page: [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/). Quoted third-party material keeps its own terms.
