Revoke the exposed credential with the service that issued it. If it was a cloud key, start in the cloud account. If it was a package registry token, start there. Deleting the Actions secret, workflow log or commit removes one copy. Anyone who already copied a still-valid credential can keep using it until the issuer blocks it.

A red workflow run can be the first warning. For example, a deployment process might print the contents of a generated configuration file when a health check fails. The example below is a rehearsal for isolating a leaked deploy credential. Use a throwaway staging identity, a private repository and a harmless read-only operation on a disposable resource.
Contain the leak where the credential works
- Record the repository, workflow run, first known exposure time and credential owner. Identify the key by its label or issuer-provided identifier; keep its value out of incident notes and screenshots. Restrict access to a public run or artifact promptly where you have permission.
- Check the issuer for the affected account, environments and privileges. Revoke or disable the compromised credential immediately. If other jobs used it, tell their owners to pause dependent deploys while you prepare a replacement. Treat a brief deploy interruption as part of containment when a live production credential is exposed.
- Look at the issuer’s audit logs during the exposure window and after revocation. Compare the expected Actions identity, resources and release times against changes to roles, package versions, deployments and reads. Record any unexplained activity and expand the investigation if the credential could create other credentials or grant extra access.
GitHub’s leaked-secret guidance covers issuer revocation, identifying affected integrations, investigating unauthorized use and cleaning repository history, in that sequence. Start recovery with the credential’s issuing service even if a secret-scanning alert has already been closed.
Restore the deployment with a smaller blast radius
Create a replacement with the permissions the job actually needs. Separate staging and production credentials and update every authorized reference at its proper scope: repository, organization, environment or external secrets manager. Verify any environment approval before restarting the production pipeline. If a leaked registry token could publish packages, compare versions and publication times against releases you authorized before resuming.
In the replacement run, log a safe result and a run ID rather than full headers or environment dumps. Look at the deployed revision and the provider’s activity record to confirm which identity performed the action. A green runner alone leaves important questions open if it used a cached image or skipped the deployment stage.
Rehearse the old-key and new-key checks in staging
| Check | Expected result | Evidence to keep |
|---|---|---|
| Before revocation | The disposable credential performs its one permitted test action. | Sanitized timestamp and issuer key identifier. |
| After revocation | The issuer shows the old credential as disabled. | Issuer status or a provider-supported validity check. |
| Replacement run | A new job reaches the intended staging resource, with production access excluded. | Run ID, deployed revision and authorized identity. |
| Follow-up | Expected staging activity is visible and anomalies are reviewed. | Audit time window and the incident owner’s decision. |
Use a read-only return value, such as the name of a disposable staging object, to make the rehearsal observable. If the dummy test key is revocable, use the provider’s documented validity check or a request to your own test resource. Record the response status without printing the header, key or full error payload. Clean up the test credentials and staging resources after the exercise.
Close the path that caused the exposure
Review debug output, workflow artifacts, downloadable summaries and any mirrored or forked copies you can scope. Repository history cleanup may need coordination with other contributors after revocation. A new commit by itself leaves previous copies in reach. Put sensitive build inputs in the platform’s secrets mechanism and structure failure logs around the action name, environment and status code.
Give each workflow job the minimum token permissions it needs. Review third-party actions before approving them and pin those you use to a full commit SHA. Where your cloud supports it, GitHub Actions OpenID Connect can issue short-lived credentials instead of saving a long-lived cloud key. Bind the cloud role to the repository and intended environment, then verify a run from an unauthorized ref cannot obtain it. Review the GitHub Actions secure-use reference for the controls applicable to your setup.
If you found the value in an app or a public build, first identify whether you have an actual secret or a public client identifier. Many services issue a publishable key meant for browsers and a separate secret key for servers. The provider's API key documentation says which is which, and only the secret one needs revoking at once.
Confirm that the old token no longer works
After revoking a GitHub personal access token, send one read-only request with the old value and one with the replacement. Load each value from an environment variable so it does not land in your shell history:
curl -s -o /dev/null -w "%{http_code}\n" -H "Authorization: Bearer $OLD_TOKEN" https://api.github.com/user
curl -s -o /dev/null -w "%{http_code}\n" -H "Authorization: Bearer $NEW_TOKEN" https://api.github.com/user
The old token should return 401 and the new one 200. For a cloud or registry key, use the equivalent read-only call in that provider's documentation, and record only the status codes in the incident notes.