Reject control-padded MCP work-proof format#839
Conversation
📝 WalkthroughWalkthroughThe PR adds control-character validation to the ChangesControl-Character Validation for MCP Format Argument
Possibly related issues
Possibly related PRs
🚥 Pre-merge checks | ✅ 5 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Comment |
jakerated-r
left a comment
There was a problem hiding this comment.
Reviewed current head 5b5a88c936bb6175e28bece75b177c3c55662b49 for Bounty #654.
Evidence checked:
- Inspected the three-file diff:
app/mcp_tools.py,tests/test_api_mcp.py,tests/test_mcp_tools.py. - Confirmed
submit_work_proofnow rejects raw C1/control-paddedformatvalues beforestrip().lower(), matching the neighboring MCP string-validation behavior. - Confirmed clean
format: "text"still returns the normal submission guidance path. - Local focused tests:
110 passed, 1 warningwithpytest tests/test_mcp_tools.py tests/test_api_mcp.py -q. - Local quality checks:
ruff format --check .,ruff check .,mypy app, andscripts/docs_smoke.pyall passed. git diff --check origin/main...HEADpassed.git merge-tree $(git merge-base HEAD origin/main) origin/main HEADproduced a clean merge result.- Hosted GitHub checks are passing; CodeRabbit reports pass.
No blocker found. The change is small, scoped, and covered at both dispatcher and JSON-RPC API levels.
|
Scope clarification for the Bounty PR Focus warning: GitHub compare currently shows this PR as one commit with three changed files and 14 additions:
|
|
Maintainer queue status: held. Current head is clean and has one useful current-head human approval; the queue gate requires two useful current-head human reviews before merge. No MRWK requested. |
MolhamHamwi
left a comment
There was a problem hiding this comment.
Reviewed current head 5b5a88c936bb6175e28bece75b177c3c55662b49 as a non-author.
Evidence checked:
- Inspected
app/mcp_tools.py,tests/test_api_mcp.py, andtests/test_mcp_tools.pyin the PR diff. - Confirmed
output_format_arg()now rejects C0/C1 control characters beforestrip().lower(), matching the existing clean-selector pattern used for repo/status-style MCP arguments. - Confirmed both dispatcher-level coverage (
call_mcp_tool(..., {"format": "\u0085json"})) and JSON-RPC invalid-params coverage were added forsubmit_work_proof. - Verified GitHub reports the PR as
mergeStateStatus=CLEANwith hosted checks green. - Ran locally on the PR checkout:
python -m pytest tests/test_api_mcp.py tests/test_mcp_tools.py -q→ 110 passed, 1 warning.
No blocker found; this is a focused validation hardening change.
aglichandrap
left a comment
There was a problem hiding this comment.
Review evidence (head SHA: current):
- ✅ Scope: Rejects C1 control characters in
formatarg before normalization inoutput_format_arg(). - ✅ Reuse: Uses existing
contains_control_characterhelper — consistent with other validation. - ✅ Tests:
test_api_mcp.pyadds"\x85json"to parametrized rejection cases.test_mcp_tools.pyadds dedicatedtest_call_mcp_tool_rejects_c1_work_proof_format_before_normalizing. - ✅ Files: 3 files, +14/-0 — minimal.
- ✅ Mergeable: state=clean.
No blockers. Approve.
Summary
submit_work_proofformatargument before trimming/lowercasing.formatvalues.Evidence
formatpreviously normalized a C1-control-padded JSON format value tojson, unlike neighboring MCP string helpers that reject raw control characters before normalization.app/mcp_tools.py,tests/test_api_mcp.py,tests/test_mcp_tools.py.text/jsonbehavior changes.Test Evidence
python scripts/check_agents.pypytest tests/test_api_mcp.py::test_mcp_submit_work_proof_rejects_invalid_bounty_selectors -q(red before fix, green after fix)pytest tests/test_api_mcp.py tests/test_mcp_tools.py -qpytestruff format --check .ruff check .mypy apppython scripts/docs_smoke.pygit diff --checkMRWK
Related bounty or issue: Refs #819.
Maintainer PR; no MRWK bounty requested.