-
Notifications
You must be signed in to change notification settings - Fork 393
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
prevent JS in link to github #114
Conversation
@@ -33,7 +34,7 @@ public String getIconFileName() { | |||
|
|||
@Override | |||
public String getUrlName() { | |||
return projectProperty.getProjectUrl().baseUrl(); | |||
return XSSApi.asValidHref(projectProperty.getProjectUrl().baseUrl()); |
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.
Functions.*escape*
hudson.Util#escape
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.
nope. They can't escape js
Thank you for this pull request! Please check this document for how the Jenkins project handles pull requests. |
*/ | ||
public static String asValidHref(String urlString) { | ||
try { | ||
return new URL(urlString).toExternalForm(); |
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.
What happens to relative links? Protocol-relative URLs? Tests don't cover those.
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.
Expecting github url is scheme + fqdn + project path all other urls will be filtered (added tests for such cases)
This change is