Repository navigation
feat(pm): install the MCP content-write deny roster into user-scope settings - #34526
Merged
Merged
Conversation
…ettings A claude.ai project thread never applies the repository's Claude settings file, so lock 1 (the permissions.deny roster) is absent there and every MCP GitHub content-write tool is offered. Such a session does read ~/.claude/settings.json, and reloads it live: measured, writing the roster there mid-session removed exactly the 17 roster tools. scripts/pm/install-settings-deny-roster.mjs merges CONTENT_WRITE_TOOLS (imported from check-settings-deny-roster.mjs, never restated) into the user-scope file: creates it when absent, keeps every other key and deny entry, writes nothing when already complete, refuses an unreadable file, and judges the result with the gate's own verdict. Its self-test runs under check:pm-settings-deny-roster. Co-authored-by: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WGufzfgjqr3ubfqP8Wc51p
Contributor
Author
|
domain:skills#3 · os-support-ai · session_01WGufzgtCwPzNYSczvxDEpw 席位核对Verdict: ACCEPT · head
|
This was referenced Nov 17, 2026
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.
Requested by Yibo Wang · project thread
Refs #25583
Clause-②: no
Metadata-protocol: none
维护者速读
scripts/pm/install-settings-deny-roster.mjs,把 17 个 MCP GitHub 内容写工具的 deny 名单写进用户级~/.claude/settings.json(名单从现有门禁check-settings-deny-roster.mjs导入,不复制),自测接进check:pm-settings-deny-roster。.claude/settings.json(平台设计如此),写身份锁 1 缺席;实测用户级文件会被读取且会话中途写入即时生效,17 个写工具当场从工具列表消失。scripts/pm/install-settings-deny-roster.mjs的mergeDenyRoster与install;package.json第 102 行。node scripts/pm/install-settings-deny-roster.mjs --settings /tmp/x.json && node scripts/pm/check-settings-deny-roster.mjs --settings /tmp/x.json,两条都应 exit 0。What changes
scripts/pm/install-settings-deny-roster.mjs(new): mergesCONTENT_WRITE_TOOLS, imported fromscripts/pm/check-settings-deny-roster.mjs, into the user-scope settings file (~/.claude/settings.json, or--settings PATH). It creates the file and its folder when absent, keeps every other key and every existing deny entry, appends only the missing roster tools, writes nothing when the file already holds them (bytes and mtime unchanged), writes atomically, refuses (exit 3, nothing written) a file it cannot parse or whosepermissions/denyhas the wrong shape, and judges the on-disk result with the gate's ownverdict. Exit codes match the gate's.--dry-runreports without writing. It spells no roster tool name; its self-test asserts that.package.json:check:pm-settings-deny-roster(already run byLint & Repo Gates) also runs the installer's--self-test(36 cases, six pinned batteries plus the verdict handshake).Why the repo half is a user-scope installer rather than a hook: the platform documents that a project thread applies none of a repository's
.claude/settings.jsonpermission rules, hooks orenv, with one repository or several. So no repo file reaches the session by itself; the user scope is the only settings layer the session reads that the environment's setup script can write.Tests
node scripts/pm/install-settings-deny-roster.mjs --self-test: 36 cases pass.pnpm check:pm-settings-deny-roster: gate self-test 36 pass, gate 17 = 17, installer self-test 36 pass, exit 0.node scripts/pm/install-settings-deny-roster.mjsthennode scripts/pm/check-settings-deny-roster.mjs --settings ~/.claude/settings.json, both exit 0.Acceptance notes
package.jsonis outside the claim's declared file surface (scripts/pm/**); it is the one alias line that makes CI run the new self-test.Maintainer-action:line needs a new wording (proposed in the hand-off comment): the done-when no longer depends on the repository being cloned before the setup script runs.Verification
Measurement table: the three triage questions, re-measured 2026-11-16 in a project thread (session_01WGufzfgjqr3ubfqP8Wc51p, objectstack origin/main 9e6fee1)
/root/.claude/projects/-home-claude/; repo at/home/claude/objectstack;CLAUDE_PROJECT_DIRunset/root/.claude/and/home/claude/.claude/each holdlauncher-settings.json(identical; allowSkill, deny only on launcher files; hooks PostToolUse, Stop, UserPromptSubmit) and nosettings.json.claude/settings.jsonread?git show origin/main:) ran unblocked, exit 0; the same command piped to the hook directly: exit 2. No SessionStart pointer appeared./root/.claude/settings.jsonat 16:42:43Z. The next tool listing dropped exactly those 17 tools;issue_read(control) stayed. User scope is read and reloaded live.HOME=TMP node .../install-settings-deny-roster.mjs: 5 s, 43 MB, created the file; gate on it exit 0.Proposed setup-script line (after merge, cloud environment of the project):
It does not depend on where or whether the session's own clone exists when the setup script runs. A thread on the current built-in environment can close the lock for itself by running
node scripts/pm/install-settings-deny-roster.mjsas its first step.🤖 Generated with Claude Code
https://claude.ai/code/session_01WGufzfgjqr3ubfqP8Wc51p