Refs #576: Reject control chars in wallet type filters#609
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)
📝 WalkthroughWalkthroughThe PR adds input validation to the wallet transaction type filter. The route now imports a control-character regex and checks the transaction_type parameter before querying ledger data, rejecting requests containing control characters with HTTP 400. Tests verify the validation rejects control-character values. ChangesTransaction Type Validation
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.
Verdict: APPROVED
Scope: Rejects control characters in wallet transaction type filter. Adds validation using existing CONTROL_CHAR_RE from ledger.service before processing the type parameter.
Checklist:
- Diff: +5/-0 across 2 files
- Uses existing CONTROL_CHAR_RE pattern (consistent with prior PRs)
- Test verifies status_code 400 and correct error message
- CI passing
Conclusion: Clean, focused input validation. Ready to merge.
eliasx45
left a comment
There was a problem hiding this comment.
Reviewed current head cf16ede04aaf6506680949dbb754e95b5720af29.
Verdict: approve.
The change is small and matches the existing validation pattern: wallet_page_context() now rejects a non-null type filter containing control characters before trimming and passing it into the ledger transaction query. Clean unknown type filters still keep the existing empty-state behavior, while %09/tab style control input returns a bounded 400 response instead of being normalized into an ambiguous empty/all filter path.
Validation:
git diff --check origin/main...HEAD
# clean
git merge-tree --write-tree origin/main HEAD
# 4feadf80b877af5933fd3aaaefd1cd0e9aa5e0ef
C:\Users\home\Downloads\0-Elias\coprinter\mergework\.venv\Scripts\python.exe -m pytest tests/test_wallet_api.py -q
# 33 passed
C:\Users\home\Downloads\0-Elias\coprinter\mergework\.venv\Scripts\python.exe -m ruff check app/public_routes.py tests/test_wallet_api.py
# All checks passed!
C:\Users\home\Downloads\0-Elias\coprinter\mergework\.venv\Scripts\python.exe -m ruff format --check app/public_routes.py tests/test_wallet_api.py
# 2 files already formatted
C:\Users\home\Downloads\0-Elias\coprinter\mergework\.venv\Scripts\python.exe -m mypy app/public_routes.py
# Success: no issues found in 1 source file
C:\Users\home\Downloads\0-Elias\coprinter\mergework\.venv\Scripts\python.exe scripts/docs_smoke.py
# docs smoke ok
One environment note: the isolated worktree did not have its own .venv, so I ran the validation from the existing MergeWork checkout virtualenv against this PR worktree. No private data, wallet material, production mutations, tokens, signatures, price/liquidity/exchange/bridge/off-ramp claims, or fabricated payout claims were used.
wangedmund77-cmyk
left a comment
There was a problem hiding this comment.
Reviewed current head cf16ede04aaf6506680949dbb754e95b5720af29 for bounty #578.
Evidence checked:
- Inspected
app/public_routes.pyandtests/test_wallet_api.py. git diff --check origin/main...origin/pr/609returned clean.- Ran
uv run pytest tests/test_wallet_api.py -qon the PR head: 33 passed, 1 StarletteDeprecationWarning. - GitHub mergeability is clean/MERGEABLE.
No blocker found. The new guard follows the existing public-query control-character validation pattern and the regression covers tab-only type input before rendering the wallet detail filter state.
Summary
typefilter before trimming/rendering.type=%09.Validation
PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 uv run --extra dev python -m pytest tests/test_wallet_api.py::test_wallet_pages_expose_transfer_and_github_claim_flows -q-> 1 passed, 1 warningPYTEST_DISABLE_PLUGIN_AUTOLOAD=1 uv run --extra dev python -m pytest tests/test_wallet_api.py -q-> 33 passed, 1 warningPYTEST_DISABLE_PLUGIN_AUTOLOAD=1 uv run --extra dev python -m pytest -q-> 482 passed, 1 warninguv run --extra dev python -m ruff check app/public_routes.py tests/test_wallet_api.py-> passeduv run --extra dev python -m ruff format --check app/public_routes.py tests/test_wallet_api.py-> 2 files already formattedPYTEST_DISABLE_PLUGIN_AUTOLOAD=1 uv run --extra dev python -m mypy app/public_routes.py-> successPYTEST_DISABLE_PLUGIN_AUTOLOAD=1 uv run --extra dev python scripts/docs_smoke.py-> docs smoke okgit diff --check-> cleanNo private data, wallet material, tokens, signatures, live mutations, admin access, price/liquidity/exchange/bridge/off-ramp claims, or fabricated payout claims are included.
Summary by CodeRabbit