Repository navigation
fix(deps): inline a patched deepmerge into addons-linter - #173
Merged
Merged
Conversation
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.
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.
Fixes Dependabot alert #102 (GHSA-gcqx-w48m-w2h4, low): prototype poisoning in
deepmerge<= 4.3.1.Why not a version bump
deepmergehas no patched release (4.3.1 is the latest, from 2023), and the latestaddons-linter(10.15.0) still pins it. It's only reached throughweb-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-sizereplacement:addons-linter@10.10.0patch replacesrequire("deepmerge")with an inlined copy of deepmerge 4.3.1 (MIT, attribution kept). Merged keys are written withObject.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.addons-linter>deepmerge: "-") removes the package from the lockfile, which closes the alert.patches/README.mddocuments the change and when to remove it.Verification
deepmerge.all. The original is poisoned by a target with an own__proto__key and the inlined copy is not.pnpm lint:firefoxgives the same result before and after (0 errors, 0 warnings, 0 notices). Linting a deliberately broken manifest gives identical findings before and after.scripts/addons-linter-deepmerge.test.mjs(inpnpm test:dependencies) checks the installed bundle: nodeepmergerequire 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, andpnpm auditpass.