Skip to content

fix(federation): isolate Filigree MCP Python imports - #146

Closed
tachyon-beep wants to merge 1 commit into
mainfrom
codex/fix-filigree-mcp-arbitrary-code-execution
Closed

fix(federation): isolate Filigree MCP Python imports#146
tachyon-beep wants to merge 1 commit into
mainfrom
codex/fix-filigree-mcp-arbitrary-code-execution

Conversation

@tachyon-beep

Copy link
Copy Markdown
Collaborator

Motivation

  • Prevent an attacker-controlled repository from shadowing the installed filigree Python package when the local Filigree MCP subprocess is launched from the project root, which could enable arbitrary code execution during MCP tool calls.

Description

  • Change the resolved Python MCP launcher to run the module in isolated mode by adding -I to the Python arguments so the analyzed project is not added to Python's import path (resolve_filigree_mcp_command now delegates to filigree_python_mcp_command).
  • Preserve existing behavior by keeping the --project <root> argument when a project root is present.
  • Add filigree_python_mcp_command helper to centralize the safe command construction and a regression test python_mcp_command_isolates_imports_from_project_root that verifies the program and args include the isolation flag.
  • Only the launcher construction was changed; the fallback to the standalone filigree-mcp binary and the MCP subprocess-driving logic remain unchanged.

Testing

  • Ran cargo fmt --check, which succeeded.
  • Ran the new targeted unit test with cargo test -p loomweave-federation filigree::tests::python_mcp_command_isolates_imports_from_project_root -- --exact, which passed.
  • Attempted cargo test -p loomweave-federation (full crate suite): the new regression and most tests ran, but several pre-existing HTTP mock tests failed or hung in the parallel full-suite run, so the full run was interrupted; the failures appear unrelated to the Python-launcher change and affect HTTP client/mock expectations.

Codex Task

Copilot AI lite review requested due to automatic review settings September 1, 2026 18:49
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, add credits to your account and enable them for code reviews in your settings.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR hardens the Filigree MCP launcher used by loomweave-federation by ensuring that when Filigree is launched via Python module execution, it runs in Python isolated mode to prevent project-root import shadowing of the installed filigree package.

Changes:

  • Switch the Python-based MCP launcher path to use a centralized helper that adds python -I -m filigree.mcp_server.
  • Preserve existing --project <root> behavior when a project root is available.
  • Add a regression unit test ensuring the resolved Python command includes the -I isolation flag.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@tachyon-beep

Copy link
Copy Markdown
Collaborator Author

Superseded by the rebase onto release/1.6.0 (the working release branch) — same commit, landing there. The CI failure here was an unrelated serve test.

@tachyon-beep
tachyon-beep deleted the codex/fix-filigree-mcp-arbitrary-code-execution branch September 1, 2026 20:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants