No Protections Against XSS Attacks Using innerHTML
See original GitHub issueIf someone were building an app with Hyperapp and wanted to allow for formatting of user-supplied data with HTML instead of Markdown or other such syntax, using the innerHTML
attribute adds a XSS vulnerability that we should probably at least warn about if not prevent entirely.
In React this would be prevented with the message:
Warning: Directly setting property `innerHTML` is not permitted. For more information, lookup documentation on `dangerouslySetInnerHTML`.
As the warning implies, the dangerouslySetInnerHTML attribute is React’s way of allowing the user to still do this while acknowledging how dangerous it is.
Issue Analytics
- State:
- Created 6 years ago
- Comments:16 (13 by maintainers)
Top Results From Across the Web
Preventing cross-site scripting attacks when using innerHTML ...
The idea behind an XSS attack with innerHTML is that malicious code would get injected into your site and then execute. This is...
Read more >If using innerHTML poses a security threat when should we ...
And I've read that if you're using a front end framework like React, there will be built in protections against XSS attacks.
Read more >XSS prevention and .innerHTML - javascript - Stack Overflow
This would be like a DOM Based XSS attack as it is using rendered JavaScript rather than HTML, however, as it passes though...
Read more >Cross Site Scripting Prevention - OWASP Cheat Sheet Series
This cheatsheet is a list of techniques to prevent or limit the impact of XSS. No single technique will solve XSS. Using the...
Read more >.innerHTML Cross-site Scripting - DEV Community
It's a security issue if it inserts user-provided values, but if you use it to insert static data, or something generated without including...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
My vote is documentation. No need to add the extra complexity in my opinion.
It’s a good candidate for “Dev mode” console warnings in the future also.
On Sun, Sep 10, 2017, 7:22 PM Jorge Bucaran notifications@github.com wrote:
https://github.com/hyperapp/hyperapp/commit/3ab5a1e483fc0520447b3280c52ec67c84f66ff1
😄