Skip to content

fix: [handlebars] Upgrade handlebars from 4.0.14 to 4.7.9 to resolve SNYK-JS-HANDLEBARS-534988 (Prototype Pollution) - #224

Open
hannahhuh-cog wants to merge 1 commit into
mainfrom
devin/1787559357-fix-handlebars-prototype-pollution
Open

fix: [handlebars] Upgrade handlebars from 4.0.14 to 4.7.9 to resolve SNYK-JS-HANDLEBARS-534988 (Prototype Pollution)#224
hannahhuh-cog wants to merge 1 commit into
mainfrom
devin/1787559357-fix-handlebars-prototype-pollution

Conversation

@hannahhuh-cog

@hannahhuh-cog hannahhuh-cog commented Aug 24, 2026

Copy link
Copy Markdown

Summary

Fixes the highest-CVSS finding of the scheduled Snyk MCP scan: Prototype Pollution in handlebars.

  • Vulnerability: Prototype Pollution — SNYK-JS-HANDLEBARS-534988 (no CVE assigned)
  • Severity: Critical, CVSS 9.8
  • Affected: handlebars@4.0.14, pulled in transitively via hbs
  • Fixed in: >=4.5.3; pinned to 4.7.9, the current 4.x release
  • Risk: A crafted template/compile input can pollute Object.prototype, leading to property injection and, in Handlebars' case, remote code execution during template compilation.

handlebars is not a direct dependency, so the fix is an npm overrides entry rather than a dependencies bump:

+  "overrides": {
+    "handlebars": "4.7.9"
+  }

package-lock.json regenerated with npm install --package-lock-only; resolved node_modules/handlebars is now 4.7.9.

Snyk scan reference: snyk test --all-projects --dev / snyk_sca_scan (unmanaged: true), Snyk org 9e26acce-22c7-4efc-b470-21d9587f49fe.

Devin-Org: engineering

Link to Devin session: https://app.devin.ai/sessions/fc1965e7d98f4966bea1c7aa64a929b0
Requested by: @hannahhuh-cog


Devin Review

Status Commit
⚪ Not started

Run Devin Review

Devin Review (Staging)
Open in Devin Review

Co-Authored-By: Hannah Huh <hannah.huh@cognition.ai>
@devin-ai-integration

Copy link
Copy Markdown

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment, CI, and merge conflict monitoring

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Devin Review found 2 potential issues.

Open in Devin Review

Comment thread package.json
Comment on lines +57 to +59
"overrides": {
"handlebars": "4.7.9"
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Lockfile missing overrides breaks npm ci

package.json adds an overrides block, but the lockfile root packages[""] records no matching overrides field, so the two are out of sync. npm ci compares the overrides and aborts with an EUSAGE error, breaking clean and CI installs.

Prompt for agents
The package.json now declares an overrides block for handlebars, but package-lock.json was not truly regenerated by npm: the lockfile root object packages[""] has no overrides field. When npm regenerates a lockfile (lockfileVersion 2/3) with overrides present, it writes the overrides into packages[""]. Its absence means npm ci will detect package.json and package-lock.json as out of sync and fail. Regenerate the lockfile with a real npm install (npm install --package-lock-only) using an npm version that supports overrides (>=8.3), and commit the result so packages[""] includes the overrides entry.
Open in Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verified locally — npm ci is not broken by this.

I regenerated the lockfile with npm install --package-lock-only on npm 10.8.2. This repo's lockfile is lockfileVersion: 2 (hybrid v1/v2), and npm did not write an overrides key into packages[""] — but it did resolve the overridden version in the tree, and npm only enforces the overrides-sync check when the lockfile records one.

Evidence, from a clean checkout of just package.json + package-lock.json on this branch:

$ npm ci --ignore-scripts
added 947 packages in 5s
$ node -e "console.log(require('handlebars/package.json').version)"
4.7.9

No EUSAGE error. Leaving the lockfile as npm generated it.

Comment thread package.json
Comment on lines +57 to +59
"overrides": {
"handlebars": "4.7.9"
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔍 hbs forced from exact handlebars 4.0.14 to 4.7.9

hbs@4.0.4 pins an exact handlebars@4.0.14; the override forces 4.7.9. Handlebars 4.x is broadly compatible, but hbs was never tested against 4.7.9, so a runtime smoke test of view rendering is warranted.

Open in Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Smoke-tested hbs against the forced handlebars@4.7.9 from this branch's lockfile:

handlebars 4.7.9
compile('Hello {{name}}!')({name:'world'}) -> "Hello world!"
views/account.hbs  -> rendered, 890 chars
views/layout.hbs   -> rendered, 482 chars

No API breakage from hbs's pinned 4.0.14 to 4.7.9.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant