Skip to content

handle internal stylesheets - #36

Merged
Daniel15 merged 3 commits into
reactjs:masterfrom
sicks:master
Oct 25, 2015
Merged

Daniel15 merged 3 commits into
reactjs:masterfrom
sicks:master

Conversation

@sicks

@sicks sicks commented Sep 17, 2015

Copy link
Copy Markdown
Contributor

Fixes #35

@sicks

sicks commented Sep 17, 2015

Copy link
Copy Markdown
Contributor Author

Actually, style tags in the body are still broken if they contain quotes. Digging deeper!

@sicks

sicks commented Sep 17, 2015

Copy link
Copy Markdown
Contributor Author

Not sure what's going on here. The test passes, but as seen in this fiddle or when you test this on a real page, the quotes get turned into entities.

@ssorallen

Copy link
Copy Markdown
Contributor

Could you use dangerouslySetInnerHTML={{__html: JSON.stringify(text)}} instead of writing to its innerText? Here's a fiddle with the change: https://jsfiddle.net/ucgLqtbu/1/

This opens a security hole though if you ever let user-created content be written inside a <style> tag.

@sicks

sicks commented Sep 28, 2015

Copy link
Copy Markdown
Contributor Author

That works, but is what I had before considered safe? I would think one of the more common use cases of an internal stylesheet would be for custom end-user styles.

@Daniel15

Copy link
Copy Markdown
Contributor

This opens a security hole though if you ever let user-created content be written inside a <style> tag.

Do you have an example, or is it just a theoretical hole? :)

@sicks

sicks commented Oct 25, 2015

Copy link
Copy Markdown
Contributor Author

Do you have an example, or is it just a theoretical hole? :)

That's in reference to react's docs on dangerouslySetInnerHTML but I just did a quick test and <script> tags nested inside <style> tags don't get run, so I don't think it's a danger here.

Daniel15 added a commit that referenced this pull request Oct 25, 2015
handle internal stylesheets
@Daniel15
Daniel15 merged commit 0adf9a4 into reactjs:master Oct 25, 2015
@ssorallen

Copy link
Copy Markdown
Contributor

Do you have an example, or is it just a theoretical hole? :)

It's a theoretical hole that I have not proven to be real yet. Since @sickslives tested <script> tags inside <style> tags, it at least seems not blatantly bad.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

⌂ Proxy