fix: prevent open redirect via protocol-relative returnTo - #1185
fix: prevent open redirect via protocol-relative returnTo#1185yogeshchoudhary147 wants to merge 2 commits into
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughThe authentication redirect converts protocol-relative pathnames such as ChangesReturn path sanitization
Estimated code review effort: 2 (Simple) | ~10 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@__tests__/with-authentication-required.test.tsx`:
- Around line 189-210: Update this test to save the original browser URL before
replacing it, then wrap the render and waitFor assertions in a try/finally block
that always restores the saved URL. Preserve the existing redirect expectations
while ensuring cleanup runs even when either operation fails.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: 56f1c66c-5639-41e1-a0fd-0ba0567476eb
📒 Files selected for processing (2)
__tests__/with-authentication-required.test.tsxsrc/with-authentication-required.tsx
d632900 to
8a23d7e
Compare
Summary
defaultReturnToinwithAuthenticationRequiredcapturedwindow.location.pathnameverbatim, which equals//evil.comwhen a user visitshttps://app.example.com//evil.com//-prefixed string as a protocol-relative URL, redirecting the user to an external hostappState.returnToTest plan
loginWithRedirectreceives a sanitized single-slashreturnToSummary by CodeRabbit
Bug Fixes
Tests