Update handlebars to 4.7.9 in test SPDX fixture to resolve CVE-2026-33937#121
Draft
Update handlebars to 4.7.9 in test SPDX fixture to resolve CVE-2026-33937#121
Conversation
Resolves Dependabot alert for GHSA-2w6w-674q-4c4q / CVE-2026-33937. The handlebars package is only referenced in the test SPDX manifest fixture, not as an actual dependency of this project. Agent-Logs-Url: https://github.com/advanced-security/spdx-dependency-submission-action/sessions/b4249f00-fcfe-4231-80c7-7824a6b4e416 Co-authored-by: felickz <1760475+felickz@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix Handlebars.js JavaScript injection vulnerability
Update handlebars to 4.7.9 in test SPDX fixture to resolve CVE-2026-33937
Apr 10, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Dependabot flags
handlebars@4.4.3listed intest/manifest.spdx.json(GHSA-2w6w-674q-4c4q). This is a test fixture SPDX document, not an actual dependency.versionInfoandreferenceLocatorfrom4.4.3→4.7.9in the SPDX package entryReachability Assessment
Not reachable (high confidence).
handlebarsis not inpackage.jsonorpackage-lock.json. No code imports or callsHandlebars.compile(). The package appears solely as an inventory entry in a test SPDX manifest used to exercise the SBOM parser. This update satisfies the vulnerability scanner only.Original prompt
This section details the Dependabot vulnerability alert you should resolve
<alert_title>Handlebars.js has JavaScript Injection via AST Type Confusion</alert_title>
<alert_description>## Summary
Handlebars.compile()accepts a pre-parsed AST object in addition to a template string. Thevaluefield of aNumberLiteralAST node is emitted directly into the generated JavaScript without quoting or sanitization. An attacker who can supply a crafted AST tocompile()can therefore inject and execute arbitrary JavaScript, leading to Remote Code Execution on the server.Description
Handlebars.compile()accepts either a template string or a pre-parsed AST. When an AST is supplied, the JavaScript code generator inlib/handlebars/compiler/javascript-compiler.jsemitsNumberLiteralvalues verbatim:Because the value is not wrapped in quotes or otherwise sanitized, passing a string such as
{},{})) + process.getBuiltinModule('child_process').execFileSync('id').toString() //as thevalueof aNumberLiteralcauses the generatedeval-ed code to break out of its intended context and execute arbitrary commands.Any endpoint that deserializes user-controlled JSON and passes the result directly to
Handlebars.compile()is exploitable.Proof of Concept
Server-side Express application that passes
req.body.texttoHandlebars.compile():The response body will contain the output of the
idcommand executed on the server.Workarounds
Handlebars.compile(): ensure the argument is always astring, never a plain object or JSON-deserialized value.handlebars/runtime) on the server if templates are pre-compiled at build time;compile()will be unavailable.</alert_description>critical
https://github.com/handlebars-lang/handlebars.js/security/advisories/GHSA-2w6w-674q-4c4q https://github.com/handlebars-lang/handlebars.js/commit/68d8df5a88e0a26fe9e6084c5c6aaebe67b07da2 https://github.com/handlebars-lang/handlebars.js/releases/tag/v4.7.9 https://nvd.nist.gov/vuln/detail/CVE-2026-33937 https://github.com/advisories/GHSA-2w6w-674q-4c4qGHSA-2w6w-674q-4c4q, CVE-2026-33937
handlebars
npm
<vulnerable_versions>= 4.4.3</vulnerable_versions>
<patched_version>4.7.9</patched_version>
<manifest_path>test/manifest.spdx.json</manifest_path>
<task_instructions>Resolve this alert by updating the affected package to a non-vulnerable version. Prefer the lowest non-vulnerable version (see the patched_version field above) over the latest to minimize breaking changes. Include a Reachability Assessment section in the PR description. Review the alert_description field to understand which APIs, features, or configurations are affected, then search the codebase for usage of those specific items. If the vulnerable code path is reachable, explain how (which files, APIs, or call sites use the affected functionality) and note that the codebase is actively exposed to this vulnerability. If the vulnerable code path is not reachable, explain why (e.g. the affected API is never called, the vulnerable configuration is not used) and note that the update is primarily to satisfy vulnerability scanners rather ...