Skip to content

Upgrading js-yaml 3 to 4

Breaking3.15.2 → 4.3.2Breaking7Security9New10Changed9Fixed13Other7

BreakingUpgrade verdict

7 breaking changes and 8 security fixes.

  • The separate safe loading and dumping functions are gone; the regular functions are now safe.
  • Two schema constants are gone; use the single default schema.
  • This release changes several APIs and behaviors; check the migration guide before upgrading.
  • JavaScript-specific YAML tags are no longer built in; install the separate js-yaml-js-types package if you need them.
Top 5 of 15 that need code or config changes

Drops esprima.

Installs 1 package in all (was 3).

Breaking7
Removes safe* functions; use load, loadAll and dump, which are now safe by default.
safeLoadsafeLoadAllsafeDumploadloadAlldump
Removes yaml.DEFAULT_SAFE_SCHEMA and yaml.DEFAULT_FULL_SCHEMA; use yaml.DEFAULT_SCHEMA instead.
yaml.DEFAULT_SAFE_SCHEMAyaml.DEFAULT_FULL_SCHEMAyaml.DEFAULT_SCHEMA
Breaking changes are documented in the migration guide.
Moves "unsafe" tags !!js/function, !!js/regexp and !!js/undefined to the js-yaml-js-types package.
!!js/function!!js/regexp!!js/undefined
Removes yaml.Schema.create(schema, tags); use schema.extend(tags) instead.
yaml.Schema.create()schema.extend()
!!binary is now always mapped to Uint8Array on load.
!!binaryUint8Array
Parses numbers per YAML 1.2: 01234 is decimal, 0o1234 is octal, and 1:23 is a string instead of base60.
Security8
js-yaml: maxTotalMergeKeys does not limit CPU use for empty merge sources
High · CVSS 7.5
JS-YAML: Quadratic CPU consumption in !!omap resolution (3.x and 4.x) — CVE-2026-59870 fix not backported
High · CVSS 7.5
Backports the maxTotalMergeKeys option.
maxTotalMergeKeys
js-yaml: YAML merge-key chains can force quadratic CPU consumption
High · CVSS 7.5
JS-YAML: Quadratic-complexity DoS in merge key handling via repeated aliases
Moderate · CVSS 5.3
Fixes a prototype pollution issue in the yaml merge (<<) operator.
<<
js-yaml has prototype pollution in merge (<<)
Moderate · CVSS 5.3
The __proto__ key no longer overrides the object prototype.
__proto__