<?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: Ziqi</title>
    <description>The latest articles on DEV Community by Ziqi (@sinoziqi).</description>
    <link>https://dev.to/sinoziqi</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%2F4244162%2F48d93aa7-afdf-4b23-8ca1-aa338903699f.jpg</url>
      <title>DEV Community: Ziqi</title>
      <link>https://dev.to/sinoziqi</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/sinoziqi"/>
    <language>en</language>
    <item>
      <title>Isolating Autonomous AI Coding Sandboxes &amp; Fixing Tailscale Subnet Collisions (nftables, macOS pf, 4via6 &amp; MCP)</title>
      <dc:creator>Ziqi</dc:creator>
      <pubDate>Sat, 14 Nov 2026 15:35:33 +0000</pubDate>
      <link>https://dev.to/sinoziqi/isolating-autonomous-ai-coding-sandboxes-fixing-tailscale-subnet-collisions-nftables-macos-pf-ifp</link>
      <guid>https://dev.to/sinoziqi/isolating-autonomous-ai-coding-sandboxes-fixing-tailscale-subnet-collisions-nftables-macos-pf-ifp</guid>
      <description>&lt;p&gt;Autonomous AI coding agents (Claude Code, Cursor background agents, containerized SWE sandboxes) are increasingly given raw shell execution inside cloud VMs, Docker containers, or Tailscale-joined workstations. Left unguarded, two predictable failure modes show up fast:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;AI Sandbox SSRF &amp;amp; Lateral Movement&lt;/strong&gt;: An unisolated coding agent can query cloud instance metadata (&lt;code&gt;169.254.169.254&lt;/code&gt; / &lt;code&gt;fd00:ec2::254&lt;/code&gt;) to harvest IAM credentials, probe private &lt;code&gt;192.168.0.0/16&lt;/code&gt; or &lt;code&gt;100.64.0.0/10&lt;/code&gt; peers over TCP &lt;code&gt;:22&lt;/code&gt; SSH / &lt;code&gt;:2375&lt;/code&gt; Docker / &lt;code&gt;:5432&lt;/code&gt; Postgres, or collide on shared Tailscale &lt;code&gt;NodeKey&lt;/code&gt; state across container restarts.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;RFC 1918 Wi-Fi Collisions &amp;amp; Selective QUIC Stalls&lt;/strong&gt;: Advertising raw &lt;code&gt;/24&lt;/code&gt; LAN routes over Tailscale breaks silently whenever a hotel or coffee-shop Wi-Fi shares your home prefix, while throttled &lt;code&gt;UDP/443&lt;/code&gt; proxy tunnels in &lt;code&gt;Sing-box&lt;/code&gt; or &lt;code&gt;Mihomo&lt;/code&gt; stall Apple Media and mobile Gmail fetches for 50 seconds—yet blocking &lt;code&gt;UDP/443&lt;/code&gt; globally breaks YouTube mobile (&lt;code&gt;Cronet&lt;/code&gt; HTTP/3) captions.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;To eliminate these failure modes deterministically across Linux, macOS, and Tailscale without external dependencies, I built and open-sourced &lt;strong&gt;&lt;a href="https://github.com/Ziqi/starhub-kit" rel="noopener noreferrer"&gt;StarHub Kit (&lt;code&gt;v1.3.0&lt;/code&gt;)&lt;/a&gt;&lt;/strong&gt; — a zero-dependency Python 3.9+ policy compiler and native &lt;strong&gt;Model Context Protocol (&lt;code&gt;MCP&lt;/code&gt;)&lt;/strong&gt; server certified &lt;strong&gt;Linux Foundation OpenSSF Best Practices Silver (&lt;code&gt;#16658&lt;/code&gt;)&lt;/strong&gt; with &lt;strong&gt;SLSA Build Level 3&lt;/strong&gt; provenance.&lt;/p&gt;




&lt;h2&gt;
  
  
  1. Turnkey Autonomous AI Agent Sandbox Isolation (&lt;code&gt;--profile ai-sandbox&lt;/code&gt;)
&lt;/h2&gt;

&lt;p&gt;Instead of hand-maintaining brittle firewall shell scripts across OSes, a single declarative topology (&lt;code&gt;profiles/topology.ai-sandbox.json&lt;/code&gt;) compiles into &lt;strong&gt;Linux &lt;code&gt;nftables&lt;/code&gt; (&lt;code&gt;inet&lt;/code&gt;)&lt;/strong&gt;, &lt;strong&gt;&lt;code&gt;macOS pf&lt;/code&gt; anchors&lt;/strong&gt;, &lt;strong&gt;&lt;code&gt;Tailscale ACL&lt;/code&gt; HuJSON&lt;/strong&gt;, and dual-stack &lt;strong&gt;&lt;code&gt;iptables&lt;/code&gt; / &lt;code&gt;ip6tables&lt;/code&gt;&lt;/strong&gt; (&lt;code&gt;--target all&lt;/code&gt;):&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Hard-drops cloud metadata SSRF (&lt;code&gt;169.254.169.254/32&lt;/code&gt; and &lt;code&gt;fd00:ec2::254/128&lt;/code&gt;);&lt;/li&gt;
&lt;li&gt;Rejects inbound/lateral TCP &lt;code&gt;:22&lt;/code&gt; SSH over both IPv4 and IPv6 (&lt;code&gt;STARHUB-BOT-NOSSH&lt;/code&gt; / &lt;code&gt;NOSSH6&lt;/code&gt;) while isolating per-sandbox Tailscale state directories;&lt;/li&gt;
&lt;li&gt;Permits only explicitly declared upstream API endpoints before dropping remaining RFC 1918 and CGNAT lateral traffic.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  2. Eliminating Subnet Collisions (&lt;code&gt;4via6&lt;/code&gt;) &amp;amp; Cross-Engine QUIC Guardrails (&lt;code&gt;Sing-box&lt;/code&gt; + &lt;code&gt;Mihomo&lt;/code&gt;)
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Zero Subnet Collisions&lt;/strong&gt;: Containers join Tailscale natively on &lt;code&gt;100.64.0.0/10&lt;/code&gt;, while non-Tailscale hypervisors map through stateless &lt;strong&gt;&lt;a href="https://tailscale.com/kb/1201/4via6-subnets" rel="noopener noreferrer"&gt;Tailscale &lt;code&gt;4via6&lt;/code&gt;&lt;/a&gt;&lt;/strong&gt; IPv4-to-IPv6 translation with an automatic &lt;code&gt;STARHUB-IPV6-EXIT-GUARD&lt;/code&gt; leak-prevention chain.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Selective QUIC (&lt;code&gt;UDP/443&lt;/code&gt;) &amp;amp; Deterministic Split-DNS&lt;/strong&gt;: Compiles matching rulesets for both &lt;strong&gt;&lt;code&gt;Sing-box&lt;/code&gt; (&lt;code&gt;v1.11+&lt;/code&gt; rule actions)&lt;/strong&gt; and &lt;strong&gt;&lt;code&gt;Mihomo&lt;/code&gt;&lt;/strong&gt;, rejecting &lt;code&gt;UDP/443&lt;/code&gt; only for stalled Apple/Gmail endpoints so clients fall back to TCP/TLS in &lt;code&gt;&amp;lt;50 ms&lt;/code&gt; while keeping YouTube HTTP/3 untouched.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  3. 10-Second Unprivileged Preview &amp;amp; Zero-Dependency &lt;code&gt;MCP&lt;/code&gt; Server
&lt;/h2&gt;

&lt;p&gt;Every target supports non-root &lt;code&gt;--dry-run&lt;/code&gt; preview directly to &lt;code&gt;stdout&lt;/code&gt;, static risk auditing (&lt;code&gt;starhub audit&lt;/code&gt;), and a built-in &lt;code&gt;stdio&lt;/code&gt; MCP server (&lt;code&gt;starhub mcp&lt;/code&gt;) for Claude Code, Cursor, or Windsurf:&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;# Install via Homebrew Tap (macOS / Linuxbrew):&lt;/span&gt;
brew install Ziqi/tap/starhub-kit

&lt;span class="c"&gt;# Preview Linux nftables, macOS pf, Tailscale ACL &amp;amp; Sing-box rules with zero root or disk writes:&lt;/span&gt;
starhub render --profile ai-sandbox --target all --dry-run
starhub audit

&lt;span class="c"&gt;# Or run directly via Nix Flakes without installing:&lt;/span&gt;
nix --extra-experimental-features &lt;span class="s1"&gt;'nix-command flakes'&lt;/span&gt; run github:Ziqi/starhub-kit -- \
  render --profile ai-sandbox --target nftables --dry-run
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Before publishing configs, &lt;code&gt;starhub doctor --verify-public-export&lt;/code&gt; scans your working tree and Git history to verify zero private IPs, tailnet names, or keys leak into public commits.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;GitHub Repository (MIT License)&lt;/strong&gt;: &lt;a href="https://github.com/Ziqi/starhub-kit" rel="noopener noreferrer"&gt;https://github.com/Ziqi/starhub-kit&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;OpenSSF Best Practices Silver (&lt;code&gt;#16658&lt;/code&gt;)&lt;/strong&gt;: &lt;a href="https://www.bestpractices.dev/projects/16658" rel="noopener noreferrer"&gt;https://www.bestpractices.dev/projects/16658&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

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