Copilot Secret Scanning: Setup, Limits and Billing
Set up Copilot secret scanning across CLI, app, SDK and code review. Learn what it detects, where it falls short, and how AI credit billing works.

Copilot Secret Scanning: Setup, Limits and Billing
How to Set Up Copilot Secret Scanning Across Every Surface
Secret scanning inside GitHub Copilot security review can catch credentials in code changes before they reach a pull request - or flag them during the pull request itself if you're using Copilot code review. The catch is that it's off by default, and you have to enable it separately for each Copilot "surface." A clean review on one surface doesn't automatically mean scanning is running everywhere else.
There's also a hard boundary worth repeating: this feature checks what's in front of it. It doesn't go digging through your repository's existing Git history for older leaks. That makes it great as a development-time and pre-merge check, but it's not a replacement for classic GitHub secret scanning.
This guide covers what the preview does, how to enable it in Copilot CLI, the app, SDK integrations, and code review. It also walks through what to consider around coverage, billing, and automation. The goal is simple: add a practical check without accidentally treating it like a full secrets-management strategy.
What Copilot secret scanning detects
GitHub announced secret scanning in Copilot security review as a public preview on November 17, 2026. Once you enable it, the review runs two detection layers: GitHub's provider-pattern detectors and a fine-tuned model that looks at code context.
That distinction matters when you look at results. A known token format can match a pattern. But a password or credential embedded in a connection string might not have an obvious "shape," so the model looks at surrounding code to decide whether it looks like a secret. Those findings are useful, but they aren't the same as a deterministic match.
Two detection methods, different strengths
GitHub says its provider catalog covers more than 500 secret types and was built with more than 150 partners through its secret scanning partner program. The code review changelog describes those provider detectors as deterministic methods, like regular expressions - built to catch known formats reliably.
The fine-tuned model fills in gaps where there's no recognizable provider pattern. It reads nearby code to identify likely secrets, including passwords and credentials in connection strings. That broadens coverage, but it also means the result is an assessment, not a direct format match.
Treat both as actionable, but validate them differently. A token that matches a recognizable provider format should be treated as exposed unless you have evidence otherwise. A model-based finding usually needs closer review to tell whether it's a real credential, a placeholder, a test value, or something else that merely "looks" sensitive.
What changes when you opt in
Copilot security review already includes LLM-based secret detection. Turning on this setting adds GitHub secret scanning detectors to the review. It doesn't just flip the existing LLM detection from "off" to "on." If you don't opt in, the review sticks with its existing LLM-based detection.
This feature is meant to inspect the changes being reviewed. In the app and CLI, that means the current work (or agent output). In code review, that means the changes in the pull request. With the SDK route, an agent can request a specialist review as part of its workflow.
So: it's a development-time check. It doesn't tell you whether an old credential was committed months ago, copied into another branch, or exposed elsewhere. For those questions, you'll need separate controls.
How to enable it on each Copilot surface
There isn't a single account-wide switch. If you want secret detection to run where developers (or agents) are working, enable it on each surface - and then verify that a review actually runs. Opting in doesn't guarantee a scan will happen by itself.
| Surface | Enable detection | Start or schedule a review |
|---|---|---|
| Copilot CLI | In an interactive session, run /settings aiSecretDetection on |
Run /security-review or ask the agent to delegate to security-review using the task tool |
| Copilot app | Settings > Experimental > AI secret detection | Run /security-review or delegate to the security-review agent |
| Copilot SDK | Set SECURITY_REVIEW_FINE_TUNED_MODEL to true when creating the session and configure GitHub authentication on the client |
Delegate from the session agent or call session.rpc.tasks.startAgent with agentType: "security-review" |
| Copilot code review | Repository Settings > Copilot > Code review > Security > Secret scanning | Request a Copilot review, or configure automatic reviews |
CLI and Copilot app
In an interactive Copilot CLI session, enable detection and then run the specialist review:
/settings aiSecretDetection on
/security-review
You can also ask a coding agent to delegate the review to security-review through the task tool. That's a useful checkpoint between "the agent says it's done" and "the code is about to be committed." If the specialist finds something, fix it and request another review instead of treating the first result as a final stamp of approval.
In the Copilot app, the toggle is under Settings > Experimental. Open an active session with in-progress code changes, then run /security-review. GitHub's app documentation describes this command as a public-preview review of current workstream changes, returning prioritized findings with severity and confidence scores and suggested fixes.
Practically, this gives you a solid check before you open a pull request. It complements code scanning, Dependabot, and classic secret scanning - it doesn't replace them.
SDK integrations and code review
The SDK setup has extra requirements. Set the SECURITY_REVIEW_FINE_TUNED_MODEL feature flag to true when creating a session, and configure GitHub authentication on the SDK client. A model-provider API key alone isn't enough. GitHub also notes that tokens issued by an integration's own OAuth app aren't supported in this release, and VS Code support isn't included.
The changelog covers the requirements and the task call, but it doesn't include a complete SDK program. Use the SDK's documentation for the client constructor and authentication setup. Don't treat a short configuration sketch as a finished working implementation. GitHub updated its announcement on November 18 to clarify authentication requirements.
For pull requests, enable secret scanning under Repository Settings > Copilot > Code review > Security. A developer can request a review manually, but automatic reviews are less dependent on someone remembering a command. Configure automatic reviews through a branch ruleset using Automatically request Copilot code review. If you can, also consider enabling Review new pushes - without it, Copilot reviews the pull request only once, and later pushes won't be reviewed automatically. Enable Review draft pull requests if you want the check to run before the pull request is marked ready for review.
What the feature misses and how it compares with classic scanning
Copilot's on-demand feature and classic secret scanning answer different questions. Copilot checks changes as you develop or review. Classic scanning provides broader, ongoing coverage across the repository content and history.
| Question | Copilot secret scanning in review | Classic secret scanning |
|---|---|---|
| What does it inspect? | Changes under review | Git history on all branches, plus issues, pull requests, Discussions, wikis and secret gists |
| When does it run? | When requested, delegated to an agent, or triggered by a pull request review | Automatically, with periodic rescans when new secret types are added |
| Where do findings appear? | In the session or as pull request review comments | As alerts on the repository's Security and quality tab |
| Does it use AI? | Yes, alongside provider patterns | AI-detected secrets are listed as an optional extension, alongside other detection options |
The history gap is the critical limitation
A clean Copilot review doesn't mean your repository has never contained a secret. It means this review didn't flag anything in the changes it examined. A key committed in the past and deleted later is outside the scope here, because the review doesn't search repository history.
Classic secret scanning is the right tool for that broader job. GitHub's documentation says it scans Git history on all branches and other supported repository surfaces. For public repositories, classic secret scanning is available for free; private organization repositories require GitHub Secret Protection. Public monitoring can also catch secrets leaked by members of an enterprise in public repositories.
If a credential shows up in current changes, treat it like it was exposed. Rotate or revoke it right away. GitHub also notes that removing it from Git history can be time-intensive and is often unnecessary once the credential has been revoked. History rewriting can still make sense for other reasons, but it shouldn't delay invalidating the credential.
Keep the controls in separate layers
A practical setup uses classic scanning as the standing alarm, with Copilot review as a check on the diff. Classic scanning covers more surfaces and history. Copilot review can catch a mistake before or during pull request review.
Don't assume one control covers the other. Enabling a Copilot setting doesn't enable classic secret scanning, and classic scanning doesn't automatically make an agent review its own changes. If you need to prioritize, pull request review tends to be the most repeatable option because it doesn't depend on every developer remembering a command. Keep classic scanning for history and ongoing monitoring.
How billing works and how to roll it out
Copilot secret scanning uses AI credits under the Secret Protection AI Credit SKU. GitHub says no additional Copilot plan is required for the listed Copilot experiences, but scans consume credits. The announcement doesn't include a per-scan price or credit count, so you can't forecast costs precisely from the public info alone.
For code review, secret detection is available on Copilot Pro, Pro+, Max, Business and Enterprise plans. Organization settings also affect who pays for code review. With Member billing, the member's Copilot entitlement is used - and the review fails if the member has exhausted their quota. With Organization billing, the organization is charged, and it must have paid AI credits usage enabled.
The documentation doesn't clearly confirm whether this code review billing choice controls charges for the Secret Protection AI Credit SKU. Check how the SKU is billed in your organization before committing to a setting. Also, track actual SKU usage during an initial rollout rather than guessing based on pull request counts.
Roll out by risk and measure actual usage
A staged rollout is easier to troubleshoot than turning everything on everywhere at once. Start with the control that gives the clearest coverage, then add developer and agent workflows.
- Enable code review for a high-activity repository. Turn on secret scanning in Copilot code review settings and configure automatic reviews.
- Review the ruleset. Enable Review new pushes if you want follow-up commits to trigger another review. Enable draft reviews if you want coverage before a pull request is ready.
- Enable CLI and app access where developers use them. Each surface has its own setting - verify both rather than assuming one setting carries over.
- Add the SDK path intentionally. Set the feature flag, configure supported GitHub authentication, and place the specialist review before the agent returns its changes.
- Measure AI credit usage after the first week. Check Secret Protection AI Credit SKU usage and confirm the intended code review billing mode before expanding.
- Keep classic scanning enabled. Copilot review doesn't search repository history.
This same release also includes Adaptive review effort, which picks Lite, Balanced, or Max effort based on pull request complexity and risk, constrained by the maximum configured for the enterprise, organization, or repository. Balanced remains the default. This is a separate preview and doesn't enable secret detection. Higher review effort can use more AI credits than Lite, so track that separately when you measure usage.
Common setup problems and a practical checklist
Most failures come from mixing up a feature setting with actual coverage, or assuming a review repeats automatically. Before rolling this out broadly, verify the following:
| Symptom | Likely cause | Fix |
|---|---|---|
/security-review misses a key in the changes |
Secret detection is off on that surface, so the existing LLM-based detection is being used | Enable AI secret detection for the CLI, app or other surface in use |
| An SDK session cannot run the specialist scan | The client has only a model-provider API key, or uses an unsupported OAuth app token | Configure GitHub authentication on the SDK client and check the supported authentication requirements |
| A later push is not reviewed | Automatic review ran once, but Review new pushes is off | Enable that option in the branch ruleset |
| A code review fails | Member billing is in use and the member has exhausted their quota | Check quota and billing configuration; organization billing requires paid AI credits usage |
| A previously leaked key is not reported | The review checks changes, not repository history | Use classic secret scanning for historical coverage |
| A draft pull request receives no review | Draft reviews are not enabled in the ruleset | Turn on Review draft pull requests if drafts should be scanned |
For an initial functional check, use a disposable branch and a known test credential - not a real production secret. Confirm the intended surface produces a finding, then remove the test value. This validates the workflow without deliberately exposing a live credential.
As an operational rule: treat every confirmed credential finding like an incident until the credential is rotated or revoked. Don't wait for a history cleanup to make it "safe." And avoid pasting real environment values into support tickets or chat while investigating - use a redacted configuration or a synthetic example instead.
Conclusion
Copilot secret scanning is most useful as an extra check on code changes: in a developer's current work, an agent workflow, or a pull request. The separate settings, SDK authentication requirements, and AI-credit billing are exactly why it's worth testing intentionally instead of assuming it's active everywhere.
The boundary is straightforward: Copilot review checks what's in front of it, while classic secret scanning covers repository history and broader surfaces. Enable both where your security requirements call for it, automate pull request reviews where possible, and verify AI credit usage before you expand the rollout.