Js-yaml is a popular and actively maintained JavaScript library for parsing and serializing YAML data, adhering to the YAML 1.2 specification. Versions 3.13.0 and 3.12.2, both released in early 2019, offer similar core functionality, making the upgrade relatively straightforward for most users. Key features of js-yaml that remain consistent between these versions include robust YAML parsing and serialization capabilities, essential for applications dealing with configuration files or data exchange in YAML format. Both versions support a common set of developer dependencies, such as eslint, mocha, and uglify-js, ensuring a consistent development environment for contributors.
However, the upgrade from 3.12.2 to 3.13.0 includes some changes that, while not major, might be relevant. The unpackedSize increases slightly, from 280272 bytes in version 3.12.2 to 281728 bytes in version 3.13.0. These additional 1.4KB, likely contain bug fixes, performance improvements, or minor feature enhancements. The newer version was released on "2019-03-20", roughly three weeks after version 3.12.2, which might suggest a timely maintenance release addressing issues discovered in the earlier version. Users should evaluate these potential subtle upgrades when deciding between versions. Both versions maintain the same dependencies (argparse and esprima), indicating that the core API and functionality remain stable and compatible.
All the vulnerabilities related to the version 3.13.0 of the package
Code Injection in js-yaml
Versions of js-yaml
prior to 3.13.1 are vulnerable to Code Injection. The load()
function may execute arbitrary code injected through a malicious YAML file. Objects that have toString
as key, JavaScript code as value and are used as explicit mapping keys allow attackers to execute the supplied code through the load()
function. The safeLoad()
function is unaffected.
An example payload is
{ toString: !<tag:yaml.org,2002:js/function> 'function (){return Date.now()}' } : 1
which returns the object
{
"1553107949161": 1
}
Upgrade to version 3.13.1.