Repository navigation
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.
fix(mcp): tighten the allow-list name check; never copy a non-object policy #56
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Uh oh!
There was an error while loading. Please reload this page.
fix(mcp): tighten the allow-list name check; never copy a non-object policy #56
Changes from 1 commit
47c2d62bb1c154File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Correct — fixed in bb1c154. The comment claimed more than the code did, which is the same mistake this PR was already fixing elsewhere.
Verified before changing it:
The boxed string is the one that actually bites: its character indices would be copied into
mcp.toolPolicy— precisely the corruption this guard was added for one round earlier.Now prototype-checked:
Object.create(null)is accepted deliberately — it is still a plain map, and some JSON handling produces one on purpose to dodge the__proto__trap.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right — fixed in bb1c154.
sanitizeSegmentnever returns empty, so a separator always has something on both sides, andabc__/__abcare not names this module can emit.Worth recording how the obvious fix fails, because it is the third variation of the same trap in this file.
indexOf('__') > 0looks correct and is not:A server legitimately named
__aproduces a name whose first separator sits at index 0, so the index test rejects it — and "Always allow" silently stops working for that server. Exactly the failure mode as the original__-required regex, just reached from the other side.An anchored regex backtracks to the separator at index 3 and accepts it, so shape 1 is now:
/^[A-Za-z0-9_-]+__[A-Za-z0-9_-]+$/Behaviour after the change:
I checked the
__a__bcase before writing the fix rather than after, having twice now shipped a tightening that quietly rejected a legitimate name. The sweep also runs every server length over's','_'and'-'now, so that case is covered by construction instead of by one hand-picked example.50 mcpConfig cases; 23 suites, 0 failures.