Refs #576: Reject control chars in MCP integer args#626
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughAdds control-character validation to integer-like string arguments in MCP tool calls. Imports ChangesControl character validation for MCP integer arguments
Possibly related PRs
🚥 Pre-merge checks | ✅ 6✅ Passed checks (6 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Comment |
barnacleagent-svg
left a comment
There was a problem hiding this comment.
PR Review — #626
PR: #626
Author: @xingxi0614-cpu
Head SHA: 11b5d84
Files Changed (2 files, +45/-1)
- app/mcp_tools.py: Added CONTROL_CHAR_RE check before strip/parse in int_arg()
- tests/test_mcp_tools.py: Parametrized test covering ,
, � control chars
CI Status
Quality/readiness/docs/image checks: completed/success
Code Review
- Correct: checks raw value before strip so control chars at start/end are caught
- Import added for CONTROL_CHAR_RE
- Three test cases cover tab, newline, DEL character
- No side effects, no stale references
Verdict
APPROVE — Ready for merge.
|
Reviewed for Bounty #578. Evidence checked:
No blocker from this review. The patch is narrow and the regression test covers the intended pre-trim rejection behavior. |
|
Review note after inspecting The important detail is that |
Refs #576
Summary
Reject raw control characters in MCP integer-like string arguments before trimming/parsing.
This keeps MCP tool calls from accepting tab/newline/DEL-padded numeric strings as if they were clean integers:
get_bountywithid="\t1"list_bounty_attemptswithbounty_id="1\n"submit_work_proofwithissue_number="\x7f390"Distinctness
This is limited to MCP integer argument parsing in
app/mcp_tools.py.It does not overlap PR #612, which covers MCP optional clean-string filters, or PR #614, which covers HTTP JSON integer parsing. It also stays separate from the wallet/account/bounty filter, source URL, MRWK amount, webhook, treasury, and public search control-character fixes.
Validation
uv run --extra dev python -m pytest tests/test_mcp_tools.py -q-> 8 passeduv run --extra dev python -m pytest tests/test_mcp_tools.py tests/test_api_mcp.py -q-> 90 passed, 1 warninguv run --extra dev python -m pytest -q-> 497 passed, 1 warninguv run --extra dev ruff check app/mcp_tools.py tests/test_mcp_tools.py-> passeduv run --extra dev ruff format --check app/mcp_tools.py tests/test_mcp_tools.py-> 2 files already formatteduv run --extra dev mypy app/mcp_tools.py-> successuv run --extra dev python scripts/docs_smoke.py-> docs smoke okgit diff --check-> cleangit merge-tree --write-tree origin/main HEAD-> cleanSafety
No private data, wallet material, tokens, signatures, admin access, production mutation, price/liquidity/exchange/bridge/off-ramp claims, private security details, or fabricated payout claims are included.
Summary by CodeRabbit
Refactor
Tests