Yargs is a lightweight, command-line argument parsing library for Node.js applications, designed to simplify the process of handling user input. Version 1.2.1 builds upon the solid foundation of version 1.2.0, offering developers a polished tool for creating interactive command-line experiences. Both versions share the same core dependencies, relying on minimist for underlying argument parsing, and utilizing chai, mocha, and hashish for development and testing. They are both licensed under the permissive MIT/X11 license.
The key difference between version 1.2.0 and 1.2.1 lies in their release date, with version 1.2.1 being published slightly later, indicating that it contains some incremental improvements or bug fixes that were not present in the prior version. The release dates show that version 1.2.1 came out just an hour or so after version 1.2.0. This suggests any changes between releases will be minor, likely addressing immediate issues found upon the initial release.
For developers considering using Yargs, both versions provide a straightforward way to parse command-line arguments into a usable JavaScript object. Given the minimal time between releases, choosing either version will likely result in comparable functionality; however, using the latest version (1.2.1) is generally recommended to take advantage of any included patches or enhancements. The library is designed for ease of use and integration, streamlining the development workflow for command-line tools.
All the vulnerabilities related to the version 1.2.1 of the package
Prototype Pollution in minimist
Affected versions of minimist
are vulnerable to prototype pollution. Arguments are not properly sanitized, allowing an attacker to modify the prototype of Object
, causing the addition or modification of an existing property that will exist on all objects.
Parsing the argument --__proto__.y=Polluted
adds a y
property with value Polluted
to all objects. The argument --__proto__=Polluted
raises and uncaught error and crashes the application.
This is exploitable if attackers have control over the arguments being passed to minimist
.
Upgrade to versions 0.2.1, 1.2.3 or later.
Prototype Pollution in minimist
Minimist prior to 1.2.6 and 0.2.4 is vulnerable to Prototype Pollution via file index.js
, function setKey()
(lines 69-95).