Skip to content

Scanning packages ​

deps checks a package for supply-chain risk before you trust it. It uses GuardDog, Datadog's malicious-package detector, and reports in the same format as scan.

sh
malware-detector deps <package-dir-or-archive> [--ecosystem npm|pypi] [options]

The ecosystem is detected automatically: a directory containing package.json is treated as npm, anything else as PyPI. Use --ecosystem to override it.

Vet an npm package ​

sh
npm pack left-pad                 # downloads left-pad-<version>.tgz, nothing is installed
tar xzf left-pad-*.tgz            # extracts to ./package
malware-detector deps ./package

Vet a PyPI package ​

sh
pip download --no-deps --no-binary :all: requests -d ./pkgs
malware-detector deps ./pkgs/requests-*.tar.gz --ecosystem pypi

Download, don't install

npm install and pip install can run the package's install scripts, which is exactly the attack you're trying to catch. Use npm pack / pip download to get the files without running anything.

What it catches ​

GuardDog findings are mapped onto the shared severity scale:

GuardDog signalExamplesSeverity
threat-* (malicious behaviour)exfiltration, download-and-execute, obfuscated codeCRITICAL
Metadata heuristicstyposquatting, deceptive author, empty descriptionHIGH
capability-*network access, process spawningMEDIUM

deps or scan --include-deps? ​

depsscan --include-deps
Targetone packageyour whole project, deps included
Looks at package metadata✅ (typosquats, authors, …)❌
Uses the malware rule pack❌✅
Best for"should I add this package?""is anything in my tree compromised?"

For the most thorough review of a package you're unsure about, run both:

sh
malware-detector deps ./package
malware-detector scan ./package --include-deps --with-malcontent