Security update about npm libraries ‘colors’ and ‘faker’
The infinite loop introduced by the developer broke several apps using these libraries by printing the text ‘LIBERTY LIBERTY LIBERTY’ and non-ASCII characters in the apps’ logs.
It causes a lot of trouble as the colors library receives over 20 million weekly downloads on npm alone and has almost 19,000 projects relying on it. Whereas, faker receives over 2.8 million weekly downloads on npm, and has over 2,500 dependents.
How to check if your Node.js app is impacted?
The first thing to do is to check if your app is using the npm libraries ‘colors’ or ‘faker’. To do so, run either:
npm ls colors
npm ls faker
You will get an output like this:
[email protected] /home/me/my-project ├─┬ @storybook/[email protected] │ └─┬ [email protected] │ └─┬ [email protected] │ └── [email protected] deduped ├─┬ @storybook/[email protected] │ └─┬ @storybook/[email protected] │ └─┬ [email protected] │ └── [email protected] deduped └── [email protected]
With this output, we can identify that this project uses ‘colors’ directly with version 1.4.0 and through transitive dependencies, also in version 1.4.0.
Your app uses ‘colors’ or ‘faker’, what can you do?
If your app uses one of these npm libraries, we invite you to check three thing:
Check the version
First of all, you need to check if you’re using one of the compromised versions of these libraries:
Check the package-lock.json
Do you have a
package-lock.json? If you don’t we invite you to read the documentation and add one to your project.
If you do, you need to force a version which is not compromised (
1.4.0 for colors and
5.5.3 for ‘faker’). You’re using npm? You can try with the module npm-force-resolutions. You’re using Yarn? You can use the process described in this documentation.
Update your tools to their latest version
A note for Clever Tools users
By the way, if you use our CLI, the clever-tools, and if you installed it via npm, please upgrade to v2.8.1.