<?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: Razu Kc</title>
    <description>The latest articles on DEV Community by Razu Kc (@kcrazy).</description>
    <link>https://dev.to/kcrazy</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%2F136232%2F172f9deb-1e8b-4701-89ca-0fccd9d739d9.jpeg</url>
      <title>DEV Community: Razu Kc</title>
      <link>https://dev.to/kcrazy</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/kcrazy"/>
    <language>en</language>
    <item>
      <title>I pointed capgate at Damn Vulnerable MCP. Here's what it caught — and what it couldn't.</title>
      <dc:creator>Razu Kc</dc:creator>
      <pubDate>Tue, 16 Jun 2026 18:52:58 +0000</pubDate>
      <link>https://dev.to/kcrazy/i-pointed-capgate-at-damn-vulnerable-mcp-heres-what-it-caught-and-what-it-couldnt-52i1</link>
      <guid>https://dev.to/kcrazy/i-pointed-capgate-at-damn-vulnerable-mcp-heres-what-it-caught-and-what-it-couldnt-52i1</guid>
      <description>&lt;p&gt;&lt;em&gt;A capability-compiler meets ten deliberately-broken MCP servers. The honest scorecard: it cleanly stops one class, shrinks the blast radius on several, and is useless against another. Knowing which is which is the whole point.&lt;/em&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Disclosure: I'm the author of &lt;a href="https://github.com/razukc/capgate" rel="noopener noreferrer"&gt;capgate&lt;/a&gt;, the Apache-2.0 sandbox compiler this post puts to the test. The DVMCP project and the other tools mentioned aren't mine; the manifests and compiled output are reproducible from the &lt;a href="https://github.com/razukc/capgate/tree/main/examples/dvmcp" rel="noopener noreferrer"&gt;repo&lt;/a&gt;.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  The setup
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://github.com/harishsg993010/damn-vulnerable-MCP-server" rel="noopener noreferrer"&gt;Damn Vulnerable MCP (DVMCP)&lt;/a&gt; is a teaching project: ten MCP servers, each built to demonstrate one attack — prompt injection, tool poisoning, excessive permission scope, token theft, command injection, and so on. It's the closest thing the ecosystem has to a shared adversarial fixture.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/razukc/capgate" rel="noopener noreferrer"&gt;capgate&lt;/a&gt; is a &lt;em&gt;compile-time&lt;/em&gt; tool. You write a manifest declaring what an MCP server is &lt;em&gt;allowed&lt;/em&gt; to do — &lt;code&gt;fs:read:/workspace/**&lt;/code&gt;, &lt;code&gt;net:connect:api.github.com:443&lt;/code&gt;, nothing else — and it compiles that to a concrete sandbox policy (&lt;code&gt;docker run&lt;/code&gt; flags, bwrap argv, or an egress-proxy config). It does &lt;strong&gt;not&lt;/strong&gt; run anything, watch traffic, or inspect the server's code. It turns a declared capability set into an enforced boundary.&lt;/p&gt;

&lt;p&gt;So this is a fair, falsifiable test: for each DVMCP challenge, I wrote the &lt;em&gt;honest minimum&lt;/em&gt; manifest, compiled it, and asked one question — &lt;strong&gt;does the boundary capgate emits actually stop the attack?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The answer is not "yes" across the board, and the cases where it's "no" are the interesting ones.&lt;/p&gt;

&lt;h2&gt;
  
  
  The bullseye: Challenge 3 — Excessive Permission Scope
&lt;/h2&gt;

&lt;p&gt;The vulnerable tool advertises "read a file from the public directory" and then does this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="nd"&gt;@mcp.tool&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;read_file&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;filename&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;str&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="nb"&gt;str&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="c1"&gt;# VULNERABILITY: doesn't restrict file access to the public directory
&lt;/span&gt;    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;os&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;path&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;exists&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;filename&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;          &lt;span class="c1"&gt;# any absolute path works
&lt;/span&gt;        &lt;span class="k"&gt;with&lt;/span&gt; &lt;span class="nf"&gt;open&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;filename&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;r&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;read&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The private directory next door holds &lt;code&gt;employee_salaries.txt&lt;/code&gt;, &lt;code&gt;acquisition_plans.txt&lt;/code&gt;, and &lt;code&gt;system_credentials.txt&lt;/code&gt; (a live DB password and cloud API keys). A prompt-injected agent just calls &lt;code&gt;read_file("/tmp/dvmcp_challenge3/private/system_credentials.txt")&lt;/code&gt; and walks out with everything.&lt;/p&gt;

&lt;p&gt;The honest manifest — what the tool &lt;em&gt;claims&lt;/em&gt; to need:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nl"&gt;"name"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"read_file"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nl"&gt;"capabilities"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"fs:read:/tmp/dvmcp_challenge3/public/**"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;capgate compiles it (&lt;code&gt;--target docker&lt;/code&gt;) to:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight docker"&gt;&lt;code&gt;--rm --cap-drop ALL --security-opt no-new-privileges --read-only
--network none
--volume /tmp/dvmcp_challenge3/public:/tmp/dvmcp_challenge3/public:ro
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;The attack now fails — not because the path check got better, but because the private directory is not mounted into the container.&lt;/strong&gt; &lt;code&gt;read_file("/tmp/.../private/system_credentials.txt")&lt;/code&gt; returns &lt;em&gt;file not found&lt;/em&gt;, because inside the sandbox that file does not exist. The path-traversal bug is still in the code; capgate made it unreachable. Network is off, the filesystem is read-only, every capability is dropped.&lt;/p&gt;

&lt;p&gt;capgate is loud about one approximation it made here. The output carries a &lt;code&gt;notes[]&lt;/code&gt; entry: &lt;em&gt;"fs: `/tmp/dvmcp_challenge3/public/&lt;/em&gt;&lt;em&gt;&lt;code&gt; lowered to volume mount &lt;/code&gt;/tmp/dvmcp_challenge3/public` — Docker mounts directories, not globs. Fine-grained glob enforcement is the server's job."&lt;/em&gt; The declared capability was a glob; Docker can only mount a directory. capgate grants the &lt;em&gt;directory&lt;/em&gt; and tells you, in the output, that the finer-grained glob is now the server's responsibility, not the sandbox's. That's the pattern for the whole exercise — the boundary is real, and the places it's coarser than the declaration are written down, not hidden.&lt;/p&gt;

&lt;p&gt;This is capgate's bullseye. The vulnerability &lt;em&gt;is&lt;/em&gt; over-broad reach, and a capability boundary is exactly the right shape of answer. One of ten — but it's a clean kill.&lt;/p&gt;

&lt;h2&gt;
  
  
  The contains, not prevents: Challenges 7, 8, 9
&lt;/h2&gt;

&lt;p&gt;These are the honest middle. capgate doesn't stop the bug; it shrinks what the bug can achieve.&lt;/p&gt;

&lt;h3&gt;
  
  
  Challenge 7 — Token Theft → exfiltration blocked at egress
&lt;/h3&gt;

&lt;p&gt;The tool leaks a bearer token and API key into an error string (which flows straight into the LLM context):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;Authorization&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;Bearer&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="n"&gt;email_token&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;access_token&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)}&lt;/span&gt;
&lt;span class="n"&gt;API&lt;/span&gt; &lt;span class="n"&gt;Key&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="n"&gt;email_token&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;api_key&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;capgate can't stop the tool from &lt;em&gt;reading&lt;/em&gt; its own token. What it can do is constrain where that token can &lt;em&gt;go&lt;/em&gt;. The honest manifest declares one egress endpoint, and the &lt;code&gt;--target egress --egress-target squid&lt;/code&gt; output is:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight conf"&gt;&lt;code&gt;&lt;span class="c"&gt;# capgate-egress.squid.conf (generated — do not edit)
&lt;/span&gt;&lt;span class="n"&gt;acl&lt;/span&gt; &lt;span class="n"&gt;to_private&lt;/span&gt; &lt;span class="n"&gt;dst&lt;/span&gt; &lt;span class="m"&gt;10&lt;/span&gt;.&lt;span class="m"&gt;0&lt;/span&gt;.&lt;span class="m"&gt;0&lt;/span&gt;.&lt;span class="m"&gt;0&lt;/span&gt;/&lt;span class="m"&gt;8&lt;/span&gt; &lt;span class="m"&gt;172&lt;/span&gt;.&lt;span class="m"&gt;16&lt;/span&gt;.&lt;span class="m"&gt;0&lt;/span&gt;.&lt;span class="m"&gt;0&lt;/span&gt;/&lt;span class="m"&gt;12&lt;/span&gt; &lt;span class="m"&gt;192&lt;/span&gt;.&lt;span class="m"&gt;168&lt;/span&gt;.&lt;span class="m"&gt;0&lt;/span&gt;.&lt;span class="m"&gt;0&lt;/span&gt;/&lt;span class="m"&gt;16&lt;/span&gt; &lt;span class="m"&gt;127&lt;/span&gt;.&lt;span class="m"&gt;0&lt;/span&gt;.&lt;span class="m"&gt;0&lt;/span&gt;.&lt;span class="m"&gt;0&lt;/span&gt;/&lt;span class="m"&gt;8&lt;/span&gt; &lt;span class="m"&gt;169&lt;/span&gt;.&lt;span class="m"&gt;254&lt;/span&gt;.&lt;span class="m"&gt;0&lt;/span&gt;.&lt;span class="m"&gt;0&lt;/span&gt;/&lt;span class="m"&gt;16&lt;/span&gt; ::&lt;span class="m"&gt;1&lt;/span&gt;/&lt;span class="m"&gt;128&lt;/span&gt; &lt;span class="n"&gt;fc00&lt;/span&gt;::/&lt;span class="m"&gt;7&lt;/span&gt; &lt;span class="n"&gt;fe80&lt;/span&gt;::/&lt;span class="m"&gt;10&lt;/span&gt;
&lt;span class="n"&gt;http_access&lt;/span&gt; &lt;span class="n"&gt;deny&lt;/span&gt; &lt;span class="n"&gt;to_private&lt;/span&gt;
&lt;span class="n"&gt;acl&lt;/span&gt; &lt;span class="n"&gt;cg_dst_0&lt;/span&gt; &lt;span class="n"&gt;dstdomain&lt;/span&gt; &lt;span class="n"&gt;api&lt;/span&gt;.&lt;span class="n"&gt;emailpro&lt;/span&gt;.&lt;span class="n"&gt;com&lt;/span&gt;
&lt;span class="n"&gt;acl&lt;/span&gt; &lt;span class="n"&gt;cg_port_0&lt;/span&gt; &lt;span class="n"&gt;port&lt;/span&gt; &lt;span class="m"&gt;443&lt;/span&gt;
&lt;span class="n"&gt;http_access&lt;/span&gt; &lt;span class="n"&gt;allow&lt;/span&gt; &lt;span class="n"&gt;cg_dst_0&lt;/span&gt; &lt;span class="n"&gt;cg_port_0&lt;/span&gt; &lt;span class="n"&gt;CONNECT&lt;/span&gt;
&lt;span class="n"&gt;http_access&lt;/span&gt; &lt;span class="n"&gt;deny&lt;/span&gt; &lt;span class="n"&gt;all&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A poisoned tool that tries to POST the token to &lt;code&gt;attacker.example.com&lt;/code&gt; is refused at the proxy — the allowlist contains exactly one host, and the config ends in an unconditional &lt;code&gt;deny all&lt;/code&gt;. The classic prompt-injection-to-exfiltration chain is broken at the network boundary.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Honest caveat, stated plainly:&lt;/strong&gt; the token still reaches the model's context, and if an attacker can smuggle it out through the &lt;em&gt;one allowed channel&lt;/em&gt; (a crafted request to &lt;code&gt;api.emailpro.com&lt;/code&gt; itself), capgate does not see it. It closes the broad exfil path, not every conceivable one. (A second honesty note: DVMCP stores these tokens in a world-readable file; a faithful capgate manifest would never grant &lt;code&gt;fs&lt;/code&gt; access to that file, so the tool couldn't read it at all. The egress allowlist is the backstop for when the secret legitimately lives in the process.)&lt;/p&gt;

&lt;h3&gt;
  
  
  Challenge 8 — Malicious Code Execution → boxed, not blocked
&lt;/h3&gt;

&lt;p&gt;This one exposes a real limit of the grammar, and it's worth being loud about. The tool is:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="nd"&gt;@mcp.tool&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;execute_shell_command&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;command&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;str&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="nb"&gt;str&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;result&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;subprocess&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;check_output&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;command&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;shell&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="bp"&gt;True&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;...)&lt;/span&gt;   &lt;span class="c1"&gt;# arbitrary shell
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;capgate's capability grammar cannot express "run arbitrary shell."&lt;/strong&gt; &lt;code&gt;exec&lt;/code&gt; is basename-only (&lt;code&gt;exec:spawn:git&lt;/code&gt;), by design — there is no &lt;code&gt;exec:spawn:*&lt;/code&gt;. So you &lt;em&gt;cannot&lt;/em&gt; write an honest manifest that grants this tool what it actually does. capgate's own docs say it: &lt;em&gt;"a manifest that under-declares is a bug in the manifest."&lt;/em&gt; capgate will not make a shell-exec tool safe, and it doesn't pretend to.&lt;/p&gt;

&lt;p&gt;What it does instead is contain the blast radius of the surrounding server. Compile the &lt;em&gt;legitimate&lt;/em&gt; tools (&lt;code&gt;get_system_info&lt;/code&gt;, &lt;code&gt;analyze_log_file&lt;/code&gt;) and you get:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight docker"&gt;&lt;code&gt;--rm --cap-drop ALL --security-opt no-new-privileges --read-only
--network none
--volume /tmp/dvmcp_challenge8/logs:/tmp/dvmcp_challenge8/logs:ro
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If &lt;code&gt;execute_shell_command&lt;/code&gt; ships anyway and fires, it runs inside &lt;em&gt;that&lt;/em&gt; box: no network, no Linux capabilities, read-only rootfs, no injected secrets, only the logs directory visible. Successful RCE that can't reach the network, can't escalate, and can't see a credential is a dramatically smaller incident. That's defense-in-depth — explicitly &lt;em&gt;not&lt;/em&gt; prevention.&lt;/p&gt;

&lt;h3&gt;
  
  
  Challenge 9 — Command Injection → private ranges blocked, public egress can't be
&lt;/h3&gt;

&lt;p&gt;&lt;code&gt;network_diagnostic(target, options)&lt;/code&gt; pipes user input straight into &lt;code&gt;shell=True&lt;/code&gt;. It's a network tool, so the honest manifest must grant &lt;code&gt;net:connect:*&lt;/code&gt; — and capgate is honest about what that costs:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nl"&gt;"egress"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[{&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nl"&gt;"host"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"*"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nl"&gt;"port"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kc"&gt;null&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nl"&gt;"blockPrivate"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;}]&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A wildcard host means the egress &lt;em&gt;allowlist&lt;/em&gt; can't help — you can't allowlist "everywhere." But &lt;code&gt;blockPrivate&lt;/code&gt; is automatically set, and the &lt;code&gt;nftables&lt;/code&gt; target enforces it in-kernel:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight conf"&gt;&lt;code&gt;&lt;span class="n"&gt;table&lt;/span&gt; &lt;span class="n"&gt;inet&lt;/span&gt; &lt;span class="n"&gt;capgate&lt;/span&gt; {
  &lt;span class="n"&gt;chain&lt;/span&gt; &lt;span class="n"&gt;egress&lt;/span&gt; {
    &lt;span class="n"&gt;type&lt;/span&gt; &lt;span class="n"&gt;filter&lt;/span&gt; &lt;span class="n"&gt;hook&lt;/span&gt; &lt;span class="n"&gt;output&lt;/span&gt; &lt;span class="n"&gt;priority&lt;/span&gt; &lt;span class="m"&gt;0&lt;/span&gt;; &lt;span class="n"&gt;policy&lt;/span&gt; &lt;span class="n"&gt;drop&lt;/span&gt;;
    &lt;span class="n"&gt;ip&lt;/span&gt; &lt;span class="n"&gt;daddr&lt;/span&gt; { &lt;span class="m"&gt;10&lt;/span&gt;.&lt;span class="m"&gt;0&lt;/span&gt;.&lt;span class="m"&gt;0&lt;/span&gt;.&lt;span class="m"&gt;0&lt;/span&gt;/&lt;span class="m"&gt;8&lt;/span&gt;, &lt;span class="m"&gt;172&lt;/span&gt;.&lt;span class="m"&gt;16&lt;/span&gt;.&lt;span class="m"&gt;0&lt;/span&gt;.&lt;span class="m"&gt;0&lt;/span&gt;/&lt;span class="m"&gt;12&lt;/span&gt;, &lt;span class="m"&gt;192&lt;/span&gt;.&lt;span class="m"&gt;168&lt;/span&gt;.&lt;span class="m"&gt;0&lt;/span&gt;.&lt;span class="m"&gt;0&lt;/span&gt;/&lt;span class="m"&gt;16&lt;/span&gt;, &lt;span class="m"&gt;127&lt;/span&gt;.&lt;span class="m"&gt;0&lt;/span&gt;.&lt;span class="m"&gt;0&lt;/span&gt;.&lt;span class="m"&gt;0&lt;/span&gt;/&lt;span class="m"&gt;8&lt;/span&gt;, &lt;span class="m"&gt;169&lt;/span&gt;.&lt;span class="m"&gt;254&lt;/span&gt;.&lt;span class="m"&gt;0&lt;/span&gt;.&lt;span class="m"&gt;0&lt;/span&gt;/&lt;span class="m"&gt;16&lt;/span&gt; } &lt;span class="n"&gt;drop&lt;/span&gt;
    ...
  }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;So command injection still runs, and still reaches the public internet — but it &lt;em&gt;cannot&lt;/em&gt; pivot to &lt;code&gt;169.254.169.254&lt;/code&gt; (cloud metadata), &lt;code&gt;127.0.0.1&lt;/code&gt; (local services), or RFC1918 internal hosts. And capgate refuses to fake the rest: the wildcard rule shows up in an &lt;code&gt;unenforceable[]&lt;/code&gt; field with the reason &lt;em&gt;"nftables filters IPs, not hostnames; '&lt;/em&gt;' cannot be expressed as an IP allowlist. Use the 'squid' target for wildcard/hostname rules."* It tells you what it can't do — and where to go instead — rather than silently dropping it.&lt;/p&gt;

&lt;h2&gt;
  
  
  The honest miss: Challenge 1 — Basic Prompt Injection
&lt;/h2&gt;

&lt;p&gt;The Challenge 1 tool has no teeth at all — it reads an in-memory dictionary:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="nd"&gt;@mcp.tool&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;get_user_info&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;username&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;str&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="nb"&gt;str&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;users&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;admin&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;System administrator with full access&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;...}&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;User information for &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;username&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s"&gt;: &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;users&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;username&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The attack isn't about what the tool &lt;em&gt;reaches&lt;/em&gt;. It's about convincing the model, through injected text, to ignore its instructions. The honest manifest is empty (&lt;code&gt;"capabilities": []&lt;/code&gt;), and capgate compiles it to the most locked-down sandbox it can produce:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight docker"&gt;&lt;code&gt;--rm --cap-drop ALL --security-opt no-new-privileges --read-only --tmpfs /tmp --network none
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;And the prompt injection still works, completely.&lt;/strong&gt; capgate constrains what a tool is allowed to &lt;em&gt;do&lt;/em&gt;; it has nothing to say about whether the LLM can be &lt;em&gt;talked into&lt;/em&gt; doing it. Challenges 1, 2 (tool poisoning), and 6 (indirect injection) all live at the model layer, and a capability compiler is the wrong instrument for all three. It shrinks the blast radius if those attacks then try to &lt;em&gt;reach&lt;/em&gt; something — but it does not prevent the manipulation itself.&lt;/p&gt;

&lt;p&gt;Anyone who tells you a sandbox compiler stops prompt injection is selling you something. It doesn't. It makes prompt injection &lt;em&gt;less useful&lt;/em&gt; by capping what the hijacked tools can touch.&lt;/p&gt;

&lt;h2&gt;
  
  
  The scorecard
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;#&lt;/th&gt;
&lt;th&gt;Challenge&lt;/th&gt;
&lt;th&gt;capgate's effect&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;td&gt;Basic Prompt Injection&lt;/td&gt;
&lt;td&gt;❌ Doesn't prevent (model layer) — only caps blast radius&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;2&lt;/td&gt;
&lt;td&gt;Tool Poisoning&lt;/td&gt;
&lt;td&gt;❌ Doesn't prevent (model layer) — only caps blast radius&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;3&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;Excessive Permission Scope&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;✅ &lt;strong&gt;Prevents&lt;/strong&gt; — the bullseye&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;4&lt;/td&gt;
&lt;td&gt;Rug Pull&lt;/td&gt;
&lt;td&gt;◐ The declared capability set is the contract drift violates; &lt;code&gt;assert:&lt;/code&gt; records it. No runtime enforcement in v0.0.x&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;5&lt;/td&gt;
&lt;td&gt;Tool Shadowing&lt;/td&gt;
&lt;td&gt;— Out of scope (naming/registry)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;6&lt;/td&gt;
&lt;td&gt;Indirect Prompt Injection&lt;/td&gt;
&lt;td&gt;❌ Doesn't prevent (model layer) — only caps blast radius&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;7&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;Token Theft&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;◐ &lt;strong&gt;Contains&lt;/strong&gt; — egress allowlist blocks exfil; token still readable&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;8&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;Malicious Code Execution&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;◐ &lt;strong&gt;Contains&lt;/strong&gt; — can't express shell-exec; boxes the blast radius&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;9&lt;/td&gt;
&lt;td&gt;
&lt;strong&gt;Remote Access Control&lt;/strong&gt; (cmd injection)&lt;/td&gt;
&lt;td&gt;◐ &lt;strong&gt;Contains&lt;/strong&gt; — blocks private ranges; can't allowlist public egress for a net tool&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;10&lt;/td&gt;
&lt;td&gt;Multi-Vector&lt;/td&gt;
&lt;td&gt;◐ Partial — depends on the chain&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;One clean prevention. Four meaningful containments. Three honest misses. Two out-of-scope.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;That is the real shape of a capability compiler against a real adversarial corpus. It is not a silver bullet, and the cases it can't touch are exactly the cases the rest of the MCP-security stack (scanners, runtime monitors, the model's own defenses) exists to cover. capgate is one layer. It happens to be the layer that turns "this server can reach your whole disk and the open internet" into "this server can reach one directory, read-only, and one host" — and that boundary lives in a file you can review in a pull request before the server ever runs.&lt;/p&gt;

&lt;p&gt;A static scanner like NVIDIA's SkillSpector lives one layer up: its least-privilege checks would flag Challenge 3 at review time — the tool's code reaches past its declaration, which trips an "underdeclared capability" rule before you ever install. But flagging the mismatch and enforcing the honest declaration are different jobs. A scanner tells you the manifest is dishonest; capgate makes an honest manifest &lt;em&gt;binding&lt;/em&gt; — it confirms &lt;code&gt;fs:read:/tmp/dvmcp_challenge3/public/**&lt;/code&gt; was declared, but only the compiled mount stops the tool reading the private directory anyway. You want both, and they don't substitute for each other.&lt;/p&gt;

&lt;h2&gt;
  
  
  Reproduce it
&lt;/h2&gt;

&lt;p&gt;The five capability manifests live in &lt;a href="https://github.com/razukc/capgate/tree/main/examples/dvmcp" rel="noopener noreferrer"&gt;&lt;code&gt;examples/dvmcp/&lt;/code&gt;&lt;/a&gt; in the capgate repo. Every policy above is the &lt;code&gt;argv&lt;/code&gt;/&lt;code&gt;config&lt;/code&gt; payload from &lt;code&gt;capgate@0.0.3&lt;/code&gt; — the CLI prints a JSON envelope (&lt;code&gt;{ "argv": [...], "egress": [...], "notes": [...] }&lt;/code&gt;); the blocks above show the payload, and I call out the &lt;code&gt;notes[]&lt;/code&gt;/&lt;code&gt;unenforceable[]&lt;/code&gt; fields explicitly where they matter, because those honest edges are the point. Run it yourself from the repo root (&lt;code&gt;npm install &amp;amp;&amp;amp; npm run build&lt;/code&gt;):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;node dist/cli.js compile examples/dvmcp/challenge3-excessive-permission.json &lt;span class="nt"&gt;--target&lt;/span&gt; docker &lt;span class="nt"&gt;--pretty&lt;/span&gt;
node dist/cli.js compile examples/dvmcp/challenge7-token-theft.json &lt;span class="nt"&gt;--target&lt;/span&gt; egress &lt;span class="nt"&gt;--egress-target&lt;/span&gt; squid &lt;span class="nt"&gt;--pretty&lt;/span&gt;
node dist/cli.js compile examples/dvmcp/challenge9-command-injection.json &lt;span class="nt"&gt;--target&lt;/span&gt; egress &lt;span class="nt"&gt;--egress-target&lt;/span&gt; nftables &lt;span class="nt"&gt;--pretty&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If you run MCP servers and decide their capability boundary by hand today — a devcontainer here, a mount list there — I'd genuinely like to know where that decision lives for you, and what it costs. That's the actual open question this whole exercise is circling.&lt;/p&gt;

</description>
      <category>mcp</category>
      <category>security</category>
      <category>sandbox</category>
      <category>ai</category>
    </item>
    <item>
      <title>Compile-time vs runtime: where MCP security actually lives</title>
      <dc:creator>Razu Kc</dc:creator>
      <pubDate>Tue, 12 May 2026 10:46:36 +0000</pubDate>
      <link>https://dev.to/kcrazy/compile-time-vs-runtime-where-mcp-security-actually-lives-1g6l</link>
      <guid>https://dev.to/kcrazy/compile-time-vs-runtime-where-mcp-security-actually-lives-1g6l</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Update (2026-05-29):&lt;/strong&gt; The four-layer decomposition below is still useful as a procurement checklist — &lt;em&gt;do we have a story for each of these four points in the lifecycle?&lt;/em&gt; — and that's the job it does best. For &lt;em&gt;classifying&lt;/em&gt; tools and projects, I've since moved to a tighter three-way working model: static technical, static governance, dynamic attestation. The current write-up of that framing is here: &lt;a href="https://razukc.github.io/capgate/positioning/" rel="noopener noreferrer"&gt;A working map of MCP security tools&lt;/a&gt;. If you've landed on this post via search, read both — they answer different questions about the same space.&lt;/p&gt;

&lt;p&gt;Disclosure: I represent &lt;a href="https://github.com/razukc/capgate" rel="noopener noreferrer"&gt;capgate&lt;/a&gt;, a compile-time policy compiler for MCP servers. capgate appears as the worked example in the compile-time section. The other three sections describe categories, not specific products.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;If you run a Model Context Protocol (MCP) server in production, you've probably noticed that "MCP security" doesn't mean one thing. It means at least four things, sitting at different points in the lifecycle of a tool call, solving different problems. Most teams I've talked to need two or three of them. Almost none of them realize that until they've shipped the wrong one first.&lt;/p&gt;

&lt;p&gt;This is a positioning post. The goal isn't to argue that any one layer is best — it's to give you a way to figure out which layer your team actually needs, so you stop bolting the wrong tool onto the wrong problem.&lt;/p&gt;

&lt;h2&gt;
  
  
  The four layers
&lt;/h2&gt;

&lt;p&gt;A tool call through an MCP server passes through, conceptually, four points where security work can happen:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;manifest → [1] compile-time policy → [2] sandbox runtime → [3] tool invocation → [4] decision log
              emission                 inspection             gateway / auth        signed receipts
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Each of these is its own discipline with its own tooling and its own people who care deeply about it. Lumping them together as "MCP security" is what causes teams to evaluate one tool for a problem it doesn't solve.&lt;/p&gt;

&lt;h3&gt;
  
  
  1. Compile-time policy emission
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;What it does.&lt;/strong&gt; Reads the MCP server's manifest &lt;em&gt;before&lt;/em&gt; the server runs and emits a concrete sandbox policy — &lt;code&gt;bwrap&lt;/code&gt; argv, &lt;code&gt;docker run&lt;/code&gt; flags, an egress allowlist, a list of environment variables the server is allowed to see. The output is a static artifact. It does not execute, does not speak MCP on the wire, does not watch traffic.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The argument for it.&lt;/strong&gt; Most sandboxes a team actually runs are hand-written: someone reads the README, makes their best guess at what the server needs, and writes &lt;code&gt;--cap-drop ALL --network host --volume ...&lt;/code&gt; from memory. That hand-written sandbox is the &lt;em&gt;de facto&lt;/em&gt; security policy for the server, and it's invisible to code review. A compile-time policy makes the sandbox a reviewable artifact: it lives in the repo, it changes when the manifest changes, and it can be diffed in a PR.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;When you'd reach for it.&lt;/strong&gt; Your team runs more than two or three MCP servers, the people running them aren't the people who wrote them, and "what is this server allowed to do?" is a question that has to be answerable from the repo, not from someone's memory.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Concrete example.&lt;/strong&gt; Here's a minimal manifest and the policy capgate emits for it:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;compile&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;lowerToDocker&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;capgate&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;docker&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;lowerToDocker&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;compile&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
  &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;my-server&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;version&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;0.1.0&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;tools&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[{&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;read_file&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;capabilities&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;fs:read:/workspace/**&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="p"&gt;}],&lt;/span&gt;
&lt;span class="p"&gt;}));&lt;/span&gt;

&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;docker&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;argv&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;join&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt; &lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;
&lt;span class="c1"&gt;// → --rm --cap-drop ALL --security-opt no-new-privileges --read-only&lt;/span&gt;
&lt;span class="c1"&gt;//   --tmpfs /tmp --network none --volume /workspace:/workspace:ro&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;One capability in, one container policy out. The server declared no network → &lt;code&gt;--network none&lt;/code&gt;. Read-only filesystem declared → &lt;code&gt;:ro&lt;/code&gt; mount. No environment variables declared → none cross the boundary. A real manifest with several tools merges per-tool capabilities into a server-level policy.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The limits.&lt;/strong&gt; Compile-time emission doesn't watch what the server actually does. It enforces what was &lt;em&gt;declared&lt;/em&gt;. A manifest that under-declares is silently over-granted at runtime; that bug lives in the manifest, not the compiler. If you need to catch a server doing something its manifest didn't say it would, that's layer 2.&lt;/p&gt;

&lt;h3&gt;
  
  
  2. Runtime sandbox inspection
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;What it does.&lt;/strong&gt; Watches the MCP server as it runs, inspects its tool definitions and call traces against a catalog of known threat techniques, and surfaces risky behavior — prompt injection patterns in tool descriptions, indirect tool-chaining, unexpected outbound calls.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The argument for it.&lt;/strong&gt; You did not write this server. You found it on a registry, or a vendor handed it to you, or your CI agent installed it. You don't know what its tool descriptions look like. You don't know whether one of its tools chains into another in a way the author didn't anticipate. You want a sensor in the path that says "this looks wrong" — preferably one that maps what it sees onto a recognized taxonomy (STRIDE, MITRE ATT&amp;amp;CK, OWASP LLM Top 10) so your security team can interpret the signal.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;When you'd reach for it.&lt;/strong&gt; Your threat model assumes the server &lt;em&gt;might&lt;/em&gt; be adversarial or buggy in ways its manifest doesn't reveal. Common cases: third-party servers, large in-house catalogs of servers you can't deeply audit, regulated environments where "we have a sensor watching for X" is a compliance requirement.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The limits.&lt;/strong&gt; Runtime inspection catches what's already happening. By the time the sensor sees the suspicious outbound request, the request has been made. It's a detection layer, not a prevention layer. Most teams that adopt runtime inspection also have layer 1 (compile-time policy) running underneath it — the sandbox prevents the bulk of the bad things, and inspection catches what gets through the gaps in declaration coverage.&lt;/p&gt;

&lt;h3&gt;
  
  
  3. API gateway / per-request authorization
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;What it does.&lt;/strong&gt; Sits in front of the MCP server as a network proxy. Every request from the agent to a tool passes through it, and the gateway decides — based on identity, headers, role, policy rules — whether that request is allowed. This is the same shape as a regular service mesh, applied to MCP traffic.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The argument for it.&lt;/strong&gt; Your concern isn't &lt;em&gt;what the server can do&lt;/em&gt;. Your concern is &lt;em&gt;who is asking it to do things&lt;/em&gt;. You have multiple agents, multiple users, multiple environments hitting the same MCP server, and the right thing to enforce is &lt;em&gt;"developer Alice can call &lt;code&gt;apply_patch&lt;/code&gt;, but the deploy agent can only call &lt;code&gt;search_code&lt;/code&gt;"&lt;/em&gt; — a per-caller policy, not a per-server one. This is identity-and-access work, and the mature tooling for it is exactly the kind of API-gateway / authorization-proxy software that solved the same problem for HTTP APIs ten years ago.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;When you'd reach for it.&lt;/strong&gt; Multiple callers share an MCP server, and the boundary you care about is between &lt;em&gt;callers&lt;/em&gt;, not between &lt;em&gt;the server and the host&lt;/em&gt;. Your security team already runs an authorization gateway for everything else; extending it to MCP is cheaper than evaluating a new category.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The limits.&lt;/strong&gt; A gateway can stop a call before it reaches the server. It can't stop the server, once invoked, from doing something the gateway didn't anticipate. If the agent is allowed to call &lt;code&gt;read_file('/etc/passwd')&lt;/code&gt;, the gateway authorized that call; the sandbox in layer 1 is what prevents the underlying read from succeeding.&lt;/p&gt;

&lt;h3&gt;
  
  
  4. Decision logs / signed receipts
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;What it does.&lt;/strong&gt; Cryptographically logs each tool invocation — what was called, with what arguments, by whom, with what result. The log is tamper-evident: a downstream auditor can verify, weeks later, that the recorded history hasn't been edited.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The argument for it.&lt;/strong&gt; This is for environments where "we need a trustworthy record of what the agent did" is a hard requirement — regulated industries, agents that touch financial state, anything where the conversation with the auditor begins with &lt;em&gt;"prove to me this didn't happen."&lt;/em&gt; It's the audit-trail layer, and it doesn't make sense to evaluate it for the same reasons you'd evaluate layers 1-3. It solves a different problem.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;When you'd reach for it.&lt;/strong&gt; Your compliance posture requires a verifiable record of agent actions. Or you're building tooling for &lt;em&gt;other people's&lt;/em&gt; agents and you need to give &lt;em&gt;them&lt;/em&gt; a way to prove what their agents did. Or you're sufficiently far ahead of the curve that you're trying to build the artifact regulators will eventually ask for.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The limits.&lt;/strong&gt; Receipts prove what happened. They don't prevent anything. A signed log of an agent exfiltrating a secret is still a log of an agent exfiltrating a secret. Like layer 2, this is almost always run &lt;em&gt;alongside&lt;/em&gt; layer 1, not instead of it.&lt;/p&gt;

&lt;h2&gt;
  
  
  A decision matrix
&lt;/h2&gt;

&lt;p&gt;If you're trying to figure out which layer to invest in first, the question I'd ask is:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Question you're asking&lt;/th&gt;
&lt;th&gt;Layer that answers it&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;"What is this server &lt;em&gt;allowed&lt;/em&gt; to do?"&lt;/td&gt;
&lt;td&gt;1 — compile-time policy&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;"What is this server &lt;em&gt;actually&lt;/em&gt; doing right now?"&lt;/td&gt;
&lt;td&gt;2 — runtime inspection&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;"Who is allowed to call which tool?"&lt;/td&gt;
&lt;td&gt;3 — API gateway&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;"What did the agent do, and can we prove it?"&lt;/td&gt;
&lt;td&gt;4 — decision logs&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Most production teams running MCP servers at scale end up with layers 1 + 2, or 1 + 3, or 1 + 4. Layer 1 is the load-bearing one — it prevents the bulk of bad outcomes by construction. The others are sensors and policy controls that ride on top of that prevention.&lt;/p&gt;

&lt;p&gt;The wrong answer is buying a layer-2 product because &lt;em&gt;"we need MCP security"&lt;/em&gt; and then discovering six months later that you never wrote a sandbox underneath it, so the sensor is logging the smoke from fires you could have prevented.&lt;/p&gt;

&lt;h2&gt;
  
  
  What this means for tool selection
&lt;/h2&gt;

&lt;p&gt;The reason it's worth being precise about these four layers is that the tools in this space are, by and large, &lt;em&gt;not&lt;/em&gt; trying to do all four. The honest ones are explicit about which layer they live at. The ones to be cautious of are the ones that pitch themselves as "MCP security" without telling you which layer.&lt;/p&gt;

&lt;p&gt;When you're evaluating something in this space, the first question to ask is: &lt;em&gt;which of the four does this live at?&lt;/em&gt; If the answer is "all of them," push harder — usually it means one of the four is the actual product and the rest are marketing. There's nothing wrong with focused tools; the wrong shape is a tool that pretends to cover layers it doesn't.&lt;/p&gt;

&lt;h2&gt;
  
  
  Where this is going
&lt;/h2&gt;

&lt;p&gt;The four layers will look more distinct, not less, as the MCP ecosystem matures. Right now most teams pick one tool and accept that it's covering 60% of what they need. In a year, expect to see specialized tools at each layer, expect to see them composed, and expect the question "which layer is this?" to be the first one in any procurement conversation.&lt;/p&gt;

&lt;p&gt;If you're picking a layer to start with, start with layer 1. It's the cheapest prevention and the foundation everything else assumes is in place.&lt;/p&gt;




&lt;p&gt;Please feel free to leave questions for me in the comments.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;capgate is open source under Apache 2.0. If you're running MCP servers in production and want to compare what your hand-written sandbox grants vs what a manifest-derived policy would, the &lt;a href="https://github.com/razukc/capgate" rel="noopener noreferrer"&gt;repo&lt;/a&gt; has a CLI you can point at a manifest in 30 seconds.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>mcp</category>
      <category>security</category>
      <category>sandbox</category>
      <category>ai</category>
    </item>
    <item>
      <title>extn — A Modern CLI Framework for Building Chrome Extensions (with HMR + Live Preview)</title>
      <dc:creator>Razu Kc</dc:creator>
      <pubDate>Fri, 14 Nov 2025 20:00:47 +0000</pubDate>
      <link>https://dev.to/kcrazy/extn-a-modern-cli-framework-for-building-chrome-extensions-with-hmr-live-preview-2hmk</link>
      <guid>https://dev.to/kcrazy/extn-a-modern-cli-framework-for-building-chrome-extensions-with-hmr-live-preview-2hmk</guid>
      <description>&lt;p&gt;I’m excited to introduce &lt;strong&gt;extn&lt;/strong&gt; — a TypeScript-first CLI framework that makes building Chrome extensions fast, modern, and effortless. If you’ve ever been stuck in the cycle of manually reloading &lt;code&gt;chrome://extensions&lt;/code&gt; after every tiny file change… this tool is for you.&lt;/p&gt;

&lt;p&gt;👉 &lt;strong&gt;GitHub Repo:&lt;/strong&gt; &lt;a href="https://github.com/razukc/extn" rel="noopener noreferrer"&gt;https://github.com/razukc/extn&lt;/a&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  🌟 Why extn?
&lt;/h2&gt;

&lt;p&gt;Building browser extensions is often painful — outdated boilerplate, complex manifest setup, and no good local dev environment.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;extn&lt;/strong&gt; fixes this by giving you:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;⚡ &lt;strong&gt;Hot Module Replacement (HMR)&lt;/strong&gt; for instant updates
&lt;/li&gt;
&lt;li&gt;🧪 &lt;strong&gt;Live Preview&lt;/strong&gt; — automatically opens Chrome with your extension loaded
&lt;/li&gt;
&lt;li&gt;📦 &lt;strong&gt;Templates&lt;/strong&gt; for Vanilla TS, React TS, and Vue TS
&lt;/li&gt;
&lt;li&gt;🏗️ &lt;strong&gt;Production-ready scaffolding&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;🔒 &lt;strong&gt;Manifest v3 validation&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;🛠️ &lt;strong&gt;Vite-powered builds&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;🧹 &lt;strong&gt;No more manual reloading&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Everything works out of the box.&lt;/p&gt;




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




&lt;h2&gt;
  
  
  🚀 Quick Start
&lt;/h2&gt;

&lt;p&gt;Get started in one minute:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npx extn create my-extension

&lt;span class="nb"&gt;cd &lt;/span&gt;my-extension
npm &lt;span class="nb"&gt;install
&lt;/span&gt;npm run dev
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This will:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;start a development server
&lt;/li&gt;
&lt;li&gt;build your extension
&lt;/li&gt;
&lt;li&gt;auto-load it in Chrome
&lt;/li&gt;
&lt;li&gt;open DevTools
&lt;/li&gt;
&lt;li&gt;apply updates instantly with HMR
&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  📁 Project Structure
&lt;/h2&gt;

&lt;p&gt;After running &lt;code&gt;extn create&lt;/code&gt;, you get:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;my-extension/
├── src/
│   ├── popup/
│   │   ├── popup.html
│   │   ├── popup.js
│   │   └── styles.css
│   ├── background/
│   │   └── background.js
│   └── content/
│       └── content.js
├── public/
│   └── icons/
├── manifest.json
├── package.json
├── vite.config.js
└── tsconfig.json
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If you select React or Vue templates, those files are included automatically.&lt;/p&gt;




&lt;h2&gt;
  
  
  💡 Why I Built extn
&lt;/h2&gt;

&lt;p&gt;While working on browser-based tools, I constantly found Chrome extension development to be:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;slow (manual reloads)
&lt;/li&gt;
&lt;li&gt;fragmented
&lt;/li&gt;
&lt;li&gt;outdated
&lt;/li&gt;
&lt;li&gt;hard to iterate quickly
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;So I built &lt;strong&gt;extn&lt;/strong&gt; to deliver:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;a modern workflow
&lt;/li&gt;
&lt;li&gt;instant feedback with HMR
&lt;/li&gt;
&lt;li&gt;clean TypeScript setup
&lt;/li&gt;
&lt;li&gt;framework flexibility
&lt;/li&gt;
&lt;li&gt;MV3 done right
&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  🗺️ Roadmap
&lt;/h2&gt;

&lt;p&gt;Upcoming features:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Svelte template support
&lt;/li&gt;
&lt;li&gt;Firefox + Edge packaging
&lt;/li&gt;
&lt;li&gt;More example templates
&lt;/li&gt;
&lt;li&gt;Chrome Web Store publishing helper
&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  🤝 Try It / Contribute
&lt;/h2&gt;

&lt;p&gt;If you’re building Chrome (or Chromium) extensions and want a smooth development experience, check out the repo:&lt;/p&gt;

&lt;p&gt;👉 &lt;strong&gt;&lt;a href="https://github.com/razukc/extn" rel="noopener noreferrer"&gt;https://github.com/razukc/extn&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Feedback, issues, and PRs are welcome!&lt;/p&gt;




</description>
      <category>browser</category>
      <category>chrome</category>
      <category>extensions</category>
      <category>framework</category>
    </item>
  </channel>
</rss>
