fix(oidc): reject backslash authority forms in relative redirects#1311
Open
lovasoa wants to merge 1 commit into
Open
fix(oidc): reject backslash authority forms in relative redirects#1311lovasoa wants to merge 1 commit into
lovasoa wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ac23375837
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
0c7a90e to
0915ce1
Compare
…rgets The relative-redirect check accepted /\evil.test (and /<TAB>/evil.test): the WHATWG URL parser used by the url crate treats \ as / and strips ASCII tab/newline/CR, so url::Url::join turned these into the external authority evil.test when building post_logout_redirect_uri. is_safe_relative_redirect now rejects any backslash or ASCII control character, applied via one shared helper in verify_logout_params, validate_redirect_url, and sqlpage.oidc_logout_url.
0915ce1 to
66f47c8
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
OIDC relative-redirect validation accepts
/\evil.testsqlpage.oidc_logout_urland the post-login redirect validated relative targets withstarts_with('/') && !starts_with("//"), which accepted/\evil.testand/<TAB>/evil.test. The WHATWG URL parser used by theurlcrate treats\as/and strips ASCII tab/newline/CR, soUrl::joinresolves both to the external authorityevil.testwhen SQLPage buildspost_logout_redirect_uri.Proof (reproducible): rust-url and Node both turn
/\evil.testintohttps://evil.test/; the same WHATWG rule is implemented by current browsers (new URL('/\\evil.test', location.origin).href). RFC-3986 parsers do not normalize it, so SQLPage cannot rely on the client either way.One shared
is_safe_relative_redirectnow rejects any backslash or ASCII control character, used inverify_logout_params,validate_redirect_url, andsqlpage.oidc_logout_url. Normal paths like/foo/bar?x=1keep working. Unit test covers/\evil.test,/\/evil.test,\evil.test,//evil.test, and the tab/newline/CR forms. clippy + tests pass.