template-toolkit-reviewlisted
Install: claude install-skill topunix/bugzilla-skills
# Bugzilla Template Toolkit Review
Bugzilla's templates are Template Toolkit (`.tmpl`) files under `template/<lang>/default/`,
gated by a real test (`t/004template.t`) in addition to convention. Every
rule below is sourced from that test, `Bugzilla::Hook`/`Bugzilla::Template`,
and bugzilla.readthedocs.io — see `reference/` for full quotes.
## `FILTER html` discipline
Any value interpolated into output that isn't already known-safe markup must
go through a filter matching its output context. Per the Bugzilla docs,
*5.4. Templates*:
> "One thing you should take particular care about is the need to properly
> HTML filter data that has been passed into the template. This means that
> if the data can possibly contain special HTML characters such as `<`, and
> the data was not intended to be HTML, they need to be converted to entity
> form, i.e. `<`. You use the `html` filter in the Template Toolkit to
> do this (or the `uri` filter to encode special characters in URLs). If
> you forget, you may open up your installation to cross-site scripting
> attacks."
Concretely, `html` resolves to `Bugzilla::Util::html_quote` (registered in
`Bugzilla::Template`). Note the two filters the docs name for two different
contexts: **`html` for HTML text, `uri` for URLs** — entity encoding is not
URL encoding, and using the first where the second belongs leaves the value
wrong and potentially unsafe.
Review checklist for any `[% ... %]` interpolation:
- Plain user-controlled value (summar