Introducing CodeMender: an AI agent for code security

CodeMender is an AI-powered agent designed to automatically find and fix software vulnerabilities using Gemini Deep Think models, already contributing dozens of fixes to major open-source projects.
Using advanced AI to fix critical software vulnerabilities
Today, we’re sharing early results from our research on CodeMender, a new AI-powered agent that improves code security automatically.
Software vulnerabilities are notoriously difficult and time-consuming for developers to find and fix, even with traditional, automated methods like fuzzing. Our AI-based efforts like Big Sleep and OSS-Fuzz have demonstrated AI’s ability to find new zero-day vulnerabilities in well-tested software. As we achieve more breakthroughs in AI-powered vulnerability discovery, it will become increasingly difficult for humans alone to keep up.
CodeMender helps solve this problem by taking a comprehensive approach to code security that’s both reactive, instantly patching new vulnerabilities, and proactive, rewriting and securing existing code and eliminating entire classes of vulnerabilities in the process. Over the past six months that we’ve been building CodeMender, we have already upstreamed 72 security fixes to open source projects, including some as large as 4.5 million lines of code.
By automatically creating and applying high-quality security patches, CodeMender’s AI-powered agent helps developers and maintainers focus on what they do best – building good software.
CodeMender operates by leveraging the thinking capabilities of recent Gemini Deep Think models to produce an autonomous agent capable of debugging and fixing complex vulnerabilities.
To do this, the CodeMender agent is equipped with robust tools that let it reason about code before making changes, and automatically validate those changes to make sure they’re correct and don’t cause regressions.
While large language models are rapidly improving, mistakes in code security could be costly. CodeMender’s automatic validation process ensures that code changes are correct across many dimensions by only surfacing for human review high-quality patches that, for example, fix the root cause of the issue, are functionally correct, cause no regressions and follow style guidelines.
As part of our research, we also developed new techniques and tools that let CodeMender reason about code and validate changes more effectively. This includes pinpointing root causes using debuggers and source code browsers, and proactively rewriting code to use secure data structures like -fbounds-safety in libwebp.
While our early results with CodeMender are promising, we’re taking a cautious approach, focusing on reliability. Currently, all patches generated by CodeMender are reviewed by human researchers before they’re submitted upstream. We hope to release CodeMender as a tool that can be used by all software developers to keep their codebases secure.
Source: Google DeepMind Blog















