Skip to content

Find the holes before someone else does. A fast, 100% Rust vulnerability scanner: XSS, SQL injection, leaked secrets, dependency CVEs and AI agent setups.

feat(agent): flag enableAllProjectMcpServers in Claude Code settings (#79)

Onur Ugur95b32655877c
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 21110eb..69ae5e1 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -33,6 +33,9 @@
such as `mongodb+srv://<username>:<password>@host/db`, the form MongoDB Atlas shows in its docs.
- Dependencies: `pnpm-lock.yaml` is read again. A blank line ended the `packages:` section, and
pnpm writes one right after it, so every pnpm project reported 0 packages checked.
+- Agent: new rule `agent.mcp-auto-approve` (high) for `"enableAllProjectMcpServers": true` in
+ `.claude/settings*.json`, which starts every MCP server in the project's `.mcp.json` without asking about
+ each one.
## 1.0.2 (2026-11-23)
diff --git a/README.md b/README.md
index 1faf296..c5cf016 100644
--- a/README.md
+++ b/README.md
@@ -20,7 +20,7 @@ Every finding comes with the line, the reason and the fix.</p>
<a href="https://github.com/erkamyaman/safe-anything"><img src="https://img.shields.io/github/stars/erkamyaman/safe-anything?style=social" alt="GitHub stars"></a>
</p>
-<p align="center"><b><a href="#quick-start">Install</a></b> · <a href="https://github.com/erkamyaman/safe-anything/releases">Releases</a> · <a href="#for-ai-agents">Claude Code plugin</a> · <a href="#in-ci">GitHub Action</a> · <a href="docs/rules.md">All 78 rules</a> · <a href="docs/agent-setups.md">Agent setups</a><br>
+<p align="center"><b><a href="#quick-start">Install</a></b> · <a href="https://github.com/erkamyaman/safe-anything/releases">Releases</a> · <a href="#for-ai-agents">Claude Code plugin</a> · <a href="#in-ci">GitHub Action</a> · <a href="docs/rules.md">All 79 rules</a> · <a href="docs/agent-setups.md">Agent setups</a><br>
Made in Türkiye 🇹🇷 by <a href="https://github.com/erkamyaman">erKam Yaman</a>, who also made <a href="https://github.com/erkamyaman/rust-anything">rust-anything</a> · <a href="https://github.com/sponsors/erkamyaman">❤️ Sponsor me</a> · Sponsored by <a href="https://coderabbit.link/er-kam">CodeRabbit</a></p>
<p align="center">
@@ -86,14 +86,14 @@ safe-anything --list-rules
## What it finds
-78 rules, each with a CWE id, an OWASP category and a link to the OWASP page that explains it.
+79 rules, each with a CWE id, an OWASP category and a link to the OWASP page that explains it.
The full list is in [docs/rules.md](docs/rules.md).
| | |
| --- | --- |
| **Code** | SQL injection, command injection, XSS (`innerHTML`, `dangerouslySetInnerHTML`, `v-html`, `echo $_GET`, `raw`), `eval` and `new Function`, path traversal, SSRF, unsafe deserialization (pickle, `yaml.load`, `ObjectInputStream`, `BinaryFormatter`, `unserialize`, `Marshal`), TLS checks turned off, MD5/SHA-1, DES/RC4/ECB, JWT `none`, template injection, debug mode, insecure cookies, `Math.random` tokens. JS/TS, Python, Go, Java, Kotlin, PHP, Ruby, C#, SQL |
| **Secrets** | AWS, GitHub, Slack, Stripe, OpenAI, Anthropic and Google keys, private keys, passwords in code, credentials in connection strings, committed `.env` files, real values in `.env.example`, a `.gitignore` that misses `.env`, secrets behind public prefixes (`NEXT_PUBLIC_`, `VITE_`, `EXPO_PUBLIC_`) that ship in the client bundle |
-| **Agent setups** | `bypassPermissions` and `--dangerously-skip-permissions`, pre-approved `Bash`, MCP servers run with unpinned `npx`/`uvx`/`docker`, MCP tokens in plain text, remote MCP over `http://`, `curl \| sh` in hooks and skills, prompt-injection text, skills that read `~/.ssh` or cloud credentials, invisible Unicode in instructions. [More](docs/agent-setups.md) |
+| **Agent setups** | `bypassPermissions` and `--dangerously-skip-permissions`, pre-approved `Bash`, `enableAllProjectMcpServers`, MCP servers run with unpinned `npx`/`uvx`/`docker`, MCP tokens in plain text, remote MCP over `http://`, `curl \| sh` in hooks and skills, prompt-injection text, skills that read `~/.ssh` or cloud credentials, invisible Unicode in instructions. [More](docs/agent-setups.md) |
| **Mobile** | Android `debuggable`, cleartext traffic, exported content providers, WebView file access and JS bridges, world-readable files; iOS ATS turned off; tokens in UserDefaults, SharedPreferences, AsyncStorage or localStorage |
| **Config** | Docker (unpinned base, root, secrets in `ENV`, `ADD <url>`), GitHub Actions (`pull_request_target`, `write-all`, actions on `@main`, script injection from PR titles), privileged containers, `hostNetwork`, open Terraform ingress, public buckets, nginx autoindex, TLS 1.0/1.1 |
| **Dependencies** | every locked version in `package-lock.json`, `npm-shrinkwrap.json`, `yarn.lock`, `pnpm-lock.yaml`, `Cargo.lock`, `requirements*.txt`, `poetry.lock`, `uv.lock`, `pdm.lock`, `go.mod`, `Gemfile.lock`, `composer.lock` and `pubspec.lock`, checked against [OSV.dev](https://osv.dev), with the nearest fixed version |
@@ -175,7 +175,7 @@ lockfile listed under Dependencies. Nothing is executed. The only network call i
names and versions to OSV.dev ([privacy](docs/privacy.md)).
It finds known patterns; it does not trace data through your program. A clean scan means none of
-these 78 problems were found, not that the code is safe. [Design notes](docs/adr).
+these 79 problems were found, not that the code is safe. [Design notes](docs/adr).
## Credits
diff --git a/docs/agent-setups.md b/docs/agent-setups.md
index 5f53e54..7d8a70d 100644
--- a/docs/agent-setups.md
+++ b/docs/agent-setups.md
@@ -20,6 +20,7 @@ decide what they may do are code, and safe-anything checks them like code.
| Rule | Example | Why |
| --- | --- | --- |
| `agent.bypass-permissions` | `"defaultMode": "bypassPermissions"`, `--dangerously-skip-permissions`, `sandbox_mode = "danger-full-access"` | one bad instruction can do anything on the machine |
+| `agent.mcp-auto-approve` | `"enableAllProjectMcpServers": true` in `.claude/settings.json` | every server in a cloned repository's `.mcp.json` starts without asking about each one |
| `agent.unrestricted-shell` | `"allow": ["Bash"]` | every shell command is pre-approved |
| `agent.mcp-unpinned` | `"command": "npx", "args": ["-y", "some-mcp-server"]` | every start runs whatever was published last; a hijacked package runs with your access |
| `agent.mcp-plaintext-secret` | `"env": { "GITHUB_TOKEN": "ghp_..." }`, `"headers": { "Authorization": "Bearer sk-..." }` | the token travels with the file; `"Bearer ${API_TOKEN}"` keeps it out |
diff --git a/docs/rules.md b/docs/rules.md
index 2977af0..c75ccf2 100644
--- a/docs/rules.md
+++ b/docs/rules.md
@@ -56,11 +56,12 @@ Every rule safe-anything checks, generated from `safe-anything --list-rules --js
| [`secret.public-env-secret`](https://cheatsheetseries.owasp.org/cheatsheets/Secrets_Management_Cheat_Sheet.html) | high | [CWE-200](https://cwe.mitre.org/data/definitions/200.html) | A05:2021 Security Misconfiguration | A secret is given a public env prefix, so the build ships it inside the client bundle where anyone can read it. |
| [`secret.env-not-ignored`](https://cheatsheetseries.owasp.org/cheatsheets/Secrets_Management_Cheat_Sheet.html) | medium | [CWE-538](https://cwe.mitre.org/data/definitions/538.html) | A05:2021 Security Misconfiguration | The project has env files but .gitignore does not exclude .env, so real secrets are one git add away from the repository. |
-## Agent setups (9)
+## Agent setups (10)
| Rule | Severity | CWE | OWASP | What it means |
| --- | --- | --- | --- | --- |
| [`agent.bypass-permissions`](https://genai.owasp.org/llmrisk/llm062025-excessive-agency/) | high | [CWE-250](https://cwe.mitre.org/data/definitions/250.html) | LLM06:2025 Excessive Agency | The agent is set to run every action without asking, so one bad instruction can do anything on this machine. |
+| [`agent.mcp-auto-approve`](https://genai.owasp.org/llmrisk/llm062025-excessive-agency/) | high | [CWE-829](https://cwe.mitre.org/data/definitions/829.html) | LLM06:2025 Excessive Agency | Claude Code starts every MCP server in the project's .mcp.json without asking about each one, so a cloned repository's servers can run commands on this machine. |
| [`agent.remote-script`](https://genai.owasp.org/llmrisk/llm032025-supply-chain/) | high | [CWE-494](https://cwe.mitre.org/data/definitions/494.html) | LLM03:2025 Supply Chain | A script is downloaded and run straight from the internet; whoever controls that URL controls this machine. |
| [`agent.prompt-injection`](https://genai.owasp.org/llmrisk/llm01-prompt-injection/) | medium | [CWE-1427](https://cwe.mitre.org/data/definitions/1427.html) | LLM01:2025 Prompt Injection | Instruction text tells the agent to override its rules or hide actions from the user (prompt injection). |
| [`agent.sensitive-file-access`](https://genai.owasp.org/llmrisk/llm022025-sensitive-information-disclosure/) | high | [CWE-200](https://cwe.mitre.org/data/definitions/200.html) | LLM02:2025 Sensitive Information Disclosure | Agent instructions read credential files such as SSH keys or cloud credentials. |
diff --git a/src/refs.rs b/src/refs.rs
index ab1a726..85e6e80 100644
--- a/src/refs.rs
+++ b/src/refs.rs
@@ -159,6 +159,9 @@ pub fn of(id: &str) -> Refs {
"agent.bypass-permissions" | "agent.unrestricted-shell" => {
r!("CWE-250", "LLM06:2025 Excessive Agency", url "https://genai.owasp.org/llmrisk/llm062025-excessive-agency/")
}
+ "agent.mcp-auto-approve" => {
+ r!("CWE-829", "LLM06:2025 Excessive Agency", url "https://genai.owasp.org/llmrisk/llm062025-excessive-agency/")
+ }
"agent.remote-script" => {
r!("CWE-494", "LLM03:2025 Supply Chain", url "https://genai.owasp.org/llmrisk/llm032025-supply-chain/")
}
diff --git a/src/rules/agent.rs b/src/rules/agent.rs
index c9f3b46..13ec46b 100644
--- a/src/rules/agent.rs
+++ b/src/rules/agent.rs
@@ -66,6 +66,15 @@ pub static RULES: &[Rule] = &[
"The agent is set to run every action without asking, so one bad instruction can do anything on this machine.",
"Use the default or an accept-edits mode and allow specific commands instead of skipping all approvals."
),
+ rule!(
+ "agent.mcp-auto-approve",
+ High,
+ claude_settings,
+ r#""enableAllProjectMcpServers"\s*:\s*true\b"#,
+ None,
+ "Claude Code starts every MCP server in the project's .mcp.json without asking about each one, so a cloned repository's servers can run commands on this machine.",
+ "Remove it and approve project MCP servers one by one, or list the trusted ones in \"enabledMcpjsonServers\"."
+ ),
rule!(
"agent.remote-script",
High,
diff --git a/tests/fixtures/agent/.claude/settings.json b/tests/fixtures/agent/.claude/settings.json
index 0705c31..bea82ab 100644
--- a/tests/fixtures/agent/.claude/settings.json
+++ b/tests/fixtures/agent/.claude/settings.json
@@ -1,4 +1,5 @@
{
+ "enableAllProjectMcpServers": true,
"permissions": {
"defaultMode": "bypassPermissions",
"deny": ["Bash", "Bash(*)"],
diff --git a/tests/fixtures/agent/EXPECTED b/tests/fixtures/agent/EXPECTED
index 5eb106e..7b83939 100644
--- a/tests/fixtures/agent/EXPECTED
+++ b/tests/fixtures/agent/EXPECTED
@@ -1,6 +1,7 @@
-.claude/settings.json:14 agent.remote-script
-.claude/settings.json:3 agent.bypass-permissions
-.claude/settings.json:7 agent.unrestricted-shell
+.claude/settings.json:15 agent.remote-script
+.claude/settings.json:2 agent.mcp-auto-approve
+.claude/settings.json:4 agent.bypass-permissions
+.claude/settings.json:8 agent.unrestricted-shell
.claude/skills/helper/SKILL.md:5 agent.prompt-injection
.claude/skills/helper/SKILL.md:6 agent.prompt-injection
.claude/skills/helper/SKILL.md:7 agent.sensitive-file-access
diff --git a/tests/fixtures/agent/trusted/.claude/settings.json b/tests/fixtures/agent/trusted/.claude/settings.json
new file mode 100644
index 0000000..4abfc5a
--- /dev/null
+++ b/tests/fixtures/agent/trusted/.claude/settings.json
@@ -0,0 +1,4 @@
+{
+ "enableAllProjectMcpServers": false,
+ "enabledMcpjsonServers": ["github"]
+}