<?xml version="1.0" encoding="utf-8"?><feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en"><generator uri="https://jekyllrb.com/" version="3.10.0">Jekyll</generator><link href="https://codehunter-py.github.io/feed.xml" rel="self" type="application/atom+xml" /><link href="https://codehunter-py.github.io/" rel="alternate" type="text/html" hreflang="en" /><updated>2026-12-03T20:04:41+00:00</updated><id>https://codehunter-py.github.io/feed.xml</id><title type="html">Ibrahim Musayev</title><subtitle>Linux platform security, PKI and AI-agent security. Notes from running real systems.</subtitle><author><name>Ibrahim Musayev</name></author><entry><title type="html">How I harden my AI coding agent</title><link href="https://codehunter-py.github.io/how-i-harden-my-ai-coding-agent/" rel="alternate" type="text/html" title="How I harden my AI coding agent" /><published>2026-12-03T00:00:00+00:00</published><updated>2026-12-03T00:00:00+00:00</updated><id>https://codehunter-py.github.io/how-i-harden-my-ai-coding-agent</id><content type="html" xml:base="https://codehunter-py.github.io/how-i-harden-my-ai-coding-agent/"><![CDATA[<p>I once asked an AI agent to delete a project’s cache folder. It ran <code class="language-plaintext highlighter-rouge">rm -rf</code> on the whole project folder.</p>

<p>This was on my laptop, and the agent had almost full access to my file system. Luckily I had daily backups, so I restored the project in a couple of minutes. Another time, agents opened ports that should have stayed closed and ran commands they shouldn’t have run.</p>

<p>That’s when I stopped treating the agent as a helper and started treating it like any process I don’t fully trust. It runs with my permissions, so its mistakes are my mistakes.</p>

<p>These are the rules I use now.</p>

<h2 id="1-i-approve-every-change">1. I approve every change</h2>

<p>The agent can read freely. Every write, install or command with side effects waits for my yes.</p>

<p>Sometimes that slows me down. When it does, I give the agent a short allowlist of safe commands it can run without asking. Everything else still waits for me. This has already stopped it from deleting files I didn’t want deleted.</p>

<p>Auto-accept and skip-permission modes stay off.</p>

<h2 id="2-nothing-installs-on-my-mac">2. Nothing installs on my Mac</h2>

<p>I don’t want a skill running a malicious Python script directly on my Mac. So the agent’s tools, runtimes and packages live in a Lima VM with rootless Docker, and everything runs in containers. If something bad runs, it runs there, isolated from me.</p>

<ul>
  <li>The VM sees one shared folder and nothing else in my home directory.</li>
  <li>Containers are thrown away after each run. Mounts are read-only unless a test needs to write, and the network is off when nothing needs downloading.</li>
  <li>No <code class="language-plaintext highlighter-rouge">--privileged</code>, no Docker socket, no <code class="language-plaintext highlighter-rouge">~/.ssh</code>, no env files in a container.</li>
  <li>Tests run on a copy of the repo, not the real one.</li>
</ul>

<h2 id="3-the-agent-never-sees-a-secret">3. The agent never sees a secret</h2>

<p>The agent may check that a secret file exists. It never reads, prints or commits the value. To check that a credential works, it looks at the result, not the value.</p>

<p>If a secret was ever committed, I rotate it, even in a private repo. Deleting it from the file doesn’t delete it from git history.</p>

<h2 id="4-branches-pull-requests-and-i-merge">4. Branches, pull requests, and I merge</h2>

<p>The agent works on a branch and never pushes without asking. Every change goes through a pull request with automated checks, and I read the diff before merging.</p>

<p>When two agents share a repo, one develops and one reviews. Only I merge.</p>

<h2 id="5-every-agent-gets-a-written-scope">5. Every agent gets a written scope</h2>

<p>A written scope ties the agent to one job. Think of it as a harness.</p>

<p>Review agents only get read-only tools. My security agent scans code, dependencies and public endpoints from an isolated container, and it’s read-only by default. Active tests need my OK for each target and each technique. It can suggest changes to its own scope, but they only count once I merge them.</p>

<p>I wouldn’t recommend anyone run an agent with full access. An agent with full access is a ticking bomb. It can destroy your server at any time.</p>

<h2 id="6-on-production-the-agent-writes-the-command-and-i-run-it">6. On production, the agent writes the command and I run it</h2>

<p>On production servers, the agent hands me the commands instead of running them. Before anything irreversible, I take a snapshot. That’s the backup lesson from the start of this post, turned into a rule.</p>

<h2 id="7-skills-are-third-party-code">7. Skills are third-party code</h2>

<p>A skill is a set of instructions the agent will follow, so I vet it like any dependency. I pin it to a commit and read it for prompt injection and data exfiltration before importing it. That’s also why skills run inside the VM and not on my Mac.</p>

<h2 id="the-one-rule">The one rule</h2>

<p>If you keep one thing from this post: never give an agent more access than the job needs.</p>

<p>My agent deleted a project folder because it could. Today it can’t. That’s not because the agent got smarter. It’s because the environment won’t let it.</p>

<p>Which rule would you never run an agent without?</p>]]></content><author><name>Ibrahim Musayev</name></author><summary type="html"><![CDATA[How I run AI coding agents without handing them my machine: approvals, a sandbox VM, no secrets in context, and human review before merge.]]></summary></entry></feed>