npm / handlebars
handlebars
What changed in handlebars 4, from its official release notes, upgrade guides and advisories. Sources checked 2026-10-17.
2 breaking14 security1 tooling2 fixes and other
See which of these apply to your code, ranked, in your agent:
npx @unstale/cli inithandlebars 419 changes
Breaking changes 2
Special properties on context data are no longer trusted.
Iteration is lazy, like for...of, rather than copying iterables into an array; values added while the block renders are visited too. Whitespace is also stripped in linear time.
Security 14
AST values are validated in the compiler instead of the parser.
The Compiler and Visitor dispatch only known node types.
Only partials that are template strings are compiled.
Precompiled output escapes
<!--and<script.The source map URL is sanitized when minifying.
Fixes security issues documented in the linked advisories.
Handlebars.js has a Property Access Validation Bypass in container.lookup
Handlebars.js has a Prototype Method Access Control Gap via Missing __lookupSetter__ Blocklist Entry
Handlebars.js has Denial of Service via Malformed Decorator Syntax in Template Compilation
Handlebars.js has JavaScript Injection in CLI Precompiler via Unescaped Names and Options
Handlebars.js has JavaScript Injection via AST Type Confusion
Handlebars.js has JavaScript Injection via AST Type Confusion by tampering @partial-block
Handlebars.js has JavaScript Injection via AST Type Confusion when passing an object as dynamic partial
Handlebars.js has Prototype Pollution Leading to XSS through Partial Template Injection
Tooling 1
The type of hash is now Record<string, any>.
Fixes and other changes 2
Fixes handling of non-contiguous program indices.
RuntimeOptions now also accepts string partials.