Skip to content

Session taint

What a session read earlier makes its later calls stricter. After a secret, network and MCP calls need review; after a web page or an MCP result, writes to CI, build and agent files need review. Taint only adds reviews: a deny stays a deny.

When you need it

Whenever an agent reads web pages, search results, downloads or MCP results, or a secret your policy lets it read, in the same session as it writes or sends.

Try it

read /p/run.sh, which session a wrote after it read untrusted content (fetch crates.io)

The reason a later session's call is held when the taint came from a file: run.sh was written by a session that had fetched a page from crates.io.

Change it

taint.protected_writes adds paths whose writes need review in a tainted session; taint.provenance: false stops following written files. Approve one file for the session with openmoat allow --last.

What it does not stop

Taint is per session: a new session starts clean, except for the files a tainted session wrote. All its limits

Protects against a session that read a secret sending it out, and a session that read a web page or an MCP result (where a prompt injection lives) planting what it read in files that run later.

A call can be decided more strictly because of what the same agent session did before. Taint only adds reviews, with rule session-taint: an allowed call can need review, and a deny stays a deny.

Once the session has read These calls need review
A secret (only when your policy lets secret reads run; the default denies them) Network to any host but the secret’s own, every MCP call, web search and unmapped tool
Untrusted content: a web page, a web search, a curl or wget download, a browser MCP call that opens a page, an MCP tool’s result Writes to CI workflows, git hooks, build files (package.json, Makefile, Cargo.toml, pyproject.toml, Dockerfile, …) and agent instructions and settings (CLAUDE.md, AGENTS.md, .claude/, .mcp.json, the Cline CLI’s .cline and .clinerules, goose’s .goosehints, …)

From 0.16.0 the instruction and skills files the next agent session obeys count too: .agents/skills/**, .windsurfrules, .windsurf/rules/** and .github/instructions/**, beside CLAUDE.md and AGENTS.md.

Since 0.26.0, once a session has read private data (a key, an agent’s login, the whole environment) and untrusted content (a page, an MCP result, gh issue view), every call that can send data out needs review, rule lethal-trifecta, to an allowed host and git push too. A send after the session packed files from outside the project, or copied private data into a file, needs review too (staging-egress). Private data, untrusted content and a way out.

Taint knows that untrusted content came in; injected input (from 0.16.0) also knows what it said: a later command or write that uses a host, path or command the page or tool result named needs review, with the source named.

Taint follows files too. When a tainted session writes a file, the audit log records it; a later session that reads or runs that file (cat, source run.sh, ./run.sh, python x.py) is tainted as well.

  • Pushes: a push from a tainted session that changes a file runs-later names needs review (push-runs-later).
  • Encoded URLs: after a secret read, a URL a fetch, network or MCP tool opens that carries 80 or more characters of base64 or hex is denied (encoded-egress, new in 0.12.0): a person reviewing the call can judge a short URL, not a few hundred characters of encoded text.
  • The proxy: under openmoat run, the run’s proxy cannot prompt, so after a secret read it refuses requests to every other host, registries included; a new run starts clean. The standalone openmoat proxy does the same for Claude Code’s sessions from 0.12.0, since each sends its own credential (Agent sessions only).

From 0.12.0 a session-taint review is answered once per file. After you approve the agent’s Write, Edit or MultiEdit of a protected file in a session that read untrusted content, later writes and edits of the same file in that session are allowed, until the session reads untrusted content again; then the file needs review once more. The reason says so:

Terminal window
an earlier write of <file> in this session was approved after the session last read untrusted content

The evidence is the file itself: it must hold what the approved call leaves (for an edit, the file with its replacements applied) and not what it held before. So a write you declined covers nothing, and a write of the file’s own content, an edit Claude Code would refuse, a patch or a shell write (whose result the hook cannot see), another file or another session still need review. A review that comes from a secret the session read is never answered this way (ADR-048).

In a clean session, an edit of package.json in the project is allowed (project-fs). After the same session fetched a web page, the same edit needs review:

Terminal window
moat: review [session-taint] — …

When the taint came from a file, the reason names it and the session that wrote it:

Terminal window
read /p/run.sh, which session a wrote after it read untrusted content (fetch crates.io)
Command What it does Example
openmoat allow --last Grant that one file until the session reads untrusted content again. A secret’s review is never answered this way openmoat allow --last
openmoat replay --session <id> The session as a timeline: which read tainted it openmoat replay --session 4f2a…
openmoat show --session <id> Every event of that session openmoat show --session 4f2a…

At the openmoat allow --last question, s instead of y approves every protected write of the session, until it reads untrusted content again.

taint:
protected_writes: ["**/deploy/**"] # more paths whose writes need review in a tainted session
provenance: true # default; false stops following written files

protected_writes only extends the built-in list; openmoat policy lint rejects a ! exclusion. The built-in list is in POLICY.md §4.1.

  • Taint is per session. A new session starts clean, except for the files a tainted session wrote.
  • Not followed: a file copied or renamed, files a build or script writes, and files a search tool (Grep, Glob) reads.
  • Shell network to an allowed host (git fetch, gh pr view) is not untrusted content.
  • Codex turns a review into a deny, so under Codex a review never taints. At the standalone openmoat proxy, taint applies to Claude Code’s sessions, which send a credential; Codex’s traffic carries none, so it is refused, or served without taint under sandbox.proxy_serve_without_credential (Agent sessions only).

More in How it decides and Limits.