Repository navigation
Description
Context & Rationale
Filed from the unchecked P0 entry at docs/ROADMAP.md:962 (at 308a71f), which had no issue, after re-checking it as decision D9 of the 2026-10-01 agentic quality assessment asked.
Reproduced on release/v0.2.24. The real tool registry was called through fastmcp.Client(mcp) with _run_mcp_cmd patched to record the argv, so nothing ran:
| Arguments | argv the tool builds |
|---|---|
{"number": true, "post": true} |
devops review pr 1 --persona devsecops --post |
{"number": "1"} |
devops review pr 1 --persona devsecops |
{"number": 1.0} |
devops review pr 1 --persona devsecops |
A malformed or hallucinated call would review PR #1 and post a comment on it. _validate_mcp_int_bound("number", ..., min_val=1) (src/devops_cli/ai/mcp/server.py:158) passes, because True == 1 after pydantic's lax coercion.
AGENTS.md:75-77 requires FastMCP tools to forbid undeclared parameters and to answer bad calls with prescriptive errors listing allowable arguments. The first half holds only through FastMCP 3.4.7 defaults; no test asserts it or sends a bad argument. The second half is false: an unknown key returns pydantic's raw Unexpected keyword argument text, and the body helpers (src/devops_cli/ai/mcp/server.py:79-114) raise on the first breach only. Types are coerced (server.py:35 omits strict_input_validation): review_pr runs, and with post comments on PR 1, for number=true. The SDK's strict check covers only listed tools (mcp/server/lowlevel/server.py:531-534) and names the value, not the field, while DomainGateMiddleware (server.py:3017) withholds sandbox_stop, tf_apply and pr_close. Principle 2 fails too: FastMCP logs rejected inputs (fastmcp/server/server.py:1313-1325), so a malformed vault_set writes key_values to the log and the result.
Scope & Deliverables
- Deliverable: Port nothing from vibes
verifier.pyorapp_factory.py. (1) Oneon_call_toolmiddleware besideDomainGateMiddlewareresolves the registered tool, listed or withheld, runsjsonschemaDraft202012Validator.iter_errorsagainst its publishedtool.parametersand refuses before the handler, and catchesfastmcp.exceptions.ValidationErrorvia__cause__.errors(include_url=False). Both feed one renderer, shared with 'Lossless Structured Error Reflection for Schema Retries': a numbered envelope (parameter, kind such as HALLUCINATED_PARAM or TYPE_MISMATCH, expected, fix), the sorted allowed parameters, and 're-issue the call'. Declarejsonschemainpyproject.toml. (2) AnAnnotated[int, Field(ge=1, strict=True)]alias for PR and issue numbers. (3) Alogging.Filteronfastmcp.server.serverredactinginput, caplog-tested liketest_no_dispatch_argument_reaches_a_log_record. (4) Intests/test_fastmcp_contracts.py, viafastmcp.Client(mcp): every schema keepsadditionalProperties: false;strict_input_validationstays off; bool-for-int, string-for-int and string-for-bool are refused on an advertised tool and onsandbox_stop, with_run_mcp_cmdfailing if reached; a sweep runs the validator, never a handler, over every integer, boolean or number schema; bound coverage is reported, not enforced. Follow-up: per-argument-classAnnotatedbounds, the hyphen check in anAfterValidator, then delete the three helpers andtests/test_mcp.py:471. - Acceptance criteria:
- Through
fastmcp.Client(mcp)with_run_mcp_cmdpatched,review_prrefuses{"number": true},{"number": "1"}and{"number": 1.0}before the handler runs, and the patched runner records no call. - The same holds for a withheld tool such as
sandbox_stop. - The refusal names the parameter, the expected type and the allowed parameters, and never echoes the value.
- Tests never touch the network.
uv run devops cipasses.
- Through
- Constraint: Echoing values is the leak: render from
json_path, validator and expected type, never jsonschema'smessage, which quotes the value; never echokey_values,oidc_tokenor replybody, other values only as a short prefix. Validate against FastMCP's published schema, never a hand-written copy. Caps are per argument class:verifier.py's blanket 256-character cap would breakpr_thread_reply(body)(server.py:2195) and the LogQL and ASTqueryarguments (:314,:973).strict_input_validation=Truealone is worse: withheld tools still coerce, and its single error precedes middleware. Faithful coercions such as"5"become errors; pre-1.0 policy accepts that. - Measured (roadmap entry):
uv run python merge_probe.py(real registry,fastmcp.Client(mcp),_run_mcp_cmdpatched): all 156 registered tools emitadditionalProperties: false; 51 of the 67 tools with an integer, boolean or number parameter are withheld from the default listing;review_prran for{"number": true}and{"number": "1"}; an invalidvault_setechoed a sentinel in the result and afastmcp.server.serverwarning.uv run python strict_probe.py(toy server,strict_input_validation=True, listing filter): the listed tool refusedtrue; the withheld tool's handler ran.
Strategic Alignment
- Milestone: Backlog (no release). It is a P0 defect fix, so it qualifies as a critical fix for the current release if a person admits it.
- Depends on: none. Related: fix(mcp): mcp tools and resources call commands and options that exist #836 (the MCP argv contract), feat(mcp): mcp tools declare ToolAnnotations, and mutating tools require approval in devops-cli's own agent loop #857 (tool annotations and approval for mutating tools).
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsDone
Activity
dan-petty commentedon Oct 1, 2026
Admitted to v0.2.24 as a critical fix, by the owner's decision (2026-10-01): a P0 security defect fix, delivered before the cut.
fix(mcp): tools refuse coerced arguments before they run (#862) (#903)
dan-petty commentedon Oct 1, 2026
Closed by #903, merged into
release/v0.2.24.GitHub only acts on closing keywords when a pull request merges into the default branch, so this was closed by
devops gh issues close-merged.feat(release): v0.2.24 (#905)
fix(mcp): fastmcp's debug log of tool calls never records argument va…
feat(release): v0.2.30 (#1473)