fix(rules): cover managed-mcp.json in tamper.agent_config_write - #25
Open
ousamabenyounes wants to merge 1 commit into
Open
fix(rules): cover managed-mcp.json in tamper.agent_config_write#25ousamabenyounes wants to merge 1 commit into
ousamabenyounes wants to merge 1 commit into
Conversation
tamper.agent_config_write matched Claude Code's managed-settings.json in the three admin directories (/etc/claude-code, /Library/Application Support/ ClaudeCode, C:/Program Files/ClaudeCode) but not managed-mcp.json, the enterprise control that restricts which MCP servers may load. It ships to the same directories. Deleting a managed-mcp.json that carries an empty server map re-enables every MCP server on the endpoint fleet-wide, so the file mutation is squarely defense impairment (the rule's existing attack.t1562.001 scope). Extend the Claude managed-settings fragment to managed-(settings(.d/..)?|mcp) in all three regex branches (file-path, shell redirect, shell argv), scoped to those admin directories only. User/project MCP stores stay out of scope. Bump the rule version 1.7 -> 1.8 and add TestTamperRules cases covering the delete, write, redirect, and argv paths across the three directories. Fixes perplexityai#24 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
tamper.agent_config_writematched Claude Code'smanaged-settings.jsonin thethree admin directories (
/etc/claude-code/,/Library/Application Support/ClaudeCode/,C:\Program Files\ClaudeCode\) but did not matchmanaged-mcp.json, theenterprise control that restricts which MCP servers may load. It ships to the
same three directories. Per Anthropic's docs, deploying a
managed-mcp.jsonwithan empty server map blocks every MCP server fleet-wide — so deleting that one
file re-enables every MCP server on the endpoint. That mutation is squarely
defense impairment, which is the rule's existing
attack.t1562.001scope.This extends the Claude
managed-settingsfragment tomanaged-(settings(\.d/…)?|mcp)\.jsonin all three regex branches (file-path,shell redirect, shell argv), scoped to those admin directories only. User/project
MCP stores (
~/.claude.json,~/.cursor/mcp.json,~/.codex/config.toml) aredeliberately left out — they are capability acquisition, not defense impairment
(a documented false negative, consistent with the rule's precision policy). This
is the conservative line the issue proposed.
Fixes #24
Changes
rules/tamper/agent_config_write.yaml: addmanaged-mcp.jsonalongsidemanaged-settings.jsonfor the three ClaudeCode admin dirs, in the file-path,redirect, and argv match branches. Bump rule
version1.7 → 1.8.rules/catalog_test.go: addTestTamperRulescases formanaged-mcp.jsoncovering delete/write (file-path branch, macOS/Linux/Windows dirs),
echo >(redirect branch), and
rm -f(argv branch).Scope / precision
managed-settings.jsonandmanaged-settings.d/<file>.jsonmatchesare unchanged (no regression).
managed-mcp.jsonhas no.d/drop-in arm, sothe addition is a single filename, not a directory tree.
managed-mcp.json, so a repositorycheckout containing
…/Library/Application Support/ClaudeCode/managed-mcp.jsonstays quiet, exactly like the existing
managed-settings.jsonnegative.Test verification (RED → GREEN)
RED — new tests on the unmodified rule (
go test ./rules/ -run TestTamperRules):GREEN — same tests after the rule change:
Verification commands run (Go 1.26.5)