GitHub

Content type: News

5 min read

GitHub integrates AI-powered security review into Copilot users' workflow

GitHub detailed how it combines CodeQL, AI scanning, and local review to catch vulnerabilities in code written by agents, before it reaches the pull request or gets forgotten in the repository.

News
Reading
5 min
Tables
1

GitHub detailed how it combines CodeQL, AI scanning, and local review to catch vulnerabilities in code written by agents, before it reaches the pull request or gets forgotten in the repository.

The agent finished, but that doesn't mean it's secure

Your AI agent finishes a task, the tests pass, and the code looks plausible. But that doesn't guarantee that what you're about to push is secure. In a post on its official blog, GitHub describes a common scenario: an agent updates a PHP search endpoint and builds the SQL query by inserting the search text directly into the statement. Normal searches keep working, so only a careful reading of the code would reveal the problem: a malicious search string can alter the SQL itself and open a path to unauthorized data access.

According to the company, from January to October 2026 GitHub detected more than 200 million vulnerabilities in code hosted on the platform, based on internal data. The number represents a 100% increase compared to the same period the previous year. The post published by GitHub ties this number to the growing volume of AI-generated code circulating across repositories and different languages, a scenario the company uses to justify the new security checkpoints.

Four layers, each covering the previous one's blind spot

GitHub's response isn't a single tool, but a sequence of checks that follow the code from the moment the agent finishes the change through to the repository already in production. Each layer covers a gap the previous one lets through:

LayerWhen to useWhat it covers
Local review (/security-review)Before opening the pull requestOnly the active changes in your environment
CodeQL + AI ScanningIn the pull request, before mergeNew or changed code
Standard AI ScanRun on demand on the default branchOld code nobody has touched in months
Deep ScanIn private preview, for critical releases and auditsDeeper scanning, using Microsoft's Codename MDASH

Local review: the first filter, before the PR

To catch an issue like the PHP endpoint one before even opening the pull request, GitHub recommends running /security-review in the Copilot app, in Copilot CLI, or in VS Code's Copilot Chat against the active changes. The check returns prioritized findings with fix suggestions, without editing the code on its own: you decide whether to apply them.

In the endpoint example, the review would flag SQL injection and suggest replacing the concatenation with a parameterized query, which separates the SQL statement from the value entered by the user. After applying the fix, the normal flow is to test that common searches still work and that a malicious input no longer alters the query. It's a deliberately limited-scope check: it only looks at what you changed, not the entire repository.

In the pull request, CodeQL and AI cover different angles

A local review doesn't shield the pull request: reviewers can suggest and even commit their own changes, and any of them can introduce a new risk. That's why GitHub Code Security runs CodeQL on every pull request before merge, complemented by an AI-based scan.

The two approaches work in different ways. CodeQL builds a database representing the code and runs structured queries against that representation; its standard suite prioritizes high precision and few false positives. AI Scanning, on the other hand, uses agents that explore the repository and reason about how the code works, which allows it to investigate off-script attack patterns and business-logic vulnerabilities, including in languages CodeQL doesn't yet cover.

In the endpoint's case, PHP is precisely one of those languages outside CodeQL's coverage. It's AI Scanning that examines this code in the pull request and returns fix suggestions for the reviewer to evaluate.

Code nobody touched is also a risk

Pull request checks only look at new or changed code. Old code can go unreviewed for months or years, and even sections considered secure when they were written can stop being so, as attackers discover new techniques. In GitHub's example, an older part of the application builds database queries in the same risky way, with nobody having touched it recently, and no pull request will bring it back to the table.

To cover this blind spot, anyone with write access to the repository can run the Standard AI Scan on the default branch. The scan uses a proprietary harness with multiple models when available; instead of reading every file in full, the agent searches the project and chooses files and functions to examine within a time budget, covering both languages supported by CodeQL and those outside it.

Findings from this scan enter the same code scanning backlog where CodeQL alerts already appear, and duplicates are automatically suppressed. From there, you can assign alerts, link issues, include findings in security campaigns, and use the supported autofix flows. Those working through the Copilot app also get a "security canvas": a single surface that brings together code scanning alerts and local review, with Copilot explaining each finding without leaving the app.

The Security panel in the Copilot app shows the local security review option, the result of the latest review, and code scanning findings
The Security panel in the Copilot app shows the local security review option, the result of the latest review, and code scanning findings. Reprodução: blog.github.com.

Deep Scan: the layer for critical releases or audits

For situations requiring more attention, such as a critical release or an audit, GitHub offers Deep Scan, currently in private preview. The tool is powered by Microsoft's Codename MDASH and runs on a repository with one click, just like Standard AI Scan, but with deeper investigation. Alerts from CodeQL, Standard AI Scan, and Deep Scan share the same backlog and come with fix suggestions; agentic autofix works across all three layers, in addition to partner tools.

What changes for developers in Brazil

In summary: the package doesn't replace code review, but tries to fit security into the same rhythm teams already use agents to generate code, rather than treating it as a separate step. For teams that adopted Copilot or other AI assistants in daily work without having a formal SAST routine, the four layers provide a concrete entry point: starting with /security-review before any PR already covers the most common case, which is the agent

Translated from the Brazilian Portuguese original · Read the original