Validate then parameter in grant handler to prevent open redirects - #250
Validate then parameter in grant handler to prevent open redirects#250yuvalk wants to merge 1 commit into
Conversation
Harden the grant handler's redirect logic by validating the `then` parameter using redirect.IsServerRelativeURL before it is used in any HTTP redirect. In handleGrant (POST), invalid values are cleared so the existing empty-check falls through to safe error rendering. In handleForm (GET), requests with non-server-relative `then` values are rejected outright as defense-in-depth, preventing untrusted URLs from being embedded in the HTML form. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
Pipeline controller notification For optional jobs, comment This repository is configured in: LGTM mode |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository: openshift/coderabbit/.coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
WalkthroughThe grant handlers now reject external and protocol-relative ChangesGrant redirect validation
Estimated code review effort: 2 (Simple) | ~10 minutes Merge Risk: ⚪ Minimal · up to The change validates redirect targets in grant approval, denial, and form-display flows to block external redirects while preserving server-relative redirects; no actionable merge-blocking risk remains beyond normal checks and review. 🚥 Pre-merge checks | ✅ 15✅ Passed checks (15 passed)
✨ Finishing Touches🧪 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 |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: yuvalk The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
@yuvalk: all tests passed! Full PR test history. Your PR dashboard. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here. |
Summary
thenURL parameter withIsServerRelativeURLin the grant handler's POST path (handleGrant) to block redirects to external sites after grant approve/denyhandleForm) to reject maliciousthenvalues before they are embedded in the HTML formTest plan
//evil.com) blockedthen, emptythen) unaffected🤖 Generated with Claude Code
Summary by CodeRabbit