Research & Analysis · Application security · 19 min read
How to Revoke a Leaked Secret Without Breaking Services
Sources checked against the cited passages; awaiting my final read before this is indexed.
I revoke a leaked secret at the system that accepts it, verify denial of the old authority, and test each material consumer with a replacement. The sequence depends on privilege and evidence of misuse: immediate containment may justify a controlled outage, while a bounded transition can preserve availability when the exposure permits it. Updating the stored value alone does not prove containment.
A key turns up in a repository, a build log, or a support ticket. Someone updates the value in a secrets manager and announces that it has been rotated. The old key may still authenticate. A worker may be pinned to the old version. A vendor integration may hold a copy. The team has changed a record, but it has not yet proved that access ended or that the business service still works.
I treat suspected secret exposure as an incident whose scope follows the credential’s authority. The two outcomes are both necessary: the exposed authority must stop working, and legitimate work must continue through a known replacement. OWASP separates rotation from revocation and deletion in its secret lifecycle, and its response guidance places revocation at the center of containment (OWASP Foundation, n.d.). The order can vary by consequence, but the distinction cannot be skipped.
What counts as containment
Before I call a leak contained, I need evidence of two things: the old authority has ended, and the dependent services work through a trustworthy replacement. I treat a credential as an edge in a graph connecting an issuer, a principal, a consumer, a target resource, and any credentials it can create. A replacement changes one edge; containment must close every relevant path by which the compromised value or its descendants can still authorize an action. This model follows from the lifecycle concerns in NIST's key-management guidance and the broader incident-response emphasis on preparation, detection, response, and recovery (Barker, 2020; Nelson et al., 2025).
The model has three boundaries. First, a secret value may be copied outside the organization's visibility. Second, an issuer's revocation semantics differ by token and service. Third, service continuity depends on all consumers, including infrequent jobs. I use standards for protocol behavior, provider documentation for specific platform mechanisms, and a peer-reviewed study for evidence that developer remediation is a real operational challenge. I do not claim that any one platform feature applies to every credential type or that absence of a suspicious log entry proves absence of abuse.
First decide what the secret can authorize
“Secret” covers different objects. An API token may grant read-only access to one tenant. A database password may permit administrative changes. A signing key may validate releases across many systems. A cloud access key may assume a role that can create more credentials. The immediate decision depends on scope, privilege, and whether the credential is likely to be in an adversary's hands. I would identify the issuer, principal, resource scope, creation and expiry times, allowed operations, and available revocation mechanism before choosing a sequence.
The exposure path matters too. A secret pasted into a ticket may have been visible to a small support group; a public repository may have been cloned before removal. Deleting the visible copy reduces future exposure but cannot establish that no one copied it. I would preserve the relevant event and access records, restrict further exposure, and plan on the compromised value being known when the evidence cannot exclude it. That is an inference and a risk decision, not proof that an attacker used it.
Map every consumer before changing the value
A secret has producers, storage locations, consumers, and a backing service that accepts it. I would list each workload, deployment environment, scheduled job, integration, human break-glass path, and vendor that can read or use the credential. Note whether each consumer retrieves the current value on every request, caches it until restart, pins a version, or received a copy through configuration. The map should say who owns each consumer and what test shows it is using the replacement.
This is where “we use a vault” can conceal a gap. A vault can hold a new version while an application keeps using an old environment variable. Google Cloud's rotation documentation explains that a schedule can send a rotation notification, but separate workflows may be needed to create a new version and deploy it to applications (Google Cloud, 2026b). The notification is a trigger, not completion. AWS likewise describes rotation as changing the credential in both Secrets Manager and the database or service that accepts it (Amazon Web Services, n.d.). A new stored value that the target has not accepted is an outage waiting to happen.
I would make the dependency map concrete enough to execute: service name, secret identifier, credential scope, current and replacement version, owner, refresh behavior, test transaction, and rollback contact. If the list is incomplete, record that uncertainty. A responder can then choose whether to revoke immediately and accept a controlled outage, or establish a short, tightly monitored overlap while moving consumers. An active adversary using a high-privilege credential can make overlap unacceptable. An apparently leaked low-privilege integration with a fragile billing workflow may justify a carefully bounded transition. The decision belongs to the risk owner with technical evidence in front of them.
What revocation means at the verifier
The word “revoke” conceals important technical differences. A database password might be changed at a database server and rejected on the next login, yet existing sessions may remain established until the server terminates them or they expire. An API key might be disabled in a provider console while a distributed edge cache continues to accept it briefly. A signing key can be removed from a trust store while already issued artifacts remain trusted under a separate policy. I would identify the verifier of the credential, not only its storage system, and ask how quickly a policy change reaches that verifier. The negative test must target the actual verifier and an operation the old credential previously authorized.
OAuth makes the distinction concrete. RFC 7009 defines a token-revocation endpoint and notes that an authorization server may invalidate related tokens or grants according to its policy; propagation delays can exist in distributed deployments (Lodderstedt et al., 2013). RFC 7662 defines introspection through which a protected resource can ask whether a token is active, but also warns that caching an active result can create a window in which a revoked token is still accepted (Richer, 2015). There is a subtler trap: RFC 7009 §2.2 returns HTTP 200 for an invalid token as well as a successfully revoked one. A 200 response alone therefore doesn't establish that the expected live token was found and invalidated, much less denied at every resource server. I would test the resource path after the expected propagation period and document any remaining acceptance window.
Bearer-token design also changes exposure consequences. The current OAuth security best-practice document discusses sender-constrained tokens that require proof of possession beyond the token string. Such a design can reduce the usefulness of a stolen token when the attacker lacks the bound key, but it does not eliminate investigation of a leaked client secret, private key, refresh token, or compromised endpoint (Lodderstedt et al., 2025). NIST IR 8587, finalized on September 15, 2026, provides implementation recommendations for federal agencies and cloud service providers, including key management and token lifecycle controls. It is guidance within that scope, not a universal mandate for every application secret (Galluzzo et al., 2026). I would not describe all credentials as equivalent “strings to rotate.” Their validation and propagation mechanisms define the response.
Human authenticators require a related but distinct workflow. NIST SP 800-63B-4 addresses subject authenticators and requires a mechanism to invalidate an authenticator when loss, theft, or compromise is suspected (Temoshok et al., 2025). That standard should not be misapplied as a machine-secret specification. It does, however, reinforce a general design principle: an organization must know how to invalidate authority at its verifier promptly. For a workload API key, the comparable question is whether the issuing platform offers an emergency disable action, what that action covers, and how it can be verified.
Replace, revoke, and test as separate actions
I would generate the replacement through the normal approved system, limit its privileges, and deliver it through the intended secret path. Do not paste the new value into the incident ticket that held the old one. Confirm that the backing service accepts the replacement and that each consumer can use it. Then revoke the old authority at the issuer or target service, not merely by removing it from the vault. OWASP's guidance is explicit that potentially compromised secrets must be revoked to restrict access (OWASP Foundation, n.d.).
The order requires care. Some services allow two active credentials for the same principal. That supports a gradual cutover, but it also gives the old value more time to work. Other services only allow one password, so the change is immediately disruptive unless the application supports a staged identity. I would know the service's behavior before the incident. In a high-risk exposure, containment may take priority over availability; the team should name the affected services and invoke the appropriate owner. In a lower-risk case, a brief overlap can be measured and closed by a deadline. “Temporarily” is not a control unless a person owns the clock.
Google Cloud's rotation recommendations describe version pinning and gradual rollout as ways to validate a new secret and avoid a fleet-wide failure; they also recommend disabling an old version before destroying it so lingering dependencies can be found without an irreversible deletion (Google Cloud, 2026a). That is a useful operational pattern when compromise urgency allows it. It does not mean a compromised old key should remain valid for a week. If the credential may be used by an attacker, the issuer's revocation is the containment action; application version management is the availability action. They must be tracked separately.
I would test with both positive and negative cases. The positive test uses the replacement from each important consumer and performs a safe real operation. For credentials whose service permits such checks, an explicitly authorized, isolated negative test verifies rejection at the backing service without exposing the value in logs. OAuth production clients must not resume using a token after a successful revocation response; verifier testing must be designed as a controlled security exercise, or use issuer and resource-server evidence where replay is prohibited (Lodderstedt et al., 2013). A green deployment pipeline alone cannot prove either outcome. If a background job runs monthly, a quick smoke test may miss it; identify a safe way to trigger its authentication path or keep the dependency open in the incident record.
A cutover with an unowned monthly job
Consider a hypothetical integration that uses one API credential for a web service, a queue worker, and a monthly reconciliation job. The provider supports two simultaneously active credentials. The credential has appeared in a public build artifact, and the responder has not yet established whether it was used by someone else. These are stipulated conditions for the example, not findings from an incident.
The first decision is whether overlap is defensible. Two active keys make an orderly migration possible; they do not make it safe. If the exposed principal can change access policy or the logs show unexplained use, I would favor immediate disablement and a controlled interruption. If the credential has narrowly bounded authority and the response owner permits a short transition, record its deadline and who can end it early. Neither option should be hidden inside the mechanics of deploying a new environment variable.
For a permitted transition, give the replacement a distinct identifier and record it without recording the secret. Deploy the web service and perform a harmless transaction whose result can be confirmed independently. For the worker, exercise both authentication and completion of a queued job; a healthy process can still fail when it fetches the credential. For the monthly job, run a supported dry-run or representative transaction. If neither is possible, the dependency remains unverified. Calendar silence is not acceptance evidence.
| Check | Positive evidence | What would keep the response open |
|---|---|---|
| Web service | Replacement version retrieved and harmless operation completed | Only a deployment success message exists |
| Queue worker | New authority used for a completed test job | Process is alive but its authenticated work is untested |
| Monthly job | Actual job path tested with a bounded transaction | No safe way to exercise the path yet |
| Old credential | Issuer state and permitted verifier evidence agree on denial | A stored version was deleted but issuer state is unknown |
| Descendant authority | Creation events reviewed within available log coverage | Missing logs or unexplained token creation |
Suppose the web service and worker pass but the monthly job has no current owner. The response has uncovered an operational defect. It hasn't earned a reason to keep the exposed key active indefinitely. The owner can accept a delayed reconciliation, appoint someone to recover the job, or authorize another bounded treatment. Record that decision separately from containment. This prevents an availability exception from quietly becoming ongoing attacker access.
After revocation, distinguish a cached value from cached authorization. A process retaining the old string should fail once the relevant verifier rejects it. A resource server retaining an earlier positive authorization decision may behave differently until that decision expires or is invalidated. RFC 7662 makes that trade-off explicit for introspection caching (Richer, 2015). The observed failure must therefore identify the resource, operation, and time, rather than rely on the issuer dashboard alone.
Rollback deserves the same precision. If the new deployment fails because of an unrelated code defect, roll back code while preserving the replacement credential. If the replacement itself is misconfigured, issue another bounded replacement rather than re-enable the leaked value. That choice may need a provider-specific procedure, and I would want it rehearsed before an incident. A rollback path that restores compromised authority defeats the reason for the change.
The final record can honestly say that the old credential is disabled, the two continuous consumers work, the monthly job is suspended pending repair, and descendant review is limited by the available logging window. That is more useful than a single green rotation ticket. It tells the service owner what access ended, what still needs recovery, and which uncertainty remains. The method is my proposed acceptance discipline; it does not pretend that any cited standard supplies these exact business decisions.
Look for use before and after the change
Rotation closes a door, but it does not explain what happened while it was open. I would review issuer logs for use of the exposed principal, unusual source locations, new tokens or keys, privilege changes, data access, and failed uses after revocation. A success event before rotation may be legitimate; a denied attempt after revocation may show a forgotten consumer or an adversary. The identity, context, and timing decide which. Logs themselves may be incomplete, so the report should state the coverage limit.
A leaked credential can be copied into more than one place. Search the repository history, build artifacts, log pipelines, issue trackers, local configuration, and backup material in a controlled way. Avoid printing the secret again during the search. The aim is to stop further exposure and find dependencies, not to create a new list of places where the credential is visible. If the secret was used to issue other credentials, the response may need to expand to those descendants. If it protected data, examine whether re-encryption or re-signing is necessary. Barker's key-management framework is useful precisely because the life of a key extends beyond a single storage location (Barker, 2020).
I would close the incident with evidence: the original value is revoked at the issuing service, a safe old-value test fails, all required consumers pass with the replacement, relevant access was reviewed, residual copies were addressed, and an owner accepts any remaining uncertainty. For ongoing health, measure time from detection to revocation, unknown consumers discovered during rotation, failed cutovers, and old-key use after closure. A rotation calendar is useful; a demonstrated ability to end authority under pressure is much more useful.
The compromise graph: original, descendants, and data
The response scope follows the authority of the exposed value. If it could issue short-lived access tokens, rotate a long-lived refresh token, create service-account keys, or change access policy, then revoking only the first value may leave a descendant path open. I would reconstruct the creation and modification events in the exposure window, inventory any newly issued credentials, and test their state. If the credential could administer a vault, investigate whether other secrets were read or re-versioned. If it could modify CI/CD signing configuration, examine release provenance and trust policy. The graph is not a claim that compromise occurred; it is a disciplined way to avoid declaring containment from a single revocation button.
The consequence of a leaked encryption key differs again. Replacing a key for new writes does not necessarily make historical ciphertext safe. Barker's key-management guidance distinguishes key states, compromise, and recovery across the cryptoperiod (Barker, 2020). The appropriate action may involve re-encryption, destruction of accessible old material, or accepting bounded historical exposure after assessing data sensitivity and feasibility. For a signing key, the team may need to identify which signatures can no longer be trusted and whether relying parties still accept them. These decisions must be tied to the data and verification system, not treated as generic secret-rotation tickets.
NIST's current incident-response guide frames response as part of cybersecurity risk management, including preparation and recovery (Nelson et al., 2025). I would use that wider lens to ask whether the same exposed credential was present in multiple build systems, whether an attacker had time to establish persistence, and what recovery evidence is needed for the service owner. The answer may be a narrow cutover for a low-scope key or a broader incident investigation for a high-privilege one. The point is proportionality: severity comes from effective authority and exposure conditions, not from the mere fact that a scanner found a string.
Detection, triage, and the danger of false closure
A detection alert is not a revocation receipt. GitHub's validity-check documentation describes how supported secrets can be tested against issuers and labeled active, inactive, or unknown; coverage and context vary by secret type (GitHub, n.d.). “Inactive” can reduce urgency for that credential as tested, but it does not establish that a related token, copy, or successor is also inactive. “Unknown” is a visibility limit, not a safe result. A platform alert should be connected to the issuer record, the affected service owner, and the incident timeline before closure.
Krause and colleagues' mixed-methods study surveyed 109 developers and interviewed 14 who had experienced secret leakage. It describes challenges in estimating risk and remediating leaks in source repositories; its participants and methods do not establish a universal frequency for all organizations (Krause et al., 2023). I take from this evidence a process implication: a response design must be usable during ordinary development, with a known owner, a practiced revocation path, and low-friction ways to test consumer migration. A policy that demands perfect manual reconstruction after every leak is unlikely to be reliable when an incident is time-sensitive.
The incident record should separate four timestamps: first known exposure, detection, issuer-side revocation, and verified old-value denial at a relevant resource. A fifth timestamp records restoration of every material consumer on the replacement. These are different events. Reporting one “rotation time” collapses the interval in which the exposed value was still accepted and the interval in which the service was impaired. The result is a deceptively tidy metric. I would preserve the evidence behind each timestamp, including the issuer event, safe negative test, and representative positive test, without storing the secret itself in the ticket.
Improve the system after the incident
A rotation that requires hand edits across ten repositories is a design finding. I would reduce the number of static copies, bind credentials to individual workloads, narrow privileges, and prefer short-lived or dynamically issued credentials where the service supports them. OWASP describes dynamic secrets and explicit revocation as ways to reduce reuse and exposure windows (OWASP Foundation, n.d.). That does not remove the need for inventory: a dynamic credential still has an issuer, a consumer, a lease, and a path to terminate it. It does make the emergency more containable when those relationships are known.
I would also challenge secret-detection metrics. Counting leaked strings is not the same as measuring containment. The useful measures are time to identify the principal, time to stop old-value authentication, consumers confirmed on the replacement, descendant credentials reviewed, and access events that remain unexplained. I would keep the incident evidence separate from the new secret value. A postmortem should show what changed in the architecture so the next exposure has fewer unknown consumers and a shorter revocation path.
Counterarguments and decision trade-offs
One response is to revoke immediately in every case. That is often right when the credential has high privilege, exposure is public, or active misuse is suspected. But an issuer may only support one active credential, and an immediate revocation can interrupt safety-critical or revenue-critical operations. The correct trade-off is not a blanket rule that availability always wins; it is an explicit decision with an owner, affected services, maximum permitted overlap, monitoring, and a deadline. If an old value must remain temporarily valid, the exposure window has been knowingly extended and should be reported as such. Nelson and colleagues' risk-management framing supports making this a governed incident decision rather than an unrecorded convenience (Nelson et al., 2025).
A second response is to rely on short-lived credentials so rotation becomes automatic. Short lifetimes can reduce the usefulness of a copied value, but an attacker with the issuer credential or refresh token may mint replacements. An application that caches an introspection result or holds a long session may also continue to act after an upstream change. RFC 7009 and RFC 7662 make the distinction between revocation, propagation, and resource-server knowledge explicit (Lodderstedt et al., 2013; Richer, 2015). Short-lived design is valuable when combined with narrow issuance authority, verifier behavior that can be tested, and monitoring of descendants.
A team may also argue that comprehensive descendant review is excessive for a read-only key. The review should be proportional: first establish whether the credential could mint authority or change policy. If it could not, explain that boundary and focus on the data it could read. If effective privileges are unknown, a nominal role label is insufficient. Investigation should follow capability, and a record of verified limits is a valid result.
Limitations and acceptance standard
The proposed graph can be incomplete when the issuer lacks logs, a vendor conceals downstream use, or a shared account obscures which actor acted. Negative tests sample a verifier at a particular time; they cannot prove that every geographically distributed replica already rejects the old value. Empirical findings from a developer study cannot be projected onto an individual organization's team. Provider documentation may change, so a runbook must be checked against the service actually in use. These are reasons to record uncertainty and choose conservative containment, not reasons to claim certainty from a green dashboard.
I would close the response only when four questions have evidence-backed answers: What authority did the exposed credential confer? Where could that authority have been copied or extended? Which verifiers now deny the old value and its relevant descendants? Which business consumers demonstrably use the replacement? A residual risk owner should explicitly accept any untestable path. The resulting record is more demanding than a “rotated” flag, but it is also more useful when a later investigation asks whether access truly ended.
The hardest part is usually the dependency nobody knew about. If you cannot say which systems will break when a credential is revoked, request a briefing. I'll help map the consumers, design a safe cutover, and make the old-value denial test part of acceptance.
Related reading
For prevention, see workload identities and cloud service access. For the wider termination workflow, see how to prove SaaS access ended after offboarding.
References
- Amazon Web Services. (n.d.). Rotate AWS Secrets Manager secrets. AWS Secrets Manager User Guide. https://docs.aws.amazon.com/secretsmanager/latest/userguide/rotating-secrets.html
- Barker, E. (2020). Recommendation for key management: Part 1—General (NIST Special Publication 800-57 Part 1 Rev. 5). National Institute of Standards and Technology. https://doi.org/10.6028/NIST.SP.800-57pt1r5
- Galluzzo, R., Regenscheid, A., Nelson, S., & Lazcano, C. (2026). Protecting tokens and assertions from forgery, theft, and misuse: Implementation recommendations for agencies and cloud service providers (NIST IR 8587). National Institute of Standards and Technology. https://doi.org/10.6028/NIST.IR.8587
- GitHub. (n.d.). Validity checks. GitHub Docs. https://docs.github.com/en/code-security/concepts/secret-security/validity-checks
- Google Cloud. (2026a, October 26). About rotation schedules. Google Cloud Documentation. https://docs.cloud.google.com/secret-manager/docs/rotation-recommendations
- Google Cloud. (2026b, October 26). Create rotation schedules in Secret Manager. Google Cloud Documentation. https://docs.cloud.google.com/secret-manager/docs/secret-rotation
- Krause, A., Klemmer, J. H., Huaman, N., Wermke, D., Acar, Y., & Fahl, S. (2023). Pushed by accident: A mixed-methods study on strategies of handling secret information in source code repositories. In 32nd USENIX Security Symposium (pp. 2527–2544). USENIX Association. https://www.usenix.org/conference/usenixsecurity23/presentation/krause
- Lodderstedt, T., Dronia, S., & Scurtescu, M. (2013). OAuth 2.0 token revocation (RFC 7009). Internet Engineering Task Force. https://www.rfc-editor.org/info/rfc7009/
- Lodderstedt, T., Bradley, J., Labunets, A., & Fett, D. (2025). Best current practice for OAuth 2.0 security (RFC 9700). Internet Engineering Task Force. https://www.rfc-editor.org/info/rfc9700/
- Nelson, A., Rekhi, S., Souppaya, M., & Scarfone, K. (2025). Incident response recommendations and considerations for cybersecurity risk management: A CSF 2.0 community profile (NIST SP 800-61 Rev. 3). National Institute of Standards and Technology. https://doi.org/10.6028/NIST.SP.800-61r3
- OWASP Foundation. (n.d.). Secrets management cheat sheet. OWASP Cheat Sheet Series. https://cheatsheetseries.owasp.org/cheatsheets/Secrets_Management_Cheat_Sheet.html
- Richer, J. (2015). OAuth 2.0 token introspection (RFC 7662). Internet Engineering Task Force. https://www.rfc-editor.org/info/rfc7662/
- Temoshok, D., Fenton, J., Choong, Y.-Y., Lefkovitz, N., Regenscheid, A., Galluzzo, R., & Richer, J. (2025). Digital identity guidelines: Authentication and authenticator management (NIST SP 800-63B-4). National Institute of Standards and Technology. https://doi.org/10.6028/NIST.SP.800-63b-4