Autonomous Remediation with CodeMender

Autonomous Remediation with CodeMender

Goran Minov

November 21, 2026

Annual Pro sale · Save $30

Have presentations of your own?

Share with private links, password protection, and more control over your work.

Transcript

23 slides
  1. DEVFEST ARMENIA 2026 · YEREVAN Autonomous Remediation with CodeMender and

    Google Cloud Goran Minov Google Developer Expert, Cloud AI
  2. THE PROBLEM Alerts are cheap. Fixes aren't. scanner output, one

    small Flask file SEVERITY CRITICAL HIGH HIGH MEDIUM ... TYPE CWE-78 CWE-89 CWE-22 CWE-328 ... TITLE Command Injection in /ping SQL Injection in /user Path Traversal in /read_file Weak hash (MD5) for passwords and the next 400 rows EVERY ROW IS WORK Reproduce it. Patch it. Prove nothing else broke. First four rows: a real scan of an intentionally vulnerable Flask app. The 400 is illustrative. DevFest Armenia 2026 · Yerevan 2
  3. THE GAP Why a code generator isn't enough GAP 1

    GAP 2 GAP 3 No repo context Invents APIs Never runs anything Sees one file. Misses the config that excludes /api from auth. Calls helpers that don't exist in your codebase or version. No build, no tests, no proof the bug is really gone. What a security engineer does: read the code, reproduce the exploit, patch it, re-test. The agent has to do all four. DevFest Armenia 2026 · Yerevan 3
  4. THE AGENT Meet CodeMender HOSTED AGENT Gemini Enterprise Agent Platform

    Multi-agent reasoning. Default model gemini-3.8-flash. Decides what to read, run and write. CM CLIENT + DAEMON TOOL REQU EST OBSERVATION Your laptop or CI runner. Executes the agent's tools in a local sandbox: list_dir read_file grep_search run_command write_to_file Snippets, not repos: the client sends targeted file contents and command results. Customer code isn't used to train the model. DevFest Armenia 2026 · Yerevan 4
  5. HOW IT WORKS What one scan looks like single-session scan,

    one of my repos (trimmed) Resetting workspace Running: git checkout HEAD -- . && git clean -fd Sandbox roots: repo, ~/.codemender, temp [Step 1] list_dir src/app [Step 6] read_file src/app/api/.../route.ts [Step 40] grep_search pattern="dangerous" [Step 41] grep_search pattern="dangerous" Cache Hit: reusing cached result Completed 59 tool steps in 16m11s CLEAN BASELINE Every run starts from a reset working tree BOUNDED Only the repo, ~/.codemender and a temp folder CACHED READS Repeat reads are free; any write clears the cache From my run, not the docs. The docs say the agent works within your workspace and a command policy. DevFest Armenia 2026 · Yerevan 5
  6. HOW IT WORKS Set up in five commands setup #

    once per project gcloud services enable \ aiplatform.googleapis.com \ cloudresourcemanager.googleapis.com # once per machine gcloud auth application-default login # once per repo cm init cm init --verify cm health --strict DevFest Armenia 2026 · Yerevan ROLE roles/aiplatform.user (Agent Platform User) BINARY cm for Linux, macOS, Windows, x86_64 and ARM64 CONFIG config.yaml: build.command, extensions, sandbox 6
  7. HOW IT WORKS Pick the model, or don't DEFAULT STRONGER

    CYBER gemini-3.8-flash gemini-4-argon gemini-3.8-flash-cyber Good enough to start. Used when you pass nothing. Pass --model on find, verify or fix. Fairwind Program access only. SAFET Y FALLBACK A safety block on gemini-4-argon retries on gemini-3.8-flash-cyber, then gemini-3.8-flash without Cyber access. --no-model-fallback turns it off. DevFest Armenia 2026 · Yerevan 7
  8. THE JOURNEY One finding, five stops src/proxy.ts (trimmed) CRITICAL ·

    CWE-287 export function proxy(request: NextRequest) { const { pathname } = request.nextUrl; if (pathname.startsWith('/_next') || pathname === '/login' || pathname.includes('.')) { return NextResponse.next(); // skip auth } // ...then check the session cookie 1. Find Anything wrong? 2. Verify Is it real? DevFest Armenia 2026 · Yerevan 3. Fix Is it gone? Auth bypass in Next.js middleware Any path with a dot skips login. And the matcher excludes every /api route. 4. Gate New in this PR? 5. PR Who approves? 8
  9. STOP 1 · FIND Find Verify Fix Gate PR Three

    ways to look DEEP · DEFAULT DIFF QUICK cm find ./src cm find . --diff cm find ./src --quick File by file, parallel workers, false positives filtered. Changed lines plus their callers and importers. One session. Local checks, new or small projects. Slowest, most tokens Typically under 2 minutes Lower recall on big repos My run, Nov 3: plain cm find ran a deep scan. 22 files, 5 pruned at zero tokens, 17 batches on 8 workers, 26 seconds, 137k tokens. DevFest Armenia 2026 · Yerevan 9
  10. STOP 1 · FIND Find Verify Fix Gate PR Bring

    your own findings findings.json (or SARIF 2.1.0) [{ "file_path": "app/db.py", "line": 42, "title": "SQL injection in get_user", "message": "username is formatted into SQL", "severity": "HIGH", "vuln_type": "CWE-89" }] cm report import --file findings.json cm report cm verify <finding-id> cm fix <finding-id> Add context at every stage: -c "Focus on the session path" works on find, verify and fix. DevFest Armenia 2026 · Yerevan 10
  11. STOP 1 · FIND Find Verify Fix Gate PR The

    bug lives in two files AndroidManifest.xml <provider android:name=".data.DataProvider" android:exported="true" /> DataProvider.java (simplified) query(uri, projection, selection, ...) // passed straight to SQLite WHAT MY SCAN REPORTED · AN OLD ANDROID APP OF MINE 3 HIGH · CWE-89 · SQL injection via query(), delete() and update() in an exported content provider. Any app on the device could read or change the local database. DevFest Armenia 2026 · Yerevan 11
  12. STOP 2 · VERIFY Find Verify Fix Gate PR Not

    real until it's exploited what verification leaves behind (my run) $ cm verify <finding-id> .exploit/ ├── PLAN.md # the agent's checklist ├── LOG.md # every action, timestamped ├── exploit.sh # reproducible proof ├── info.yaml # severity, confidence └── REPORT.md # root cause + remediation WHAT I SAW IN MY RUN curl blocked by policy It sent raw HTTP from node -e instead. kill -9 blocked It stopped its test server with process.kill. Docs: commands run inside your workspace and a command policy, in a local sandbox. Next slide: the fence. DevFest Armenia 2026 · Yerevan 12
  13. STOP 2 · VERIFY Find Verify Fix Gate PR Where

    the agent can reach LINUX ~/.codemender/config.yaml sandbox: enabled: true network: profile: permissive-closed security: protected_files: ["~/.ssh/*"] project_paths: [] namespaces + seccomp # no outbound # read-only # scan target only MACOS sandbox-exec (Seatbelt) WINDOWS AppContainer, experimental Escape hatches: --allow-all-paths, --allow-all-commands, --sandbox=false. Use them only in a throwaway VM or container. DevFest Armenia 2026 · Yerevan 13
  14. STOP 3 · FIX Find Verify Fix Gate PR Four

    steps to a patch STEP 1 STEP 2 STEP 3 STEP 4 Draft Apply Build + test Re-exploit Hosted agent writes a patch candidate To a copy, inside the sandbox Your build.command must pass exploit.sh must now fail cm vcs diff (my run) --- a/src/proxy.ts +++ b/src/proxy.ts pathname.includes('.') + /\.(png|jpg|jpeg|gif|svg|ico|css|js|woff2?)$/i.test(pathname) DevFest Armenia 2026 · Yerevan 14
  15. STOP 3 · FIX Find Verify Fix Gate PR Green

    means two things YOUR TESTS STILL PASS build: command: >npx tsc --noEmit && npm test Runs in the sandbox, offline THE EXPLOIT NO LONGER WORKS $ bash .exploit/exploit.sh # fails, as expected The same proof from stop two THE HONEST PART The regression check is only as good as your tests. And gate on VERIFIED: cm fix also patches EXPLOIT_FAILED findings, with no exploit to re-run. DevFest Armenia 2026 · Yerevan 15
  16. STOP 3 · FIX Find Verify Fix Gate PR Every

    finding has a state OPEN found or imported CM FI X FIXED RESCAN patched + verified REOPENED seen again DISMISSED not exploitable cm report --status OPEN --severity HIGH cm report --format sarif # or html, md, json cm session resume <session-id> DevFest Armenia 2026 · Yerevan 16
  17. STOP 4 · GATE Find Verify Fix Gate PR Gate

    the PR, not the past the pull request check cm find . --diff=origin/main \ --fail-on=CRITICAL,HIGH \ --format=sarif --output=results.sarif \ --sandbox=false --yes --bypass-warning SCOPE LEGACY EXIT 1 Changed lines, plus direct callers and importers (1 hop) [LEGACY / UNTOUCHED] findings are reported, never blocking Only for CRITICAL or HIGH this PR introduced --sandbox=false only on disposable runners: commands get the job's credentials. DevFest Armenia 2026 · Yerevan 17
  18. STOP 5 · PR Find Verify Fix Gate PR The

    fix arrives as a PR PR opened by a developer Scan job diff scan, SARIF to code scanning Autofix job cm fix per finding, one commit each Fix PR on its own branch, into the PR branch Human approves, merges, rescans GITHUB ACTIONS, AS DOCUMENTED Workload Identity Federation: no service account key in GitHub. Fork and Dependabot PRs are skipped. Fix PRs don't trigger workflows on their own: someone with write access approves them. DevFest Armenia 2026 · Yerevan 18
  19. WHERE IT RUNS The pipeline on Google Cloud GitHub PR

    /gcbrun for outsiders Cloud Build aiplatform.user Agent Platform disposable worker CodeMender agent Cloud Storage Cloud Logging SARIF reports build logs ALSO ON CLOUD RUN Google Cloud blog and starter kit: PR ChatOps, one Cloud Run job per finding. Mine: a nightly deep scan as a Cloud Run job. DevFest Armenia 2026 · Yerevan 19
  20. ROLLOUT Climb it one level at a time LEVEL 4

    Audit LEVEL 3 Autofix PRs LEVEL 2 Gate LEVEL 1 Report only Nightly deep scan plus imported findings. Fix PRs into the branch, human approval. Fail on CRITICAL, HIGH introduced by the PR. Diff scan with FAIL_ON empty. Learn the noise. DevFest Armenia 2026 · Yerevan 20
  21. BEFORE YOU TRY IT Read the fine print CYBER MODELS

    Fairwind Program access only, with their own terms. YOUR CODE ONLY Code you own or are authorised to test, or OSI open source. YOUR RESPONSIBILIT Y --yes or confirm_writes: false moves it to you. DATA Session data up to 7 days; DeleteInteraction removes it now. DevFest Armenia 2026 · Yerevan CodeMender docs docs.cloud.google.com/gem ini-enterprise-agent-plat form/agents/codemender 21
  22. DEVFEST ARMENIA · HARTSER? Questions? CodeMender and Google Cloud Goran

    Minov DevFest Armenia 2026 · Yerevan lineargs.dev 22

More Decks by Goran Minov

Other Decks in Technology