Use this when limiting how long credentials stay valid.
Expiration
Secret expiration gives credentials a limited lifetime, such as short-lived tokens or certificates that expire in days, so a leaked secret stops working quickly.
1. Secrets should expire (TTLs).
2. Short TTLs limit exposure.
3. Alert before expiry of long-lived secrets.
4. Renew automatically.
5. Remove expired secrets.
secret issued with TTL → renew or expire
Context & applicabilityCommon mistakes · platform/version boundaries
- Certificates expiring unexpectedly because nobody tracked them — monitor expiry.
- "Never expires" set for API keys and PATs.
- Lifetimes so short that manual renewal becomes impossible — automate first.
- Expiry not aligned with rotation, so services fail at expiry.
Operational reference
Fast context before you go deeper.
Evidence · 1 on this Topic
Expected observations and documentation recipes are reference material. Record actual output, device identity, scope and time before claiming a verified result.
- Short-lived secrets reduce exposure.
- Expired secrets must be renewed automatically.
- Certificates and tokens should expire.
- Expiry dates on keys/tokens/certs — tracked
vault token lookup— TTL- Alerts before expiry — monitoring
ReferenceWhy it matters1 section · depth on demand
Setting lifetimes
| Secret | Typical lifetime |
|---|---|
| OAuth access token | Minutes to 1 hour |
| Dynamic database credentials | Hours |
| TLS certificates (public) | 90 days or less (moving to 47 days by 2029) |
| API keys / PATs | 30–90 days, or replace with short-lived tokens |
| Service account passwords | Managed rotation (gMSA every 30 days) |
Monitor upcoming expiry so expiry does not cause outages.
ReferenceImportant terms & boundaries2 sections · depth on demand
Suggested lifetimes
| Secret | Lifetime |
|---|---|
| OAuth access token | 5–60 minutes |
| Dynamic DB credentials | Hours |
| CI/CD tokens (OIDC) | Per job |
| API keys | 90 days or less |
| Public TLS certificates | Maximum 200 days since March 2026, falling to 47 days by 2029 (CA/Browser Forum) |
| Root/CA keys | Years, offline |
In depth
Expiration gives secrets a fixed validity period after which they stop working. It limits the damage from undetected leaks and forces rotation, but expired secrets also cause outages when renewal is forgotten.
Practical guidance:
| Secret | Typical lifetime |
|---|---|
| Access tokens | 5–60 minutes |
| Personal access tokens | 30–90 days |
| Public TLS certificates | Maximum 200 days since March 2026, 100 days from March 2027, 47 days from March 2029 (CA/Browser Forum) |
| Service credentials | Automated rotation (days to months) |
Monitor upcoming expiry centrally and alert well in advance; automate renewal wherever possible so expiry becomes a non-event.
Additional reference context Scope · expected state · examples · history · terminology Open only when you need the supporting context
Verification history & basis
When and against what this Topic was checked. Later text edits do not count as a new check.
Authoritative/upstream documentation reviewed for bounded claims in Secrets Management → Expiration. Documentation verification only; this is not observed lab or production Evidence.
Basis: https://cheatsheetseries.owasp.org/cheatsheets/Secrets_Management_Cheat_Sheet.html · confidence 94%