Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: handlebars-lang/handlebars.js
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v4.7.9
Choose a base ref
...
head repository: handlebars-lang/handlebars.js
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v4.7.10
Choose a head ref
  • 13 commits
  • 34 files changed
  • 3 contributors

Commits on Mar 26, 2026

  1. Configuration menu
    Copy the full SHA
    6714e07 View commit details
    Browse the repository at this point in the history
  2. Fix Ruby component publishing documentation

    Docker images has to use root because it tries
    to write to `/.local` which would fail otherwise.
    jaylinski committed Mar 26, 2026
    Configuration menu
    Copy the full SHA
    d069c1c View commit details
    Browse the repository at this point in the history

Commits on Oct 5, 2026

  1. Bump minimist to ^1.2.8

    Update the minimist dependency to the latest 1.2.x release. Also sync the
    version in package-lock.json with package.json, which the v4.7.9 release
    commit did not update.
    jaylinski committed Oct 5, 2026
    Configuration menu
    Copy the full SHA
    ea8ed82 View commit details
    Browse the repository at this point in the history
  2. Clarify that --root does not restrict filesystem access

    The `--root` option only strips a prefix from template names, but its
    description could be read as limiting which files the CLI reads. State
    explicitly that it is not a filesystem boundary.
    jaylinski committed Oct 5, 2026
    Configuration menu
    Copy the full SHA
    0fcf25c View commit details
    Browse the repository at this point in the history
  3. Validate AST values in the compiler instead of the parser

    Instead of validating the AST in the parser, the compiler now checks every
    AST value that it writes into generated code: path depths and parts,
    literal values, content strings, hash pair keys and block params, including
    in stringParams and trackIds mode. The checks now sit where the values are
    used, so ASTs changed after parsing are covered too.
    
    A missing `depth` is treated as 0 and a missing or partial `loc` no longer
    breaks compilation or error reporting, because hand-built ASTs often omit
    both.
    
    The docs and type definitions now state that `compile` and `precompile`
    turn an AST into code, so the AST must come from the application itself
    and never from untrusted input.
    
    Fixes GHSA-8r5x-fm3f-whwj.
    jaylinski committed Oct 5, 2026
    Configuration menu
    Copy the full SHA
    703fdcc View commit details
    Browse the repository at this point in the history
  4. Only dispatch known node types in the Compiler and Visitor

    `Compiler#accept` and `Visitor#accept` call the method named by
    `node.type`. A crafted type such as `accept`, `constructor` or `pushParam`
    could therefore call an unrelated method with the node as its argument.
    
    The Compiler now accepts only node types the parser produces. A Visitor
    also accepts types for which a subclass or instance defines its own
    handler, but never methods of `Visitor` or `Object.prototype`.
    jaylinski committed Oct 5, 2026
    Configuration menu
    Copy the full SHA
    7d501a5 View commit details
    Browse the repository at this point in the history
  5. Only compile partials that are template strings

    `resolvePartial` treated any value with a truthy `call` property as a
    compiled partial, so an object from context data could reach
    `env.compile()` and be compiled as a template. Only functions are now
    treated as compiled partials, and only strings are compiled at render
    time. Anything else is rejected with an error.
    
    A function partial that returns nothing now throws a clear error instead
    of being passed on to the compiler.
    
    Partials registered as an AST are no longer compiled; pass them through
    `Handlebars.compile()` first.
    jaylinski committed Oct 5, 2026
    Configuration menu
    Copy the full SHA
    c28ee7a View commit details
    Browse the repository at this point in the history
  6. Don't trust special properties on context data

    A prototype's own `constructor` (e.g. `Function.prototype.constructor`)
    passed the own-property check in `lookupProperty`. With prototype method
    access enabled (e.g. `allowProtoMethodsByDefault`), templates could reach
    the `Function` constructor through `__proto__`. Such lookups now go through
    the prototype-access checks, which deny `constructor` unless explicitly
    allowed.
    
    `escapeExpression` called `toHTML` on any value with such a property, so
    context data with a non-function `toHTML` key, e.g. from parsed JSON, made
    rendering throw. Only values with a callable `toHTML` are now treated as
    SafeStrings.
    
    Fixes GHSA-p8wg-vrv2-v86f.
    jaylinski committed Oct 5, 2026
    Configuration menu
    Copy the full SHA
    ceec388 View commit details
    Browse the repository at this point in the history
  7. Escape <!-- and <script in precompiled output

    Precompiled templates are often inlined in `<script>` tags. Strings in
    the generated code containing `</script` could end the script element
    early, and `<!--` followed by `<script` could keep it from ending where
    intended. `quotedString` now escapes the `<` of these sequences as
    `\u003C`, and the JavaScript compiler uses it instead of
    `JSON.stringify` for lookup names, partial indents and tracked ids.
    Source locations, which include the `srcName` option, and the template
    names written by the CLI are escaped the same way.
    
    `quotedString` now builds on `JSON.stringify`, so it also escapes
    control characters and surrogates, and it skips escaping entirely when a
    string has nothing to escape, which is true of almost every lookup name.
    Compilation doesn't slow down.
    
    The `nameLookup` example in the compiler API docs now quotes with
    `quotedString` as well, and the docs say that overrides must do the
    same.
    
    Fixes GHSA-xw65-4hp5-5hc7.
    jaylinski committed Oct 5, 2026
    Configuration menu
    Copy the full SHA
    609d1b1 View commit details
    Browse the repository at this point in the history
  8. Iterate lazily in #each and strip whitespace in linear time

    `#each` collected every value of an iterable before rendering the block.
    It now renders each value as it goes, like `for...of`, and closes the
    iterator if the block throws, so generators can run their cleanup code.
    Values added to the iterable while the block renders, e.g. to a `Set`, are
    now visited too, as with `for...of`.
    
    The regexes that find trailing whitespace in whitespace control were
    retried at every position of a whitespace run, which takes quadratic time
    on long runs. They are now anchored so that matching takes linear time.
    jaylinski committed Oct 5, 2026
    Configuration menu
    Copy the full SHA
    812c226 View commit details
    Browse the repository at this point in the history
  9. Sanitize the source map URL when minifying

    The CLI strips line terminators from the `--map` value before writing it
    into the sourceMappingURL comment. With `--min`, uglify drops that comment
    and writes its own from the raw value, so a newline in it ended the
    comment and the rest of the value ran as JavaScript. The sanitized value
    is now passed to uglify as well.
    
    The comment also kept a raw "<", so a value containing `</script` or
    `<!--` could end or change the parsing of an enclosing <script> element.
    "<" is now percent-encoded, which keeps the URL pointing to the same file.
    jaylinski committed Oct 5, 2026
    Configuration menu
    Copy the full SHA
    f37c599 View commit details
    Browse the repository at this point in the history
  10. Update release notes

    handlebars-lang
    handlebars-lang committed Oct 5, 2026
    Configuration menu
    Copy the full SHA
    e47b236 View commit details
    Browse the repository at this point in the history
  11. v4.7.10

    handlebars-lang
    handlebars-lang committed Oct 5, 2026
    Configuration menu
    Copy the full SHA
    45ce152 View commit details
    Browse the repository at this point in the history
Loading