Agent Security
Bulwark scans the AI coding assistants on your machine for three classes of problem that ordinary host scanners don't look for. The supported agents are Claude Code, Claude Desktop, Cursor (editor and CLI), GitHub Copilot (VS Code and CLI), OpenAI Codex, Gemini CLI, Qwen Code, Zed, Goose, OpenCode, Kilo Code, Crush, Amp, Kiro, Amazon Q, Cline, Roo, Windsurf / Devin Desktop, Continue, Augment, JetBrains Junie and AI Assistant, Aider, Warp and Open Interpreter, plus VS Code and its forks (VS Code Insiders, VSCodium, Cursor, Windsurf, Kiro).
- Secrets leaked into AI context. Provider API keys and tokens (exact formats such as
sk-ant-…,AKIA…,ghp_…) in an assistant's session transcripts, memory and instruction files (CLAUDE.md, slash commands, skills, rules) — anywhere a key ends up in the model's context — and in a project's settings, MCP and hook files, which travel with the repository. Transcripts keep a copy on disk long after the conversation, and are read to the end however long they are. A.env, and the same config files in your home folder, hold keys on purpose, so a key there is not reported as a leak. When one of them holds a key, Bulwark checks instead that other accounts on the computer cannot read it (BLWK-AI-015) and, in a project, that git neither tracks the file nor would add it (BLWK-AI-016). The key itself is only counted, never shown or stored. - Dangerous agent configuration. Settings that a prompt injection can turn into code execution on your host, grounded in real, published attacks.
- Sandbox posture. Whether the agent's own command sandbox is switched off, and whether the account the agents run as can become root without a password anyway.
In the desktop app these checks run as part of every Scan now and their problems appear on the Scan page with everything else (configure extra folders in Settings → AI assistants). From a terminal, bulwark ai scan runs only these checks (bulwarkctl ai scan with the CLI-only package). Each check below links to its own page with the full explanation and fix.

A scan reads real secrets. Treat its output accordingly.
Findings are stored and displayed with the secret masked (sk-a…3f), never in full, and the raw value is never written to the database or the logs. But the file paths a finding points at are real, so a screenshot of a live scan can still disclose where you keep things. The screenshots in this documentation are deliberately generated from fixtures, not from a real machine.
What it checks
| Rule | Severity | What it catches | Reference |
|---|---|---|---|
BLWK-AI-001 | High / Medium | A provider secret (Anthropic, OpenAI, GitHub, AWS, …) in an assistant's context, config, or transcript | T1552.001 |
BLWK-AI-002 | Critical | Project-supplied agent hooks that run shell on session/tool events (Claude Code, Cursor, Kiro, Copilot, Gemini/Qwen, Crush, Augment, Cline, Devin Desktop) | CVE-2025-59536 |
BLWK-AI-003 | High | An MCP server launched from a registry package with no exact version (npx, npm exec, pnpm dlx, yarn dlx, bunx, uvx, uv tool run, pipx run). A range (@^1) or a tag (@latest) is not a pin | T1195.001 |
BLWK-AI-004 | High | An MCP server using mcp-remote (command-injection ≤ 0.1.15), unless it is pinned to 0.1.16 or later | CVE-2025-6514 |
BLWK-AI-005 | High | An MCP server wrapped in a shell interpreter (bash -c …, sh -lc …, pwsh -Command …) | T1059.004 |
BLWK-AI-006 | High | A permission allowlist that permits arbitrary execution: everything (Bash(*), Shell(*), run_shell_command, a blanket bash: allow), or a shell, interpreter, downloader, package runner or rm with nothing fixed about what it is given (Bash(curl *), Bash(sh -c:*)). One program doing its own job (Bash(git log:*), Bash(npx prettier:*)) is not reported | T1059 |
BLWK-AI-007 | High | An agent told never to ask — bypassPermissions, Zed default: allow, Goose GOOSE_MODE: auto, OpenCode permission: allow, Qwen Code yolo, Cursor CLI unrestricted, Open Interpreter auto_run | T1059 |
BLWK-AI-008 | High | enableAllProjectMcpServers / enabledMcpjsonServers auto-enabling a repo's MCP servers | CVE-2025-59536 |
BLWK-AI-009 | Critical | VS Code chat.tools.autoApprove ("YOLO mode") | CVE-2025-53773 |
BLWK-AI-010 | High | VS Code Workspace Trust disabled | T1204.002 |
BLWK-AI-011 | High | A VS Code task set to run on folderOpen | T1204.002 |
BLWK-AI-012 | High | Hidden Unicode in an instruction file: bidi controls that reorder what you see, invisible Tag characters that spell text only the model reads (shown decoded), a long run of zero-width characters, or zero-width characters threaded between the letters of ordinary text (the Rules File Backdoor, ASCII smuggling, GlassWorm) | Pillar Security |
BLWK-AI-013 | Medium | Prompt-injection-style phrases in an instruction file (heuristic) | T1566 |
BLWK-AI-014 | High | An ANTHROPIC_BASE_URL / OPENAI_BASE_URL override to a non-official host | CVE-2025-59536 |
BLWK-AI-015 | Medium | A plaintext credential file readable by group/other; a .env or home config file holding a key that other accounts can actually read (the file and every folder above it are open to them) | T1552.001 |
BLWK-AI-016 | High | A secret-bearing file in a git repo that git already tracks, or that no .gitignore rule covers | T1552.001 |
BLWK-AI-017 | High | Codex approval_policy = "never" + sandbox_mode = "danger-full-access" | T1059 |
BLWK-AI-018 | High | An MCP server connecting to a remote endpoint with a plaintext token in its config: in a header, or in the address itself (?token=…, user:password@). A reference such as ${API_TOKEN} is not a stored token | T1552.001, T1071.001 |
BLWK-AI-019 | Critical | An MCP server running a privileged or host-mounting container (--privileged, the Docker socket or / mounted with -v, --volume or --mount) | T1610, T1611 |
BLWK-AI-020 | High | A filesystem MCP server granted an over-broad root: /, or a whole home directory by any name (~, $HOME, /home/you, /Users/you, /root, C:\Users\you) | T1083 |
BLWK-AI-021 | High | An agent's command sandbox is turned off (Codex danger-full-access, Cursor CLI sandbox.mode: disabled, Claude Code's weaker nested sandbox) | T1059, T1611 |
BLWK-AI-022 | High | The account that runs your agents is in the docker, lxd or incus-admin group, so it can become root with no password | T1611, T1068 |
BLWK-AI-023 | Medium | An MCP server whose tools all run without approval (trust: true, autoApprove: ["*"], alwaysAllow: ["*"]) | T1059 |
These are native Rust detectors, not YAML rules — the same reason the ClamAV integration isn't a collector. Secret detection needs capturing regexes and redaction spans; the config checks parse MCP JSON and inspect files for invisible Unicode; none of that fits the flat condition DSL. They carry the same shape as a YAML rule all the same (id, severity, plain-language explanation, one-line fix, references) and the same discipline (every detector is unit-tested, including a benign no-false-positive case).
Supported agents
Every agent stores the same few things in its own dialect: instruction files the model reads, settings that decide what it may do without asking, hooks that run commands on agent events, MCP server lists, and transcripts. Bulwark knows where each agent keeps them, normalizes the MCP server lists into one shape, and runs one set of checks over all of them. A new agent mostly needs new locations, not new rules.
| Agent | What Bulwark reads |
|---|---|
| Claude Code | CLAUDE.md, CLAUDE.local.md, .claude/{settings,agents,commands,skills,rules}, .mcp.json, ~/.claude.json, installed plugins (~/.claude/plugins/cache), transcripts, memory, prompt history |
| Claude Desktop | ~/.config/Claude/claude_desktop_config.json |
| Codex | ~/.codex/config.toml (approvals, sandbox, [mcp_servers]), AGENTS.md, prompts, sessions, history |
| Cursor | .cursorrules, .cursor/{rules,commands,mcp.json,hooks.json,cli.json}, ~/.cursor/{mcp,cli-config}.json, Cursor's VS Code-style user settings |
| GitHub Copilot | .github/{copilot-instructions.md,instructions,prompts,agents,chatmodes,hooks,copilot/settings.json,mcp.json}, ~/.copilot (MCP, instructions, agents, providers.json) |
| Gemini CLI / Qwen Code | GEMINI.md / QWEN.md, .gemini / .qwen settings, commands, agents, skills and rules, extensions, chat transcripts, OAuth credential files |
| Zed | .rules, .zed/settings.json, ~/.config/zed/settings.json (agent.tool_permissions, context_servers) |
| Goose | .goosehints, ~/.config/goose/config.yaml (GOOSE_MODE, extensions), secrets.yaml |
| OpenCode / Kilo Code | opencode.json[c] / kilo.json[c] (permission, mcp), .opencode agents, commands and modes, .kilo rules |
| Crush | CRUSH.md, crush.json, project crushrc (a shell script Crush runs at startup) |
| Amp | .amp/settings.json, ~/.config/amp/settings.json (amp.mcpServers) |
| Kiro / Amazon Q | .kiro/{steering,agents,hooks,settings/mcp.json}, .amazonq/{rules,prompts,cli-agents,mcp.json}, ~/.aws/amazonq |
| Cline / Roo / Kilo (VS Code) | .clinerules (and its hooks/), .roo, .roomodes, ~/.cline/data (MCP, task transcripts, secrets.json), the extensions' globalStorage in every VS Code-family editor |
| Windsurf / Devin Desktop | .windsurfrules, .windsurf/rules, .devin/{rules,config.json,hooks.v1.json}, ~/.codeium/windsurf/mcp_config.json |
| Continue | .continue/rules, .continue/mcpServers/*.yaml, ~/.continue/config.yaml |
| Augment, JetBrains, Warp | .augment/{settings.json,rules}, .augment-guidelines, .junie, .aiassistant/rules, WARP.md |
| Aider, Open Interpreter | .aider.conf.yml and chat history; ~/.config/open-interpreter/profiles/*.yaml (auto_run) |
| Cross-agent | AGENTS.md, AGENT.md, .agents/skills, ~/.config/agents/skills |
| VS Code and forks | settings.json (also per profile) and mcp.json under ~/.config/{Code,Code - Insiders,Code - OSS,VSCodium,Cursor,Windsurf,Kiro}/User |
Only locations confirmed in an agent's own docs or source are listed. Zed, Goose, OpenCode, Crush and Amazon Q keep their chat history in SQLite databases, which the text secret scanner can't read, so those transcripts are not secret-scanned.
An MCP server switched off in its config (disabled: true, enabled: false) never launches, so only its at-rest risk, an inline token, is reported for it.
Hooks are reported only when a repository supplies them. A hook in your own home directory is your automation. A hook that arrives in a repository you cloned runs its authors' commands on your machine (the CVE-2025-59536 pattern), whichever agent it targets. Your home folder is never treated as a cloned repository, even when an agent was once run there.
What .gitignore changes, and what it cannot
A project's .gitignore is written by the project, and a scan is what you run before you trust one. So it decides exactly one thing: whether a leaked key in a file is worth reporting.
- What an agent will run or obey is always checked. Settings, hooks, MCP servers, tasks, and hidden or injected text in instruction files are checked in every file found, whether git ignores it or not. Your agent reads
.claude/settings.local.jsoneither way, so Bulwark does too: an ignored, untrackedsettings.local.jsonwithbypassPermissionsis reported. - A key is left alone only in a file that is both ignored and not tracked, a file you keep local on purpose. A file that is ignored and tracked (added with
git add -f, or committed before the ignore rule was written) is in the repository, so its key is reported andBLWK-AI-016says git already tracks it. Such a file is never offered for redaction. - When Bulwark cannot tell whether a file is tracked, it reports the key. That is the case in a linked worktree (where
.gitis a file) and with a split or sparse index.
Bulwark never runs git in a folder it checks: a repository's own .git/config can make git start a program. It reads the ignore files (every .gitignore down to the file's folder, .git/info/exclude, and your own global ignore file) and the index itself. A core.excludesFile set in the repository's config is not honoured.
Sandbox posture
Approval prompts and sandboxes are the two things between a prompt-injected agent and your machine. Bulwark reports an agent whose sandbox has been switched off (BLWK-AI-021) separately from one that never asks (BLWK-AI-007). When both are true for Codex, that is the single stronger BLWK-AI-017.
BLWK-AI-022 looks past the agent's own settings. If the account your agents run as is in the docker, lxd or incus-admin group, any shell command an agent runs can start a container that mounts / and become root, sandbox or not. This check runs only on a whole-machine scan of your own home directory, and only when at least one agent was found.
How workspaces are discovered
Because every developer's layout differs, the scanned workspace set is derived, not hardcoded:
- From your assistants' own records — the projects Claude Code has opened (
~/.claude/projects/). The folder is taken from the name of the record, or, when that name is ambiguous (a-,.or_in the path), from the folder its transcripts say they ran in. - A shallow sweep of common code roots —
~/Workspaces,~/Projects,~/src,~/dev,~/code,~/git, … — for directories carrying any supported agent's marker (.claude/,CLAUDE.md,.cursor/,.mcp.json,AGENTS.md,.kiro/,opencode.json,.goosehints,.github/instructions/, …). Every location in the table above is a marker, including.vscode/settings.jsonand.vscode/tasks.json; a folder with only those is checked too, but is the first to be left out when there are more projects than one scan covers.node_modules,.git, and build trees are skipped. - Folders you add in Settings → AI assistants, plus any you exclude there (
--rootand--excludeon the command line). An excluded folder takes out everything under it.
Files are read in place and nothing in them is run. A link is followed only while it stays inside the project (or, for your agents' own state, inside your home folder); a link that leaves it, a folder that cannot be listed, a pipe where a file should be, and a file larger than 64 MB (of which the first 64 MB are read) are each listed under "Not covered by this scan" (--all shows them) and never counted as checked.
Global $HOME tool state (~/.claude/, ~/.codex/, ~/.gemini/, ~/.config/<agent>/, the VS Code-family user directories, …) is always included. The desktop app also runs a periodic background sweep and notifies you when a new secret or risky config appears. Turn it off in Settings → AI assistants.
Redaction
Bulwark reads these files but never rewrites them on its own — finding a secret and removing it are two deliberate, separate acts, the same stance file-integrity baselining takes.
- Dry run first.
bulwarkctl ai redact(no flags) reports exactly which files would change and how many secrets each holds, touching nothing. - Apply explicitly.
bulwarkctl ai redact --apply(or Remove secret from this file on an opened finding in the app) rewrites the files, replacing each high-confidence secret with an inert placeholder. Before overwriting, it writes a0600backup of every file it touches, and it preserves the original file's permissions on the rewritten copy. Only high-confidence provider secrets are redacted — the fuzzyKEY=valueheuristic is report-only. - Only inside an agent's own folder. A file is rewritten only when it really is inside one (
~/.claude/…,.cursor/rules/…,~/.config/opencode/…), with no link anywhere between that folder and the file. A.env, aCLAUDE.mdat a project root, and a file an ignore rule matches are reported and never rewritten. - Never a file in use. A file changed in the last 30 seconds is left alone (a session may still be writing to it;
--include-activeoverrides this), and a file that changes while it is being rewritten is left as it was.ai redact --applyexits1when a file it meant to clean still holds a key, and names it.
Redaction removes the secret from that file; it can't un-leak it. Rotate any exposed credential. The backup is the original file, secret included: it stays in ~/.local/share/bulwark/redaction-backups until you delete that folder.
CLI
# Scan every discovered workspace + your home-directory tool state.
bulwarkctl ai scan
# Scan just one project (skips the whole-machine sweep). The folder must exist. The result is
# shown but not saved: only a whole-machine scan replaces the stored results.
bulwarkctl ai scan --target ~/work/service
# Add discovery roots, or leave out a folder and everything under it.
bulwarkctl ai scan --root ~/oss --exclude ~/Projects/huge-monorepo
# Also low-priority items, every file each problem was found in, and the masked evidence.
bulwarkctl ai scan --all
# Preview, then apply, redaction. A 0600 backup of each file is kept.
bulwarkctl ai redact
bulwarkctl ai redact --applyThe report leads with what to fix — one line per problem, worst first, why it matters and the first step — and ends with what Bulwark can do for you:
Bulwark 0.15.0 · AI coding agents · 1 project · 4 agent files checked
4 problems to fix 1 critical · 3 high
● Critical Project-supplied agent hooks run shell commands automatically
This project settings file defines hooks. Claude Code hooks run shell commands
automatically on tool/session events — a project-supplied hook can execute …
→ Remove the hooks from the repository's agent config (for example the hooks
block in .claude/settings.json, .cursor/hooks.json, .kiro/hooks/, or a …
in: ~/Projects/api/.claude/settings.json:1
more: https://bulwark.nrl.ai/checks/blwk-ai-002
● High GitHub PAT exposed in AI context
Anything written into an assistant's context, memory, or transcript should be
treated as leaked — rotate it.
→ Remove the key from the file and replace it with a new one. Anything pasted
into an AI chat should be treated as leaked.
in: ~/.claude/projects/-home-u-api/memory/notes.md:1
more: https://bulwark.nrl.ai/checks/blwk-ai-001
…
→ 1 agent file holds leaked secrets Bulwark can remove — preview with bulwarkctl ai redact, then add --apply
→ Removing a secret from a file doesn't make it safe again: rotate it with its provider.ai scan exits non-zero on findings (2 for a critical, 1 for medium/high), so it drops into cron or CI the same way bulwarkctl scan does.
Stopping a scan
A sweep across a machine with many workspaces takes a while, so every scan can be stopped from the UI. Stop is not cosmetic: it stops the engine mid-walk (and, for the antivirus scan, kills the clamscan child process rather than leaving it churning the disk in the background).
A stopped scan is partial, and Bulwark treats it that way rather than pretending otherwise:
- The results are labelled as partial and are not persisted. A half-finished sweep never replaces a complete picture on disk.
- Nothing it didn't reach is marked as passing. The rule engine only records the checks that demonstrably ran, so stopping a scan can never resolve a finding it never actually re-tested.