Repository navigation
Server templates
Two new rules for HTML written by a template engine: Jinja, Django, Nunjucks, Twig, Blade, ERB, EJS, Handlebars, PHP, JSP and Liquid. They run on @html-eslint/parser, and the new templateEngineSyntax export gives its delimiters for each engine. The engine comes from settings['template-security'].engine or the file extension. See Server templates.
no-unsafe-output-contextreports output where HTML escaping does not protect it:<script>content, event handlers and htmx/Alpine code attributes,srcdoc, unquoted values (autofixed by adding quotes) and attribute names. The check on the start of URL attributes is opt-in withurls: true.no-unescaped-outputreports output that skips escaping:|safe,|raw,{!! !!},{{{ }}},<%== %>,raw/html_safe,<%- %>, PHPecho, JSP${}and{% autoescape false %}.
Both rules were checked on ten open-source projects, one per engine, about 1,540 templates in all.
htmx and Alpine
no-unsafe-htmltreats Alpine'sx-htmlas an HTML sink. It also reports htmx requests (hx-get,hx-post, …) to another origin, because htmx inserts the HTML that origin returns into the page. A newtrustedHostsoption exempts your own hosts.no-mixed-contentchecks htmx request attributes on any element, plussse-connectandws-connect. It reportsws:URLs and suggestswss:.no-html-with-childrencoversx-html.
Qwik and MDX
Both work through the JSX support as they are. They are now documented and covered by an end-to-end test.
Other changes
- The plugin's
metanow reads the name and version frompackage.json. - The
no-mixed-contentsuggestion is now nameduseSecureinstead ofuseHttps, since it also coverswss:.