Free Intensive Nov 21–22Free 2-day hands-on Vibecoding Intensive on Nov 21–22 at 16:00 MSK (Sat–Sun) · Live Cohort 3 starts Nov 23Join Free →Cohort 3 (Nov 23)
ReleaseCode / SDK · ActionableGitHub Changelog→ original

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
GitHub Teaches Copilot to Hunt for Leaked Passwords and Keys in Code Before Merge
Source: GitHub Changelog. Collage: Hamidun News.
Listen to article
Article Fact Sheet & Key Figures
ParameterDetails
Primary sourceGitHub Changelog ↗
Editor-in-Chief
Key metric #1The option is off by default and must be enabled manually: /settings aiSecretDetection on
Key metric #2Only changes are scanned; the scanner does not look at repository history
Key metric #3Each scan consumes AI credits under the Secret Protection SKU

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.

Story

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.

ZK
Zhemal Khamidun — CPO at Alpina Digital, product manager of AlpinaGPT. Building AI products since 2019. Hamidun News is a pet project that grew into a production aggregator with 6,000+ readers.
✦ Hands-On AI Engineering · Hamidun Academy

Build & Ship Production AI Agents Without Boilerplate Code

Start your free 72-hour trial at Hamidun Academy (academy.hamidun.com) — interactive lessons on Claude Code & Cursor, live Tech Radar, and production agent templates.

Start 72h Free Trial →Vibe-Coding Intensive
What do you think?
Loading comments…