Repository navigation
Description
Problem
Some tools flagged read-only take a path argument that the server opens or writes. Examples: ai_ast_graph --output_path, k8s_security_stream --output, gh_pages_verify --root_dir. Over a network transport, a model chooses these paths, so it can read or write outside the work tree of the server. This is the class that SECURITY.md rule 11 covers for the transport itself.
Found by the agent that built the role-scoped MCP servers (#3219, PR #3233). That change uses explicit name tables per role, so these tools are only in a role if a person lists them.
Evidence
devops ai ast-graph --help,devops k8s security-stream --help,devops gh pages-verify --helplist the path options.src/devops_cli/ai/mcp/roles.pyon the PR branch holds the role tables.
Fix
For each tool of a role table, either drop the path option from the published schema or confine it to a root that the server sets. Add a check that fails when a tool of a role table has a text parameter named like a path and no confinement.
Acceptance criteria
- No tool of a role table accepts a path outside a confined root.
- A test reads the published schema of every role tool and fails on an unconfined path parameter.
Proposed design
Problem statement
Read-only MCP tools in role tables accept path arguments from a model. A model can choose a path outside the server work tree over a network transport. This change removes each unneeded path option and confines each kept path option to a server-set root. A test audits the published schema of every role tool.
Acceptance criteria
Requirement: Confined path resolution
Every path parameter that a role-table MCP tool publishes MUST resolve through safe_resolve_subpath against a server-set root before the server opens or writes the path.
Scenario: Traversal attempt
- WHEN A model calls a role tool with
../../etc/passwdin a path parameter. - THEN The tool returns a validation error and opens or writes no path outside the server root.
Requirement: Unneeded path options removed
A role-table MCP tool that cannot confine a path parameter to a server-set root MUST remove that parameter from its published schema.
Scenario: Unconfined option is absent
- WHEN The tool has a path parameter that no server root can confine.
- THEN The published schema has no property for that parameter, and the tool uses a server-chosen default.
Requirement: Schema audit for role tools
A test SHALL read the published schema of every tool in every role table and fail when a path-like text parameter has no confinement entry.
Scenario: Unconfined path parameter
- WHEN A role-table tool publishes a text parameter named like a path and the confinement registry does not name it.
- THEN The test fails with the tool name and the parameter name.
Requirement: Server root is not model input
The confinement root MUST come from server configuration and MUST NOT come from a tool argument.
Scenario: Model supplies root
- WHEN A model supplies a root path argument to a role tool.
- THEN The server rejects the argument or resolves it under the configured root, and it does not use the supplied value as the root.
Requirement: Example tools covered
Tests SHALL cover the path options of ai_ast_graph, k8s_security_stream, and gh_pages_verify.
Scenario: Example tools reject outside paths
- WHEN Each example tool receives a path outside the server root.
- THEN Each tool rejects the path and leaves the outside location unchanged.
Existing Tool Considered
No alternatives check has run. No open, maintained tool or library covers confinement of MCP tool path parameters. The plan uses the existing safe_resolve_subpath helper and _PATH_PARAM_RESTRICTIONS registry. The written cost is about 20,000 tokens to build, about 5,000 tokens per year to keep and fix, and 1-2 days elapsed; it adds no new dependency.
Key questions
- How should a role-table tool handle a path argument from a model?: Drop the option when the server can choose the path. Otherwise confine the value with
safe_resolve_subpathagainst a server-set root and reject traversal. (best practice) [sources: SECURITY.md, src/devops_cli/core/paths.py]- Rejected: Drop every path option. It removes useful read-only outputs and changes commands that need a path.
- Chosen: Confine kept options with safe_resolve_subpath. SECURITY.md rule 11 requires this helper for a model-supplied path.
- Rejected: Leave the path option as it is. It lets a model read or write outside the server work tree.
- Which root confines a kept path option?: Use a server-set work tree or data directory. Never use a model-supplied root. Remove
gh_pages_verify --root_diror map it to the server root. (best practice) [sources: SECURITY.md]- Rejected: Model-supplied root. It gives the model control of the confinement boundary.
- Chosen: Server-configured work tree. It keeps the boundary outside the model and matches SECURITY.md rule 11.
- Rejected: OS temporary directory. It does not confine reads and is not stable for every tool.
- How should the schema audit find unconfined path parameters?: Iterate every role table, read each tool's published schema, match path-like text parameter names, and require a confinement registry entry. (best practice) [sources: src/devops_cli/ai/mcp/generator.py, SECURITY.md]
- Rejected: Hard-code the three example tools. A new role tool or path option would escape the check.
- Chosen: Audit all role-table schemas with a shared path-name pattern. It covers every current and future role tool.
- Rejected: Trust tool annotations only. An annotation is not enforcement and can be wrong.
- Where should the confinement registry live?: Extend
_PATH_PARAM_RESTRICTIONSingenerator.pywith tool and parameter entries. SECURITY.md names it as the schema gate. (best practice) [sources: SECURITY.md, src/devops_cli/ai/mcp/generator.py]- Rejected: New registry in roles.py. It duplicates the existing schema gate.
- Chosen: Extend _PATH_PARAM_RESTRICTIONS. It keeps one central place for published path options.
- Rejected: Per-tool ad hoc checks. It is easy to miss a new role tool.
Fit
Fits in one pull request.
Suspected block
None.
Activity
devops-cli-service commentedon Nov 2, 2026
Intake placed this item to the backlog: intake puts every new item in the backlog. A person plans the milestones.
fixprefix of the title gives the type.(mcp)scope of the title gives the scope.A model over a network transport can read or write files outside the server work tree, which is a security gap.Prevents unauthorized file access and data exfiltration through MCP tool path arguments.Requires editing multiple tool schemas and adding a test that scans every role table for unconfined path parameters.Both are MCP tool safety defects found during the role-scoped server work (#3219); #3235 fixes a mislabeled read-only flag, this candidate confines path parameters in read-only tools.devops-cli-service commentedon Nov 2, 2026
Status set to Ready at ff9ad06 (see proposed design in issue body).
devops-cli-service commentedon Nov 2, 2026
Staged: branch
fix/3236-read-only-tools-take-paths-that, draft pull request #3248. The pull request plans the item and closes no issue.The task groups, with the tokens of the inputs of each step, for a budget of 40000 tokens:
The plan run made 2 model request(s), and used 113585 input tokens and 10650 output tokens. The model made no tool call.
A model review of the plan found these points. They stop no draft, and a person judges them:
otherat group 4 and group 1: The audit covers every tool ofCONST_MCP_EXPOSURE_TABLE, but the plan registers onlygh_pages_verify. Other exposed tools such asai_read,ai_ast_parseandreview_pathlikely have path-like text parameters. The audit would fail on them, or the plan leaves them unconfined, and no task covers them. Evidence: "Registergh_pages_verifyand itsroot_dirthere."docs(openspec): plan #3236 confine MCP tool path options
docs(openspec): plan #3236 confine MCP tool path options
docs(openspec): fix plan #3236 scope to role tools and correct comman…
docs(openspec): plan #3236 confine MCP tool path options
docs(openspec): plan #3236 confine MCP tool path options (#3248)
docs(openspec): fix plan #3236 scope to role tools and command names
docs(openspec): fix plan #3236 scope to role tools and command names
docs(openspec): plan #3236 revise scope to role tools (#3317)
dan-petty commentedon Nov 4, 2026
Merged PR #3467 delivers the work of this item under #3300, so no job must run the plan of this item, and this item closes as not planned. The PR merged at 2026-11-04T15:28:32Z as commit
e5df741e. Issue #3300 closed with it at 15:28:34Z.Proof at
e5df741e:src/devops_cli/ai/mcp/path_confinement.pyholdsPATH_CONFINEMENTSwithai_ast_graph.target_dirandgh_pages_verify.root_dir, andNOT_A_FILE_PATHwithsecurity_intel_network. The change togenerator.pydropsoutput_pathofai_ast_graphandoutputofk8s_security_stream.tests/ai/mcp/test_path_confinement.pyaudits the whole catalogue, and that catalogue holds every role tool. It also holdstest_a_traversal_value_is_refused_before_a_command_runs,test_an_absolute_path_outside_the_work_tree_is_refusedandtest_the_confinement_root_is_not_a_tool_argument.The change folder needs a cleanup.
openspec/changes/3236-read-only-tools-take-paths-that/is still on main with unticked tasks, and its task 1.2 writes a module that main now holds. Remove the folder in one pull request, after this close. Do not archive it, because its spec delta adds other requirements tomcp-tool-path-confinement, which main already holds.One test detail of the plan did not transfer: task 3.1 asks for a synthetic tool with
output_paththat fails the audit. The test file holds no such case. #3480 holds this need: its first criterion is a test where the audit fails on a fixture tool with aPathoption.#3299, #3301, #3302, #3304 and #3318 cite this plan through PR #3248, which stays readable.
docs(openspec): plan #3304 Ask the plan for a count of a claimed set (#…
feat(roadmap): add a set count to every-member plan claims (#4089)