Fixing alerts
Once a secret has been committed to a repository, you should consider the secret compromised. GitHub recommends the following actions for compromised secrets:
- Verify that the secret committed to GitHub is valid. Applies to GitHub tokens only. See Checking a secret's validity and Performing an on-demand validity check.
- For secrets detected in private repositories, report the leaked secret to GitHub, who will treat it like any publicly leaked secret and revoke it. Applies to active or unconfirmed GitHub personal access tokens only. See Reporting a leaked secret in a private repository.
- Review and update any services that use the old token. For GitHub personal access tokens, delete the compromised token and create a new token. See Managing your personal access tokens.
- Depending on the secret provider, check your security logs for any unauthorized activity.
Fixing alerts for secrets in GitHub Actions workflow logs
Note
Detection of secrets in GitHub Actions workflow logs is in public preview and is subject to change.
When a secret is detected in a GitHub Actions workflow log, follow these steps in order.
- Review the alert and linked job log to identify the credential and the source of the exposure. The secret may have been printed by the workflow, an action, or another dependency.
- Check whether the credential is still valid. See Checking a secret's validity. If the credential is active or you cannot confirm its status, rotate or revoke it immediately using the secret provider's dashboard.
- Fix the source of the exposure. For example, update the workflow or dependency, remove hardcoded secrets, or store credentials as encrypted secrets. See Using secrets in GitHub Actions.
- If necessary, add
::add-mask::<value>to redact the value from future log output.
Warning
Do not rerun the workflow until you have fixed the exposure source. Rerunning the workflow without addressing the root cause may re-expose the secret.
Reporting a leaked secret in a private repository
Note
Reporting a privately exposed secret to GitHub is in public preview and subject to change. The feature is currently only available for GitHub personal access tokens (v1 and v2).
-
On GitHub, navigate to the main page of the repository.
-
Under the repository name, click the Security and quality tab. If you cannot see the " Security and quality" tab, select the dropdown menu, and then click Security and quality.
-
In the left sidebar, under "Vulnerability alerts", click Secret scanning.
-
From the alert list, click the alert you want to view.
-
In the alert view for the leaked secret, click Report leak.
Note
In order to prevent breaking workflows, consider first rotating the secret before continuing, as disclosing it could lead to the secret being revoked. If possible, you should also reach out to the token owner to let them know about the leak and coordinate a remediation plan.
-
Review the information in the dialog box, then click I understand the consequence, report this secret.
Closing alerts
Note
Secret scanning doesn't automatically close alerts when the corresponding token has been removed from the repository. You must manually close these alerts in the alert list on GitHub.
If a branch ruleset requires secret scanning alerts to be resolved, an open alert introduced by a pull request can block merging. After fixing the exposed secret, close the alert using the following steps. After all blocking alerts are closed, the alerts no longer prevent merging. The rule can continue to block merging until a secret scanning scan completes for the pull request's head commit.
-
On GitHub, navigate to the main page of the repository.
-
Under the repository name, click the Security and quality tab. If you cannot see the " Security and quality" tab, select the dropdown menu, and then click Security and quality.
-
In the left sidebar, under "Vulnerability alerts", click Secret scanning.
-
Under "Secret scanning", click the alert you want to view.
-
To dismiss an alert, select the "Close as" dropdown menu and click a reason for resolving an alert.

-
Optionally, in the "Comment" field, add a dismissal comment. The dismissal comment will be added to the alert timeline and can be used as justification during auditing and reporting.
-
Click Close alert.