Update Browserslist to patched release - #37
Merged
Conversation
Co-authored-by: adrienpessu <[email protected]>
Co-authored-by: adrienpessu <[email protected]>
adrienpessu
marked this pull request as ready for review
September 3, 2026 12:48
Copilot
AI
changed the title
[WIP] Fix Browserslist vulnerability in normalizeStats function
Update Browserslist to patched release
Sep 3, 2026
There was a problem hiding this comment.
🟢 Approval recommended
All reviewed changes address the vulnerability with no unresolved findings.
Pull request overview
Updates the development dependency tree to address the Browserslist vulnerability.
Changes:
- Pins Browserslist to patched version 4.28.7.
- Refreshes related transitive dependencies and lockfile metadata.
File summaries
| File | Description |
|---|---|
package.json |
Adds the patched Browserslist dependency. |
package-lock.json |
Locks Browserslist 4.28.7 and updated transitive packages. |
Review details
- Files reviewed: 1/2 changed files
- Comments generated: 0
- Review effort level: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
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.
An untrusted
browserslist-stats.jsoncould crash Browserslist or mutate object prototypes throughnormalizeStats(), affecting build tools that invoke Browserslist indirectly.^4.28.7, the lowest patched release.package-lock.jsonwith npm.ts-jestand related tooling.Original prompt
This section details the Dependabot vulnerability alert you should resolve
<alert_title>Browserslist: Uncaught crash / prototype write via untrusted browserslist-stats.json custom stats (normalizeStats)</alert_title>
<alert_description>## Vulnerability Details
File:
node.jsFunction:
normalizeStats()(line ~214), reached fromgetStat()(calledunconditionally on every
browserslist()call) andloadStat()Root Cause
statsis untrusted: it comes fromJSON.parse()-ing abrowserslist-stats.jsonfile — auto-discovered by walking up the directorytree from the project root on every
browserslist()call, regardless ofthe query (
env.getStat(opts, browserslist.data)runs unconditionallyinside
browserslist()) — or fromopts.statspassed programmatically /via the CLI's
--stats=flag.dataisbrowserslist.data, a plain objectpopulated only with real browser names.
Two independent bugs from the same root cause (unguarded
for...inoveruntrusted keys used with plain-object bracket access/assignment):
data[i]has nohasOwnPropertyguard. Ifstatscontains akey that also happens to be an inherited
Object.prototypemember name —"__proto__","toString","valueOf","constructor","hasOwnProperty","isPrototypeOf", etc. —data[i]resolves to thatinherited function/object (always truthy), and the code then does
data[i].versions.length→undefined.length→ uncaughtTypeError,for any such key whose JSON value has exactly one sub-key, e.g.:
{ "toString": { "onekey": 5 }, "chrome": { "100": 50 } }normalized[i] = ...on the freshnormalized = {}— ifiis exactly"__proto__"(andnormalizedhasno own property by that name yet), this computed assignment invokes the
real
Object.prototype.__proto__setter, changingnormalized's actual[[Prototype]]instead of creating a plain property.Because this runs on every
browserslist()call regardless of thequery, simply committing a poisoned
browserslist-stats.jsonanywhere in aproject's directory tree breaks every subsequent Browserslist call in that
project — including calls made by Autoprefixer, Babel
preset-env,Stylelint, or PostCSS internally, for completely unrelated queries.
Attack Scenario
browserslist-stats.jsonfile anywhere between the project root andfilesystem root, containing e.g.
{"toString": {"onekey": 5}, "chrome": {"100": 50}}.browserslist()internally, for any query.
TypeErroron the very first call.Measured Impact
Confirmed crash (real
browserslist()call, v4.28.6) withstatskeys:__proto__,toString,valueOf,hasOwnProperty,constructor,isPrototypeOf— each paired with a one-key JSON object — for any query,including
browserslist('defaults')which never mentions stats.Recommended Fix (implemented and verified)
normalizedusesObject.create(null)so a write to"__proto__"is anordinary property set, never a
[[Prototype]]change;data[i]is replacedwith an explicit
hasOwnPropertycheck so it never resolves to an inheritedObject.prototypemember.Verification:
NODE_ENV=test npx uvu test .test.js→ 301/301 pass unmodified(
test/custom.test.js,test/shareable-stats.test.js,test/cover.test.jsexercise the stats-handling paths).
without error.
browserslist-stats.json+ an unrelatedbrowserslist('defaults')call)now returns a normal result instead of crashing.
Impact
...