Repository navigation
fix(hooks): stop reporting Claude built-in MCP servers as unknown; add ccd_turn - #465
Conversation
…lt-ins as unknown MCP servers Claude built-ins (Claude_Browser, ccd_session_mgmt, ccd_turn) are runtime-provided and never have a config, so the PreToolUse hook reported every call to them as 'unknown mcp server with no resolvable config' (Sentry AI-GATEWAY-57Q, 37V, 19R). Skip that report for known built-ins and add ccd-turn to every hook's built-in map.
vigneshsubbiah16
left a comment
There was a problem hiding this comment.
🛡️ Automated Security Review (consensus)
1 finding: 0 high-confidence, 1 to triage. Reviewers: Claude (lead), Semgrep, Gitleaks.
- [LOW] A custom MCP server can claim the reserved
ccd_turnname and be treated as a built-in 🟡 —claude-code/hooks/unbound.py:2396(the same map entry exists in the antigravity, augment, codex, copilot and cursor hooks)- What: The hook decides a server is a built-in from its name alone. After this PR, any server named
ccd_turn,ccd-turnorCCD Turngets the identityclaude-builtin:ccd-turn. A user or a project.mcp.jsoncan register a server with that name. The new parity test confirms this:compute_mcp_cache_key(name, None, None, [])returns the built-in key without looking at any config. - Why: If org policy allows or does not fingerprint
claude-builtin:*identities, a server registered under this name could get past MCP sanctioning. Its calls would be recorded under the trusted built-in identity. The change atclaude-code/hooks/unbound.py:4372also removes the "unknown mcp server with no resolvable config" report for these names, so the swap would be quieter.⚠️ This is only shown for the config-less path. The diff does not show whether a server that has a real launch config (a command or URL) under this name still maps to the built-in key, or whether the gateway treats built-ins as allowed by default. - Fix: Give the
claude-builtin:identity only when the server has no user-defined config (mcp_server_configis empty). A server with a resolved command or URL should keep its launch fingerprint even when its name matches a built-in. Add a parity test whereccd_turnhas a stdio config and check that it does not returnclaude-builtin:ccd-turn. - Flagged by: Claude (lead)
- What: The hook decides a server is a built-in from its name alone. After this PR, any server named
Not raised as PR findings
- None of the Semgrep hits are on lines this PR adds or changes. They are listed here only for completeness:
insecure-file-permissionson0o700(5 hook files): this is a false positive.0o700gives access to the owner only, which is stricter than the0o644the rule suggests.python36-compatibility-Popen2atclaude-code/hooks/unbound.py:1683: this is a compatibility note, not a security issue.sqlalchemy-execute-raw-queryatcursor/unbound.py:1096: this code was already there and the PR does not touch it.⚠️ It was not checked here, because that code is not in the diff.
🤖 consensus review · reviewers: Claude, Semgrep, Gitleaks · head 80b83e1e · 2026-11-30T13:35Z
|
Re the LOW finding (a custom server named
What's left is a server that has a real config the hook fails to resolve. That gap already applies to every built-in name and isn't new here. I'm leaving this open for a human to decide rather than changing code. Generated by Claude Code |
…computer-use built-in
|
/review Generated by Claude Code |
vigneshsubbiah16
left a comment
There was a problem hiding this comment.
🛡️ Automated Security Review (consensus)
1 finding: 0 high-confidence, 1 to triage. Reviewers: Claude (lead), Semgrep, Gitleaks.
- [LOW] Built-in name
ccd_turncan be claimed by a custom server whose config is not resolved 🟡:claude-code/hooks/unbound.py:4372- What: This PR adds
ccd-turnto the built-in map in all six hooks. It also stops the "unknown mcp server with no resolvable config" report for any server name thatclaude_builtin_identity()recognizes. As a result, a server namedccd_turnthat the hook cannot resolve is now silently labelledclaude-builtin:ccd-turn. - Why: Say a real custom or malicious server is named
ccd_turn(orCCD Turn,ccd-turn) and the hook fails to resolve its config. It then gets the built-in fingerprint. If an org has sanctioned the "Claude Code Turn" group, it inherits that decision. This PR also removes the Sentry miss report and the diagnostic dispatch, which were the only signal that a name-only match happened. The PR author argues three points: configured servers keep their launch fingerprint (npm:,url:,script:); built-ins are not allowed by default; and the same gap already exists for every other built-in name. That reduces the impact.⚠️ The author's comment carries no maintainer authority, and this diff does not show the gateway side, so those points are not confirmed here. - Fix: Choose one of these:
- Keep the suppression, but only after checking a runtime signal that the server really is the Claude Desktop built-in (for example, client/app identity in the event), not the name alone.
- Or downgrade the miss to a low-volume or sampled breadcrumb instead of dropping it. That keeps a signal when a name matches a built-in but the source is unknown.
- Flagged by: Claude
- What: This PR adds
🤖 consensus review · reviewers: Claude, Semgrep, Gitleaks · head ab9702d6 · 2026-11-30T13:46Z
|
/review Generated by Claude Code |
vigneshsubbiah16
left a comment
There was a problem hiding this comment.
🛡️ Automated Security Review (consensus)
1 finding: 0 high-confidence, 1 to triage. Reviewers: claude, semgrep, gitleaks.
- [LOW] A custom server named
ccd_turnwith no resolved config is treated as the Claude built-in and stops reporting 🟡 (claude-code/hooks/unbound.py:4372, plus theccd-turnentry added to the built-in map in all six hooks)- What: Adding
ccd-turnto the built-in map does two things for any MCP server calledccd_turn/ccd-turn/CCD Turnwhose config the hook can't resolve. The server gets the fingerprintclaude-builtin:ccd-turn. And the newclaude_builtin_identity()guard drops the "unknown mcp server with no resolvable config" log and diagnostic for it. - Why: An attacker-supplied server that copies this name could be grouped with the sanctioned "Claude Code Turn" built-in. It would also no longer show up in Sentry or the diagnostic dispatch, which is the signal that would expose a config-resolution gap. The PR author says a configured server keeps its launch fingerprint (
npm:/url:/script:), and that built-ins are not allowed by default. That matches thecompute_mcp_cache_keycases they list, but this diff doesn't show it. What's left is the case where a server has a real config the hook fails to resolve. That gap is not new (it already applies toClaude_Browser,ccd_session_mgmt, …), but this PR widens it to one more name. - Fix: Keep the miss report for built-in names when there is any sign of a user-defined server. Check whether the name appears in a config file or plugin dir that failed to parse, and report in that case. Or downgrade the report to a lower-severity log for built-ins instead of dropping it. A maintainer should decide whether the leftover risk is acceptable.
- Flagged by: claude. The PR author's reply (
[MEMBER] [PR AUTHOR]) disputes this, but the PR author's own reply can't suppress a finding, and it explicitly leaves the decision to a human.
- What: Adding
Pre-existing (not introduced by this PR)
- Semgrep
insecure-file-permissions(0o700) in all six hooks, Semgreppython36-compatibility-Popen2(claude-code/hooks/unbound.py:1683) and Semgrepsqlalchemy-execute-raw-query(cursor/unbound.py:1096): this diff doesn't touch any of these lines.0o700(owner-only access) is stricter than Semgrep's suggested0o644, so that rule is a false positive.
🤖 consensus review · reviewers: Claude, Semgrep, Gitleaks · head 3340b163 · 2026-11-30T15:04Z
Before: every call to a Claude built-in MCP tool (
Claude_Browser,ccd_session_mgmt, and Claude Desktop'sccd_turn) made the Claude Code hook report "unknown mcp server with no resolvable config" to Sentry. That is the top ai-gateway issue: AI-GATEWAY-57Q (ccd_turn, 16k events), plus 37V and 19R.After: the hook stays quiet for known Claude built-ins, and
ccd_turnis a built-in. A server the hook really can't resolve, such astoolchain-agentcore(AI-GATEWAY-4Q4), still reports.Built-ins are runtime-provided and never have a config, so a missing config is expected for them. The gateway already names them
claude-builtin:<name>from the bare name.How
claude-code/hooks/unbound.py: the miss report skips servers whereclaude_builtin_identity()is set.ccd-turn.test_pretool_mcp.pychecks built-ins don't report and a custom unresolved server still does; the parity suite checks every hook mapsccd_turntoclaude-builtin:ccd-turn.Red, then green (new tests only)
ccd-turnidentity).stagingwhen run as root.Companion PRs (same branch name): ai-gateway, ai-gateway-data, coding-discovery-tool add
ccd-turnto their built-in maps.Generated by Claude Code
Unbound Review · Score 5/5 (no findings) ·
3340b16ccd-turnto the built-in map in all six hooks. I found no problems. The skip uses the sameclaude_builtin_identity()the hooks already use to fingerprint built-ins, every copy of the map is updated, and the Claude Code hook is the only place that reports the miss,findings: 0 P0 · 0 P1 · 0 P2 (top 5 P0/P1 inline) · engines: codex ✅ · claude ✅