Reject padded MCP bounty filters#871
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 (3)
📝 WalkthroughWalkthroughThis PR tightens argument validation for the MCP ChangesMCP List Bounties Padding Validation
Possibly related issues
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 |
tudorian95
left a comment
There was a problem hiding this comment.
Reviewed current head 7070cdaf3655338c2bf7e263cb904a302442e0ca as a non-author.
Scope reviewed:
app/mcp_tools.pynow rejects raw leading/trailing whitespace only for non-emptylist_bountiesstring filters:status,q,sort, andavailability.- Other MCP string arguments continue using the existing trim/control-character behavior because
reject_paddingdefaults tofalse. - Clean case-insensitive status/filter values still work through normalization, while padded aliases now fail before normalization.
- Regression coverage checks both the direct
call_mcp_tool()path and the JSON-RPC/mcptools/callpath for padded filter rejection.
Validation run in an isolated Docker container from the checked-out PR head:
uv run --extra dev pytest tests/test_api_mcp.py::test_mcp_list_bounties_filters_status_query_and_limit tests/test_api_mcp.py::test_mcp_list_bounties_rejects_invalid_filters tests/test_mcp_tools.py::test_call_mcp_tool_rejects_padded_list_bounty_filters -q-> 16 passed, 1 existing Starlette/httpx warning.uv run --extra dev ruff check app/mcp_tools.py tests/test_api_mcp.py tests/test_mcp_tools.py-> passed.uv run --extra dev ruff format --check app/mcp_tools.py tests/test_api_mcp.py tests/test_mcp_tools.py-> 3 files already formatted.uv run --extra dev mypy app/mcp_tools.py-> success.uv run --extra dev python scripts/docs_smoke.py-> docs smoke ok.git diff --check origin/main...HEAD-> clean.git merge-tree --write-tree origin/main HEAD-> clean treec8d53d8e8d03eb566298ee1f0d4fb54bc1246ed3.
GitHub state checked before review: mergeStateStatus=CLEAN, mergeable=MERGEABLE, hosted Quality, readiness, docs, and image checks successful, and no prior reviews on this PR.
No issue found in the focused change. Scope stays limited to read-only MCP list_bounties filter validation and does not touch REST/HTML list behavior, bounty creation, proposal/payout execution, treasury mutation, wallet material, ledger mutation, private data, bridge/exchange/cash-out behavior, secrets, or MRWK price behavior.
MolhamHamwi
left a comment
There was a problem hiding this comment.
Reviewed current head 7070cdaf3655338c2bf7e263cb904a302442e0ca as a non-author.
Evidence checked:
- inspected
app/mcp_tools.pyand confirmedreject_padding=Trueis applied only to thelist_bountiesMCPstatus,q,sort, andavailabilityfilters, while the helper still trims optional string args for callers that do not opt into padded-input rejection; - inspected
tests/test_api_mcp.pyand verified the existing happy-path status filter now uses canonical"Paid"so padded status is reserved for invalid-input coverage; - inspected
tests/test_mcp_tools.pyand confirmed direct tool coverage rejects leading/trailing whitespace before normalization for all four affected list-bounty filters; - ran
uv sync --extra devandPYTHONPATH=. uv run --extra dev pytest tests/test_mcp_tools.py::test_call_mcp_tool_rejects_padded_list_bounty_filters tests/test_api_mcp.py::test_mcp_list_bounties_rejects_invalid_filters tests/test_api_mcp.py::test_mcp_list_bounties_filters_status_query_and_limit -qlocally: 16 passed, 1 warning.
No blockers found.
|
Bounty #838 review evidence for current head I reviewed the focused MCP Local verification on this PR branch:
Note: my local environment has Python 3.11 only, while the project declares Python >=3.12, so the runtime test evidence is useful but not a replacement for CI on the supported version. I did not find a blocking issue in this diff. |
Summary
list_bountiesstring filter arguments before normalizationstatus,q,sort, andavailabilityPaidworking and keep blank/omitted filters on the existing default pathsBounty #799
Source report: #798 (comment)
Production evidence before fix
Current production accepts whitespace-padded MCP
list_bountiesfilters as hidden aliases for the clean values:Duplicate/current check
list_bountiesqstrings, not leading/trailing whitespace aliases.list_bountiesargument handling.initialize,get_prooftimestamp shape, non-JSON content types, and oversizedq; I did not find this padded MCP filter behavior reported before the linked source report.Validation
uv run --extra dev pytest tests/test_api_mcp.py::test_mcp_list_bounties_filters_status_query_and_limit tests/test_api_mcp.py::test_mcp_list_bounties_rejects_invalid_filters tests/test_mcp_tools.py::test_call_mcp_tool_rejects_padded_list_bounty_filters -q-> 16 passed, 1 warninguv run --extra dev pytest tests/test_api_mcp.py tests/test_mcp_tools.py -q-> 120 passed, 1 warninguv run --extra dev ruff check app/mcp_tools.py tests/test_api_mcp.py tests/test_mcp_tools.py-> passeduv run --extra dev ruff format --check app/mcp_tools.py tests/test_api_mcp.py tests/test_mcp_tools.py-> 3 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-> cleanScope
This PR is limited to read-only MCP
list_bountiesstring filter argument validation. It does not change REST/HTML bounty list behavior, valid clean MCP query semantics, bounty creation, payout execution, treasury mutation, wallet behavior, ledger mutation, admin-token behavior, private data, secrets, bridge/exchange/cash-out behavior, or MRWK price behavior.Summary by CodeRabbit
Bug Fixes
Tests