{"slug": "how-do-you-build-securely-when-ai-is-writing-more-of-the-code", "title": "How do you build securely when AI is writing more of the code?", "summary": "GitHub detected more than 200 million vulnerabilities from January to October 2026, a 100% year-over-year increase, the company reported in a blog post on securing AI-generated code. GitHub said its built-in security checks now run a local `/security-review` in the Copilot app, Copilot CLI and Copilot Chat in VS Code to flag issues such as SQL injection in agent-written changes before a pull request opens, with CodeQL as the foundation of GitHub Code Security for pull request checks. The company framed the effort as an ongoing find-and-fix process rather than one-time checks or growing backlogs of findings.", "body_md": "# How do you build securely when AI is writing more of the code?\n\nAI writes more code, faster, but security still needs your judgment. See how GitHub combines static and AI-powered security analysis, right where you work.\n\nYour agent has finished making a change. The tests pass, and the code looks plausible, but you don't have the time to closely review every line. How do you know what you're shipping is secure?\n\nAI agents are accelerating software development, but they can also unintentionally introduce vulnerable code, expose secrets, or suggest nonexistent dependencies. As AI-generated code scales across repositories and languages, security becomes increasingly critical. From January to October 2026, GitHub detected over 200 million vulnerabilities, based on internal data. This represents a 100% increase year over year, underscoring the growing need to secure code at scale.\n\nKeeping your application secure means checking code as you build, reviewing changes before they merge, and looking for risks across the wider project. That's why GitHub combines [built-in security checks](https://github.blog/changelog/2025-10-28-copilot-coding-agent-now-automatically-validates-code-security-and-quality/?utm_source=agentic-security-blog-security-check-changelog&utm_medium=blog&utm_campaign=post-universe-2026) with different kinds of analysis and gives you ways to investigate findings and apply fixes where you're already coding.\n\nLet's follow a change from the agent session to the pull request and the wider codebase. Along the way, you'll see how to build security into your own development workflow on GitHub. These aren't one-time checks or growing backlogs of findings. Instead, it's an ongoing process of finding vulnerabilities followed by evaluating and applying suggested fixes, without switching between disconnected tools.\n\n## [The agent says it's done. What did it miss?](#the-agent-says-its-done-what-did-it-miss)\n\nJust because an agent says it's finished the work doesn't mean it's safe. Your change can pass every test and still carry a security risk.\n\nConsider an example where your agent updates a PHP search endpoint and builds the database query by inserting the search text directly into the SQL. Ordinary searches still work, so you'd only catch the problem by reading the code closely and asking why the agent built the query that way. But that search text could change the SQL itself and give attackers a way to access your data.\n\nReading every line to find a problem like this is slow, and these kinds of errors are easy to miss. A [local security review](https://github.blog/changelog/2026-07-14-security-reviews-now-available-in-the-github-copilot-app/?utm_source=agentic-security-blog-local-security-review-changelog&utm_medium=blog&utm_campaign=post-universe-2026) can do that first pass for you. Before you open a pull request, run `/security-review` in the Copilot app, Copilot CLI, or Copilot Chat in VS Code on your active changes.\n\nThe review returns prioritized findings and remediation suggestions. It's focused on your local changes, not a full repository audit, and the review itself doesn't edit your code. You can ask Copilot to explain a finding or try a fix in your working copy.\n\nFor your PHP endpoint, the review could flag SQL injection. As a fix, it might suggest a parameterized query, which keeps the SQL instructions separate from the user's search value. You can then apply the fix and test that ordinary searches still work and crafted input can no longer alter the query.\n\n## [Your pull request is open. What could still slip through?](#your-pull-request-is-open-what-could-still-slip-through)\n\nWhile a local review is valuable, the pull request is the next checkpoint, and it has its own weak spot: reviewers can suggest and commit changes of their own, and any one of them could introduce a new risk. Your team still needs a check that runs on every pull request before code gets merged.\n\nCodeQL is the foundation of GitHub Code Security's pull request checks. Complementary AI-powered scanning builds on that base, extending coverage to additional languages and vulnerability patterns.\n\nThese two kinds of analysis work in different ways:\n\n- CodeQL builds a database representing the code, then runs queries over that representation to identify potential problems. Its default query suite is designed for high precision and few false positives.\n- [AI Scanning](https://docs.github.com/en/enterprise-cloud@latest/code-security/concepts/code-scanning/ai-powered-security-detections?utm_source=agentic-security-blog-ai-scan-docs&utm_medium=blog&utm_campaign=post-universe-2026) uses agents to explore the repository and reason about how the code works. Rather than relying only on predefined queries, it can investigate unfamiliar attack patterns and vulnerabilities in business logic, including in additional languages outside CodeQL's coverage.\n\nIn our example, PHP is one of those additional languages outside of CodeQL's coverage. AI Scanning checks the endpoint on the pull request and any findings come with suggested fixes for you or your reviewers to evaluate.\n\n## [What about the code you didn't touch?](#what-about-the-code-you-didnt-touch)\n\nPull request checks examine code that's new or changing, but they don't scan what's already there. Older code can go unchecked for months or years, and even code that appeared to be safe when it shipped may not hold up as attackers find new techniques.\n\nIn our example, an older part of the application builds database queries too, and nobody has changed it in months. It may carry the same kind of risk as the endpoint you just fixed, and no pull request will ever bring it up for review.\n\nTo look at code like that, if you have write access to a repository, you can run [Standard AI Scan](https://docs.github.com/en/enterprise-cloud@latest/code-security/concepts/code-scanning/ai-scan-for-repositories?utm_source=agentic-security-blog-standard-ai-scan-docs&utm_medium=blog&utm_campaign=post-universe-2026) on its default branch.\n\nThe scan uses a proprietary harness with multiple models when available. Rather than reading every file in full, its agent searches the project and selects files and functions to examine within a time budget. It can examine languages CodeQL supports as well as those outside its coverage.\n\nWhen the scan finishes, findings from the repository AI Scan appear alongside CodeQL alerts in the code scanning backlog. When CodeQL alerts already cover the same issue, AI Scan suppresses the duplicate findings.\n\nFrom there, you can assign these alerts, link issues, include them in [security campaigns](https://docs.github.com/en/code-security/concepts/security-at-scale/about-security-campaigns?utm_source=agentic-security-blog-security-campaign-docs&utm_medium=blog&utm_campaign=post-universe-2026), and use supported autofix workflows.\n\nIf you're working in the Copilot app, the [GitHub security extension](https://docs.github.com/en/copilot/how-tos/github-copilot-app/view-and-fix-security-alerts?utm_source=agentic-security-blog-gh-security-extension-docs&utm_medium=blog&utm_campaign=post-universe-2026) brings all code scanning alerts into a security canvas. You can find alerts, ask Copilot to explain them, and work on fixes without leaving the app. The same canvas supports the local security review we used earlier, so you can check new changes and act on existing alerts in one place.\n\n## [Your critical project warrants another look](#your-critical-project-warrants-another-look)\n\nFor most work, the checks you've seen so far are enough. But regular scanning is built to work within practical limits, such as time and scope. In some situations, such as a major release or an audit, you can't afford to leave any stone unturned.\n\nSuppose the example application is approaching a critical release. You've checked the endpoint and scanned the wider codebase, but the stakes of this release call for the most thorough investigation possible before shipping.\n\nDeep Scan, which is powered by Microsoft's [Codename MDASH](https://github.blog/open-source/maintainers/maintainers-dont-need-more-ai-bug-reports-they-need-fixes/?utm_source=agentic-security-blog-mdash-blog&utm_medium=blog&utm_campaign=post-universe-2026) and currently in private preview, is intended for higher-attention situations such as release testing and audits. Like Standard AI Scan, you run it on a repository with a click.\n\nCodeQL, Standard AI Scan, and Deep Scan alerts all share the same backlog and come with fix suggestions. Agentic autofix works across all three, as well as partner tools, helping you turn findings into fixes within a shared workflow.\n\n## [Build with security in the loop](#build-with-security-in-the-loop)\n\nWhether you're writing code yourself or working with an agent, these security checks help you evaluate what you're building from your first local change through to the codebase you maintain. You can use focused, local reviews while you build, complementary CodeQL and AI-powered analysis on pull requests, and broader, hybrid scans to look beyond what's recently changed, all within the same GitHub workflow.\n\nNo single green check certifies the whole codebase, but together, these approaches give you more chances to find issues and provide a clearer path from a finding to a fix you have reviewed.\n\n| Feature | When to use it | \n|---|---|\n| Local security review ( `/security-review` ) | Review your active changes for vulnerabilities before opening a pull request. | \n| CodeQL and AI Scanning | Check pull requests for vulnerabilities in new or changed code before merging. | \n| Standard AI Scan | Scan your repository's default branch for risks in code that hasn't changed recently. | \n| Deep Scan | Run a more thorough scan for higher-attention situations, such as release testing or an audit. | \n\n## [Put security into your next change](#put-security-into-your-next-change)\n\nNext time you work with an agent, [run `/security-review`](https://docs.github.com/en/copilot/how-tos/github-copilot-app/agent-sessions?utm_source=agentic-security-blog-security-review-app-docs&utm_medium=blog&utm_campaign=post-universe-2026#using-security-review-in-app-sessions) in the Copilot app, Copilot CLI, or Copilot Chat in VS Code to check your changes for vulnerabilities before opening a pull request.", "url": "https://wpnews.pro/news/how-do-you-build-securely-when-ai-is-writing-more-of-the-code", "canonical_source": "https://blog.github.com/security/application-security/how-do-you-build-securely-when-ai-is-writing-more-of-the-code/", "published_at": "2026-12-02 18:30:34+00:00", "updated_at": "2026-12-02 19:46:40.827656+00:00", "lang": "en", "topics": ["ai-safety", "ai-agents", "developer-tools", "ai-products"], "entities": ["GitHub", "Copilot", "CodeQL", "GitHub Code Security", "VS Code"], "also_reported_by": [], "takeaway": "Run `/security-review` in the Copilot app, Copilot CLI or Copilot Chat in VS Code on active changes before opening a pull request to get prioritized findings and fixes, such as replacing string-built SQL with parameterized queries.", "recommendation": null, "alternates": {"html": "https://wpnews.pro/news/how-do-you-build-securely-when-ai-is-writing-more-of-the-code", "markdown": "https://wpnews.pro/news/how-do-you-build-securely-when-ai-is-writing-more-of-the-code.md", "text": "https://wpnews.pro/news/how-do-you-build-securely-when-ai-is-writing-more-of-the-code.txt", "jsonld": "https://wpnews.pro/news/how-do-you-build-securely-when-ai-is-writing-more-of-the-code.jsonld"}}