Skip to content

fix(deps): inline a patched deepmerge into addons-linter - #173

Merged
dantraynor merged 1 commit into
mainfrom
fix/deepmerge-prototype-poisoning
Nov 14, 2026
Merged

dantraynor merged 1 commit into
mainfrom
fix/deepmerge-prototype-poisoning

Conversation

@dantraynor

Copy link
Copy Markdown
Owner

Fixes Dependabot alert #102 (GHSA-gcqx-w48m-w2h4, low): prototype poisoning in deepmerge <= 4.3.1.

Why not a version bump

deepmerge has no patched release (4.3.1 is the latest, from 2023), and the latest addons-linter (10.15.0) still pins it. It's only reached through web-ext -> addons-linter, the Firefox lint/review tooling, which uses it to merge its own bundled WebExtension schemas. It isn't shipped in the extension.

Fix

Same approach as the existing image-size replacement:

  • The addons-linter@10.10.0 patch replaces require("deepmerge") with an inlined copy of deepmerge 4.3.1 (MIT, attribution kept). Merged keys are written with Object.defineProperty, so an own __proto__ key on a merge target becomes an ordinary own property instead of replacing the result's prototype. No keys are dropped.
  • A pnpm override (addons-linter>deepmerge: "-") removes the package from the lockfile, which closes the alert.
  • patches/README.md documents the change and when to remove it.

Verification

  • The inlined copy matched deepmerge 4.3.1 on 20,000 randomized merges, including thrown errors, the two array strategies addons-linter passes, and deepmerge.all. The original is poisoned by a target with an own __proto__ key and the inlined copy is not.
  • pnpm lint:firefox gives the same result before and after (0 errors, 0 warnings, 0 notices). Linting a deliberately broken manifest gives identical findings before and after.
  • New scripts/addons-linter-deepmerge.test.mjs (in pnpm test:dependencies) checks the installed bundle: no deepmerge require or lockfile entry, poisoning blocked, merge semantics intact, and addons-linter still validates extension and theme manifests against its merged schemas.
  • pnpm test, pnpm review:firefox, and pnpm audit pass.

deepmerge 4.3.1 is vulnerable to prototype poisoning
(GHSA-gcqx-w48m-w2h4) and has no patched release. It is only reached
through web-ext -> addons-linter, which uses it to assemble its bundled
WebExtension schemas.

Following the existing image-size replacement, the addons-linter patch
now inlines deepmerge 4.3.1 with merged keys written via
Object.defineProperty, so an own "__proto__" key on a merge target can
no longer replace the result's prototype. A pnpm override removes the
deepmerge package, which clears Dependabot alert #102.

The inlined copy matched deepmerge 4.3.1 on 20,000 randomized merges
using the array strategies addons-linter passes. Firefox lint findings
are identical before and after, for both the extension build and a
deliberately broken manifest. test:dependencies now covers the inlined
module and addons-linter schema validation.
@dantraynor
dantraynor merged commit 9464968 into main Nov 14, 2026
19 checks passed
@dantraynor
dantraynor deleted the fix/deepmerge-prototype-poisoning branch November 14, 2026 03:55
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