GitHub Teaches Copilot to Hunt for Leaked Passwords and Keys in Code Before Merge
GitHub has connected its secret scanner to Copilot's security review, so a password or token that ends up in code can be caught before merge. The scanner knows more than 500 key types, and a fine-tuned model reads the surrounding code to catch even passwords in database connection strings. It works in Copilot CLI, the Copilot app, the SDK, and Copilot code review on pull requests. If an AI agent writes code for you, have it request this check before submitting its changes.
AI-processed from GitHub Changelog; edited by Hamidun News
Secrets in code remain one of the most common and costly mistakes: a developer pastes a token "just for testing," commits it, and the key is already in the repository. AI agents raise the risk. They write a lot of code fast, and humans don't always read every line. GitHub's answer is a new capability: Copilot's security review can now run secret scanning on demand.
What's new
Copilot's security reviewer already looked for leaked secrets, but only with its language model. With the option enabled, it now also runs GitHub's secret scanning detectors. The catalog covers more than 500 secret types and keeps growing as the secret scanning partner program lets services add formats for their own keys.
There is a second part. Not every secret has a recognizable format: a password in a database connection string doesn't look like a GitHub or AWS token. For these cases, GitHub uses a fine-tuned model that examines the surrounding code and assesses whether a string looks like a real password or credential.
The feature is in public preview. It is available in Copilot CLI and the Copilot app, through Copilot SDK integrations, and in Copilot code review for pull requests. There is no VS Code support in this release.
How it fits into your workflow
There are three scenarios:
- During work. In Copilot CLI or the app, you can ask the coding agent to run the security reviewer, fix the findings, and request a re-check. You can also run the check yourself, on your own changes or on the agent's output.
- Inside your own agents. Through the Copilot SDK, an agent can request a security review before returning its changes. You don't need to maintain separate secret detectors.
- In pull request review. Copilot code review can flag secrets in added lines, including changes that no one checked during development. The author and the reviewer see the problem before merge.
Enabling it depends on the tool. In an interactive session, run the command /settings aiSecretDetection on; when invoking the agent, specify the security-review type. In the SDK, set the SECURITY_REVIEW_FINE_TUNED_MODEL variable when creating a session. For code review, the option is under Settings > Copilot > Code review, or it can be set for automatic reviews.
Limitations to be aware of
First: the scanner checks only your changes. It does not go through repository history, so it won't find old leaks. For that you still need standard secret scanning and rotation of compromised keys.
Second: SDK integrations require GitHub authentication. A model provider's API key alone is not enough, and tokens from your own integration's OAuth app are not supported yet. A token obtained by signing in with GitHub CLI, for example, will work. GitHub added this clarification to its November 18 entry.
Third: the option is off by default. Until you turn it on, the check relies only on LLM-based detection. No additional plan is required, but scans consume AI credits under the Secret Protection SKU, so keep an eye on usage if agents are used heavily.
Why it matters for practitioners
The main benefit is that the check sits at the point where a secret is still cheap to remove: before merge. If you build your own agents, adding a "security review before returning changes" step now comes down to a single SDK call. For teams where agents write code at scale, this is a low-cost additional barrier. But don't rely on it alone: it does not replace push protection or repository history auditing.
- Dec 2, 2026Ai2 Releases MolmoWeb2 Web Agents: 27B Model Solves 75.3% of Tasks
- Dec 2, 2026T-Decision-1 9B scores 71.6 points and beats a model six times its size
- Dec 2, 2026JetBrains Releases Air App: Control AI Agents in Your IDE From a Smartphone
- Dec 2, 2026JetBrains Offers Voluntary Departures as IDE Search Raised Agent Task Costs by 6–7%
Key Questions Answered
What's new?
Copilot's security reviewer already looked for leaked secrets, but only with its language model. With the option enabled, it now also runs GitHub's secret scanning detectors. The catalog covers more than 500 secret types and keeps growing as the secret scanning partner program lets services add formats for their own keys. There is a second part. Not every secret has a recognizable format: a password in a database connection string doesn't look like a GitHub or AWS token.
How it fits into your workflow?
There are three scenarios: During work. In Copilot CLI or the app, you can ask the coding agent to run the security reviewer, fix the findings, and request a re-check. You can also run the check yourself, on your own changes or on the agent's output. Inside your own agents. Through the Copilot SDK, an agent can request a security review before returning its changes. You don't need to maintain separate secret detectors. In pull request review.
What are the key details on Limitations to be aware of?
First: the scanner checks only your changes. It does not go through repository history, so it won't find old leaks. For that you still need standard secret scanning and rotation of compromised keys. Second: SDK integrations require GitHub authentication. A model provider's API key alone is not enough, and tokens from your own integration's OAuth app are not supported yet. A token obtained by signing in with GitHub CLI, for example, will work. GitHub added this clarification to its November 18 entry.
Free 2-Day Vibecoding & AI Agents Intensive
Day 1: the autonomous Hermes + DeepSeek AI agent — vibecoding and development on par with Claude Code / Codex / Gemini. Led by Jemal Hamidun, Head of AI at Alpina Digital and academic supervisor at MIPT. Right after you register with our bot Nika: the recording + 11 materials from the previous intensive.
Daily 60-sec AI Voice Brief + Weekly Production AI Agent Playbook
Listen to a 60-second AI news brief every morning and get a weekly hands-on playbook for shipping AI agents to production — tools, MCP servers and patterns that work. Curated by Jemal Hamidun, Head of AI at Alpina Digital.
