Share OAuth next-path control character validation#906
Share OAuth next-path control character validation#906catcherintheroad-hub wants to merge 1 commit into
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 refactors OAuth redirect-path validation to use a delegated ChangesRedirect path control character validation
🚥 Pre-merge checks | ✅ 6✅ Passed checks (6 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Comment |
pqmfei
left a comment
There was a problem hiding this comment.
Reviewed current head 6c7dd2e0d1be0251845113d27b3670210681f6ab as a non-author.
Evidence checked:
- inspected
app/auth.pyandtests/test_security.py; - confirmed
safe_next_path()now delegates raw and decoded control-character checks to the sharedcontains_control_character()helper, preserving the existing C0/C1 rejection boundary; - confirmed raw path checks still run before decoded path checks for empty, external
//, overlong, and backslash inputs; - confirmed the new percent-encoded newline regression covers decoded header-like redirects that the raw string alone would not expose;
- checked GitHub state before review: PR open,
mergeStateStatus=CLEAN,mergeable=MERGEABLE, hosted Quality/readiness/docs/image check successful, CodeRabbit successful/no actionable comments, and no prior human reviews or #838 claim for PR #906 visible.
Validation run locally on this exact head:
.\.venv\Scripts\python.exe -m pytest tests\test_security.py::test_oauth_next_path_rejects_external_or_headerlike_paths tests\test_wallet_api.py::test_oauth_next_path_rejects_redirect_ambiguity tests\test_wallet_api.py::test_github_login_stores_safe_default_for_backslash_next -q-> 17 passed, 1 existing Starlette/httpx warning..\.venv\Scripts\python.exe -m pytest tests\test_wallet_api.py tests\test_security.py::test_oauth_next_path_rejects_external_or_headerlike_paths -q-> 57 passed, 1 existing Starlette/httpx warning..\.venv\Scripts\python.exe -m ruff check app\auth.py tests\test_security.py-> passed..\.venv\Scripts\python.exe -m ruff format --check app\auth.py tests\test_security.py-> 2 files already formatted..\.venv\Scripts\python.exe -m mypy app\auth.py-> success..\.venv\Scripts\python.exe scripts\docs_smoke.py-> docs smoke ok.git diff --check origin/main...HEAD-> clean.git merge-tree --write-tree origin/main HEAD-> clean treecafc60c42d14e4d36c7e563d4833b571f1576c5e.
No blocker found. Scope is OAuth next-path validation cleanup/test coverage only; no OAuth provider configuration, cookie signing, wallet, ledger, treasury, payout, admin-token, private data, bridge, exchange, cash-out, or MRWK price behavior changed.
Bounty #846
Summary
contains_control_character()helper insafe_next_path()instead of maintaining two inline ordinal scans;nextpath.Duplicate check
gh search prs "safe_next_path" --repo ramimbo/mergework --state open-> no results.gh search prs "control character auth" --repo ramimbo/mergework --state open-> no results.app/auth.pyPR I found is Validate OAuth scalar query parameters #825, which validates repeated OAuth scalar query parameters; this PR is separate and only shares existing control-character validation insidesafe_next_path().Validation
uv run --python 3.12 --extra dev python -m pytest tests/test_security.py::test_oauth_next_path_rejects_external_or_headerlike_paths tests/test_wallet_api.py::test_oauth_next_path_rejects_redirect_ambiguity tests/test_wallet_api.py::test_github_login_stores_safe_default_for_backslash_next -q-> 17 passed, 1 existing Starlette/httpx warning.uv run --python 3.12 --extra dev python -m pytest tests/test_wallet_api.py tests/test_security.py::test_oauth_next_path_rejects_external_or_headerlike_paths -q-> 57 passed, 1 existing Starlette/httpx warning.uv run --python 3.12 --extra dev ruff check app/auth.py tests/test_security.py-> passed.uv run --python 3.12 --extra dev ruff format --check app/auth.py tests/test_security.py-> 2 files already formatted.uv run --python 3.12 --extra dev mypy app/auth.py-> success.uv run --python 3.12 --extra dev python scripts/docs_smoke.py-> docs smoke ok.git diff --check-> clean.git merge-tree --write-tree origin/main HEAD-> clean treecafc60c42d14e4d36c7e563d4833b571f1576c5e.Scope
Maintainability-only cleanup in OAuth next-path validation. No OAuth flow semantics, redirect target behavior, cookie behavior, wallet behavior, ledger behavior, treasury behavior, payout behavior, admin-token behavior, private data, exchange, bridge, cash-out, or MRWK price behavior changed.
Summary by CodeRabbit
Bug Fixes