-
Notifications
You must be signed in to change notification settings - Fork 105
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
Escape publisher provided strings #3436
Escape publisher provided strings #3436
Conversation
const BAD_CONFIG = ` | ||
{ | ||
"publication": { | ||
"name": "<script>PUBLICATOIN_NAME</script>" |
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.
nit: PUBLICATION_NAME (my understanding is the html is what makes it a bad input and not the typo, correct me if i'm wrong)
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.
Fixed, thanks.
Yes, we want to escape any potentially malicious strings.
@@ -27,6 +27,7 @@ | |||
"build-storybook": "build-storybook" | |||
}, | |||
"dependencies": { | |||
"safevalues": "0.5.2", |
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.
not sure what our policy is on using external libraries... @oyj9109 @ChrisAntaki do you know?
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.
We've really tried avoiding it when possible. That being said, this is an open library from Google. Do we know how many bytes this adds to the compiled JavaScript?
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.
LGTM
Tested Firefox and Safari for polyfill. Merging. |
This escapes the title, and message, both provided by the publisher. We use the safevalues library, which is an open source Google library recommended by the ISE's secure coding site.
b/326280984