logoalt Hacker News

chii • yesterday at 7:01 AM • 1 reply • view on HN

and this leads to html injection attacks when there are small errors in your escaping.

Using a template engine means you systematically ensure that values are escaped (at least, that's one of the reasons i would choose an engine over raw dogging the html).


Replies

goalieca • yesterday at 10:52 PM

You can have a safe library that does this and then enforce its usage with a linter or something. Template engines print strings and escape them under the hood.