<?xml version="1.0" encoding="utf-8"?><feed xmlns="http://www.w3.org/2005/Atom"><title>Ju Lin's AI Weblog: Security</title><subtitle>An independent research notebook on AI engineering, agents, models and the systems around them.</subtitle><id>https://julin.ai/atom/tags/security/index.xml</id><link rel="self" type="application/atom+xml" href="https://julin.ai/atom/tags/security/index.xml"/><link rel="alternate" type="text/html" href="https://julin.ai/tags/security/"/><author><name>Ju Lin</name></author><updated>2026-08-28T00:00:00+12:00</updated><entry><title>Give AI Agents Git Access, Not Git Credentials</title><id>https://julin.ai/2026/08/28/let-ai-agent-push-code-safely/</id><link rel="alternate" type="text/html" href="https://julin.ai/2026/08/28/let-ai-agent-push-code-safely/"/><published>2026-08-28T00:00:00+12:00</published><updated>2026-08-28T00:00:00+12:00</updated><category term="explainer"/><category term="agents"/><category term="security"/><content type="html">&lt;p&gt;If you run a coding agent inside a sandbox VM, the usual advice is simple: isolate the filesystem, restrict network access, don&amp;rsquo;t mount your home directory, don&amp;rsquo;t expose SSH keys or cloud credentials.&lt;/p&gt;
&lt;p&gt;But that leads to one question: without an SSH key, how would the agent run &lt;code&gt;git push&lt;/code&gt; safely?&lt;/p&gt;
&lt;p&gt;You could give the VM an SSH key or a GitHub token. That basically diminishes the purpose of the VM, and gives the agent more access than it needs. So, &lt;strong&gt;don&amp;rsquo;t do this.&lt;/strong&gt; AI agents had &lt;a href="https://openai.com/index/hugging-face-incident-and-the-road-ahead/"&gt;bad reputation&lt;/a&gt;.&lt;/p&gt;
&lt;h3 id="use-a-proxy"&gt;Use a proxy&lt;/h3&gt;
&lt;p&gt;Configure a proxy outside the sandbox.&lt;/p&gt;
&lt;p&gt;Inside the VM, &lt;code&gt;git push&lt;/code&gt; never talks to github.com directly — it points at the proxy instead. The VM holds no GitHub credential at all. The proxy is what attaches a real token before forwarding the request upstream, so the token stays invisible to the model.&lt;/p&gt;
&lt;p&gt;&lt;img src="/2026/08/28/let-ai-agent-push-code-safely/diagram-broker.svg" alt="Agent VM sends a git push with no credential to a Git Broker, which attaches the real token before forwarding to GitHub."&gt;&lt;/p&gt;
&lt;p&gt;The broker can even enforce rules such as:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;allow fetch&lt;/li&gt;
&lt;li&gt;allow push &lt;code&gt;agent/run-123&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;deny push &lt;code&gt;main&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;deny force push&lt;/li&gt;
&lt;li&gt;deny other repos&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The agent does not need to hold the real GitHub credential.&lt;/p&gt;
&lt;h3 id="a-practical-guide"&gt;A practical guide&lt;/h3&gt;
&lt;p&gt;In practice, the proxy can be as simple as an nginx docker process listening on &lt;code&gt;127.0.0.1:8082-&amp;gt;80/tcp&lt;/code&gt;. It injects &lt;code&gt;gh auth token&lt;/code&gt; into outgoing requests as the auth header.&lt;/p&gt;
&lt;p&gt;Inside the VM, the push command looks like &lt;code&gt;git push https://github.com/name/repo.git main&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;Getting an agent to use it doesn&amp;rsquo;t take much: just hint it. Something like &amp;ldquo;push via GitHub broker on host port 8082 instead of origin&amp;rdquo; works well — the agent figures out the rest on its own.&lt;/p&gt;
&lt;p&gt;I published &lt;a href="https://gist.github.com/soasme/0f93509db16e6a5a950cff26769ae11c"&gt;a gist here&lt;/a&gt; for quickly launching such a github-broker.&lt;/p&gt;
&lt;h3 id="the-general-pattern"&gt;The general pattern&lt;/h3&gt;
&lt;p&gt;This is a useful way to think about agent permissions in general. A runtime does not need your identity. It needs a small set of capabilities for the current task. For &lt;code&gt;git push&lt;/code&gt;, that capability is usually: this repo, this branch, for a short time.&lt;/p&gt;
&lt;h3 id="references"&gt;References&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="https://agyn.io/blog/ai-agent-sandboxing-filesystem-network-isolation"&gt;AI Agent Sandboxing: Filesystem &amp;amp; Network Isolation&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://jonnyzzz.com/blog/2026/06/20/auditing-git-for-ai-agents/"&gt;What Did the Agent Just Push? Auditing Git for AI Agents&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;</content></entry></feed>