Skip to content

fix(mcp): block suspicious stdio configs before probe - #46112

Merged
teknium1 merged 1 commit into
mainfrom
fix/mcp-pre-spawn-exfil-guard
Jun 14, 2026
Merged

fix(mcp): block suspicious stdio configs before probe#46112
teknium1 merged 1 commit into
mainfrom
fix/mcp-pre-spawn-exfil-guard

Conversation

@teknium1

Copy link
Copy Markdown
Contributor

Summary

MCP stdio configs now reject exfil-shaped commands before any probe/connect path can spawn them.

PR #46083 blocked persistence and config-loaded runtime startup, but hermes mcp add still probed a suspicious stdio command before the save-time rejection. This follow-up moves the guard ahead of probe/connect and reuses it for explicit runtime registration paths such as ACP-provided MCP servers.

Changes

  • hermes_cli/mcp_config.py: validate suspicious stdio entries before cmd_mcp_add probe and inside _probe_single_server before _connect_server.
  • tools/mcp_tool.py: centralize suspicious MCP filtering and apply it to both config-loaded discovery and direct register_mcp_servers() calls.
  • hermes_cli/config.py: avoid the temporary validator name assignment pattern that produced type-checker warnings.
  • tests/hermes_cli/test_mcp_security.py: add regressions proving dangerous entries do not reach probe, connect, or explicit runtime registration.

Validation

Check Result
python3 -m py_compile hermes_cli/mcp_config.py tools/mcp_tool.py hermes_cli/config.py tests/hermes_cli/test_mcp_security.py passed
scripts/run_tests.sh tests/hermes_cli/test_mcp_security.py tests/hermes_cli/test_mcp_config.py tests/hermes_cli/test_mcp_catalog.py tests/tools/test_mcp_tool.py 287 passed

Infographic

MCP Pre-Spawn Guard

Loading
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.

2 participants