What a bypass does#
Push protection for repositories blocks a push that contains a detected secret. By default, "anyone with write access to the repository can bypass push protection by specifying a bypass reason." When someone does, GitHub creates an alert in the repository's Security and quality tab, "Adds the bypass event to the audit log," and emails owners, security managers and watching repository administrators "with a link to the secret and the reason it was allowed." Push protection bypass and alerts
The reason the person chooses decides the alert's state:
| Bypass reason | Alert behavior |
|---|---|
| It's used in tests | GitHub creates a closed alert, resolved as "used in tests" |
| It's a false positive | GitHub creates a closed alert, resolved as "false positive" |
| I'll fix it later | GitHub creates an open alert |
On the command line, the person visits the URL from the rejected push, picks a reason, clicks Allow me to push this secret, and must push again within three hours. Bypassing push protection The organization audit log records secret_scanning_push_protection.bypass with a push_protection_bypass_reason field. Audit log events for your organization
Push protection for repositories "Requires GitHub Secret Protection to be enabled" and is off by default. Secret scanning is free for public repositories and available for organization-owned private and internal repositories with GitHub Secret Protection on GitHub Team or GitHub Enterprise Cloud.
The bypass that closes itself#
Suppose a developer on a fictional private repository, acme/payments-api, commits a fixture file with a real cloud access key copied from their shell history. The push is blocked. The developer believes the key is a dead test credential, picks "It's used in tests", and pushes.
GitHub creates the alert already closed, so it never appears among the open alerts that people work through. The email to watchers and the audit log event both record the reason, but only as the developer stated it. CI passes, and a reviewer reading the pull request sees a fixture file with a string in it, which is what fixture files look like. If the key is live, it now sits in the repository's history, and in every clone and fork that fetches it.
The "I'll fix it later" path fails more slowly. Its alert stays open, which is visible, but nothing ties the open alert to a deadline or an owner.
What to do after each reason#
GitHub's own guidance on a leaked secret sets the bar for all three: "Once a secret has been committed to a repository, you should consider the secret compromised." Fixing alerts Its remediation tutorial adds that "Simply removing the secret from the codebase, pushing a new commit, or deleting and recreating the repository do not prevent the secret from being exploited." Remediating a leaked secret
For "I'll fix it later", assign the open alert to the secret's owner. The fix is to revoke or rotate the secret with its provider, check the provider's logs for use, and then close the alert by hand, since "Secret scanning doesn't automatically close alerts when the corresponding token has been removed from the repository." Deleting the line from the code is not the fix.
For "It's used in tests", confirm with the system that issued it that the credential reaches nothing outside a test environment. If it does, rotate it and reopen the alert. If it is a test credential, decide whether it needs to be in the repository at all, or whether the test can read it from its environment.
For "It's a false positive", check the string. If it is not a secret, the closed alert is correct, and a repeated false positive from a custom pattern is a reason to tighten that pattern. If it is a secret, treat it as "I'll fix it later".
In all three cases, add a comment to the alert saying who checked it and what they found. GitHub notes that a dismissal comment "will be added to the alert timeline and can be used as justification during auditing and reporting." Closing alerts
Moving the review before the push#
Delegated bypass changes who can bypass. A repository, organization or enterprise names roles or teams on a bypass list, and everyone else must request "bypass privileges", which reviewers approve or deny. Requests expire after 7 days. Delegated bypass for push protection On the command line, the requester adds a comment under "Or request bypass privileges" and clicks Submit request. If approved, they can push the commits "as well as any future commits that contain the same secret." Requesting bypass privileges
The setting is Who can bypass push protection for secret scanning, changed to Specific roles or teams. You can also mark an actor Exempt, which skips push protection for all of their commits. GitHub's warning on that option is direct: "Exemptions may lead to leaked secrets, and should be granted with caution." Enabling delegated bypass On GitHub.com, delegated bypass is available for organization-owned repositories on GitHub Team, or GitHub Enterprise Cloud, with GitHub Secret Protection enabled.
In the example, delegated bypass would have put a reviewer between the developer's guess and the push, able to ask which system issued the key before approving.
The cost#
Delegated bypass makes every true false positive wait for a reviewer, and an unanswered request blocks the contributor until it is answered or expires after a week. Size the reviewer group for your bypass volume, which the audit log's bypass events show, and agree how quickly requests get an answer.
What push protection does not catch#
It blocks secrets that match a supported provider pattern, an enabled generic pattern or a custom pattern with push protection on, with AI-detected secrets in public preview. A credential in a format none of these recognize goes through, and so does anything an exempt actor pushes. A ruleset rule can additionally block merging while a pull request has open secret scanning alerts, which is in public preview too. Require secret scanning alerts are resolved That rule acts on open alerts, so it does not see the two reasons that close their alerts. For files that should not enter history at all, see push rulesets.
The decision#
Turn on delegated bypass for repositories where a leaked credential would reach production, and keep the bypass list to people who can judge a credential. Review closed alerts resolved as "used in tests" or "false positive" on a schedule, not only open ones. Give every "I'll fix it later" alert an owner and a date. Record each bypass the way you would any emergency exception.