Sub topic 8
Bypass reasons and who can approve a bypass
This chapter assumes you know how push protection blocks a push and how to read the block message. It covers what happens when a contributor decides to push anyway, and how an organization can control that choice.
Bypass reasons
When push protection blocks a push, the contributor can bypass the block. GitHub asks for one of three reasons:
| Reason in the prompt | Meaning | Alert resolution |
|---|---|---|
| It's used in tests | The value is a dummy or test credential | `used_in_tests` |
| It's a false positive | The match is not a real secret | `false_positive` |
| I'll fix it later | The secret is real and will be removed afterward | Alert stays open |
The first two reasons close the resulting alert automatically. The third leaves it open, because a real secret has been pushed. Treat it as a live leak and follow the remediation steps from the previous chapters.
A bypass is not silent. GitHub creates a secret scanning alert marked as bypassed, adds an audit log entry, and emails repository administrators and organization owners. Reviewers can see who bypassed the block and why.
Delegated bypass
By default, anyone who can push can bypass. Many teams find this too loose. With delegated bypass, an organization or repository restricts bypass to approved reviewers.
You set this in the push protection settings under "Bypass list". You can limit who may bypass directly to specific roles or teams. Everyone else must send a bypass request.
The flow looks like this:
Key points about requests:
- The contributor picks a reason and can add a comment.
- Reviewers are the roles or teams you named in the bypass list.
- A request that nobody answers expires after a fixed period, so the push stays blocked.
- If the request is denied, the contributor must remove the secret from the commits and push again.
- An approval applies to that specific secret, so the contributor must push again after it.
Reviewing a request
A reviewer should not approve on trust. Before approving, check three things:
- Is the secret really a test value or a false positive? Ask where it is used.
- Could the value be revoked and replaced with an environment variable instead?
- Does the stated reason match the code? A "used in tests" claim on a file in
src/deserves a question.
Deny and explain when in doubt. A denial costs the contributor a few minutes. An approved real credential can cost far more.
Auditing bypasses
Bypassed pushes appear in the alerts API. This command lists open alerts that were bypassed, with the person who bypassed them:
gh api 'repos/OWNER/REPO/secret-scanning/alerts?state=open' \
--jq '.[] | select(.push_protection_bypassed == true) | {number, secret_type_display_name, push_protection_bypassed_by: .push_protection_bypassed_by.login}'Review this list regularly. A pattern of "I'll fix it later" bypasses means the team has a workflow problem, not just a few careless pushes.
Choosing a policy
- Small teams with high trust can keep the default and rely on alerts and email for visibility.
- Larger organizations, or repositories with production access, should use delegated bypass so a second person checks every exception.
- Keep the reviewer group small and reachable. If reviewers respond slowly, contributors will look for workarounds.
Exercise
A contributor bypasses push protection with the reason "I'll fix it later". What happens to the alert, and what should the team do?
Show answer
GitHub creates an alert marked as bypassed, and it stays open because the secret may be real. The team should treat it as a leak: revoke and rotate the credential at the provider, then close the alert with the resolution revoked.