An AI coding assistant can add a credential in seconds: a test token in a fixture, a password in a connection string, or a copied example in a configuration file. A later repository scan may find it, but the safest time to stop the leak is before the change is merged or shared more widely.
On November 17, 2026, GitHub announced a public preview that adds GitHub's secret-scanning detectors to Copilot's security review. The result is a useful new pre-merge check for developers and coding agents. It is not a replacement for repository secret scanning, credential rotation, or human review. It is a new layer between “the change exists locally” and “the change becomes part of the project.”
Two detectors, two kinds of evidence
The preview combines two different approaches:
- Provider patterns recognize credential formats from GitHub's secret scanning catalog. GitHub says the catalog covers more than 500 secret types and is built with more than 150 industry partners.
- AI secret detection uses surrounding code to identify likely unstructured secrets, such as a password or credential in a connection string that does not have a distinctive provider format.
These signals should not be treated as interchangeable. A provider-pattern match is evidence that a known credential shape appears in the reviewed changes. An AI finding is a contextual suspicion that needs inspection. A clean result is not proof that the change contains no secret: custom formats, encoded values, old credentials, and secrets outside the reviewed diff remain possible.
The preview is also off by default. Until it is enabled, Copilot security review uses its existing LLM-based detection rather than the additional GitHub secret-scanning detectors.
Where the preview fits
GitHub names four supported surfaces:
- Copilot CLI and the Copilot app: enable AI secret detection, then ask the security-review specialist to inspect the local change or agent work.
- Copilot SDK integrations: enable the relevant feature flag and provide GitHub authentication. A model-provider API key by itself is not enough.
- Copilot code review: enable secret scanning for code review and request Copilot on a pull request, or configure automatic reviews.
- Pull-request review by a human: use the findings as review input rather than treating the automated result as approval.
GitHub's announcement does not include VS Code in this release. That matters when a team standardizes its workflow: the feature's availability is tied to the listed Copilot surfaces, not to every editor that can host an AI assistant.
For a CLI workflow, the announcement documents the following example:
/settings aiSecretDetection on
/security-review
This is an illustrative command sequence from GitHub's documentation, not a run performed for this article. In an automated integration, the SDK can request a security review before returning an agent's changes, which avoids having every team build and maintain a separate provider-detector integration.
A safe pre-merge workflow
1. Enable it where the change is being reviewed
Turn on the preview for the Copilot surface your team actually uses. Record the setting in your team onboarding notes, because a new workstation or agent integration may otherwise fall back to the older review behavior.
For an SDK integration, confirm that the client has the required GitHub authentication and that the organization permits the feature. Do not paste tokens into prompts, repository files, or test fixtures merely to demonstrate that scanning works.
2. Review the diff, not just the finding
Ask the reviewer to inspect the exact changes and identify the file, line, and reason for each finding. A secret may be in a test fixture, documentation example, generated file, or configuration template. The remediation depends on whether the value is real, a safe placeholder, or an intentionally documented example.
Do not “fix” a finding by weakening the detector or hiding the line without understanding its origin. Replace real credentials with a secret-manager reference or a clearly fake value. Keep examples obviously non-functional and avoid using realistic-looking keys in documentation.
3. Rotate first when a real credential appears
If the value was ever valid, treat it as exposed even if the pull request was closed. Revoke or rotate it through the issuing service before cleaning up the branch or editing the file. GitHub's secret-scanning guidance recommends rotating an affected credential immediately.
Then check the surrounding change for copies: lockfiles, generated output, logs, screenshots, issue comments, and artifacts can carry the same value. Removing a line from the latest diff does not invalidate a credential that was already shared.
4. Run the repository-level follow-up
The new review path checks the changes under review; GitHub explicitly says it does not search repository history. After a confirmed leak, use repository secret scanning to search Git history and all branches, and inspect any other repository locations that may contain the value.
History cleanup can be disruptive and is not a substitute for revocation. The credential's lifetime is the security problem; rewriting commits only reduces future exposure after the credential is no longer useful.
5. Re-review after the fix
Request another review after replacing the value. Copilot code review does not automatically review every new push unless automatic review for new pushes is configured. A pull request can therefore contain a clean initial review and an unreviewed follow-up commit.
Keep a human in the loop. Copilot reviews normally leave comments rather than an approval, and a clean comment set does not establish that a credential is safe to use.
Know what a clean result does not mean
This preview has a narrow, useful boundary. It is not a general data-loss prevention system.
It may not identify an organization-specific token that has no supported provider pattern. It may not recognize a transformed, encrypted, or indirectly constructed value. It does not retroactively inspect old commits, workflow logs, artifacts, or external logging systems. It also cannot prove that a value was revoked or that an attacker did not copy it before the review ran.
That is why several controls belong together:
- repository secret scanning for history and repository content;
- custom or generic patterns for organization-specific credentials;
- least-privilege tokens and short expirations;
- pre-commit or CI checks appropriate to the repository; and
- an incident process that can revoke, rotate, and audit use quickly.
The new detector reduces the chance that a known credential format reaches a pull request. It does not change the responsibility of the service that issued the credential.
Choose review effort deliberately
Copilot code review offers Lite, Balanced, Max, and Adaptive effort levels. GitHub describes Lite as targeted, Balanced as deeper, and Max as the most intensive option; Adaptive chooses within the configured maximum. Higher effort uses more AI credits, and GitHub's published prices are estimates that vary with pull-request size and instructions.
Use the level as an operational choice, not a security guarantee. A small configuration-only pull request may need a targeted check, while a large agent-generated change touching deployment and authentication code deserves more scrutiny. Set a budget and an owner for automatic reviews, then make sure developers know whether a review is advisory or part of a required merge rule.
Agentic code-review capabilities can use GitHub Actions runners for full project context and related tasks. If Actions or the required workflows are unavailable, GitHub says a more limited review may still be generated. A review that completed is therefore not necessarily a review that had every context-enhancing capability. Treat runner availability as part of the review's audit record.
A compact team checklist
Before adopting the preview:
- Decide which Copilot surfaces are in scope.
- Enable the detector explicitly and document its preview status.
- Confirm SDK integrations use GitHub authentication.
- Define who reviews findings and who can revoke credentials.
- Keep repository secret scanning enabled as a separate control.
For each finding:
- Identify whether the value is real, fake, transformed, or unknown.
- Revoke or rotate any credential that was valid.
- Search the branch, history, artifacts, logs, and issue content for copies.
- Replace the value with a secret-manager reference or safe placeholder.
- Request a review after the fix and inspect the new diff.
The practical boundary
GitHub's preview makes secret detection more useful during AI-assisted development because it adds provider-aware scanning before merge. The best implementation is deliberately layered: use the preview to catch changed lines early, use repository scanning to find historical exposure, and use credential controls and human ownership to handle what neither detector can prove.