DepSentinel

← All posts

How to check your project for malicious or compromised packages

GuideUpdated 30 November 2026npmPyPINuGetMaven

When a supply-chain attack hits the news, the first question is always the same: did we install it? This guide shows how to answer that for every major ecosystem, what to do if the answer is yes, and how to be ready for the next one.

1. Find out whether the package is in your dependency tree

Attackers usually compromise a package you don’t depend on directly, so always search the full tree, including sub-dependencies, and check the exact version against the advisory.

EcosystemCommand
npmnpm ls <package> --all
pnpmpnpm why <package>
Yarnyarn why <package>
pippython -m pip freeze | grep -i <package>
Poetry / uvpoetry show --tree · uv tree
.NET / NuGetdotnet list package --include-transitive
Mavenmvn dependency:tree -Dincludes=<groupId>:<artifactId>
Gradle./gradlew dependencies
Gogo mod why -m <module>
Rustcargo tree -i <crate>

Also search lockfiles directly (package-lock.json, pnpm-lock.yaml, yarn.lock, poetry.lock, uv.lock, packages.lock.json) in every repository and branch you build from, plus CI caches and container images. A clean main doesn’t help if a release branch installed the bad version.

2. Check it against advisory databases

3. If you installed a malicious version

  1. Assume the machine is compromised. Most recent npm malware runs at install time and steals credentials before you notice anything.
  2. Rotate secrets from a clean machine: cloud keys, GitHub and npm tokens, SSH keys, CI secrets, and anything in .env files the install could read.
  3. Remove the package and pin a known-good version, then clear package-manager caches (npm cache clean --force, pip and CI caches).
  4. Look for persistence: new GitHub tokens, repositories or workflow runs you didn’t create, and unexpected .vscode/tasks.json or .claude/ files in your repositories.
  5. Rebuild anything built while the bad version was installed.

4. Be ready for the next one

Automate the check with DepSentinel. DepSentinel is a free VS Code extension that does steps 1 and 2 for you in the background. It reads lockfiles and manifests for npm, yarn, pnpm, Maven, Gradle, Python, Go, Rust, Ruby, PHP and .NET, checks every dependency (including sub-dependencies) against OSV, marks CISA KEV vulnerabilities as exploited, and flags supply-chain warning signs such as new install scripts, brand-new packages, typosquats and dropped provenance. It also has a CLI for CI. No account or API key.

Recent incidents