Skip to content

fix(mcp): exact-match dangerous flags, stop -c substring false positives#1115

Open
nguyennguyenit wants to merge 1 commit intodevfrom
fix/mcp-arg-validation-substring-1027
Open

fix(mcp): exact-match dangerous flags, stop -c substring false positives#1115
nguyennguyenit wants to merge 1 commit intodevfrom
fix/mcp-arg-validation-substring-1027

Conversation

@nguyennguyenit
Copy link
Copy Markdown
Contributor

Summary

  • `ValidateArgs` now matches short/long flags (`-c`, `-e`, `-r`, `--eval`, `--require`, `--import`) by exact value or `--flag=value` prefix only.
  • Inline code-execution substrings (`exec(`, `eval(`, `import`, `child_process`, `subprocess`) keep their substring semantics.
  • Fixes false positive where `@nick.bester/clickup-cli` was rejected because it contained `-c` as a substring.

Closes #1027.

Test plan

  • `go test ./internal/mcp/ -run ValidateArgs` passes (existing cases + new `clickup-cli`, `some-experimental-pkg`, `some-runner-pkg`, `--eval=...` regression cases)
  • `go build ./...` and `go build -tags sqliteonly ./...` succeed

Previously ValidateArgs flagged any arg containing '-c', '-e', or '-r' as
substrings, blocking legitimate npm package names like 'clickup-cli'. Split
the check: short/long flags now require exact match (or '--flag=value' prefix),
while inline-code patterns ('exec(', '__import__', 'subprocess', etc.) keep
substring semantics.

Closes #1027.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: MCP arg validation false positive — substring match on '-c' blocks legitimate package names

1 participant