-
Notifications
You must be signed in to change notification settings - Fork 95
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix for SECURITY-2979 / CVE-2023-50771 #261
Fix for SECURITY-2979 / CVE-2023-50771 #261
Conversation
Sanitize redirect url to make sure it cannot point wherever the from query parameter shows.
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## master #261 +/- ##
============================================
- Coverage 71.21% 70.46% -0.75%
Complexity 190 190
============================================
Files 9 9
Lines 740 745 +5
Branches 122 124 +2
============================================
- Hits 527 525 -2
- Misses 153 160 +7
Partials 60 60 ☔ View full report in Codecov by Sentry. |
} | ||
} | ||
// If the URL is null, empty, or invalid, return the root URL | ||
return getRootUrl(); |
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.
Root URL is not always correctly setup (typicallty localhost on k8s deployments) and people rely on referer to deduce the correct URL as seen by the user.
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.
See my comment in the issue, please. The referer is passed in when calling the function.
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.
Please use referer if not empty.
Hello @michael-doubez , thank you for your feedback. The referer is already passed in when the validation method is being called. The precedence is the same as before: |
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.
Right.
LGTM
I've added a test yet, but I cannot figure out how to determine the dynamic port of the wireMockRule. Hints appreciated. It has a constructor that accepts the rootUrl as string and I wanted to use that one but it was ignored in github ci. |
Hi, this fixes the open redirect vulnerability of #259 by validating. I've patched that for our internal use and I didn't work on the other open CVE because from my understanding it's only relevant if you enable this fallback user functionality which is not relevant for us. I thought it might still make sense to propose this here so others can quickly patch it for themselves or just use our fork release.
Please forgive me for not writing a test. I just wanted to share the fix to make the world a better place with the little time I have. Feel free to steal my code and do it properly.
Testing done
I manually tested this following these steps:
https://jenkins.example.com/securityRealm/commenceLogin?from=https://google.com
Submitter checklist