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

User-controlled data is not escaped #38

Closed
dleshem opened this issue Mar 11, 2016 · 3 comments
Closed

User-controlled data is not escaped #38

dleshem opened this issue Mar 11, 2016 · 3 comments

Comments

@dleshem
Copy link

dleshem commented Mar 11, 2016

All HTML4.generateDefaultTemplate arguments are added directly to the raw HTML.

While not a vulnerability per se, it opens up an attack vector against careless users who directly pass unsanitized user-generated values, which unfortunately is a common scenario.

Consider escaping these values as a best effort to protect Oy users.

@revivek
Copy link
Owner

revivek commented Mar 12, 2016

This is worth addressing. The only way to protect against this consistently is to escape the arguments in Oy.renderTemplate before generateDefaultTemplate and generateCustomTemplate. However, we can't do this for bodyContent, since that HTML we want to directly inject. One way to achieve this is by having Oy.renderTemplate take the top-level component in directly.

I think an update to API is in order. It also opens up opportunities for node traversal/transformation as mentioned in #33. Something like this should work.

Oy.renderTemplate(<Template />, templateOptions)

Then we can safely inject the HTML generated by renderToStaticMarkup and escape the various templateOption properties.

@dleshem
Copy link
Author

dleshem commented Mar 16, 2016

Love the new interface, makes much more sense.

@revivek
Copy link
Owner

revivek commented Mar 16, 2016

Great!

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

No branches or pull requests

2 participants