Secret scanners have always been good at one thing: recognizing tokens with a known shape. An AWS access key, a GitHub personal access token, a Stripe key. They are much worse at the secrets that have no format, such as a database password in a config file or a hand-rolled API credential. Those are the leaks that tend to slip through.
In October 2026, GitHub moved to close part of that gap. A changelog entry dated October 28 describes push protection for AI-detected secrets, in public preview, building on a purpose-built detection model GitHub described earlier in the month. This post covers what is documented, the cost model, and how we would layer it into a team workflow. Details come from GitHub's changelog and press coverage; confirm availability and pricing for your plan before rollout.
What changed
Push protection has long blocked a git push when it contains a secret matching one of GitHub's partner or custom patterns. The new capability extends this to secrets found by an AI model, which can flag things like generic passwords that pattern matching cannot describe.
Requirements as reported:
- The repository needs push protection and AI-detected secret scanning already enabled.
- It is available to organizations with GitHub Secret Protection or GitHub Advanced Security on github.com.
- It is in public preview, and AI detection in push protection consumes AI credits, with billing starting once you opt in. Post-push scan alerts remain included at no extra charge.
That last point shapes rollout. Unlike pattern-based protection, this one has a variable cost tied to push volume, so you will want to turn it on deliberately rather than org-wide on day one.
Why it matters more now
Two trends make generic-secret detection more valuable than it was a year ago.
First, coding agents write configuration. Agents scaffold .env.example files, docker-compose services, and test fixtures, and they sometimes fill in a plausible-looking password and sometimes copy a real one from the environment they can see. GitHub's Octoverse figures, as reported at Universe, put agent-opened pull requests above 40%. More machine-authored code means more chances for a credential to land in a diff nobody reads closely.
Second, false negatives are expensive. A pattern scanner that misses a generic password gives a clean bill of health on a repository that is not clean.
Where it fits: a layered approach
No single control is enough. We suggest three layers, each catching what the previous one misses.
Layer 1: Pre-commit scanning on the developer machine
Catching a secret before it enters git history is cheaper than anything after. A local hook with an open-source scanner works offline and costs no credits.
# .pre-commit-config.yaml
repos:
- repo: https://github.com/gitleaks/gitleaks
rev: v8.24.2
hooks:
- id: gitleaksPin rev to a release you have verified; the version above is an example, not a recommendation.
Layer 2: Server-side push protection
This is where the GitHub feature sits. It is a backstop for pushes from machines that skipped the hook, including agent sandboxes and CI bots. Enable pattern-based push protection broadly first, then trial the AI-detected option on a few repositories with high-risk config (infrastructure, integration code) and watch both the alert quality and the credit consumption.
Layer 3: Post-push alerting and rotation
Detection after the fact is still useful, but the only correct response to a pushed secret is to treat it as compromised. Removing it from history does not un-leak it.
You can list open alerts through the REST API to feed a dashboard or an on-call queue:
gh api repos/OWNER/REPO/secret-scanning/alerts \
--jq '.[] | select(.state == "open") | {number, secret_type, created_at}'Pair this with a written rotation runbook: who rotates, where the secret lives, what the target time is (15 minutes or 2 hours), and how you verify the old value stopped working.
Handling bypasses
Push protection lets a developer bypass a block with a reason (for example, "false positive" or "used in tests"). Decide up front who reviews those. At minimum, route bypass events to the security channel and review them weekly. If your team sees many "used in tests" bypasses, that is a signal to change the tests: use obviously fake values with a reserved format, such as test-password-not-real, so that both humans and scanners can tell them apart.
Rollout checklist
- Confirm your plan includes Secret Protection or Advanced Security and understand AI credit billing.
- Add a pre-commit hook for a local scanner in repository templates.
- Enable pattern-based push protection across the organization.
- Trial AI-detected protection on two or three repositories for two weeks; record blocks, false positives, and credits used.
- Write down the rotation runbook and the bypass review owner before expanding.
- Review agent configuration: make sure agents work with fake values and never receive production credentials in their environment.
The last item matters most. A detector reduces the damage when a secret leaks, but the stronger control is making sure agents and developers rarely have real production secrets within reach of the code they edit.
Sources
- GitHub changelog: "Push protection beyond predefined secret patterns" (October 28, 2026) and "Purpose-built model for leaked secret detection" (October 7, 2026)
- Help Net Security and ITPro coverage of the push protection changes