3 ms·
Better to know that by default ANYTHING is unsanitized than this: $a=$_GET["username"]; echo "Hello & Welcome $a"; By tainting, the & in the & would be
by mschuster91 11y ago
Better to know that by default ANYTHING is unsanitized than this: $a=$_GET["username"]; echo "Hello & Welcome $a";
By tainting, the & in the & would be double escaped as $a would carry its taint over to the output string. No thanks, I like to know what is escaped and where.
- justinsaccount 11y agoRight, because in any sane templating library you would just have something like Hello & Welcome {{a}} but despite being "built for the web", php is not a sane templating language for dealing with html. Facebook's XHP solves this problem: https://github.com/facebook/xhp-lib#escaping https://github.com/facebook/xhp-lib#escaping "An interesting feature of XHP is the idea of automatic escaping" ... "As you can see, using XHP makes safety the default rather than the exception." Unfortunately your standard php hosting site is not running hhvm.