-
-
Notifications
You must be signed in to change notification settings - Fork 398
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
Better XSS Check for frames.erb #1537
Conversation
Even with this, I still believe the best way to resolve this permanently is to use let url = new URL(name, location.href)
url.origin === location.origin |
Dear @lsegal, |
if (name.match(/^((?:(?:[\w]*):)?[\/\\]*)/gm)[0]?.length > 0) { | ||
name = '<%= url_for_main %>' | ||
} | ||
window.top.location.replace(name) |
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.
if (name.match(/^((?:(?:[\w]*):)?[\/\\]*)/gm)[0]?.length > 0) { | |
name = '<%= url_for_main %>' | |
} | |
window.top.location.replace(name) | |
if (new URL(name, window.location.href).origin == window.location.origin) { | |
window.top.location.replace(name); | |
} |
I like your idea, I'm gonna squash and reopen a pull-request. |
Description
Yikes! I'm so embarrassed. My patch fails to resolve the XSS/Open-Redirect vulnerability. This second patch will fix it, and I've done much testing to confirm it. Please understand my mistake and implement this into the repository.
Proof-Of Concept
See the following pen for an example: https://codepen.io/Aviv-Keller/pen/mdgdmyW
#!:javascript:alert("XSS")
Completed Tasks
bundle exec rake
locally (if code is attached to PR).