GitHub Copilot Secret Scanning for AI Agents: What Developers Should Know
GitHub Copilot can now run secret scanning on demand during security review. Learn how it detects credentials in AI-generated changes, where it runs, and what it cannot replace.

In This Article
This article covers GitHub Copilot Secret Scanning for AI Agents: What Developers Should Know. GitHub Copilot can now run secret scanning on demand during security review. Learn how it detects credentials in AI-generated changes, where it runs, and what it cannot replace.
Key Takeaways
- Published: November 19, 2026
- Category: Developer Security
- Tags: GitHub Copilot, secret scanning, AI agents, code security, developer tools
- Views: 943
- Reading time: ~22 min read
"GitHub Copilot can now run secret scanning on demand during security review. Learn how it detects credentials in AI-generated changes, where it runs, and what it cannot replace."

The update in one sentence
GitHub announced on November 17, 2026 that Copilot’s security review specialist can run GitHub secret scanning on demand. The public preview brings provider-pattern detection and GitHub’s fine-tuned secret-detection model into workflows that developers and coding agents already use. It is available through Copilot CLI and app sessions, Copilot SDK integrations, and Copilot code review, but secret scanning is opt-in and the feature checks code changes rather than repository history.
The practical change is important for teams using AI agents because an agent can create or modify many files quickly. A credential that might have been caught during a careful manual review can now travel through a generated diff, a pull request, or an SDK-controlled session. The official GitHub Changelog announcement says the detector catalog covers more than 500 secret types, built with more than 150 industry partners, and that a fine-tuned model can identify less recognizable credentials by reading surrounding code.
This guide explains what the preview does, how it fits into a development workflow, and what it does not replace. It is not a claim that one scan makes a repository secure. Secret management, revocation, least privilege, and human review still matter.
Why AI-generated changes need a separate secret check
AI coding agents optimize for completing a task. They may copy a configuration example, create a test fixture, move a connection string, or modify a deployment script. Even when the original request is harmless, the resulting diff can contain a token, password, private key, or credential embedded in a URL. The problem is not limited to malicious prompts. It can arise from realistic-looking sample data, copied documentation, or a developer’s local environment being included in a command output.
Traditional secret scanning and AI-assisted review solve related but different problems. Provider patterns are good at recognizing known formats. A model-based detector can examine context when a secret does not match a familiar pattern, such as a password inside a connection string. GitHub’s update combines both forms of analysis in Copilot security review. That combination should improve coverage, but it also means teams need to understand what is being scanned, what is not, and what happens after an alert.
The announcement is explicit about one boundary: the review checks changes for secrets; it does not search repository history. A leaked credential in an older commit therefore needs a separate historical scan and incident response. Finding a string is also not the same as proving it is active. Treat every credible finding as a reason to investigate, rotate, and reduce permissions.
Where the preview fits in the workflow
There are three useful moments to run the check. First, a developer or agent can scan while work is in progress. In Copilot CLI or the Copilot app, a user can ask the security-review specialist to inspect changes, or run /security-review directly. The result can guide a fix and a second review before a pull request is opened.
Second, a team can place the check inside an agent workflow. GitHub says Copilot SDK integrations can request a security review before an agent returns its changes, without every team maintaining a separate detector. This is a valuable control point because it makes “scan before handoff” part of the agent contract. The agent should still be constrained from printing secrets, committing them, or sending them to third-party services.
Third, Copilot code review can examine added lines in a pull request, including changes that were not checked during development. That catches the gap between an agent’s local work and the final review surface. It does not remove the need for branch protection, push protection, environment isolation, or a response plan.
GitHub also documents a separate MCP route for agents. The secret-scanning MCP guide describes enabling the secret_protection toolset and invoking run_secret_scanning from a coding agent. That creates another software integration option, but teams should verify permissions, authentication, logging, and data boundaries before enabling tools broadly.
How detection works and where it stops
GitHub describes two detection layers. Provider patterns cover more than 500 secret types from its catalog, developed with a partner program. These patterns are intended to recognize high-confidence formats and may support provider-specific validity checks or response actions depending on the secret type and product configuration.
The second layer is GitHub’s fine-tuned model for secret detection. It reads the surrounding code to identify likely credentials that do not have a recognizable format, including passwords and credentials in connection strings. Model-based detection can find context that a regular expression misses, but it can also produce uncertain findings. A reviewer should inspect the location, determine whether the value is real, and decide whether it needs immediate revocation or safe replacement.
The feature is off by default. GitHub’s documentation says users must enable it in the relevant tool before requesting a scan. In Copilot CLI, the setting is /settings aiSecretDetection on; in the Copilot app, it is under Settings > Experimental; SDK integrations use the SECURITY_REVIEW_FINE_TUNED_MODEL feature flag; and Copilot code review has a Secret scanning setting under repository Copilot settings. Exact menus and entitlements can change during public preview, so check the current documentation instead of copying an old screenshot.
A safer rollout checklist
Start with a disposable test repository containing deliberately fake credentials and ordinary code patterns. Confirm that the workflow produces findings, that alerts reach the intended reviewers, and that a false positive can be dismissed without hiding real issues. Never use a real production credential as a test fixture.
Next, decide what the agent is allowed to do after a finding. A safe default is to stop the task, redact the value from logs, show only the file and line context needed for review, and ask a person to rotate or replace the credential. Do not let an agent silently edit a secret into an environment variable and declare the incident closed; the original secret may already have been copied to logs, artifacts, caches, or a third-party model context.
Then add deterministic controls around the model. Use pre-commit or CI checks, protected branches, short-lived credentials, environment-specific permissions, and a documented rotation process. Record the scan mode, tool version, commit, alert result, and reviewer decision. The scan consumes AI credits under the Secret Protection AI Credit SKU, according to GitHub’s announcement, so include usage and review time in the operating model.
For broader developer-tool discovery, the BTTC software catalog can help teams compare adjacent security, coding, and productivity tools. The BTTC technology blog provides more context on AI-assisted software workflows.
What teams should not assume
Do not assume that enabling the preview scans every place a secret can exist. The November announcement focuses on code changes in the listed Copilot experiences. Historical commits, issue comments, build logs, local files, artifacts, and external systems may need their own controls. GitHub has separate products and previews for other surfaces, and availability depends on the Copilot experience and account configuration.
Do not assume the model can distinguish every fake from every live credential. A high-confidence alert deserves investigation, while a low-confidence alert still deserves a consistent triage rule. Do not paste an exposed secret into a chat asking whether it is valid. Treat it as compromised until the owner confirms rotation or revocation through the provider’s secure workflow.
Finally, do not confuse detection with prevention. Detection tells a team that a change contains a likely secret. Prevention requires keeping credentials out of source files, using secret stores and environment injection, limiting permissions, rotating quickly, and teaching agents to use placeholders. The strongest workflow makes the secure path easier than copying a real token into an example.
FAQ
What does GitHub’s new secret scanning preview do?
It lets Copilot security review run GitHub secret-scanning detectors and a fine-tuned detection model against code changes before merge in supported Copilot experiences.
Does it scan the entire repository history?
No. GitHub’s announcement says the review checks changes for secrets and does not search repository history. Historical exposure requires a separate scan and incident response process.
Where can developers use it?
The public preview is available in Copilot CLI and app sessions, Copilot SDK integrations, and Copilot code review, subject to current account and feature settings.
Is secret scanning enabled automatically?
No. It is off by default in the described workflow. Users must opt in through the relevant CLI, app, SDK, or repository code-review setting.
What should happen after a real secret is found?
Stop further exposure, revoke or rotate the credential through the provider, remove it from the change and related logs where possible, investigate access, and replace it with a least-privilege secret-management workflow.
Conclusion
GitHub’s on-demand secret scanning preview gives developers and AI agents a more direct way to check code changes before they reach a merge. Its combination of provider patterns and contextual model detection is useful because credentials do not always look like obvious tokens. The boundaries matter just as much: scanning is opt-in, the preview focuses on changes rather than history, and an alert still requires human triage and credential rotation. Use it as one layer in a defense-in-depth workflow, then reinforce it with short-lived secrets, protected branches, secure storage, and an agent policy that treats exposed credentials as an incident.

