fix(mcp): reject local targets over HTTP transport#196
Open
rodboev wants to merge 1 commit into
Open
Conversation
Signed-off-by: Rod Boev <rod.boev@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
HTTP MCP callers can currently pass local filesystem targets to
scan_skill, and the server forwards those paths into the normal scan graph. This adds an MCP transport guard so routable HTTP use rejects local paths andfile://targets before the graph can read them, while CLI and stdio MCP scans keep their existing local-path behavior.Closes #191
Root cause
scan_skillforwards the caller-providedtargettorun_scanwithout transport context. The input resolver then treats local files and directories as valid scan targets, which is correct for trusted local use but too broad for unauthenticated HTTP exposure.Diff Notes
run_scanuse.Scope
This does not add MCP authentication, change the generic input resolver, or alter report output. PR #193 covers the documentation warning slice; this PR covers the code guard.
Verification
python -m pytest tests/unit/test_mcp_server.py -v-> 18 passed, 1 warninguv run ruff check src/ tests/-> passeduv run ruff format --check src/skillspector/mcp_server.py tests/unit/test_mcp_server.py-> 2 files already formatteduv run ruff format --check src/ tests/-> still reports pre-existing drift outside the target scope insrc/skillspector/nodes/analyzers/static_runner.py,tests/nodes/analyzers/test_binary_and_pe3_filtering.py,tests/nodes/analyzers/test_mp2_regex_backtracking.py, andtests/nodes/test_llm_analyzer_base.pyLint & Test (Python 3.12),Lint & Test (Python 3.13), andDCO Check- pending maintainer approval if fork checks are gatedNotes
Follow-up to maintainer review on #36 (review).