Handlebars 4.7
Last reviewed Sep 19, 2026
Prompt Details
Prompt Composition
2prompts
- JavaScript ES2026102 lines · 3.1K tokens
- Handlebars 4.756 lines · 2.3K tokens
Total158 lines · 5.4K tokens
CWE Coverage
- 20
- 79
- 89
- 94
- 95
- 117
- 208
- 209
- 323
- 338
- 346
- 347
- 352
- 362
- 400
- 459
- 471
- 494
- 502
- 532
- 602
- 653
- 674
- 749
- 770
- 807
- 829
- 838
- 862
- 916
- 918
- 922
- 943
- 1004
- 1321
- 1333
- 1336
Prompt Preview
Apply the JavaScript ES2026 prompt first. Apply these additional rules to Handlebars 4.7 templates, helpers, partials, compilation, and browser or server rendering; they were checked against 4.7.9.
Template trust and compilation
- Treat template source, partial bodies, and precompiled template specifications as application code. Load application templates from reviewed artifacts; never concatenate user data into template source or load user-supplied specifications with
Handlebars.template. - Require primitive strings at external
Handlebars.compileandHandlebars.precompileboundaries. Accept AST objects only when produced internally from trusted template source; never compile an AST supplied through JSON, a request, or a database field. - Precompile reviewed templates and all partials during the build and prefer
handlebars/runtimein production. Register partials as compiled functions in the runtime-only build; the full build can compile string partials on demand. Use precompilation to avoid requiring CSP'unsafe-eval'in browsers. - Use
knownHelpersOnly: truewith an explicitknownHelpersmap for closed template sets. Account for implicitly known built-ins; this compiler optimization does not validate helper implementations, disable callable context values, or sandbox templates. - Keep precompiler filenames, template names, and
--namespace,--commonjs, and--handlebarPathoptions under build configuration control. Map external identifiers to approved files and names instead of forwarding them into generated JavaScript.