tl;dr: npm stands for nerfed package manager
In case you missed it, two popular npm packages (chalk and debug) were compromised last week.
I wrote a short script for quickly testing if a repo depends on any of the affected libraries. It makes use of CycloneDX to create a Software Bill of Materials (SBOM), and then queries that SBOM using jq. Let’s walk throug how to use it.
How to scan for compromised packages
Make a local copy of the script
Copy the following code into a file namednode-guard.sh:
Run the script
Run the script by using the following command:0, after logging:
0 and output logs similar to the following:
1 and output logs similar to the following (note that this is flagging version 4.4.1 of debug, which is not actually the compromised version— this is for testing/illustrative purposes):