Skip to main content
Claude Code Mods: Programmable, Unsandboxed, and Your Problem in CI

Claude Code Mods: Programmable, Unsandboxed, and Your Problem in CI

KU
· Founder & Chief Editor
• 8 min read•Updated •29 views

Mods make Claude Code a real runtime you can program. They also run with your full native permissions, no sandbox, so a bad one is a bad CI step.

Key takeaways

  • Claude Code mods are JavaScript or TypeScript hooks that run inside Claude Code with your full user permissions and no sandbox, and they also run in claude -p pipelines.
  • Adopt them in CI only when written in-house or vendored and reviewed.
  • Inspect each one with claude plugin validate, pin it, and never auto-install from a marketplace.

Claude Code mods are worth using in CI for policy enforcement and output filtering, but only if you treat each one as a CI step with your runner's full credentials. Anthropic's docs say mods aren't sandboxed: they run with your permissions, can read secrets, and approve tool calls. Vendor them, read them, pin them.

Verified against

Claude Code v2.1.287 (the minimum terminal version for mods), against the code.claude.com Mods overview, React to events, and Plugin security and trust pages. Checked October 2026.

A mod hooks Claude Code's internal events and can rewrite a prompt before the model sees it, block or retry a tool call, approve or deny a permission check, withhold a tool result, or change what the interface draws. That turns a CLI agent into a programmable runtime instead of a tool you configure with flags. It is also, in Anthropic's own words, code that "runs with your permissions" and isn't sandboxed.

What a mod actually is

A mod is a plugin whose hooks module, a JavaScript or TypeScript file, registers handlers for events Claude Code fires internally: prompt.submit before a prompt is sent, tool.call before a tool runs, tool.check when a permission decision is made, ui.render when part of the interface is drawn. It installs like any plugin, with /plugin install name@marketplace or claude plugin install. You can write one by hand or ask Claude to build one during a session. Because mods ride the existing plugin system, a marketplace already distributing skills, subagents, and MCP servers now distributes mods too. As of October 2026 the docs say mods are on by default in Claude Code v2.1.287 or later in the terminal, with no separate flag.

The difference from a settings-file hook is reach. A settings hook is a shell command that runs outside the process; a mod's handler runs inside Claude Code as middleware and can rewrite the event before anything downstream sees it. The docs list what a loaded mod can do: act on your machine as you, read environment variables and settings files including API keys, see every prompt and tool call, and approve a tool call before you're asked.

Why this matters specifically in CI

The CI use case is obvious from the event list. Two problems teams running coding agents in pipelines have solved with brittle wrappers become native: redacting secrets from tool output before they land in a log artifact, and enforcing a permission policy (deny this tool, auto-approve that one) as code instead of hoping the default configuration holds. We covered the shape of this problem in running AI CLI agents in CI pipelines: the question that decides whether an agent belongs in a pipeline is what it can do that you did not approve. A well-written mod answers that in code, not documentation.

That is the upside case, and it is real. Note that it applies to headless runs: the docs confirm a mod's hooks run under claude -p and the Agent SDK, even though nothing it draws appears there.

The catch Anthropic put in writing

The catch sits right in the install instructions: "A mod is code that runs with your permissions. It can read and write your files, start processes, and make network requests. Install mods only from authors and marketplaces you trust." The docs also state "Mods aren't sandboxed", and that if you turn on Claude Code's sandbox, it isolates the Bash commands Claude runs while a process a mod starts runs outside it. In a CI runner, that means deploy credentials and cloud tokens included.

One more detail matters for pipelines. Without managed settings or a Team or Enterprise login as the credential, the docs say a mod can approve a call that an ask rule would prompt for, or that your PreToolUse hook blocked. A CI runner using a bare API key is exactly that configuration.

The same shape as Plugin4Shell, deliberately

Plugin4Shell was a bug where four coding agents, Claude Code included, checked out a pinned plugin commit but never verified the working tree landed on it, letting an attacker swap code after review. It got fixed. Mods are not a bug. They are a feature built on the premise that code from a plugin marketplace runs with full native access, by design, because that is what gives a mod the power to rewrite prompts and intercept tool calls at all. The posture is the one Plugin4Shell exploited; this time it is documented, intended behavior rather than a defect. That does not make it safer. It makes the trust decision the whole control, since no sandbox sits underneath to catch a mistake.

Here is the kind of mod a team would plausibly want in CI, a hook that keeps a Bash result containing a credential pattern away from Claude (and out of the transcript it logs). It uses the documented tool.call middleware shape: await the tool, inspect the result, return { deny } to withhold it:

JavaScript
// hooks/register.js: withhold Bash output that contains a credential
const SECRET = /sk-[A-Za-z0-9_-]{20,}|ghp_[A-Za-z0-9]{36}|AKIA[0-9A-Z]{16}/

export function register(on) {
  on('tool.call', { tool: 'Bash' }, async ($, e, next) => {
    const result = await next(e)
    if (SECRET.test(JSON.stringify(result))) {
      return { deny: 'Output withheld: it matched a credential pattern. Re-run without printing secrets.' }
    }
    return result
  })
}

That is worth running in a pipeline. It is also exactly what a malicious actor would want installed, with one extra line that calls $.process.run or makes a network request with the match before withholding it. Reading the code is the only control between those two files. Claude Code helps here: claude plugin validate lists a mod's hooks: and calls: without running it, so a "redaction" mod that asks for network access stands out.

Bash
# Inspect a vendored mod before it goes near a runner
claude --version
claude plugin validate ./vendor/mods/redact-secrets

What we would actually require before CI adoption

Treat a mod like a new GitHub Action, not a config flag:

  • Pin the exact source and turn off auto-update. Reference a mod by commit SHA or a specific plugin version, never a branch or "latest." Anthropic's security page notes that with marketplace auto-update on, the files you reviewed can change on disk. The checkout-doesn't-match-the-pin failure from Plugin4Shell applies here too: a pin nobody verifies is a label.
  • Read the code before you run it. A mod that touches tool output or approves permission requests is operating with your credentials. Review it the way you would review a PR touching your deploy pipeline, because that is what it is.
  • Never auto-install from a marketplace in CI. Vendor the mod into your own repository and install from that copy instead.
  • Run it in the same contained environment as the agent. Our AI agent security guide covers scoped tokens and restricted egress, and Docker cloud sandboxes for agent isolation covers putting the whole process in a box. A mod inherits the agent's access, not a narrower one, and Claude Code's own sandbox does not contain it.
  • Use managed settings on shared runners. Administrators can restrict marketplaces and, with allowManagedModsOnly, stop user-installed mods from loading.

The decision, concretely

  • Want secret redaction or policy enforcement in CI? Write the mod yourself, or review a vendored one line by line; never take one from a marketplace unreviewed.
  • Already running Claude Code in a pipeline with real credentials? Audit which plugins and mods are installed on that runner, the same way you would audit a set of GitHub Actions.
  • Considering a marketplace mod a teammate found? Treat it like a new dependency: pin the exact source, read the diff, re-review every update.
  • Running untrusted mods in CI at all? Don't, unless your container already assumes the agent process can do anything the runner's credentials allow.

Questions people ask

Are Claude Code mods sandboxed?

No. Anthropic's Mods overview says "Mods aren't sandboxed." A mod runs inside Claude Code with your user permissions: it can read and write files, start processes, make network requests, and read environment variables and settings, including API keys. Turning on Claude Code's sandbox isolates the Bash commands Claude runs, but a process a mod starts runs outside it.

Do mods run in claude -p and CI pipelines?

Yes. The docs say a mod's hooks run in claude -p and the Agent SDK, as well as in cloud sessions for plugins that reach them; only the interface a mod draws is missing. So a mod installed on a CI runner executes on every headless run, with the runner's credentials, whether or not anyone sees its output.

The call we'd make

Mods are a real upgrade for exactly the CI problems worth solving: redaction and policy enforcement written as code you control instead of defaults you hope hold. We would adopt them for that, written in-house or vendored and reviewed, never pulled live from a marketplace into a pipeline. The unsandboxed, native-permissions design is not a flaw to wait out, it is the deal, and the only thing standing between a useful mod and a malicious one is whether someone on your team actually read the code.

Sources

Explore topics:SecurityCI/CDAI
React
Share this post
Cite this article
Plain text

Kiril Urbonas (2026). Claude Code Mods: Programmable, Unsandboxed, and Your Problem in CI. DevOpsNess. Updated 2026-11-15. https://www.devopsness.com/blog/claude-code-mods-unsandboxed-ci-risk

Markdown

[Claude Code Mods: Programmable, Unsandboxed, and Your Problem in CI](https://www.devopsness.com/blog/claude-code-mods-unsandboxed-ci-risk) (Kiril Urbonas, DevOpsNess, updated 2026-11-15)

KU

Kiril Urbonas

Founder & Chief Editor

601 articles
View all articles by Kiril Urbonas

You might have missed

Evergreen posts worth revisiting.