fix(mcp): block exfil-shaped stdio server configs - #46083
Conversation
🔎 Lint report:
|
| Rule | Count |
|---|---|
unresolved-import |
2 |
invalid-assignment |
2 |
First entries
tests/hermes_cli/test_mcp_security.py:7: [unresolved-import] unresolved-import: Cannot resolve imported module `pytest`
tests/hermes_cli/test_mcp_security.py:96: [unresolved-import] unresolved-import: Cannot resolve imported module `fastapi.testclient`
hermes_cli/config.py:4835: [invalid-assignment] invalid-assignment: Object of type `None` is not assignable to `def validate_mcp_server_entry(name: str, entry: dict[str, Any]) -> list[str]`
tools/mcp_tool.py:2701: [invalid-assignment] invalid-assignment: Object of type `None` is not assignable to `def validate_mcp_server_entry(name: str, entry: dict[str, Any]) -> list[str]`
✅ Fixed issues: none
Unchanged: 5726 pre-existing issues carried over.
Diagnostics are surfaced as warnings — this check never fails the build.
f5ea813 to
4e9477e
Compare
|
Verified: clean security hardening for MCP stdio exfiltration. Applied security checklist:
No issues found. |
|
Verified: clean security PR. Applied security checklist — no findings. Checked:
Well-scoped security gate with clean fail-closed behavior throughout the save pipeline. |
|
Positive verification — MCP exfiltration hardening Reviewed the full diff across 10 files. The defense-in-depth is well-structured:
One observation: No issues found. Clean security PR. |
Summary
MCP stdio config now rejects the #45620 exfiltration shape before it can be saved or spawned.
Changes
hermes_cli/mcp_security.py: shared narrow validator for shell interpreter + network egress/exfil-shaped args.hermes mcp add, dashboard/api/mcp/servers, profile creation, and catalog installs.config.yamlentries before spawning them.mcp-catalog-reviewedlabel whenoptional-mcps/**orhermes_cli/mcp_catalog.pychanges.Validation
pytest 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 -o "addopts=" --tb=short -qpython -m py_compile hermes_cli/mcp_security.py hermes_cli/mcp_config.py hermes_cli/mcp_catalog.py hermes_cli/web_server.py tools/mcp_tool.py hermes_cli/config.py hermes_cli/doctor.py tests/hermes_cli/test_mcp_security.pygit diff --checkFixes #45620 by hardening the persisted MCP command boundary; investigation found no evidence that the referenced config migration injected the reporter's entry.
Infographic