You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Parsing a YAML document with yaml may throw a RangeError due to a stack overflow.
The node resolution/composition phase uses recursive function calls without a depth bound. An attacker who can supply YAML for parsing can trigger a RangeError: Maximum call stack size exceeded with a small payload (~2–10 KB). The RangeError is not a YAMLParseError, so applications that only catch YAML-specific errors will encounter an unexpected exception type. Depending on the host application's exception handling, this can fail requests or terminate the Node.js process.
Flow sequences allow deep nesting with minimal bytes (2 bytes per level: one [ and one ]). On the default Node.js stack, approximately 1,000–5,000 levels of nesting (2–10 KB input) exhaust the call stack. The exact threshold is environment-dependent (Node.js version, stack size, call stack depth at invocation).
Note: the library's Parser (CST phase) uses a stack-based iterative approach and is not affected. Only the compose/resolve phase uses actual call-stack recursion.
All three public parsing APIs are affected: YAML.parse(), YAML.parseDocument(), and YAML.parseAllDocuments().
PoC
constYAML=require('yaml');// ~10 KB payload: 5000 levels of nested flow sequencesconstpayload='['.repeat(5000)+'1'+']'.repeat(5000);try{YAML.parse(payload);}catch(e){console.log(e.constructor.name);// RangeError (NOT YAMLParseError)console.log(e.message);// Maximum call stack size exceeded}
Test environment: Node.js v24.12.0, macOS darwin arm64
The library is now available on JSR as @eemeli/yaml and on deno.land/x as yaml. In addition to Node.js and browsers, it should work in Deno, Bun, and Cloudflare Workers.
This patch release includes a fix for an error that could be thrown in parseDocument for degenerate input. Otherwise, it's a patch release uplifting a few fixes from the ongoing v2.3 work to v2.2:
Corner case failure in error pretty-printer (CVE-2023-2251)
Use correct argument order when stringifying flow collection comments (#443)
renovateBot
changed the title
fix(deps): update dependency yaml to v2.2.2 [security]
fix(deps): update dependency yaml to v2.2.2 [security] - autoclosed
Dec 8, 2024
renovateBot
changed the title
fix(deps): update dependency yaml to v2.2.2 [security] - autoclosed
fix(deps): update dependency yaml to v2.2.2 [security]
Dec 8, 2024
renovateBot
changed the title
chore(deps): update dependency yaml to v2.2.2 [security]
chore(deps): update dependency yaml to v2.8.3 [security]
Mar 26, 2026
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
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.
This PR contains the following updates:
2.2.1→2.8.3Uncaught Exception in yaml
CVE-2023-2251 / GHSA-f9xv-q969-pqx4
More information
Details
Uncaught Exception in GitHub repository eemeli/yaml starting at version 2.0.0-5 and prior to 2.2.2.
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).
yaml is vulnerable to Stack Overflow via deeply nested YAML collections
CVE-2026-33532 / GHSA-48c2-rrv3-qjmp
More information
Details
Parsing a YAML document with
yamlmay throw a RangeError due to a stack overflow.The node resolution/composition phase uses recursive function calls without a depth bound. An attacker who can supply YAML for parsing can trigger a
RangeError: Maximum call stack size exceededwith a small payload (~2–10 KB). TheRangeErroris not aYAMLParseError, so applications that only catch YAML-specific errors will encounter an unexpected exception type. Depending on the host application's exception handling, this can fail requests or terminate the Node.js process.Flow sequences allow deep nesting with minimal bytes (2 bytes per level: one
[and one]). On the default Node.js stack, approximately 1,000–5,000 levels of nesting (2–10 KB input) exhaust the call stack. The exact threshold is environment-dependent (Node.js version, stack size, call stack depth at invocation).Note: the library's
Parser(CST phase) uses a stack-based iterative approach and is not affected. Only the compose/resolve phase uses actual call-stack recursion.All three public parsing APIs are affected:
YAML.parse(),YAML.parseDocument(), andYAML.parseAllDocuments().PoC
Test environment: Node.js v24.12.0, macOS darwin arm64
Depth threshold on yaml 2.8.2:
Severity
CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:LReferences
This data is provided by the GitHub Advisory Database (CC-BY 4.0).
Release Notes
eemeli/yaml (yaml)
v2.8.3Compare Source
trailingCommaToString option for multiline flow formatting (#670)1e84ebb)v2.8.2Compare Source
v2.8.1Compare Source
v2.8.0Compare Source
--mergeoption to CLI tool (#611)v2.7.1Compare Source
v2.7.0Compare Source
The library is now available on JSR as @eemeli/yaml and on deno.land/x as yaml. In addition to Node.js and browsers, it should work in Deno, Bun, and Cloudflare Workers.
v2.6.1Compare Source
:00seconds from!!timestampvalues (#578, with thanks to @qraynaud)!!bool(#587, with thanks to @vra5107)v2.6.0Compare Source
!!merge <<keys (#580)stringKeysparse option (#581)v2.5.1Compare Source
v2.5.0Compare Source
--indentoption to CLI tool (#559, with thanks to @danielbayley)...(#558)minContentWidthif greater thanlineWidth(#562)Collection.maxFlowStringSingleLineLength(#522, #421)v2.4.5Compare Source
v2.4.4Compare Source
With special thanks to @RedCMD for finding and reporting all of the following:
[]{}immediately after:with plain key (#550)?explicit-key contents (#551)v2.4.3Compare Source
-.NaNor+.nanas NaN (#546)#within%TAGprefixes with trailing#commentsv2.4.2Compare Source
v2.4.1Compare Source
v2.4.0Compare Source
lineWidthoption for line breaking in flow collections (#522)v2.3.4Compare Source
v2.3.3Compare Source
v2.3.2Compare Source
v2.3.1Compare Source
"engines"config (#476)v2.3.0Compare Source
This release corresponds with the release of
yaml-typesv0.2.0, an expanding library of custom tags or types for use withyaml.This release contains no changes from v2.3.0-5, and the notes below include all changes from the v2.3.0-x prereleases.
Custom Tag Improvements
createNode()&createPair()to'yaml/util'(#457)from()methods to simplify tag development, and otherwise make extending custom collections easier (#467)TypeScript Improvements
StricttoDocumentinstances. (#441)StringifyContexttype from'yaml/util'(#464)Other New Features
toJS(doc, options?)method to nodes (#451, #458)createNode()for non-default tags (#464)Bugfixes
v2.2.2Compare Source
This patch release includes a fix for an error that could be thrown in
parseDocumentfor degenerate input. Otherwise, it's a patch release uplifting a few fixes from the ongoing v2.3 work to v2.2: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.