Skip to content

How is AI Guard’s package check different from npm audit?

npm audit asks the registry for a report of known vulnerabilities in the dependencies your project already declares. AI Guard’s verify-deps checks a package before it is installed: whether the name and version exist, whether npm replaced it with a security placeholder, whether it imitates a popular package, and how new it is. They answer different questions, so use both.

By the AI Guard maintainers · Last updated · Applies to v1.4.7

What npm audit does

npm's documentation says the audit command "submits a description of the dependencies configured in your project to your default registry and asks for a report of known vulnerabilities", and that remediations are applied with npm audit fix (npm docs: npm audit). npm's audit setting defaults to true, which submits audit reports alongside other npm commands such as install (npm docs: config). npm audit signatures verifies registry signatures and provenance attestations of downloaded packages.

Its subject is known vulnerabilities: advisories published for packages that exist. npm's documentation does not describe audit as checking whether a name was invented, imitates a popular package, or was published an hour ago.

What AI Guard's package check does

npx ai-guard verify-deps looks each package up before it is installed and blocks on facts:

  • the name does not exist on npm (often invented by an assistant)
  • the exact version does not exist
  • npm replaced it with a security placeholder (removed malware)
  • a look-alike of a popular package, or an install script, on a package that is new or rarely downloaded

It warns on a look-alike name, a new package, few downloads, an install script, a deprecation, or a release from the last 24 hours. It does not report known vulnerabilities (CVEs).

Side by side

npm auditAI Guard verify-deps
Question it answersDo my dependencies have known vulnerabilities?Is this the package I meant, and is it safe to install now?
WhenAfter dependencies are declared or installedBefore install, on names or on what a change adds
Invented or misspelled namesNot described in npm's docsBlocked (missing) or warned/blocked (look-alike)
Removed malware placeholdersNot described in npm's docsBlocked
Very new releasesNot described in npm's docsWarned (24 hours by default)
Known vulnerabilities (advisories)YesNo
NetworkYour default registryregistry.npmjs.org and api.npmjs.org; private-registry packages skipped

Use both

Run npm audit (or let npm run it on install) for known vulnerabilities, and verify-deps or the agent install hook for what an assistant or a change is about to add. Add a release cooldown for hijacked releases of real packages.

Sources