- Notifications
You must be signed in to change notification settings - Fork928
fix: limit OAuth redirects to local paths#14585
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Merged
Merged
Uh oh!
There was an error while loading.Please reload this page.
Conversation
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
- This prevents a malicious user from crafting a redirect URL to a nefarious site under their control.
Introduce a utility function `uriFromURL` to strip host information fromredirect URLs, ensuring redirects remain local. This mitigates potentialsecurity risks by preventing redirects to external malicious sites.Changes:- Modify OAuth2 and OIDC callback logic to utilize `uriFromURL`.- Enhance related test cases for preventing external redirects.This work ensures secure handling of redirect URLs across the application.
- Removed an unnecessary blank line for code consistency.
- Improve handling of redirect logic in FakeIDP.- Ensure existing CheckRedirect functions are respected.- Enhance OIDC login test to handle redirects properly.
- Improve handling of redirect logic in FakeIDP by ensuring existing CheckRedirect functions are respected.- Enhance related test cases for better testing of redirect behaviors.Changes:- Store claims if state is available before falling back to existing CheckRedirect.- Ensure HTTP client transport is set to default in tests before assigning CheckRedirect.
Removing a leftover debug print statement to clean up the code.
- Prevent redirecting the last step in the OIDC flow involving the state parameter, ensuring it remains part of the core OIDC process.- This ensures secure and consistent handling of redirects in the OIDC login flow.
Update the OAuth redirect URL test to exclude fragmentPreviously, the test included a fragment in the constructed URL.Removing the fragment ensures consistency with the actual URL formatused in the application.
Emyrk approved these changesSep 10, 2024
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Really clean solution to prevent redirects outside our domain 👍
328e696
intomain 26 checks passed
Uh oh!
There was an error while loading.Please reload this page.
Sign up for freeto subscribe to this conversation on GitHub. Already have an account?Sign in.
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.
Uh oh!
There was an error while loading.Please reload this page.
fixeshttps://github.com/coder/security/issues/57