GitHub layers CodeQL and AI scanning to check code written by AI agents
GitHub has described a chain of security checks for code produced by AI agents: a local review with /security-review, CodeQL and AI Scanning on pull requests, and repository-wide AI scans. It concerns development teams and security leads who use GitHub and Copilot.
What to do now
GitHub has used its security blog to set out how it combines tools to check code written by AI agents. Its starting point is that an agent can finish a task, with every test passing, and still introduce vulnerable code, expose secrets or suggest dependencies that do not exist. Based on internal data, GitHub says it detected more than 200 million vulnerabilities between January and October 2026, double the figure for the same period a year earlier.
The first check happens before a pull request is opened. The /security-review command, available in the Copilot app, Copilot CLI and Copilot Chat in VS Code, examines the changes currently in progress. It covers only those local changes and is not a repository audit. It also leaves the code untouched: it returns prioritised findings with suggested remediation. The developer can then ask Copilot to explain a finding or try a fix in the working copy.
GitHub's example shows the kind of flaw this review is meant to catch. An agent edits a PHP search endpoint and inserts the user's search text straight into the SQL query. Normal searches keep working, but crafted input can rewrite the query and expose data. The review would flag SQL injection and propose a parameterised query, which keeps the SQL instructions separate from the value the user typed.
The second check runs on every pull request, because reviewers can suggest and commit their own changes, and those changes can introduce new risks. CodeQL remains the foundation here. It builds a database that represents the code and runs queries against it, and its default query suite is tuned for high precision with few false positives. AI Scanning is added on top: agents explore the repository and reason about how the code behaves. This lets them look for unfamiliar attack patterns and business-logic flaws, including in languages CodeQL does not support. According to GitHub, PHP is one of those languages.
Pull request checks only cover new or changed code, so older code that nobody touches is never reviewed. To reach it, a user with write access can run Standard AI Scan on a repository's default branch. The scan uses a proprietary harness that draws on several models when they are available. Its agent does not read every file: within a time budget, it searches the project and picks which files and functions to examine. Coverage is therefore not exhaustive.
Standard AI Scan findings land in the code scanning backlog alongside CodeQL alerts, and duplicates of issues CodeQL has already reported are suppressed. Alerts can then be assigned, linked to issues, added to security campaigns or handled through the supported autofix workflows. In the Copilot app, the GitHub security extension gathers all of these alerts in a single security canvas, which also hosts the local review.
For high-stakes situations such as a major release or an audit, GitHub offers Deep Scan, a more thorough scan powered by Microsoft's Codename MDASH. It is currently in private preview. Alerts from CodeQL, Standard AI Scan and Deep Scan share one backlog, and agentic autofix works across all three as well as partner tools.
GitHub acknowledges that no single passing check certifies an entire codebase. The post does not give licensing terms or pricing for these features, does not list the languages AI Scanning covers, and does not say when Deep Scan will become generally available.
What to do now
- Run /security-review in the Copilot app, Copilot CLI or Copilot Chat in VS Code on every agent-produced change before opening a pull request.
- Confirm that CodeQL scanning is enabled on pull requests in your repositories, along with AI Scanning where available for languages CodeQL does not cover, such as PHP.
- Run Standard AI Scan on the default branch of critical repositories to check code that has not changed recently.
- As general good practice, review and test every AI-suggested fix before merging, for example by confirming that crafted input can no longer alter an SQL query.