chore(deps): update dependency js-yaml@<3.15.0 to v5 [security] - #2271
chore(deps): update dependency js-yaml@<3.15.0 to v5 [security]#2271renovate[bot] wants to merge 1 commit into
Conversation
|
4bfb5da to
ec1b8ed
Compare
| @@ -35,7 +37,7 @@ overrides: | |||
| 'lodash@<4.18.0': ^4.18.0 | |||
| 'protobufjs@<7.6.5': ^7.6.5 | |||
| 'ws@>=8.0.0 <8.21.0': ^8.21.0 | |||
There was a problem hiding this comment.
🔴 Release tooling crashes because a YAML helper is forced onto an incompatible library version
The old YAML library used by the release tooling is replaced with a version 5 release ('js-yaml@<3.15.0': ^5.0.0 at pnpm-workspace.yaml:42) even though the helper still calls a function that only exists in version 3, so changeset/versioning commands crash.
Impact: Running the changesets release/version commands fails with a runtime error, blocking publishing.
Mechanism: read-yaml-file calls yaml.safeLoad, removed in js-yaml 4/5
@manypkg/get-packages@1.1.3 (a dependency of @changesets/cli) depends on read-yaml-file@1.1.0, whose entire implementation is const parse = data => yaml.safeLoad(stripBom(data)) and which declares js-yaml: ^3.6.1. The override widens that to ^5.0.0, and the lockfile now resolves read-yaml-file@1.1.0 → js-yaml: 5.3.0 (pnpm-lock.yaml:9014-9019). js-yaml removed safeLoad in v4 (verified: require('js-yaml@5.3.0').safeLoad === undefined), so any workspace/package YAML read by changesets throws TypeError: yaml.safeLoad is not a function.
A safer scope would keep the 3.x consumers on a 3.x-compatible line (or pin read-yaml-file to a newer major that uses load), rather than forcing the pre-3.15 range straight to v5.
Was this helpful? React with 👍 or 👎 to provide feedback.
ec1b8ed to
c13f51e
Compare
c13f51e to
8ce9ee3
Compare
8ce9ee3 to
c071304
Compare
c071304 to
b9242e8
Compare
b9242e8 to
62962f3
Compare
62962f3 to
a9487ea
Compare
a9487ea to
30a97cd
Compare
30a97cd to
7aaf1b7
Compare
7aaf1b7 to
b1b41e8
Compare
df542e9 to
fadffcb
Compare
fadffcb to
7cb7f40
Compare
7cb7f40 to
76d0dd7
Compare
76d0dd7 to
5fe9fb1
Compare
5fe9fb1 to
a8cd4cd
Compare
a8cd4cd to
306c81c
Compare
306c81c to
f5459b8
Compare
f5459b8 to
04cedab
Compare
04cedab to
9ace01e
Compare
9ace01e to
154ef32
Compare
154ef32 to
b63e7d0
Compare
This PR contains the following updates:
^3.15.0→^5.0.0JS-YAML: Quadratic CPU consumption in !!omap resolution (3.x and 4.x) — CVE-2026-59870 fix not backported
GHSA-5p4m-2wfm-xmqj
More information
Details
Quadratic CPU consumption in
!!omapresolution (js-yaml 3.x and 4.x)Summary
resolveYamlOmap()enforces key uniqueness for!!omapsequences with a linearscan (
objectKeys.indexOf(...)) inside the per-element loop, making resolutionO(n²) in the number of entries. A modestly sized YAML document therefore
consumes disproportionate CPU inside
yaml.load(), giving a denial of serviceagainst any consumer that parses untrusted YAML.
!!omapis registered in the default schema(
lib/schema/default.js→require('../type/omap')), so a plainyaml.load(untrustedInput)with no options is affected — no custom schema ornon-default configuration is required.
This is the same weakness as CVE-2026-59870 / GHSA-724g-mxrg-4qvm, which was
fixed in the 5.x line in 5.2.1. That fix was never backported: both currently
maintained legacy lines still carry the original implementation.
Affected versions
objectKeys.indexOf(pairKey)atlib/type/omap.js:29objectKeys.indexOf(pairKey)atlib/type/omap.js:30Set)Both figures are the newest release of each line at the time of writing, so
this is not a "you are on an old version" issue.
Details
lib/type/omap.js(js-yaml 4.3.0):objectKeysgrows by one element per entry, andArray.prototype.indexOfis alinear scan, so resolving an
n-entry!!omapperforms roughly1 + 2 + … + ncomparisons — quadratic inn. The work happens synchronouslyinside
yaml.load(), blocking the event loop for its whole duration.The 5.x line already solves exactly this by tracking seen keys in a
Set(
src/tag/sequence/omap.ts):Proof of concept
Measured (node v20.20.2, default heap, no flags)
js-yaml 4.3.0
js-yaml 3.15.0
Runtime grows by a factor of ~4 for each doubling of
n, which is thesignature of O(n²) (linear growth would be ~2×).
Scaling further: a 2.48 MB document with 150,000 entries blocked
yaml.load()for 10.8 seconds.Impact
Any service that parses attacker-influenced YAML with js-yaml 3.x or 4.x can be
stalled with a small input. Because the loop is synchronous, a single request
blocks the Node.js event loop and stalls every other request in the process —
so the amplification is per-process, not just per-request.
Suggested severity: consistent with CVE-2026-59870 (the same weakness in
5.x), i.e. Availability-only impact, network attack vector, no privileges or
user interaction required.
Suggested fix
Mirror the 5.x fix — replace the linear scan with a
Set:This preserves the existing duplicate-key rejection semantics exactly while
making resolution O(n). A
maxOmapLength-style cap would also work, but theSetmatches what 5.x already ships and requires no new option.References
lib/type/omap.js(3.x, 4.x) — the affected resolverlib/schema/default.js— registers!!omapin the default schemaDiscovery
Found by an automated static-analysis and executed-proof-of-concept scanner run
against js-yaml 4.2.0, then manually verified against 3.15.0 and 4.3.0 by
executing the proof of concept above. All timings in this report were measured
on the current releases of each line, not on the version originally scanned.
Severity
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:HReferences
This data is provided by the GitHub Advisory Database (CC-BY 4.0).
Release Notes
nodeca/js-yaml (js-yaml@<3.15.0)
v5.3.0Compare Source
This release focuses on reworking the documentation and making small
architectural improvements before moving forward.
Added
DUMP_SCHEMA, the default schema used by the dumper.YAMLException.throwAt()for throwing an error at a source position.Changed
EVENT_ID,SCALAR_STYLE,COLLECTION_STYLE, andCHOMPING_MODE, along with their value types. The oldexports are still preserved, but deprecated.
identifymandatory for custom tag definitions. Useidentify: () => falsefor load-only tags.Deprecated
Removed
MERGE_KEYexport (not used anymore after last fixes).Fixed
<<sequence items at merge time, so aliased merge sources arechecked too.
<<outside of a mapping key as the plain string'<<', matchingv4, instead of leaking an internal symbol into the result.
v5.2.3Compare Source
Fixed
!!timestampyears 0000-0099 correctly, #775.unpaired mapping event streams, #784.
parsed AST through
present();dump()and loading are unaffected, #780.v5.2.2Compare Source
Fixed
Security
v5.2.1Compare Source
Fixed
Mapsupport to !!omap (should work whenrealMapTagused)Security
addItem. Regression from v5(usually not critical, because YAML11_SCHEMA is not default anymore).
v5.2.0Compare Source
Added
maxTotalMergeKeys(10000) loader option to limit the total number ofkeys processed by YAML merge (
<<) across oneload()/loadAll()call.maxAliases(-1) loader option to limit the number of YAML aliases perdocument.
Removed
maxMergeSeqLengthreplaced withmaxTotalMergeKeysfor limiting YAML mergeprocessing.
Fixed
1e21)v5.1.0Compare Source
Added
different result value.
Changed
quoteStylenow selects the preferred quote style; use therestored
forceQuotesoption to force quoting non-key strings.v5.0.0Compare Source
Added
JSON_SCHEMAandCORE_SCHEMAwith spec-compliant scalar resolutionrules, and added
YAML11_SCHEMA.realMapTagfor lossless mappings with non-string and complex keys.Object-based mappings now reject complex keys instead of stringifying them.
dump()transformoption for changing the generated AST beforerendering.
dump()optionsseqInlineFirst,flowBracketPadding,flowSkipCommaSpace,flowSkipColonSpace,quoteFlowKeys,quoteStyleandtagBeforeAnchor.test set.
Changed
exports.
CORE_SCHEMA(loader default),JSON_SCHEMA,FAILSAFE_SCHEMA.YAML11_SCHEMA, a combination of all YAML 1.1 tags (YAML 1.1 does notspecify a schema, only "types").
load/dumpdefault behaviour is now specified exactly via schemas:loadusesCORE_SCHEMA, without!!mergeby default.dumpusesYAML11_SCHEMA+CORE_SCHEMAfor the quoting check, toguarantee backward compatibility by default.
!!setis now loaded as a JavaScriptSet.TypeAPI with a tags API. Similar, but more precise andsimpler. See examples for details. Tags can be defined via
defineScalarTag(),defineSequenceTag()anddefineMappingTag(), or as aspread + override of an existing tag.
Schema.extend()toSchema.withTags().markers, block keys, multiline scalars, tag syntax and other things.
load()now throws on empty input instead of returningundefined.js-yaml/browserexport.loadAllsignature with an iterator (still works, but is acandidate for removal).
Removed
safeLoad(),safeLoadAll()andsafeDump()exports.DEFAULT_SCHEMAand the nestedtypesexport.onWarning,legacyandlistener.styles,replacer,noCompatMode,condenseFlow,quotingTypeandforceQuotes. RenamednoArrayIndenttoseqNoIndent.Formatting and representation are now configured through presenter options,
schemas and tag definitions. See migration guide on how to replace.
lib/.v4.3.1Compare Source
v4.3.0Compare Source
v4.2.0Compare Source
Added
docs/safety.mdwith notes about processing untrusted YAML.maxDepth(100) loader option. Not a problem, but gives a betterexception instead of RangeError on stack overflow.
maxMergeSeqLength(20) loader option. Not a problem aftermergefix,but an additional restriction for safety.
dist/builds.Changed
dist/files are no longer kept in the repository.Fixed
Security
elements (makes sense for malformed files > 10K).
v4.1.1Compare Source
Security
v4.1.0Compare Source
Added
yaml.types.XXX.optionsproperty with original arguments kept as they were(see
yaml.types.int.optionsas an example).Changed
Schema.extend()now keeps old type order in case of conflicts(e.g. Schema.extend([ a, b, c ]).extend([ b, a, d ]) is now ordered as
abcdinstead ofcbad).v4.0.0Compare Source
Changed
!!js/function,!!js/regexp,!!js/undefinedaremoved to js-yaml-js-types package.
safe*functions. Useload,loadAll,dumpinstead which are all now safe by default.
yaml.DEFAULT_SAFE_SCHEMAandyaml.DEFAULT_FULL_SCHEMAare removed, useyaml.DEFAULT_SCHEMAinstead.yaml.Schema.create(schema, tags)is removed, useschema.extend(tags)instead.!!binarynow always mapped toUint8Arrayon load./libfolder.01234is now decimal,0o1234is octal,1:23is parsed as string instead of base60).dump()no longer quotes:,[,],(,)except when necessary, #470, #557.(X:Y)instead ofat line X, column Y(also present in compact format), #332.dump()now serializesundefinedasnullin collections and removes keys withundefinedin mappings, #571.dump()withskipInvalid=truenow serializes invalid items in collections as null.!are now dumped as!taginstead of!<!tag>, #576.tag:yaml.org,2002:are now shorthanded using!!, #258.Added
.mjs(es modules) support.quotingTypeandforceQuotesoptions for dumper to configurestring literal style, #290, #529.
styles: { '!!null': 'empty' }option for dumper(serializes
{ foo: null }as "foo:"), #570.replaceroption (similar to option in JSON.stringify), #339.Tagcan now handle all tags or multiple tags with the same prefix, #385.Fixed
dump(), #587.[foo,,bar]) now throw an exceptioninstead of producing null, #321.
__proto__key no longer overrides object prototype, #164.bower.json.load()and url-encoded indump()(previously usage of custom non-ascii tags may have led to invalid YAML that can't be parsed).
Configuration
📅 Schedule: (UTC)
🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.
♻ Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.
🔕 Ignore: Close this PR and you won't be reminded about this update again.
This PR was generated by Mend Renovate. View the repository job log.