NPM.Security.ExoticDeps (NPM v0.7.4)

Copy Markdown View Source

Detects and blocks exotic dependency specs in published package metadata.

Registry packages can declare dependencies that resolve from outside the configured registry, such as Git repositories, direct tarball URLs, local files, or GitHub shorthand specs. Those sources bypass the normal registry integrity and metadata flow and have been used by supply-chain malware to trigger hidden build steps through transitive optionalDependencies.

npm_ex blocks these transitive specs by default. Direct project dependencies are still controlled by the root manifest; this module protects against a package from the registry unexpectedly introducing an external source deeper in the dependency graph.

Summary

Functions

Validate a direct project dependency against the exotic dependency allowlist.

Functions

exotic?(spec)

@spec exotic?(term()) :: boolean()

validate!(package, version, info)

@spec validate!(String.t(), String.t(), map()) :: :ok

validate_direct!(dependency, spec)

@spec validate_direct!(String.t(), term()) :: :ok

Validate a direct project dependency against the exotic dependency allowlist.