Re:Show HN: Rocket – Web Framework for Rust
by paulddraper on Sunday December 25, 2016 @03:48PM
(#13255372)
I don't see why javascript: is fundamentally different than other XSS vectors
[ Parent
| on HN ]
Re:Show HN: Rocket – Web Framework for Rust
by iopq on Sunday December 25, 2016 @09:06PM
(#13256507)
because for other types of injections Yesod WILL actually properly encode <script> tags and make them <script> which will prevent SOME XSS exploits
but it doesn't prevent all of them
Re:Show HN: Rocket – Web Framework for Rust
by aban on Monday December 26, 2016 @09:21AM
(#13258308)
This is not true, at least not anymore.
Yesod uses xss-sanitize [0], and their sanitize function does indeed prevent "javascript:" attempts. They even have a test case for it [1].
Playing around with it in the REPL:
Prelude Text.HTML.SanitizeXSS Data.Text> sanitize $ pack "<IMG SRC=javascript:alert('XSS')>"
"<img>"
Prelude Text.HTML.SanitizeXSS Data.Text> sanitize $ pack "<IMG SRC=\"javascript:alert('XSS')\">"
"<img>"
Prelude Text.HTML.SanitizeXSS Data.Text> sanitize $ pack "<IMG SRC=fine>"
"<img src=\"fine\">"
Prelude Text.HTML.SanitizeXSS Data.Text> sanitize $ pack "<IMG SRC=\"this is ok too\">"
"<img src=\"this is ok too\">"
[0]: https://hackage.haskell.org/package/xss-sanitize[1]: https://github.com/yesodweb/haskell-xss-sanitize/blob/9a9101...