Re:Show HN: Rocket – Web Framework for Rust
by andrewstuart2 on Friday December 23, 2016 @10:32PM
(#13248424)
Virtual DOM doesn't really have anything to do with preventing XSS. It's done in angular 1 as well.
Really, it's about taint checking [1]. Distrust all sources of content by default that might have seen user input (or that you know have seen user input), and require explicit trust declarations from the developers to remove taints.
When you're about to use the data (e.g. appending to the DOM), you simply check for tainted data and escape is for the context you're in. Most times in the browser, that just means escaping content that might be valid HTML, but there are probably other contexts that require escaping as well.
Re:Show HN: Rocket – Web Framework for Rust
by peller on Friday December 23, 2016 @10:36PM
(#13248429)
Ah, thanks for the clarification! Today I learned :)
Re:Show HN: Rocket – Web Framework for Rust
by technion on Sunday December 25, 2016 @03:17AM
(#13253443)
There's also that if you're using React (vue, Angular, et al) with a JSON API (as is usually the case) you've also got CSRF forgery dealt with somewhat automatically as well.
For once, modern implementations are actually really helping security.
[0] https://www.owasp.org/index.php/Category:Popular
[1] https://www.owasp.org/index.php/SQL_Injection_Prevention_Che...
[2] https://www.owasp.org/index.php/XSS_(Cross_Site_Scripting)_P...
[3] https://www.owasp.org/index.php/Cross-Site_Request_Forgery_(...
[4] A good framework, used correctly, should take care of most (all?) escaping for you. For SQL injection, it's the ORM's job. For XSS, anything using a virtual DOM should escape stuff for you (I know React does). CSRF is more to do with session management, which is where using battle-tested auth code comes into play.