Skip to content

fix(mcp): find path options by type and decide each - #3687

Merged
dan-petty merged 3 commits into
mainfrom
fix/3480-mcp-path-audit-reads-types
Nov 5, 2026
Merged

dan-petty merged 3 commits into
mainfrom
fix/3480-mcp-path-audit-reads-types

Conversation

@dan-petty

Copy link
Copy Markdown
Owner

The audit of the MCP path parameters found a path option by the words in its name, so an option that holds a path under another name passed with no decision. The audit now reads the Click type of the option (a Path or a file annotation), and the pydantic path format for a tool that no command backs.

Eight published options had no decision. Seven are now confined under the work tree: the repo options of ai_harness_offload and ai_read, the workspace options of docker_sandbox and sandbox_deploy, k8s_diff_helm values, roadmap_refine source and scan_injection suppress. review_export_feedback no longer publishes output.

A sandbox workspace is confined before the sandbox check. scan_sast config keeps a Semgrep registry id and confines any other value, so a URL cannot make Semgrep reach the network.

Closes #3480

Change: openspec/changes/archive/2026-11-05-3480-mcp-path-audit-reads-types/

The audit of MCP path parameters read only the words in a name, so a Path
option under another name passed with no decision. It now reads the Click
type of each option (typer.models.TyperPath) and the pydantic path format of
a hand-written tool, as well as the name.

Eight options get a decision. ai_harness_offload.repo, ai_read.repo,
docker_sandbox.workspace, sandbox_deploy.workspace, k8s_diff_helm.values,
roadmap_refine.source, scan_injection.suppress and scan_sast.config are
confined under the work tree. A Semgrep registry id stays as it is. The
review_export_feedback tool drops its output option. The generator confines
a path before the sandbox check reads the workspace.

Closes #3480

Change: openspec/changes/3480-mcp-path-audit-reads-types/
The audit now finds an option that Typer opens from a path
(typer.FileText, typer.FileBinaryRead) as well as a Path option.
A probe with a FileText option under a name with no keyword fails
the audit.

Confinement of workspace now runs before the sandbox check, so two
tests in test_sandbox_lifecycle.py get a work tree. The run-user case
leaves the tool test, because confinement refuses a path outside the
tree first.

The error-path tests of the confinement now assert the error code and
the exit code. The proposal gives counts that the base commit shows:
59 published options, 51 with a decision.
@dan-petty dan-petty added type/bug Type bug: the code does not do what it must scope/mcp Model Context Protocol tools, system resources, and prompts labels Nov 5, 2026
@dan-petty

Copy link
Copy Markdown
Owner Author

Test results

fail-to-pass run

Command: uv run devops ci fail-to-pass --base origin/main

  • tests/ai/mcp/test_path_confinement.py errors at collection on the base. It imports NOT_A_PATH_VALUE, which the base does not have.
  • test_the_mcp_semgrep_tool_scans_with_the_default_ruleset_unless_the_caller_names_one fails on the base. A local path now resolves under the work tree.
  • test_roadmap_refine_contract_and_argv fails on the base. --source now gets the resolved path.
  • 413 other tests of the 4 changed test files pass on the base and on the head.

An earlier run of the new tests on the base, before the code, showed 23 failures. Each fails for the stated reason: the census of the 8 options, the audit, the traversal cases, the sandbox cases and the Semgrep cases.

Tests on the head

  • tests/ai/mcp and tests/commands/test_sandbox_lifecycle.py: 789 passed, after the rebase on origin/main.
  • All test files that use the MCP server (argo, telemetry, valkey, gh, pr update, vault, tf cost, builtin tools, roadmap, docs and others): 1492 passed.
  • Full uv run devops ci on the final code: every row passes (lint, format, typecheck, security, docs, openspec, test tree, constructs, build and the others) except test and coverage. Coverage of the two changed source files is 97%.
  • test has 4 failures and 1 error: test_get_ssh_key_prefix_resolution, test_find_project_config_path_skips_directory, test_mark_only_commands_under_global_dry_run and test_the_direct_executor_refuses_a_network_profile_before_it_starts_the_tool[direct]. They read host state. They fail the same way on the unchanged main checkout (f6d57ecd). Issue fix(tests): four host-dependent tests fail on main #3594 tracks them. This change does not touch them.

Review findings

I checked each finding of the review before I fixed it. All were right.

  • Two tests in tests/commands/test_sandbox_lifecycle.py broke (9 cases), because confinement now runs before the sandbox check. Fixed: both tests get a work tree. The run-user case leaves the tool test, because /run/user/1000 is outside every work tree and confinement refuses it first. The runner tests of the same file still cover it, and test_a_sandbox_workspace_outside_the_work_tree_is_refused covers the tool.
  • The audit missed an option that Typer opens from a path (typer.FileText). Fixed: it tests TyperPath and typer._click.types.File. A new probe test fails without the fix. The census over the exposure table gives 74 TyperPath options and 1 File option (gh_issues_close.comment_file, which has a decision).
  • The Feasibility counts were wrong. Fixed with the numbers that the base commit gives: 59 published options, 51 with a decision, 8 without. The test count is removed.
  • Two error-path tests now assert the error code and the exit code.

Scope notes

@dan-petty
dan-petty marked this pull request as ready for review November 5, 2026 19:17
@dan-petty
dan-petty merged commit f7320cf into main Nov 5, 2026
23 checks passed
@dan-petty
dan-petty deleted the fix/3480-mcp-path-audit-reads-types branch November 5, 2026 19:40
dan-petty pushed a commit that referenced this pull request Nov 5, 2026
🤖 I have created a release *beep* *boop*
---


##
[0.63.1](v0.63.0...v0.63.1)
(2026-11-05)


### Bug Fixes

* **mcp:** find path options by type and decide each
([#3687](#3687))
([f7320cf](f7320cf))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: dan-petty-release[bot] <346998822+dan-petty-release[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

scope/mcp Model Context Protocol tools, system resources, and prompts type/bug Type bug: the code does not do what it must

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(mcp): the path audit finds path options by type and by name

1 participant