Sub topic 8
Bypass reasons and who can approve a bypass
This chapter assumes you have read the previous chapters on push protection and on handling a blocked push. You should know that push protection rejects a push containing a detected secret, and that the terminal output gives you a way to continue. Here we look at what happens when someone continues anyway: which reasons they can give, who decides, and what trail it leaves.
Why bypass exists
Push protection works from pattern matches, so some blocks are wrong or unavoidable. A test fixture may contain a dummy token that matches a provider pattern. A developer may be rotating a credential in the next hour. A hard block with no way through would push people to disable the feature. A bypass lets work continue, records the decision, and leaves an alert for someone to review.
A bypass is not a fix. The secret still reaches the remote repository, so treat every bypass as a leak that needs a follow-up.
The three contributor bypass reasons
When a push is blocked, GitHub prints a URL. Opening it lets the pusher select one of three reasons and then allow the secret. After that, you push again and the push goes through.
| Reason shown to the pusher | Meaning | Effect on the alert |
|---|---|---|
| It's used in tests | The value is a dummy or sandbox credential | An alert is created and closed as "used in tests" |
| It's a false positive | The text looks like a secret but is not one | An alert is created and closed as "false positive" |
| I'll fix it later | The value is real and will be dealt with afterward | An alert is created and left open |
The effect on the alert is the key difference. The first two reasons close the alert immediately, so nobody is prompted to look at it again. The third keeps the alert open, which puts the secret in the triage queue.
Because the reason is self-declared, GitHub does not verify it. A contributor who picks "used in tests" for a live production key closes its own alert. This is the main weakness of open bypass, and it is why delegated bypass exists.
Open bypass versus delegated bypass
Who may use the bypass link depends on a setting called "Who can bypass push protection for secrets". It is available at repository, organization and enterprise level, usually through a security configuration.
- Anyone with write access (the default). Any contributor who can push can pick a reason and continue. No one else is asked.
- Specific roles and teams (delegated bypass). Only members of the bypass list can bypass directly. Everyone else must submit a bypass request and wait for a reviewer to decide.
Delegated bypass is a feature of GitHub's paid secret protection offering on organization-owned repositories. If you do not see the setting, check your plan and whether the repository belongs to an organization.
Who can approve
The bypass list is made up of roles and teams that you choose. Common choices are organization owners, security managers and a dedicated application-security team. People on the list act as reviewers. They get notified of incoming requests and can approve or deny them.
Choose reviewers who are not the same people who push the code. A reviewer who approves their own team's requests defeats the point of the control. Keep the list small enough that requests get answered, because a request that nobody reads blocks a developer.
The request flow
With delegated bypass on, a blocked contributor who is not on the list follows this path.
Points that matter in practice:
- The contributor gives one of the same three reasons and adds a comment explaining the situation. A good comment names the file and says why the value is safe or when it will be removed.
- A request that nobody answers expires after a fixed period (7 days at the time of writing). The push stays blocked until the contributor submits a new request.
- Approval does not push anything for the contributor. They must run the push again, and it must contain the same secret the request covered.
- A denial is final for that request. The contributor should remove the secret from the commits, not ask again with a different reason.
- The contributor is notified of the outcome, and the request and decision are recorded.
Reviewing a request well
A reviewer sees the secret type, the file and the contributor's reason. Before approving, check these things.
- Does the reason match the file? "Used in tests" is plausible for
test/fixtures/and suspicious fordeploy/prod.env. - Is the secret type one with a validity check? A pattern that GitHub can verify may show whether the credential is active. An active credential contradicts both "used in tests" and "false positive".
- Could the contributor avoid the issue by loading the value from the environment or by adding a path exclusion? If so, deny the request and say how.
- For "I'll fix it later", ask for a date or a ticket reference in the comment. The alert will stay open, so someone has to own it.
If you approve a request for a real credential, plan to revoke and rotate it afterward. Approval allows the push. It does not make the credential safe.
What a bypass leaves behind
Every bypass is visible afterward, which is what makes the control auditable.
- Secret scanning alerts include whether push protection was bypassed, who did it, and when. Alerts from "I'll fix it later" stay open.
- Audit log events record bypass actions and, with delegated bypass, request and review actions. Audit logs are the right source for questions such as "who approved the last ten requests".
- Notifications go to reviewers and to the requesting contributor.
You can find open alerts that came from a bypass using the REST API. This command lists them with the person responsible.
gh api 'repos/OWNER/REPO/secret-scanning/alerts?state=open' \
--paginate \
--jq '.[] | select(.push_protection_bypassed == true)
| {number,
type: .secret_type_display_name,
bypassed_by: .push_protection_bypassed_by.login,
bypassed_at: .push_protection_bypassed_at}'Run this on a schedule. Open bypass alerts are the backlog of secrets someone promised to fix.
Edge cases and common errors
- Closed alerts hide bypasses. "Used in tests" and "false positive" bypasses are created already closed. To audit them, query with
state=resolvedand filter onresolution, or you will only see the "fix it later" cases. - A bypass covers the detected secret, not the whole push. If the same push contains a second, different secret, you may be blocked again and need a second bypass.
- History keeps the value. Bypassing a secret in an early commit and removing it in a later commit still leaves the value in history. Remediation covers cleanup, as described in the later chapter on revoking and rotating.
- Bypass does not apply to patterns that are not covered by push protection. If a pattern is not supported for push protection, the push is not blocked, and no bypass or alert from the push is created. Those leaks appear only as ordinary alerts after the scan.
- Reviewer outages. If the bypass list has a single person, one holiday blocks every contributor. Use a team, not an individual.
- Changing the setting is itself sensitive. Switching from delegated bypass back to "anyone with write access" removes the review step. Restrict who can edit repository and organization security settings.
Choosing a policy
- Small team, low-risk repositories: open bypass is acceptable. Keep alert notifications on and review the open bypass alerts weekly.
- Repositories that deploy to production or hold customer data: use delegated bypass with a named reviewer team.
- Organization-wide: set the policy in a security configuration so new repositories inherit it, and allow exceptions only by agreement with the security team.
Exercise
A contributor is blocked by push protection on a file in test/fixtures/. They pick "It's used in tests" and push. Later you find that the value was a live key. What state is the alert in, why is that a problem, and what two controls would have reduced the risk?
Show answer
GitHub created the alert already closed as "used in tests", so it never appeared in the open alert queue and no one triaged it. The self-declared reason was wrong and nothing verified it. Delegated bypass would have required a reviewer to check the claim before the push was allowed, and a path exclusion or custom handling for fixtures (plus reviewing resolved bypass alerts) would have made the dummy values predictable. After finding the live key, revoke and rotate it at the provider, then reopen or re-resolve the alert as "revoked".
Exercise
Which command-line filter finds secrets that contributors promised to fix later, and why is state=open the right choice for that reason only?
Show answer
Query repos/OWNER/REPO/secret-scanning/alerts?state=open and select alerts where push_protection_bypassed is true. "I'll fix it later" is the only reason that leaves the alert open. "Used in tests" and "false positive" are created already closed, so they require state=resolved to audit.