# taintd — Complete Technical Reference (llms-full.txt) URL: https://taintd.dev/ Docs: https://taintd.dev/docs.html Source: https://github.com/darkobas2/agent-taint | https://github.com/darkobas2/agent-gate License: MIT OR Apache-2.0 (local OSS binaries); self-hosted commercial control plane (`taintd cloud`). Contact: hello@taintd.dev ## 1. Overview & Threat Model `agent-taint` breaks the "lethal trifecta" (untrusted input + access to secrets + outbound network egress) and the "reverse trifecta" (secret read followed by untrusted egress) deterministically in <5ms per tool call with zero daemons, zero proxies, and zero LLM-as-a-judge calls. Three progressive defense layers: 1. Layer 1 — Default Hook (`strict_shell: false`): Fast, low-friction protection against credential reads (`~/.ssh`, `~/.aws`, `~/.gnupg`, `~/.kube`, `.env*`, `/proc/*/environ`, `agent-taint/device.key`), vault CLIs (`bws`, `bw`, `op`, `vault`, `sops`, `kubectl get secret -o`), persistence edits (`~/.bashrc`, `~/.zshrc`, `authorized_keys`, `crontab`, harness settings), obfuscated exec (`base64 -d | sh`, `eval`), and known egress tools (`curl`, `wget`, `ssh`, `scp`, `rsync`, `nc`, inline Python/Node/Ruby HTTP). Name-bound for shell tools. 2. Layer 2 — Strict Allowlist (`strict_shell: true`): Flips tainted sessions to default-deny for shell execution; only safe read-only/build prefixes in `allow_commands` run without confirmation. Non-name-bound (blocks renamed binaries and custom scripts). 3. Layer 3 — OS Kernel Sandbox (`agent-taint sandbox -- `): Linux `bwrap --unshare-net` or macOS Seatbelt `(deny network*)`. Kernel-enforced network isolation, credential dir masking, and secret env scrubbing. ## 2. Supported Harnesses (Global User-Level Hooks, Fail-Closed) - Claude Code: `agent-taint install claude` -> `~/.claude/settings.json` (`PreToolUse`, `PostToolUse`, `SessionStart`) + `/taint-setup`, `/taint-review`. - Cursor: `agent-taint install cursor` -> `~/.cursor/hooks.json` (`failClosed: true`). - VS Code / Copilot: `agent-taint install vscode` -> `~/.copilot/hooks/agent-taint.json`. - Antigravity: `agent-taint install agy` -> `~/.gemini/config/plugins/agent-taint/`. - OpenCode: `agent-taint install opencode` -> `~/.config/opencode/plugins/agent-taint.ts`. ## 3. Repo Approval vs. PR / Issue Reads - `agent-gate approve .` cryptographically pins local checked-out config files (`CLAUDE.md`, `AGENTS.md`, `.mcp.json`, hooks, `SKILL.md`) and automatically pins the `agent-taint` binary & hooks when `agent-taint` is on PATH. Run `agent-gate refresh-guards` after upgrading `agent-taint`. - `gh pr view`, `gh pr diff`, `gh issue view`, and `gh api` are allowed to run even under `strict_shell: true`, and ALWAYS taint the session (because external PR/issue text can carry prompt injection even on an approved repository). ## 4. Policy Schema (`~/.config/agent-taint/policy.json`) Top-level fields: - `audit_only` (bool, default false): log would-be blocks to `audit.jsonl` without blocking. - `audit_omit_detail` (bool, default false): omit command snippets from local `audit.jsonl`. - `taint_all_mcp` (bool, default true): treat all `mcp__*`/`mcp_*` tools as taint sources unless listed in `trusted_mcp_prefixes`. - `strict_shell` (bool, default false): default-deny shell in tainted sessions. - `ask_on_git_push` (bool, default true): downgrade `git push`/`gh pr|issue` to `Ask`. - `allowed_hosts` (string[], default `["localhost","127.0.0.1","::1"]`): exact host or `*.domain.tld` subdomain wildcard (requires >=2 DNS labels after `*.`; `*` and `*.com` rejected). - `trusted_mcp_prefixes` (string[]): trusted local MCP prefixes. - `allowed_gh_api_prefixes` (string[]): read-only `gh api` GET endpoint prefixes. - `untrusted_repos` (string[]): paths or `~/` / `*` / `**` globs where sessions start tainted. - `repo_profiles` (map): exact/prefix outranks glob; ties break by longest pattern. RepoProfile fields: `untrusted`, `strict_shell`, `deny_network`, `allowed_hosts`, `allowed_gh_api_prefixes`, `trusted_mcp_prefixes`, `deny_commands`, `ask_commands`, `allow_commands`. - `deny_commands`, `ask_commands`, `allow_commands`, `extra_taint_tools`, `extra_credential_paths`, `extra_untrusted_paths`. - Fleet-only scoping & lockdown: `managed_paths` (path/glob patterns like `~/work/**`), `managed_remotes` (git remote globs like `github.com/acme/*`), and `lock_local_policy` (bool; ignores local `policy.json` inside managed zones). Unmanaged personal folders use local `policy.json` only and never upload audit events; cross-zone tool calls targeting a managed path auto-escalate the session. ## 5. Fleet Control Plane (`taintd cloud`) - Zero-token enrollment: single-use join token (`atj_...`) exchanges for a per-machine Ed25519 key stored in macOS Keychain (`security -i` stdin), Linux `systemd-creds` (`LoadCredentialEncrypted=`), Linux `secret-tool`, or container `--allow-file-key`. - `device:v2` Ed25519 request signing over method + path + query + body SHA-256 + timestamp + nonce. - `policy:v2` & `grant:v2` Ed25519 server signatures with monotonic anti-rollback versioning. - `--kind developer`: layered local allowlists under a non-weakenable fleet floor, or workspace-scoped lockdown via `managed_paths` + `managed_remotes` + `lock_local_policy` (personal folders stay 100% private with zero cloud telemetry). - `--kind agent`: strict cloud-only lockdown; local `policy.json` is ignored and local mutating CLIs are refused. - Learn -> Confirm -> Enforce: auto-synthesizes additive policy drafts from observed hosts and Shadow MCPs. - Remote Control Queue: metadata-only break-glass requests (`allow_once` / `clear_taint`) with Slack/Mattermost/Discord webhooks. - Audit sync: deduplicated via `~/.cache/agent-taint/audit_sync.offset` byte cursor; supports client-side E2EE (`--encrypt-audit age1...`). ## 6. CLI Quick Reference ```bash agent-taint install [--strict] [--no-setup] agent-taint mode agent-taint status [session-id] | taint | clear [session-id | --all] agent-taint discover [--apply-local-mcp] [--apply-ssh] [--json] agent-taint review [-i] [--clear] [--json] [--nudge] agent-taint allow-host [--global] agent-taint trusted-mcp [--global] agent-taint repo-profile [--strict-shell true|false] [--deny-network] [--allow-host ...] agent-taint sandbox [--allow-net] [--print] -- agent-taint enroll --server --join-token [--kind developer|agent] [--machine ] agent-taint sync [--push-discover] [--push-audit] [--encrypt-audit ] [--apply-grants] [--dry-run] agent-gate scan . | approve . | check . | install claude | refresh-guards [--allow-hash ] ```