
Running Google’s CodeMender security agent in GitHub pull requests

Google published a reference architecture for running CodeMender, its autonomous code-security agent, directly in GitHub pull requests via Google Cloud Run. The agent is part of Google’s AI Threat Defense platform. Google’s motivation is measured pressure: development velocity is up as much as 2x for some teams, while the average developer fix time for software flaws grew from about 59 days a decade ago to more than 170 days in 2025, per the Mandiant M-Trends 2026 Report.
The developer stays entirely inside the pull request timeline. A scan posts a single comment with a table of findings, each with an ID, and two slash commands. Replying /verify runs a sandboxed exploit attempt and returns the trace folded into a collapsible View Exploit Steps & Response Trace block; the results can change the severity of the finding. Replying /fix returns a proposed patch behind a Preview Proposed Code Diff block, with a draft pull request already open. Replying /approve commits the patch to the branch, pushes it, and sets the commit status security/codemender-gate to green; branch protection turns that status into a merge block, and without branch protection the gate is only advisory. Both commands also accept “all” in place of an ID.
The design emphasizes shipping evidence rather than just a severity. CodeMender‘s cm find returns a confidence score; below 100%, developers can use cm verify to have CodeMender build and simulate an exploit in an ephemeral sandbox. Artifacts are streamed to Google Cloud Storage for an audit trail. The article warns about verification failure modes: a harness that only searches for a successful exploit string can fail open on a crashed mock server or execution timeout and label a real vulnerability as safe. The parser should separate true negatives from test crashes and mark incomplete exploits as inconclusive.
There are no stored keys between GitHub and Cloud Run. GitHub Actions mints a short-lived OIDC token that Google is configured to accept, so nothing long-lived exists to steal. Nearly all the security rests on one condition line in the workflow; validating the issuer alone buys nothing because every GitHub Actions workflow shares the same issuer URL. The article recommends matching on repository_id and repository_owner_id because those are immutable, unlike repository names, which can be renamed or claimed.
Exploit code runs in a Cloud Run job. Because verification executes on-demand attack code nobody reviewed, the post asks two questions: where does the code run, and what can it reach? Cloud Run instances are sandboxed, and jobs always run in the second-generation execution environment, a microVM with full Linux compatibility; the instance holds nothing, lives for one finding, and only the verdict leaves. The job gets its own service account granted nothing beyond the API that writes the exploit, no registry access (the container image is imported at deploy time, not pulled at instance start), and no network route out via Direct VPC egress into a subnet with no route. One job runs per finding. Cloud Run’s sandbox also isolates process execution from the parent workload’s environment variables, secrets, and the Google Cloud metadata server. The post closes by pointing to the reference implementation at codemender-gitops.

