From beaeb5e7dfda2d076a452d4f89169a29d0c360db Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Wed, 7 Oct 2026 02:12:06 +0800 Subject: [PATCH] chore: bump up js-yaml version to v5.4.1 [SECURITY] (#15664) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This PR contains the following updates: | Package | Change | [Age](https://docs.renovatebot.com/merge-confidence/) | [Confidence](https://docs.renovatebot.com/merge-confidence/) | |---|---|---|---| | [js-yaml](https://redirect.github.com/nodeca/js-yaml) | [`5.2.3` → `5.4.1`](https://renovatebot.com/diffs/npm/js-yaml/5.2.3/5.4.1) | ![age](https://developer.mend.io/api/mc/badges/age/npm/js-yaml/5.4.1?slim=true) | ![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/js-yaml/5.2.3/5.4.1?slim=true) | | [js-yaml](https://redirect.github.com/nodeca/js-yaml) | [`^3.15.1` → `^5.0.0`](https://renovatebot.com/diffs/npm/js-yaml/3.15.2/5.4.1) | ![age](https://developer.mend.io/api/mc/badges/age/npm/js-yaml/5.4.1?slim=true) | ![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/js-yaml/3.15.2/5.4.1?slim=true) | --- ### js-yaml: maxTotalMergeKeys does not limit CPU use for empty merge sources [GHSA-r3ph-w7gj-g6xm](https://redirect.github.com/advisories/GHSA-r3ph-w7gj-g6xm)
More information #### Details ##### Summary `maxTotalMergeKeys` does not count empty mappings. An attacker can repeatedly merge a large sequence of them and consume significant CPU without reaching the configured limit. ##### Example ```yaml arr: &arr [{}, {}, {}, ...] # N empty mappings targets: - <<: *arr # repeated K times ``` For every target, the loader iterates all `N` elements of `arr`. This results in `O(N * K)` work while `totalMergeKeys` remains unchanged. ##### PoC ```js import { performance } from 'node:perf_hooks' import { load, YAML11_SCHEMA } from 'js-yaml' const n = 20000 const src = 'arr: &arr [' + '{},'.repeat(n).slice(0, -1) + ']\n' + 'targets:\n' + ' - <<: *arr\n'.repeat(n) const started = performance.now() load(src, { schema: YAML11_SCHEMA }) console.log(`${(performance.now() - started).toFixed(1)} ms`) ``` Observed results: | N | YAML size | Time | |---:|---:|---:| | 800 | ~13 KB | ~20 ms | | 3200 | ~50 KB | ~180 ms | | 20000 | ~500 KB | ~13 s | ##### Impact When merge keys are enabled, an attacker can submit a relatively small YAML document that causes prolonged CPU consumption despite the default `maxTotalMergeKeys` limit. ##### Fix Count every merge source mapping as one budget unit in addition to counting its keys. #### Severity - CVSS Score: 5.3 / 10 (Medium) - Vector String: `CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L` #### References - [https://github.com/nodeca/js-yaml/security/advisories/GHSA-r3ph-w7gj-g6xm](https://redirect.github.com/nodeca/js-yaml/security/advisories/GHSA-r3ph-w7gj-g6xm) - [https://github.com/nodeca/js-yaml/commit/6a8e05f9a485188ed730ac81e81ae221352ef480](https://redirect.github.com/nodeca/js-yaml/commit/6a8e05f9a485188ed730ac81e81ae221352ef480) - [https://github.com/nodeca/js-yaml/releases/tag/5.4.1](https://redirect.github.com/nodeca/js-yaml/releases/tag/5.4.1) - [https://github.com/advisories/GHSA-r3ph-w7gj-g6xm](https://redirect.github.com/advisories/GHSA-r3ph-w7gj-g6xm) This data is provided by the [GitHub Advisory Database](https://redirect.github.com/advisories/GHSA-r3ph-w7gj-g6xm) ([CC-BY 4.0](https://redirect.github.com/github/advisory-database/blob/main/LICENSE.md)).
--- ### Release Notes
nodeca/js-yaml (js-yaml) ### [`v5.4.1`](https://redirect.github.com/nodeca/js-yaml/compare/5.4.0...5.4.1) [Compare Source](https://redirect.github.com/nodeca/js-yaml/compare/5.4.0...5.4.1) ### [`v5.4.0`](https://redirect.github.com/nodeca/js-yaml/blob/HEAD/CHANGELOG.md#540---2026-08-25) [Compare Source](https://redirect.github.com/nodeca/js-yaml/compare/5.3.0...5.4.0) ##### Added - Added the `scalarStyleRules` dumper option to customize string formatting. See [Scalar styling](docs/scalar_styling.md) for details. ##### Changed - \[breaking] Flattened the low-level AST node style representation. Scalar and collection nodes now use `SCALAR_STYLE` and `COLLECTION_STYLE` values; explicit tags use the separate `tagged` property. Alias nodes now contain only `kind` and `anchor`. This only affects code that directly constructs or edits AST nodes. - \[breaking] The `sortKeys` option was rewritten using AST mutation to avoid side effects. - Reworked scalar style selection. This can change formatting without changing loaded values; in particular, whitespace-only strings are now double-quoted. ##### Fixed - Accept a byte order mark at the start of each document in a stream, [#​791](https://redirect.github.com/nodeca/js-yaml/issues/791). - Produce valid flow mappings with `quoteFlowKeys` and `flowSkipColonSpace`, including alias and property-only keys, [#​786](https://redirect.github.com/nodeca/js-yaml/issues/786). - Preserve empty scalar items when converting block sequences to flow style. - Do not apply the 1024-character simple-key limit to flow mapping keys. - Count Unicode code points, rather than UTF-16 code units, for the 1024-character simple-key limit. - Add an explicit document-end marker after keep-chomped block scalars when needed to preserve trailing newlines. ### [`v5.3.0`](https://redirect.github.com/nodeca/js-yaml/blob/HEAD/CHANGELOG.md#530---2026-08-14) [Compare Source](https://redirect.github.com/nodeca/js-yaml/compare/5.2.3...5.3.0) This release focuses on reworking the documentation and making small architectural improvements before moving forward. ##### Added - Added completely new documentation. - Exported `DUMP_SCHEMA`, the default schema used by the dumper. - Added `YAMLException.throwAt()` for throwing an error at a source position. ##### Changed - Changed flat constant exports to grouped exports: `EVENT_ID`, `SCALAR_STYLE`, `COLLECTION_STYLE`, and `CHOMPING_MODE`, along with their value types. The old exports are still preserved, but deprecated. - Made `identify` mandatory for custom tag definitions. Use `identify: () => false` for load-only tags. ##### Deprecated - Deprecated flat constant exports. Use grouped ones instead. ##### Removed - Removed the `MERGE_KEY` export (not used anymore after last fixes). ##### Fixed - Validate `<<` sequence items at merge time, so aliased merge sources are checked too. - Resolve `<<` outside of a mapping key as the plain string `'<<'`, matching v4, instead of leaking an internal symbol into the result.
--- ### Configuration 📅 **Schedule**: (UTC) - Branch creation - At any time (no schedule defined) - Automerge - At any time (no schedule defined) 🚦 **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 these updates again. --- - [ ] If you want to rebase/retry this PR, check this box --- This PR was generated by [Mend Renovate](https://mend.io/renovate/). View the [repository job log](https://developer.mend.io/github/toeverything/AFFiNE). Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- package.json | 4 ++-- yarn.lock | 36 ++++++++++++------------------------ 2 files changed, 14 insertions(+), 26 deletions(-) diff --git a/package.json b/package.json index 57fab12f3c..b6500e9e1c 100644 --- a/package.json +++ b/package.json @@ -204,8 +204,8 @@ "fs-xattr": "npm:@napi-rs/xattr@latest", "@opentelemetry/core": "^2.10.0", "ioredis": "^5.11.1", - "js-yaml@npm:^3.13.1": "^3.15.1", - "js-yaml@npm:^3.14.1": "^3.15.1", + "js-yaml@npm:^3.13.1": "^5.0.0", + "js-yaml@npm:^3.14.1": "^5.0.0", "js-yaml@npm:^4.1.0": "^5.0.0", "js-yaml@npm:4.1.1": "^5.0.0", "js-yaml@npm:5.2.1": "^5.2.3", diff --git a/yarn.lock b/yarn.lock index 862a93bb88..1b9ce79180 100644 --- a/yarn.lock +++ b/yarn.lock @@ -16651,7 +16651,14 @@ __metadata: languageName: node linkType: hard -"argparse@npm:^1.0.7, argparse@npm:~1.0.3": +"argparse@npm:^2.0.1": + version: 2.0.1 + resolution: "argparse@npm:2.0.1" + checksum: 10/18640244e641a417ec75a9bd38b0b2b6b95af5199aa241b131d4b2fb206f334d7ecc600bd194861610a5579084978bfcbb02baa399dbe442d56d0ae5e60dbaef + languageName: node + linkType: hard + +"argparse@npm:~1.0.3": version: 1.0.10 resolution: "argparse@npm:1.0.10" dependencies: @@ -16660,13 +16667,6 @@ __metadata: languageName: node linkType: hard -"argparse@npm:^2.0.1": - version: 2.0.1 - resolution: "argparse@npm:2.0.1" - checksum: 10/18640244e641a417ec75a9bd38b0b2b6b95af5199aa241b131d4b2fb206f334d7ecc600bd194861610a5579084978bfcbb02baa399dbe442d56d0ae5e60dbaef - languageName: node - linkType: hard - "aria-hidden@npm:^1.2.4": version: 1.2.4 resolution: "aria-hidden@npm:1.2.4" @@ -20983,7 +20983,7 @@ __metadata: languageName: node linkType: hard -"esprima@npm:^4.0.0, esprima@npm:~4.0.0": +"esprima@npm:~4.0.0": version: 4.0.1 resolution: "esprima@npm:4.0.1" bin: @@ -23871,18 +23871,6 @@ __metadata: languageName: node linkType: hard -"js-yaml@npm:^3.15.1": - version: 3.15.2 - resolution: "js-yaml@npm:3.15.2" - dependencies: - argparse: "npm:^1.0.7" - esprima: "npm:^4.0.0" - bin: - js-yaml: bin/js-yaml.js - checksum: 10/320b5471c1b7309a15d9c0068ba273e2da7382a369038a9746c92ef649087c3d6d2a5c676810154efb4eb2ca9584179c8ae14e2fc2e4bd558d964e6bf4fafd3d - languageName: node - linkType: hard - "js-yaml@npm:^4.3.0": version: 4.3.2 resolution: "js-yaml@npm:4.3.2" @@ -23895,13 +23883,13 @@ __metadata: linkType: hard "js-yaml@npm:^5.0.0, js-yaml@npm:^5.2.3": - version: 5.2.3 - resolution: "js-yaml@npm:5.2.3" + version: 5.4.2 + resolution: "js-yaml@npm:5.4.2" dependencies: argparse: "npm:^2.0.1" bin: js-yaml: bin/js-yaml.mjs - checksum: 10/5d2562f2d7e7bc51bd678b43d2dbc3965129ac854222c794157369c8904d249cfc78325dff8fc64becb505a2506242548c54c8fa50cdb24554bb1a557e460004 + checksum: 10/f2461abd1d6268fb226733f0a0e0aa48004bb824116e3dfa75f1a1279001936343b672066dfecdb852ac3ca883452706c383a760aa90430cb68ba395aa2cbc84 languageName: node linkType: hard