GitHub Secret Scanning on Demand: How Developers and AI Agents Can Detect Leaked Credentials Before Merge

GitHub secret scanning on demand is now available in public preview through GitHub Copilot’s security review specialist, allowing developers and AI coding agents to inspect code changes for exposed credentials before they are merged.

AI-assisted code review dashboard showing potential exposed credentials, security alerts and a green protection shield on a developer workstation.
GitHub’s on-demand secret scanning adds dedicated credential detection to Copilot security review for developers and AI coding agents.

Announced on November 17, 2026, the capability combines GitHub’s established secret scanning detectors with AI-assisted security review. It is available through Copilot CLI, the Copilot app, Copilot SDK integrations and Copilot code review.

GitHub Changelog

The update addresses a practical challenge in modern software development: credentials can enter code through both human mistakes and AI-generated changes, and detecting them before a pull request is merged can reduce the risk of accidental exposure.

However, the new feature has important boundaries. It is disabled by default, scans code changes rather than repository history, and consumes AI credits under GitHub’s Secret Protection billing category.

For engineering teams, understanding those distinctions is essential before adding on-demand secret detection to everyday development workflows.

What Is GitHub Secret Scanning on Demand?

GitHub secret scanning on demand extends the Copilot security review specialist with additional credential-detection capabilities.

Previously, Copilot security review already looked for exposed secrets using large language model analysis.

The new public preview allows the specialist to run GitHub’s dedicated secret scanning detectors alongside that existing review.

This introduces two complementary detection methods.

The first uses recognizable credential patterns maintained through GitHub’s secret scanning ecosystem.

The second uses a fine-tuned model that examines surrounding code to identify potential secrets without obvious predefined formats.

Pattern-based secret detection

GitHub says its detectors recognize more than 500 secret types, supported by a catalog developed with over 150 industry partners.

These include supported credentials associated with cloud services, developer platforms and other integrated providers.

Pattern-based detection is particularly useful when a credential follows a recognizable structure.

Developers can consult GitHub’s supported secret scanning patterns to understand which credential formats and providers are covered by existing detectors.

However, a string that does not match a known pattern may require additional analysis.

AI-assisted credential detection

GitHub’s fine-tuned secret-detection model examines code context to identify potential credentials that lack a recognizable format.

Examples include passwords and credentials embedded in connection strings.

This contextual approach can extend coverage beyond fixed provider patterns, but it should not be interpreted as perfect detection.

A scanner can still miss an exposed secret or flag a harmless value that requires investigation.

How GitHub Secret Scanning on Demand Works

The new capability runs through the Copilot security review specialist.

Developers or AI agents request a review of their current code changes. When secret scanning has been enabled, the specialist supplements its existing analysis with dedicated credential detection.

The resulting findings can be used to correct the changes and request another review.

This creates a useful feedback loop before code is merged.

Suggested development workflow

  1. Developer or AI agent prepares code changes
  2. Copilot security review examines the changes
  3. Enabled secret detectors identify potential exposed credentials
  4. Developer investigates and fixes confirmed findings
  5. Changes are reviewed again before merge

This is a recommended operating pattern rather than a guarantee that every security issue will be detected.

What the scanner does not inspect

GitHub explicitly states that the new review checks changes, not repository history.

That distinction matters.

A repository may already contain exposed credentials in older commits, configuration files or other supported locations.

Running the new on-demand review does not replace a historical repository secret scan.

Organizations should continue using appropriate repository-wide scanning and credential-management controls.

How to Enable GitHub Secret Scanning on Demand

GitHub provides different activation methods depending on the Copilot environment.

Environment Enable secret scanning Run review
Copilot CLI /settings aiSecretDetection on /security-review
Copilot app Settings → Experimental → AI secret detection /security-review
Copilot SDK Set SECURITY_REVIEW_FINE_TUNED_MODEL to true when creating a session Delegate to security-review specialist
Copilot code review Repository Settings → Copilot → Code review → Security → Secret scanning Request or automate pull-request review

Configuration details from GitHub’s November 17 announcement.

GitHub Changelog

Enable scanning in Copilot CLI

Developers using Copilot CLI can activate the feature during an interactive session:


/settings aiSecretDetection on

After enabling it, request a security review:


/security-review

The security review specialist can also be invoked through the agent’s task tool with agent_type set to security-review.

These commands are Copilot CLI session commands, not ordinary shell commands.

Enable scanning in the Copilot app

In the Copilot app, open Settings, navigate to Experimental and enable AI secret detection.

Developers can then run /security-review or delegate the review to the security specialist.

Because this is a public-preview capability, teams should verify the feature is available in their installed application and supported account configuration.

GitHub Secret Scanning for AI Coding Agents

One of the most important aspects of the November update is its integration with agent-based development.

An AI coding agent may generate multiple files, modify configuration and execute development tools before returning a proposed solution.

Those operations can introduce sensitive values accidentally.

For example, an agent might copy a credential-like string from a test fixture into a configuration file or include an authentication value in generated code.

The new integration allows agents to request a security review before presenting their work for acceptance.

Using the Copilot SDK

GitHub documents the SECURITY_REVIEW_FINE_TUNED_MODEL feature flag for SDK sessions.

Once configured, an integration can delegate to the security review specialist or use session.rpc.tasks.startAgent with agentType: "security-review".

This provides an integration point for developers building their own agent workflows.

However, the announcement does not establish that every custom agent automatically receives secret scanning.

The integration must be enabled and invoked appropriately.

Why automated review should remain auditable

AI-generated code should not be trusted merely because another AI component reviewed it.

Organizations should retain evidence of the review, inspect findings and preserve existing approval requirements.

The goal is to make security checks easier to perform consistently, not to eliminate accountability.

TechnologyHQ previously examined Dependabot support for AI agent package updates, which addresses maintaining reusable agent instructions and skills as versioned dependencies.

On-demand security review complements that discipline by examining changes produced during agent execution.

How On-Demand Secret Scanning Differs From Push Protection

GitHub already offers several forms of secret protection.

The new capability should be understood as an additional review surface, not a replacement for those existing systems.

GitHub also provides push protection documentation, explaining how supported secrets can be detected and blocked during push operations.

Capability Primary purpose
On-demand secret scanning Review current changes when requested
Push protection Detect and block supported secrets during push operations
Repository secret scanning Identify supported secrets in repository content
Workflow-log secret scanning Detect supported credentials exposed in CI/CD logs
Pull-request security review Examine proposed changes before merge

GitHub’s October 28 announcement also expanded push protection with AI-detected secrets in public preview, allowing context-aware detection during supported push operations.

GitHub Changelog

Why detection timing matters

A security check performed before a developer commits a change can catch mistakes early.

Push protection operates at a different point, when changes are being pushed.

Pull-request review provides another opportunity to identify problems before merge.

Repository scanning can detect supported exposures already present in the repository.

These controls form a layered defense.

No single scanning point guarantees that every credential exposure will be prevented.

How GitHub Secret Scanning Protects Pull Requests

The November release also integrates dedicated secret scanning into Copilot code review.

Once enabled in repository settings, Copilot code review can identify secrets on added lines of a pull request.

This is particularly useful when changes were not reviewed during development.

For example, a contributor may create a pull request without using Copilot CLI or the Copilot app.

If the repository has the new scanning integration enabled, Copilot code review provides an additional opportunity to identify exposed credentials.

Review findings are not necessarily merge blockers

A detected secret and an enforced merge restriction are separate mechanisms.

GitHub also supports repository rulesets that can block pull-request merges when qualifying secret scanning alerts remain unresolved.

That capability was described in GitHub’s September 9, 2026 update and has its own eligibility and configuration requirements.

GitHub Changelog

Organizations should not assume that enabling Copilot secret review automatically creates a mandatory merge gate.

Administrators need to configure enforcement separately where supported.

GitHub Secret Scanning on Demand vs. Workflow-Log Scanning

The two capabilities address different exposure scenarios.

On-demand scanning examines code changes.

Workflow-log scanning examines output generated during GitHub Actions execution.

A credential might be absent from source files but appear in a deployment script’s diagnostic output.

Conversely, a hardcoded API token could appear directly in a proposed code change before any workflow executes.

TechnologyHQ’s analysis of GitHub Actions workflow-log secret scanning explains the separate November 9 preview and its limitations.

Together, these features demonstrate why software security must examine both source changes and runtime artifacts.

Different previews have different restrictions

The November 9 workflow-log scanning preview excludes several detection categories and does not generate alert notifications.

The November 17 on-demand review has its own configuration, execution and billing model.

Administrators should not assume that the capabilities share identical eligibility, detection scope or notification behavior.

Availability, Licensing and AI Credits

GitHub states that organizations already able to use Copilot security review or Copilot code review can use the new secret scanning capability in the listed tools.

No additional plan is required.

However, scanning is not necessarily free of usage charges.

GitHub says scans consume AI credits under the Secret Protection AI Credit SKU.

The announcement does not provide a universal fixed credit cost per scan.

Planning usage for development teams

Organizations adopting the feature should evaluate how often reviews are invoked.

For example, a team might run a review before every significant pull request or after an AI agent completes a sensitive code change.

The appropriate frequency depends on risk, development volume and applicable billing controls.

Teams should consult current GitHub billing documentation before estimating monthly costs.

They should also avoid assuming that repeated scans of unchanged code provide proportional security benefits.

What Developers Should Do When a Secret Is Detected

A confirmed credential exposure requires more than deleting the offending line.

If a real credential has entered a commit, pull request or another accessible artifact, it may already have been copied or used.

The response should follow the organization’s incident-handling process.

A practical sequence is to revoke or rotate the affected credential, investigate relevant usage, remove the exposed value from active code and determine whether repository history or other artifacts require remediation.

Avoid using real credentials in scanner tests

Developers testing the new feature should use harmless dummy values or documented provider test credentials.

Placing a production token into a test file merely to verify scanning creates an unnecessary security risk.

For evaluation, the goal is to confirm that the integration activates, produces understandable findings and fits into the existing remediation workflow.

Best Practices for Deploying On-Demand Secret Scanning

A successful rollout should begin with a small number of repositories and developers.

Confirm that the required Copilot features are available, enable secret detection and run controlled reviews.

Then evaluate the quality of findings, the effort required for triage and the impact on development workflows.

Recommended rollout checklist

  • Enable secret scanning explicitly in the intended Copilot environment.

  • Test the security review specialist using safe sample code.

  • Confirm that developers understand the difference between code-change scanning and historical repository scanning.

  • Review the required Secret Protection AI credit usage.

  • Integrate findings into existing remediation and pull-request review procedures.

  • Maintain push protection and repository scanning where appropriate.

  • Verify that AI agents cannot bypass required human approvals.

These recommendations are operational guidance, not additional guarantees provided by GitHub.

What the Public Preview Does Not Guarantee

The November 17 announcement establishes that the new capability can combine provider-pattern detectors with a fine-tuned secret-detection model.

It does not provide independent detection accuracy benchmarks.

It does not establish complete coverage of every credential format.

It does not scan historical repository content through the new on-demand review.

It also does not mean that every Copilot security review automatically runs the new detectors before opt-in.

Security teams should evaluate the feature using representative workflows and avoid treating an absence of findings as proof that no secrets exist.

Frequently Asked Questions

What is GitHub secret scanning on demand?

It is a public-preview capability that allows Copilot’s security review specialist to run GitHub secret scanning detectors against code changes when a review is requested.

GitHub’s official announcement explains how on-demand secret scanning combines established credential detectors with AI-assisted security review.

Is GitHub secret scanning on demand enabled automatically?

No. GitHub states that it is disabled by default and requires opt-in.

Can AI coding agents run secret scanning?

Yes. Supported Copilot agents and SDK integrations can invoke the security review specialist after the feature is configured.

Does it scan repository history?

No. The new review examines code changes, not historical repository content.

Does it detect credentials without recognizable formats?

GitHub says its fine-tuned model can identify some potential secrets using surrounding code context, including passwords and connection-string credentials.

Does it require a new GitHub subscription?

GitHub says no additional plan is required for users who already have access to the supported Copilot review capabilities. AI credit consumption still applies.

Can it prevent every secret from reaching production?

No. It is an additional detection mechanism and should be combined with other security controls.

The Bottom Line

GitHub secret scanning on demand brings dedicated credential detection closer to the point where developers and AI agents produce code.

By integrating established provider-pattern detectors and context-aware analysis into Copilot security review, GitHub gives teams another opportunity to identify exposed credentials before merge.

The feature’s practical value depends on how it is configured and used.

Organizations should enable it deliberately, understand the AI credit implications, validate findings and retain their existing repository security controls.

The larger engineering lesson is that AI-assisted software development needs security checks that operate within the development workflow, not only after code has already been deployed.