agent-leakcheck
See what your coding agents can reach on your machine, then fix it in one command.
Claude Code · Codex CLI · Cursor · Gemini CLI
Real output on a demo home folder. Paths are shortened to ~.
Coding agents run with your permissions. agent-leakcheck checks what they can reach: .env files, plaintext tokens, SSH keys, credential file permissions, risky auto-approve modes and an outdated Claude Code. You get a grade from A to F, one finding per problem and one fix per finding.
Quick start
npx @globalmpc/agent-leakcheck
Then apply the safe fixes. Each changed file is backed up first.
npx @globalmpc/agent-leakcheck --fix
Requires Node >= 20. No dependencies, no install step, and nothing leaves your machine unless you opt in.
Why
snyk/agent-scan checks what is inside your agent's tools and skills. agent-leakcheck checks what the agent itself can reach. They cover different layers, so use both.
What it checks
| id | Severity | Fails when |
|---|
env-deny | high | An installed agent has no deny or ignore rule covering .env files (user level or in the current project). Codex rows are info only: its permission profiles are beta. |
risky-mode | high | An auto-approve, bypass, yolo or full-access mode is the default. Also Claude Code Bash or Bash(*) in permissions.allow, and Gemini CLI bare run_shell_command in tools.allowed or security.enablePermanentToolApproval: true. |
cc-version | medium | Claude Code is older than 2.1.317. |
mcp-plaintext | medium | An MCP server config holds a literal secret-looking value in env or headers instead of an env var reference. |
mcp-autoapprove | medium | Claude Code enableAllProjectMcpServers: true in user or local settings. |
gh-token | medium | The GitHub CLI token is stored in its plain hosts file instead of the OS keyring. |
ssh | medium | A private key in ~/.ssh has permissions looser than 600. |
cred-perms | medium | ~/.claude/.credentials.json, ~/.codex/auth.json or ~/.git-credentials can be read by other users. |
secret-env | warning | Exported env var names look like secrets (*_TOKEN, *_KEY, *_SECRET, *_PASSWORD, *API_KEY*). |
training | info | Never passes or fails. Links to each provider's model-training data settings, which a local scan cannot read. |
Each rule is based on the agents' official docs. The sources are in docs/research/.
Grade
The score starts at 100. Each check that fails for at least one agent costs its weight once: high −25, medium −10. Warnings and info never change the score.
| A | B | C | D | F |
|---|
| ≥ 90 | ≥ 75 | ≥ 60 | ≥ 40 | below 40 |
Privacy: what it never does
- It never opens
.env* files, ~/.ssh/* or the login files in cred-perms. It only checks whether they exist and what their permissions are.
- It reads config files that can hold secrets (MCP configs, the GitHub CLI hosts file) only to find key names. A value is checked only for whether it looks like a literal secret.
- It reads env var names, never their values.
- It prints names (server, key, env var, file), never values.
- It makes no network requests unless you share.
test/trust.test.js plants fake secrets and fails if any of them shows up in any output.
--fix
--fix shows the planned changes, asks, backs up each file, then applies them. It only makes edits that set one key or add one array entry in an agent settings file:
- Claude Code: add
Read(//**/.env) and Read(//**/.env.*) to permissions.deny; change permissions.defaultMode from bypassPermissions to default.
- Cursor CLI: add
Read(**/.env*) to permissions.deny; change approvalMode from unrestricted to allowlist.
- Codex: change top-level
sandbox_mode from danger-full-access to workspace-write.