Reject uppercase wallet path aliases#789
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)
💤 Files with no reviewable changes (2)
📝 WalkthroughWalkthroughThe PR adds a new wallet address validation helper that enforces canonical (lowercase) form across both the HTML and REST API wallet lookup routes. Non-canonical addresses are rejected with HTTP 400 before any database operations. ChangesWallet address canonicalization
🚥 Pre-merge checks | ✅ 6✅ Passed checks (6 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: b6b06c2a-d590-4849-bf22-274397758f3d
📒 Files selected for processing (4)
app/accounts.pyapp/public_routes.pyapp/wallet_api.pytests/test_wallet_api.py
|
Follow-up for CodeRabbit's helper reuse nitpick: pushed Validation after the update: No scope change: public wallet lookup paths reject uppercase aliases; wallet action normalization remains unchanged. |
jakerated-r
left a comment
There was a problem hiding this comment.
Reviewed current head 60cbeba01aab6b943c2329a45b9fbaffc5596287 as a non-author.
Evidence checked:
- Inspected the diff across
app/accounts.py,app/main.py,app/public_routes.py,app/wallet_api.py, andtests/test_wallet_api.py. - Confirmed the new
normalized_wallet_path_address()preserves normal wallet normalization for signed/action flows while failing closed for non-canonical public path aliases. - Confirmed both public lookup surfaces now use the stricter path helper:
GET /api/v1/wallets/{address}viaregister_wallet_api_routes(... normalized_wallet_path_address=...), and/wallets/{address}viawallet_page_context(). - Verified uppercase MRWK aliases now return
400 wallet address must be lowercase canonical MRWK address, while unknown canonical lowercase wallets still return404 wallet not found. - Rechecked after the author pushed
60cbebato address CodeRabbit's helper-reuse nitpick; the previous inline duplication inapp/wallet_api.pyis gone. - GitHub reports PR #789 open; hosted
Quality, readiness, docs, and image checkspassed on the current head. CodeRabbit was still processing the second commit at the time of this review, so I am not counting a final CodeRabbit pass as part of this approval.
Local validation on a clean checkout of PR head 60cbeba01aab6b943c2329a45b9fbaffc5596287:
./.venv/bin/python -m pytest tests/test_wallet_api.py-> 41 passed, 1 warning./.venv/bin/python -m pytest-> 674 passed, 1 warning./.venv/bin/python -m ruff check .-> all checks passed./.venv/bin/python -m ruff format --check .-> 104 files already formatted./.venv/bin/python -m mypy app-> success, no issues in 38 source files./.venv/bin/python scripts/docs_smoke.py-> docs smoke ok./.venv/bin/python scripts/check_agents.py-> AGENTS.md okgit diff --check origin/main...HEAD-> cleangit merge-tree $(git merge-base HEAD origin/main) origin/main HEAD-> no conflict markers or conflict text
This is a scoped path-canonicalization fix with regression coverage and no ledger mutation, auth, payout, private data, key, or wallet-signature behavior changed. Approving.
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: 2d481d44-5376-4f01-9455-73dc74fef509
📒 Files selected for processing (2)
app/main.pyapp/wallet_api.py
jakerated-r
left a comment
There was a problem hiding this comment.
Follow-up current-head review after the author pushed 4b69797a3e79ff865850f68020c2dc4056a189e6 after my earlier approval at 60cbeba01aab6b943c2329a45b9fbaffc5596287.
What changed since the prior approved head:
app/main.pyno longer imports or passes the now-unusednormalized_wallet_addressdependency intoregister_wallet_api_routes().app/wallet_api.pyremoves the unusednormalized_wallet_addressparameter from the route registrar signature.- The API route still receives and calls
normalized_wallet_path_address, so the public path-canonicalization behavior remains intact.
Current-head evidence:
- Inspected
app/accounts.py,app/main.py,app/public_routes.py,app/wallet_api.py, andtests/test_wallet_api.pyat head4b69797a3e79ff865850f68020c2dc4056a189e6. - Confirmed
GET /api/v1/wallets/{address}and/wallets/{address}still reject uppercase MRWK aliases through the shared path helper. - Confirmed signed/action wallet flows still use their existing body-field normalization paths and this PR does not change ledger mutation, auth, payout, private data, key, wallet-signature, bridge, or exchange behavior.
- GitHub reports PR #789
mergeStateStatus=CLEANon this head. - Hosted
Quality, readiness, docs, and image checkspassed on this head, and CodeRabbit reports pass/review skipped after the latest commit.
Local validation on a clean checkout of 4b69797a3e79ff865850f68020c2dc4056a189e6:
./.venv/bin/python -m pytest tests/test_wallet_api.py-> 41 passed, 1 warning./.venv/bin/python -m pytest-> 674 passed, 1 warning after rerunning serially; an earlier overlapping full-suite run hit a transient SQLite lock during collection while another pytest process was still finishing, then passed cleanly when rerun./.venv/bin/python -m ruff check .-> all checks passed./.venv/bin/python -m ruff format --check .-> 104 files already formatted./.venv/bin/python -m mypy app-> success, no issues in 38 source files./.venv/bin/python scripts/docs_smoke.py-> docs smoke ok./.venv/bin/python scripts/check_agents.py-> AGENTS.md okgit diff --check origin/main...HEAD-> cleangit merge-tree $(git merge-base HEAD origin/main) origin/main HEAD-> no conflict markers or conflict text
Approval still stands on the current head.
keilogic
left a comment
There was a problem hiding this comment.
Reviewed current head 4b69797a3e79ff865850f68020c2dc4056a189e6 as a non-author current-main follow-up.
Requesting changes because the branch is now dirty against current origin/main at 6d324f048319a84cf4b9972d31e6cb81cd4ba036. git merge-tree origin/main HEAD exits non-zero with a content conflict in app/wallet_api.py; GitHub also reports the PR as CONFLICTING.
Branch-local validation still passes on this PR head:
pytest tests/test_wallet_api.py -q->41 passed, 1 warning- targeted Ruff check: passed
- targeted Ruff format check:
5 files already formatted mypy app: passedgit diff --check origin/main...HEAD: clean- hosted Quality/readiness/docs/image and CodeRabbit checks are green for the current PR head
I did not find another blocker in the branch-local checks. The remaining issue is resolving the current-main conflict before merge.
Summary
Reject non-canonical uppercase MRWK wallet path aliases on the public wallet API and wallet detail page.
MRWK wallet addresses are emitted as lowercase
mrwk1[0-9a-f]{40}values, but the public wallet paths currently accept uppercase aliases such asMRWK1...and silently normalize them to the canonical wallet. This change keeps existing wallet-address normalization for signed/action flows, while making public lookup paths fail closed unless the path is already the canonical lowercase address.Live evidence
Read-only production checks on 2026-06-02 UTC showed the uppercase alias resolving successfully:
The uppercase API response returns the lowercase canonical
address, and the uppercase page renders the lowercase canonical wallet title, so the path alias is currently accepted rather than rejected.Implementation
normalized_wallet_path_address()for public wallet path lookups.404 wallet not found.400.Validation
Safety / scope
No private data, wallet keys, signatures, balances, ledger mutation, payout execution, bridge/exchange behavior, or auth/payment logic is changed.
Summary by CodeRabbit
New Features
Tests