GitHub has integrated static analysis alongside AI-driven security evaluations directly into the developer's environment to address this challenge.
As AI agents expedite software development, there is a risk that they might inadvertently introduce insecure code, reveal sensitive information, or propose dependencies that do not actually exist. With AI-generated code proliferating across diverse repositories and programming languages, securing the codebase is becoming an ever-more critical concern. Internal data from GitHub indicates that between January and October 2026, over 200 million vulnerabilities were identified, marking a 100% year-over-year surge, which highlights the escalating requirement to secure code at scale. Maintaining application integrity demands checking code during its creation, scrutinizing modifications prior to integration, and surveying risks across the entire project scope. Consequently, GitHub merges native security inspections with various forms of analysis, providing avenues to investigate discovered issues and implement corrections precisely where coding activity occurs. This overview will trace a modification from an agent's session through to the broader codebase, illustrating how to embed security into one's development process on GitHub. This is not about isolated checks or accumulating backlogs of discovered flaws; rather, it constitutes a continuous cycle involving vulnerability detection, subsequent evaluation, and the application of suggested remedies, all without needing to toggle between disparate tooling.
The agent signals completion of its task. However, merely because an agent declares its work finished does not guarantee its safety. A modification might pass every automated test yet still harbor a security vulnerability. Consider a scenario where an agent updates a PHP endpoint designed for searching, constructing the database query by directly embedding the search input into the SQL statement. While standard searches would function correctly, the flaw would only be apparent through close code inspection and questioning the agent's query construction methodology. This search input, however, could manipulate the SQL itself, thereby granting attackers access to the data. Manually examining every line to uncover such an issue is inefficient, and these types of errors are easily overlooked.
A preliminary security assessment can be performed locally. Prior to submitting a pull request, executing `/security-review` within the Copilot app, Copilot CLI, or Copilot Chat in VS Code on the active changes yields prioritized findings along with suggestions for remediation. This review focuses specifically on the local alterations, rather than conducting a comprehensive audit of the entire repository, and the review process itself does not alter the code. Developers can prompt Copilot to elaborate on a finding or to test a potential fix within their working copy. For the aforementioned PHP endpoint, the review might flag an SQL injection vulnerability, and as a corrective measure, it could recommend a parameterized query, which isolates the SQL directives from the user's search value. The developer can then implement this fix and verify that typical searches still operate while maliciously crafted input can no longer alter the query structure.
Once the pull request is open, another layer of risk remains. While a local review is beneficial, the pull request represents the subsequent validation point, and it possesses its own vulnerability: reviewers can propose and commit their own changes, and any one of these contributions might introduce a fresh risk. Therefore, a check that executes on every pull request before merging is still necessary for the team. CodeQL serves as the bedrock for the pull request checks within GitHub Code Security. This foundation is supplemented by AI-powered scanning, which builds upon it by extending coverage to more languages and different vulnerability patterns. These two analytical methods operate distinctively: CodeQL constructs a database model of the code, subsequently running queries against this representation to pinpoint potential issues; its standard query set is engineered for high accuracy and minimal false positives. Conversely, AI Scanning utilizes agents to traverse the repository and reason about the code's functionality. Instead of depending solely on pre-defined queries, it can investigate novel attack patterns and vulnerabilities within business logic, including in languages beyond CodeQL's scope. In the PHP example, this falls under the category of additional languages not covered by CodeQL. AI Scanning examines the endpoint within the pull request, and any resulting findings are accompanied by suggested fixes for either the developer or the reviewers to assess.
Pull request checks focus on code that is new or undergoing modification, but they omit scanning the existing codebase. Older code can remain uninspected for months or years, and even code that appeared safe upon initial deployment might become vulnerable as attackers discover new techniques. In our example, an older section of the application also constructs database queries, and it has not been modified in months; it could harbor the same type of risk as the endpoint that was just corrected, and no pull request will ever bring it to the attention of a reviewer. To examine such code, if one possesses write access to the repository, Standard AI Scan can be executed on its default branch. This scan employs a proprietary harness utilizing multiple models when available. Instead of reading every single file in entirety, its agent searches the project, selecting specific files and functions for inspection within a defined time limit. It is capable of examining languages supported by CodeQL as well as those outside its coverage. Upon completion of the scan, the findings from the repository AI Scan are presented alongside the CodeQL alerts within the code scanning backlog. If CodeQL alerts already address the identical issue, AI Scan suppresses the redundant findings. From this point, alerts can be assigned, issues can be linked, they can be incorporated into security campaigns, and supported autofix workflows can be utilized. If development is taking place within the Copilot app, the GitHub security extension integrates all code scanning alerts into a security canvas. This canvas allows users to view alerts, request Copilot to provide explanations, and work on fixes without exiting the application. This same canvas supports the local security review previously discussed, enabling users to address new changes and existing alerts in a unified location.
For the majority of development tasks, the checks detailed previously are sufficient. However, routine scanning is designed to operate within practical constraints, such as allocated time and the scope of review. In certain high-stakes scenarios, like a major product launch or a formal audit, it is unacceptable to leave any area unchecked. Should the example application be approaching a critical release, the thoroughness of the investigation before shipping might necessitate more than the standard checks. Deep Scan, which is currently in private preview and powered by Microsoft's Codename MDASH, is intended for these situations demanding heightened attention, such as release testing and audits. Similar to Standard AI Scan, it is initiated on a repository with a single click. Alerts generated by CodeQL, Standard AI Scan, and Deep Scan all populate the same backlog and include fix suggestions. Agentic autofix functionality is applicable across all three tools, as well as integrated partner utilities, assisting in transforming identified flaws into resolutions within a shared operational flow.
Whether an individual developer is writing code or collaborating with an agent, these security checks aid in evaluating the construction process from the initial local change through to the maintained codebase. Developers can employ targeted, localized reviews while building, utilize complementary CodeQL and AI-powered analysis during pull requests, and leverage broader, hybrid scans to look beyond recent modifications, all within the consistent GitHub workflow. While no single green indicator certifies the entirety of the codebase, the combination of these methodologies increases the opportunities to locate issues and provides a more defined pathway from identifying a vulnerability to implementing a reviewed fix.
The utilization guide for these features is as follows: Local security review (/security-review) should be used to assess active changes for vulnerabilities before opening a pull request. CodeQL and AI Scanning are designed to scrutinize pull requests for vulnerabilities present in newly added or altered code prior to merging. Standard AI Scan is employed to scan a repository's default branch for risks residing in code that has not been recently modified. Deep Scan should be invoked for more intensive examinations during high-priority events such as audits or release testing.
To incorporate security into the next development iteration, the operator should run `/security-review` within the Copilot app, Copilot CLI, or Copilot Chat in VS Code to validate changes for vulnerabilities before initiating a pull request.
Why it matters
As AI accelerates code generation, the risk of introducing subtle security flaws increases exponentially. Operators must implement continuous, multi-layered security checks beyond simple testing to manage this scale of automated development. This highlights the need for integrated security tooling across the entire development lifecycle.






