Skip to content

feat: add runtimeOptions to set handlebars runtime options - #284

Merged
UlisesGascon merged 1 commit into
masterfrom
feat/runtime-options
Oct 15, 2026
Merged

UlisesGascon merged 1 commit into
masterfrom
feat/runtime-options

Conversation

@UlisesGascon

Copy link
Copy Markdown
Member

Adds a per-instance runtimeOptions bag (parallel to compileOptions from #268) merged over the handlebars runtime options hbs passes to each compiled template.

The main use is restoring handlebars' safer prototype-access defaults: set allowProtoMethodsByDefault and allowProtoPropertiesByDefault to false. hbs's current defaults (both true) are left unchanged, so this is non-breaking. Flipping the defaults themselves stays a separate 5.x change.

  • lib/hbs.js: adds self.runtimeOptions, merged over the render-time defaults (ES5, no new deps)
  • README.md: new Security section + Runtime options section
  • test/4.x/: coverage for the default (proto access allowed) and the opt-in (false restores handlebars' blocking)

Opening as a draft while the 5.x default-flip is discussed separately.

@UlisesGascon UlisesGascon self-assigned this Oct 15, 2026
@UlisesGascon
UlisesGascon marked this pull request as ready for review October 15, 2026 09:09
Adds a per-instance `runtimeOptions` bag (mirroring `compileOptions`)
merged over the defaults hbs passes to the compiled template. This lets
apps restore handlebars' safer prototype-access defaults by setting
allowProtoMethodsByDefault/allowProtoPropertiesByDefault to false; the
hbs defaults are unchanged (true), so this is non-breaking.

Includes tests and README Security + Runtime options sections.
@UlisesGascon
UlisesGascon merged commit bc839e7 into master Oct 15, 2026
60 checks passed
@UlisesGascon
UlisesGascon deleted the feat/runtime-options branch October 15, 2026 09:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant