<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Ziqi Xiao — Systems & Security]]></title><description><![CDATA[Ziqi Xiao — Systems & Security]]></description><link>https://sinoziqi.hashnode.dev</link><generator>RSS for Node</generator><lastBuildDate>Sun, 15 Nov 2026 20:06:10 GMT</lastBuildDate><atom:link href="https://sinoziqi.hashnode.dev/rss.xml" rel="self" type="application/rss+xml"/><language><![CDATA[en]]></language><ttl>60</ttl><item><title><![CDATA[Isolating Autonomous AI Coding Sandboxes & Fixing Tailscale Subnet Collisions: Inside StarHub Kit v1.3.0]]></title><description><![CDATA[Autonomous AI coding agents (Claude Code, Cursor background agents, containerized SWE sandboxes) are increasingly given raw shell execution inside cloud…]]></description><link>https://sinoziqi.hashnode.dev/isolating-autonomous-ai-coding-sandboxes-fixing-tailscale-subnet-collisions-inside-starhub-kit-v1-3-0</link><guid isPermaLink="true">https://sinoziqi.hashnode.dev/isolating-autonomous-ai-coding-sandboxes-fixing-tailscale-subnet-collisions-inside-starhub-kit-v1-3-0</guid><dc:creator><![CDATA[Ziqi]]></dc:creator><pubDate>Sat, 14 Nov 2026 16:43:38 GMT</pubDate><content:encoded><![CDATA[<p>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:</p>
<ol>
<li><strong>AI Sandbox SSRF &amp; Lateral Movement</strong>: An unisolated coding agent can query cloud instance metadata (<code>169.254.169.254</code> / <code>fd00:ec2::254</code>) to harvest IAM credentials, probe private <code>192.168.0.0/16</code> or <code>100.64.0.0/10</code> peers over TCP <code>:22</code> SSH / <code>:2375</code> Docker / <code>:5432</code> Postgres, or collide on shared Tailscale <code>NodeKey</code> state across container restarts.</li>
<li><strong>RFC 1918 Wi-Fi Collisions &amp; Selective QUIC Stalls</strong>: Advertising raw <code>/24</code> LAN routes over Tailscale breaks silently whenever a hotel or coffee-shop Wi-Fi shares your home prefix, while throttled <code>UDP/443</code> proxy tunnels in <code>Sing-box</code> or <code>Mihomo</code> stall Apple Media and mobile Gmail fetches for 50 seconds—yet blocking <code>UDP/443</code> globally breaks YouTube mobile (<code>Cronet</code> HTTP/3) captions.</li>
</ol>
<p>To eliminate these failure modes deterministically across Linux, macOS, and Tailscale without external dependencies, I built and open-sourced <a href="https://github.com/Ziqi/starhub-kit"><strong>StarHub Kit (</strong><code>v1.3.0</code><strong>)</strong></a> — a zero-dependency Python 3.9+ policy compiler and native <strong>Model Context Protocol (</strong><code>MCP</code><strong>)</strong> server certified <strong>Linux Foundation OpenSSF Best Practices Silver (</strong><code>#16658</code><strong>)</strong> with <strong>SLSA Build Level 3</strong> provenance.</p>
<hr />
<h2>1. Turnkey Autonomous AI Agent Sandbox Isolation (<code>--profile ai-sandbox</code>)</h2>
<p>Instead of hand-maintaining brittle firewall shell scripts across OSes, a single declarative topology (<code>profiles/topology.ai-sandbox.json</code>) compiles into <strong>Linux</strong> <code>nftables</code> <strong>(</strong><code>inet</code><strong>)</strong>, <code>macOS pf</code> <strong>anchors</strong>, <code>Tailscale ACL</code> <strong>HuJSON</strong>, and dual-stack <code>iptables</code> <strong>/</strong> <code>ip6tables</code> (<code>--target all</code>):</p>
<ul>
<li>Hard-drops cloud metadata SSRF (<code>169.254.169.254/32</code> and <code>fd00:ec2::254/128</code>);</li>
<li>Rejects inbound/lateral TCP <code>:22</code> SSH over both IPv4 and IPv6 (<code>STARHUB-BOT-NOSSH</code> / <code>NOSSH6</code>) while isolating per-sandbox Tailscale state directories;</li>
<li>Permits only explicitly declared upstream API endpoints before dropping remaining RFC 1918 and CGNAT lateral traffic.</li>
</ul>
<h2>2. Eliminating Subnet Collisions (<code>4via6</code>) &amp; Cross-Engine QUIC Guardrails (<code>Sing-box</code> + <code>Mihomo</code>)</h2>
<ul>
<li><strong>Zero Subnet Collisions</strong>: Containers join Tailscale natively on <code>100.64.0.0/10</code>, while non-Tailscale hypervisors map through stateless <a href="https://tailscale.com/kb/1201/4via6-subnets"><strong>Tailscale</strong> <code>4via6</code></a> IPv4-to-IPv6 translation with an automatic <code>STARHUB-IPV6-EXIT-GUARD</code> leak-prevention chain.</li>
<li><strong>Selective QUIC (</strong><code>UDP/443</code><strong>) &amp; Deterministic Split-DNS</strong>: Compiles matching rulesets for both <code>Sing-box</code> <strong>(</strong><code>v1.11+</code> <strong>rule actions)</strong> and <code>Mihomo</code>, rejecting <code>UDP/443</code> only for stalled Apple/Gmail endpoints so clients fall back to TCP/TLS in <code>&lt;50 ms</code> while keeping YouTube HTTP/3 untouched.</li>
</ul>
<h2>3. 10-Second Unprivileged Preview &amp; Zero-Dependency <code>MCP</code> Server</h2>
<p>Every target supports non-root <code>--dry-run</code> preview directly to <code>stdout</code>, static risk auditing (<code>starhub audit</code>), and a built-in <code>stdio</code> MCP server (<code>starhub mcp</code>) for Claude Code, Cursor, or Windsurf:</p>
<pre><code class="language-bash"># Install via Homebrew Tap (macOS / Linuxbrew):
brew install Ziqi/tap/starhub-kit

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

# Or run directly via Nix Flakes without installing:
nix --extra-experimental-features 'nix-command flakes' run github:Ziqi/starhub-kit -- \
  render --profile ai-sandbox --target nftables --dry-run
</code></pre>
<p>Before publishing configs, <code>starhub doctor --verify-public-export</code> scans your working tree and Git history to verify zero private IPs, tailnet names, or keys leak into public commits.</p>
<ul>
<li><strong>GitHub Repository (MIT License)</strong>: <a href="https://github.com/Ziqi/starhub-kit">https://github.com/Ziqi/starhub-kit</a></li>
<li><strong>OpenSSF Best Practices Silver (</strong><code>#16658</code><strong>)</strong>: <a href="https://www.bestpractices.dev/projects/16658">https://www.bestpractices.dev/projects/16658</a></li>
</ul>
]]></content:encoded></item></channel></rss>