Validate OAuth scalar query parameters#825
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 (1)
📝 WalkthroughWalkthroughThis PR adds validation to reject repeated query parameters on GitHub OAuth routes. The ChangesOAuth repeated query parameter 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 |
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: 74d05e19-ec7b-4a85-a0e0-8e5cd7d5a84a
📒 Files selected for processing (2)
app/auth.pytests/test_wallet_api.py
There was a problem hiding this comment.
Reviewed head 33e583a74d32ef33848d4c662efb97da79b37a32 against origin/main 12ca2f0510abce4f3a8b3d77ae8596f47fa5c74c.
The code path itself is narrowly scoped and the validation I ran passed:
python -m pytest tests/test_wallet_api.py tests/test_security.py::test_oauth_next_path_rejects_external_or_headerlike_paths -q-> 61 passed, 1 warningpython -m ruff check app/auth.py tests/test_wallet_api.py-> passedpython -m ruff format --check app/auth.py tests/test_wallet_api.py-> passedpython scripts/docs_smoke.py-> docs smoke okgit diff --check origin/main...HEAD-> cleangit merge-tree --write-tree origin/main HEAD-> clean treed9d5d5d6d7de5aaa7889580d4e95d273f1621d28
I see one concrete test issue to fix before this should be treated as ready:
test_github_login_rejects_repeated_next_query should also assert that the duplicate-next rejection does not emit mrwk_oauth_state and does not set a Location header. The current implementation rejects before state generation, but the test would not catch a regression where state or redirect side effects are produced before returning 400.
On bounty/source eligibility, the PR references Bounty #761 and source issue #820; maintainers have since put this PR on hold for #761 pending source/bounty-reference correction, so I am not treating that as a code finding beyond the maintainer eligibility decision.
No other blocker found in the touched OAuth validation code.
|
Maintainer hold: this is not accepted for #761 as-is. The current-head review requests two fixes before maintainer acceptance: correct the bounty/source reference for the OAuth work, and assert the repeated- |
|
Maintainer hold repair pushed in Changes:
Validation:
|
jakerated-r
left a comment
There was a problem hiding this comment.
Reviewed current head 9e12d3c1bc7cac182533d956631b1f03aaee52aa against current origin/main 8f197562f3e6fe5d1a61a57456c36eda4309b0d1 after the maintainer-hold repair.
I inspected app/auth.py and tests/test_wallet_api.py, including the delta from the prior reviewed head 33e583a74d32ef33848d4c662efb97da79b37a32 to 9e12d3c. That delta is limited to the expected test hardening: duplicate-next rejection now asserts no Location header and no mrwk_oauth_state cookie.
Validation passed:
PYTHONPATH=. uv run --extra dev pytest tests/test_wallet_api.py::test_github_login_rejects_repeated_next_query tests/test_wallet_api.py::test_github_callback_rejects_repeated_scalar_queries tests/test_wallet_api.py::test_github_callback_exchanges_single_scalar_queries -q->5 passed, 1 warningPYTHONPATH=. uv run --extra dev pytest tests/test_wallet_api.py tests/test_security.py::test_oauth_next_path_rejects_external_or_headerlike_paths -q->61 passed, 1 warningPYTHONPATH=. uv run --extra dev ruff check app/auth.py tests/test_wallet_api.py-> passedPYTHONPATH=. uv run --extra dev ruff format --check app/auth.py tests/test_wallet_api.py-> passedPYTHONPATH=. uv run --extra dev mypy app/auth.py-> passedPYTHONPATH=. uv run python scripts/docs_smoke.py-> docs smoke okgit diff --check origin/main...HEAD-> cleangit merge-tree --write-tree origin/main HEAD-> clean tree9778140587eddbdea7c23755971d4dfe753d2ab5
Direct duplicate-next probe also returned HTTP 400 with detail next must be provided at most once, no Location header, and no mrwk_oauth_state cookie.
Hosted Quality, readiness, docs, and image checks and CodeRabbit are successful on this head; GitHub reports mergeStateStatus=CLEAN. The PR body now correctly says #820 is related to #722 and that no payout is claimed or queued for #820 while #722 is full.
No remaining blocker found in the touched OAuth scalar query validation path. No private data, wallet material, payout execution, treasury mutation, bridge, exchange, cash-out, MRWK price behavior, or #820 payout claim was used.
xiefuzheng713-alt
left a comment
There was a problem hiding this comment.
Reviewed current head 9e12d3c1bc7cac182533d956631b1f03aaee52aa as a non-author current-head review.
I did not find a remaining blocker in the OAuth scalar query validation path. The change stays narrow: /auth/github/login rejects repeated next before building OAuth state, and /auth/github/callback rejects repeated code / state before state comparison or token exchange.
Evidence checked:
- inspected
app/auth.pyand confirmed the repeated-query checks are only added to the GitHub OAuth login/callback paths; - inspected
tests/test_wallet_api.pyand confirmed duplicatenextasserts HTTP 400, noLocation, and nomrwk_oauth_statecookie; - confirmed duplicate callback
code/statetests keep the OAuth client uncalled and preserve the existing cookie state; - confirmed the single-scalar callback test still exercises the normal token/user exchange and clears
mrwk_oauth_state.
Validation I ran:
uv run --extra dev pytest tests/test_wallet_api.py tests/test_security.py::test_oauth_next_path_rejects_external_or_headerlike_paths -q-> 61 passed, 1 warninguv run --extra dev ruff check app/auth.py tests/test_wallet_api.py-> passeduv run --extra dev ruff format --check app/auth.py tests/test_wallet_api.py-> 2 files already formatteduv run --extra dev mypy app/auth.py-> successuv run --extra dev python scripts/docs_smoke.py-> docs smoke okgit diff --check origin/main...HEAD-> cleangit merge-tree --write-tree origin/main HEAD-> clean treedc6cf63f7239e886a45ec9ba479f2aee54f6961e
GitHub state checked: mergeStateStatus=CLEAN; hosted Quality/readiness/docs/image and CodeRabbit checks are successful on this head. No private data, wallet material, payout execution, treasury mutation, exchange, bridge, cash-out, MRWK price behavior, or issue mutation was used.
Summary
nexton the GitHub OAuth login route before the signed state is builtcodeandstateon the GitHub OAuth callback route before cookie-state comparison or outbound token exchangeSource issue #820: #820
Related proposed-work bounty #722: #722
Maintainer hold repair: this PR no longer claims #761. Issue #820 is a proposed-work item related to #722, and no payout is queued for #820 while that round is full.
Refs #820
Validation
uv run --extra dev pytest tests/test_wallet_api.py::test_github_callback_rejects_repeated_scalar_queries tests/test_wallet_api.py::test_github_callback_exchanges_single_scalar_queries tests/test_wallet_api.py::test_github_login_rejects_repeated_next_query -q-> 5 passed, 1 warninguv run --extra dev pytest tests/test_wallet_api.py tests/test_security.py::test_oauth_next_path_rejects_external_or_headerlike_paths -q-> 61 passed, 1 warninguv run --extra dev ruff format --check app/auth.py tests/test_wallet_api.py-> 2 files already formatteduv run --extra dev ruff check app/auth.py tests/test_wallet_api.py-> All checks passeduv run --extra dev python scripts/docs_smoke.py-> docs smoke okuv run --extra dev mypy app-> Success: no issues found in 39 source filesgit diff --check-> cleanLive duplicate/capacity check before PR:
gh issue view 820 -R ramimbo/mergework --json number,title,state,url,body,comments,labels,updatedAt-> Proposed work: validate OAuth scalar query parameters #820 open, labeledproposed-workgh issue view 722 -R ramimbo/mergework --json number,title,state,url,comments,labels,updatedAt-> MRWK bounty: 50 MRWK - accepted proposed-work requests, round 2 #722 open; maintainer comment says Proposed work: validate OAuth scalar query parameters #820 is left for successor intake review and nopay_bountyproposal is queued because MRWK bounty: 50 MRWK - accepted proposed-work requests, round 2 #722 has 0 effective slots remaininggh pr view 825 -R ramimbo/mergework --json number,title,state,url,mergeStateStatus,statusCheckRollup,comments,body,headRefName,headRepositoryOwner,updatedAt-> PR Validate OAuth scalar query parameters #825 open and clean; maintainer hold requested corrected bounty/source reference plus no-cookie/no-Location assertions for repeatednextgh pr list -R ramimbo/mergework --state open --search "820 OR OAuth scalar OR repeated next OR repeated state OR repeated code OR github callback OR github login" --json number,title,author,url,headRefName,updatedAt,body-> no OAuth scalar duplicate PR foundNo wallet, payout, treasury execution, bridge, exchange, cash-out, price, secrets, private details, or issue automation changes.
Summary by CodeRabbit
Bug Fixes
Tests