Skip to content
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

Merged
merged 4 commits into from
Feb 27, 2024

Conversation

mhkawano
Copy link
Contributor

@mhkawano mhkawano commented Feb 21, 2024

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

const BAD_CONFIG = `
{
"publication": {
"name": "<script>PUBLICATOIN_NAME</script>"
Copy link
Contributor

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)

Copy link
Contributor Author

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",
Copy link
Contributor

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?

Copy link
Collaborator

@ChrisAntaki ChrisAntaki Feb 22, 2024

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?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@mhkawano
Copy link
Contributor Author

Tested Firefox and Safari for polyfill. Merging.

@mhkawano mhkawano merged commit bf0d4ad into subscriptions-project:main Feb 27, 2024
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants