Repository navigation
fix: check every enclosing server and endpoint before reusing a local secret - #13
Merged
Merged
Conversation
… secret A nested object under a key like "servers" no longer resets the enclosing entry's scope check, and objects carrying command/url/base_url-style hints are compared wherever they sit, not only under known entry keys. The checks are ANDed down the tree; a marker leaf reuses its local value only if its parent, every enclosing entry and every enclosing hinted object are unchanged. Claude-Session: https://claude.ai/code/session_01FeijYwkkKBqRx4GkS1BRGr
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 42 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
A real local secret was reused only if key lists (endpoint hints, entry parent names at any depth) said its block was unchanged, which is incomplete by nature. The scope is now derived from the leaf's absolute path: its entry under an anchored map (mcpServers, mcp.servers, model_providers, profiles, ...), else its top-level subtree, else the whole document. Unknown maps only widen the scope, never open a hole. Claude-Session: https://claude.ai/code/session_01FeijYwkkKBqRx4GkS1BRGr
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.
Why
An automated commit security review found two problems in the secret-reuse scope rule that shipped in 1.1.0. When the repo has
{{REDACTED}}, a real local secret is reused only if its scope is unchanged. Both problems need a malicious or compromised backup repo to exploit.ENTRY_PARENTS(servers,mcp, …) reset the enclosing server's decision. A changed outercommandcould therefore still receive the token.command/args/urlwere checked on any object. The scope rule recognised servers only by their parent key. A server under an unrecognised map, such ascontext_servers, was compared only at itsenvblock.Fix
The first commit on this branch ANDed the checks and added a list of endpoint keys. A follow-up scan then pointed out that any such key list is incomplete by nature:
host,uri,proxyand others would be missing. So the second commit removes every key list from the safety decision:mcpServers,mcp_servers,servers,mcp,mcp.servers,model_providersandprofiles. The longest anchored map wins. Outside those maps the scope is the leaf's whole top-level subtree, and a leaf at the top level is scoped to the whole document. mcp.ts passesrootIsEntry, so a bare server definition is its own scope.blindEqualbetween repo and local. Repo marker paths are dropped from both sides and key order is ignored. Any added, removed or changed key blocks reuse.Unsafe values are still kept locally and reported, never moved or destroyed.
Test plan
npm run typecheck && npm test: 892 tests (875 on main).host) under an unrecognised map, the coarse fallback (a sibling entry changed), the VS Codemcp.serversshape, codexprofiles, a top-levelapiKey, andscopeOfunit cases. Earlier cases:serversmap cannot reset the entry;base_urloutside any known entry is unsafe;context_serversentry still reuses its value;envwhose only difference is the marker still reuses its value;cwd) and was corrected.https://claude.ai/code/session_01FeijYwkkKBqRx4GkS1BRGr