← Back to Blog

Your Agent Never Sees the Trust Dialog

6 min readAtypical Tech
Illustration for Your Agent Never Sees the Trust Dialog

On October 26, JFrog described 42 real GitHub repositories that had been armed so that opening one in an AI coding tool could run the attacker's code. The repos belonged to 11 legitimate owners. GitHub's own tools couldn't show the file doing the damage.

JFrog's researchers found two things doing the work. The first was size. The loader, a file called .github/init.js, came to about 13 MB, and in JFrog's words, "GitHub code search did not index the 12.9 to 13.7 MB blobs, and the contents API could not return files of that size." Checked through those paths, the files looked empty.

The second was config. Across the repos, the hooks covered four tools: a session-start hook in .claude/settings.json, Gemini's settings, Cursor's MCP config and rules, and a VS Code task that runs when the folder opens. One expert quoted by CSO said the payload runs "when a developer simply opens the repository in their tool."

For Claude Code, that's half true. The half that's wrong is the part worth your attention.


The dialog is for people

Open a folder you haven't trusted in Claude Code, and it asks first. The workspace trust dialog is a real control, built for exactly this. We've written before about hooks that ran before that dialog appeared, which is a different problem.

Now run Claude Code the way automation runs it, with claude -p or through the Agent SDK. Claude Code's own docs are plain about what happens. A headless session "never shows" the trust dialog. The repo's hooks are used, and servers in its .mcp.json are "connected without asking."

The trust dialog protects people, and your agents never see it.

That's by design. A dialog needs someone to click it, and a CI job has nobody at the keyboard. Neither does a coding agent picking up a ticket, or a scanner sweeping repos overnight.

So the useful question isn't whether your developers click Trust. It's what happens when one of your agents opens a repo nobody has looked at.


Where your agents open repos

Make the list. It's usually longer than people expect, and it's the inventory behind question 6 of last week's ten questions.

  • CI jobs that run an agent on every pull request.
  • Coding agents that clone a repo to work a ticket.
  • Review and scanning tools that check out code you didn't write.
  • The script someone wrote once that runs claude -p in a fresh checkout.

Every one of those puts an agent to work inside the repo's folder, and for Claude Code that means a session starting there. A session starting is exactly when a session-start hook fires, before your agent has read a word of your instructions.

A hostile repo doesn't need to fool your agent if it gets to run first.


The fix already exists, in one place

Since March, Anthropic's GitHub Action for Claude Code has closed this gap for pull requests. Today, before Claude Code starts, the action deletes the PR's .claude/ folder, .mcp.json, CLAUDE.md and a few other files Claude Code reads at startup, and restores the copies from the base branch, which a maintainer has already reviewed. The PR's own versions get set aside where the reviewer can read them, but nothing in them runs.

We checked our own review bots before writing this. Their run log shows the step plainly: "PR head is untrusted."

That's the pattern worth copying everywhere an agent opens code. Treat the checkout as untrusted, and put back the config someone reviewed.

If you run Claude Code headless yourself, you don't get that protection for free. The same docs list the switches:

  • --setting-sources user keeps Claude Code from reading the project's settings files and its .mcp.json.
  • --bare skips the project's hooks, skills, commands, subagents, plugins and MCP servers. The project's env block and helper commands such as awsAuthRefresh still apply, so it isn't a complete wall.
  • --settings '{"disableAllHooks": true}' turns hooks off for that run. Setting it only in your user settings isn't enough, because the project's settings take precedence and can switch it back.
  • disabledMcpjsonServers rejects a named .mcp.json server in every kind of session.

Claude Code was only one of the four tools in this campaign, and the action restores only what Claude Code itself reads at startup. The Gemini, Cursor and VS Code files stay exactly as the PR wrote them. If your pipelines run other agents, find out what each one does in a folder it has never seen. We checked Claude Code for this post, not the others.

A fix that covers one tool's config leaves the other three doors open.


The file you can't read

The file's size matters even when nothing runs at all.

We built inert copies of both into the test repo we use to check agents, then pointed our demo agent at it ten times. It flagged the hook every time, and it never ran anything from the repo.

It also couldn't read the 13 MB file in full. Its read tool stops at 110,000 characters, and a search only finds what you think to search for. So it never reached the instruction we'd planted on the file's last lines. What it did, in all ten runs, was say so: the file was too large to read in full, and its contents were unverified.

An agent that admits it couldn't read a file has just told you where to look.

That's the behavior to demand from any agent or scanner you rely on. The failure is the quiet one, a clean report from a tool that skipped the biggest file in the repo. Ask the tool, or its vendor, two things: what's the largest file it reads in full, and does its report say what it skipped?

And don't mistake GitHub search for an audit. It's the same path the file's size slipped past. JFrog found these files by walking the Git trees directly.


Opening a repo used to mean reading it. For a person at a keyboard it mostly still does, because a dialog stands in the way. For an agent, opening a repo can mean running it, unless someone decided otherwise before it got there.

Decide what your agents will run before a stranger's repo decides for them.

Related Posts