훅

dependency hook: Detect loosely resolved dependencies

Sweep a project's manifests, lockfiles, and index settings for dependencies fetched in the clear, without a hash, without a lockfile, or from merged package indexes, from the command line.

이 페이지는 아직 번역되지 않았습니다.

The dependency hook flags how a project's dependencies resolve and install wherever the files alone decide it. It reads only dependency files, and it is the deterministic engine behind the dependency specialization.

Run it​

npx lagune read dependency # scans the whole project
npx lagune read dependency --dir packages/api # scans a directory
npx lagune read dependency --file package.json # scans a single file

The scan prints up to three sections, each line naming the packages or indexes it applies to. Dependency risks found exits non-zero and holds what the files alone decide: a dependency, an index, or the build tool a wrapper downloads reached over plain http:// or git:// from another machine, a registry entry with no integrity hash, a setting that merges package indexes, so a public package can shadow a private one, and a Yarn setting that accepts a package whose checksum does not match. Dependency risks to review manually does not change the exit code and holds what the files cannot settle: a URL in the clear that the package manager refuses unless a setting outside the project allows it, a file the hook cannot read, and one entry naming why a Git state it cannot read leaves lockfile coverage unconfirmed. Dependency hardening advisories does not change the exit code either: a manifest with dependencies and no lockfile covering it, a source outside the registry (git or a remote tarball), a package the lockfile marks as running install scripts, a floating specifier such as * or latest, a wrapper download in the clear whose checksum the wrapper pins, and a Go module with no checksum in go.sum. A clean run prints no dependency risks found, and a URL it names never carries the user name or password written in it.

A file it cannot read or parse is a lead that names the file, never a clean result, and the scan goes on with every other file. So is an XML file that declares a document type, since an entity it declares could hide a URL or expand without bound. A URL on the machine itself, written as localhost, a 127.x.x.x address, or [::1], crosses no network, so the hook never reads it as fetched in the clear.

Ecosystem coverage​

It reads the dependency files of npm, pnpm, Yarn, pip, Poetry, Pipenv, uv, Cargo, Go modules, Bundler, Composer, NuGet, Maven, and Gradle, and each one gets only the rules its files decide. A rule an ecosystem's table leaves out is not checked there.

RulenpmpnpmYarn
Plain http:///git://package-lock.json, package.json, .npmrcpnpm-lock.yaml, package.json, .npmrcyarn.lock, package.json, .yarnrc, .yarnrc.yml
No integrity hashpackage-lock.jsonpnpm-lock.yamlyarn.lock: integrity or URL hash (Yarn 1), checksum (Yarn 2+)
Accepted checksumNot checkedNot checkedchecksumBehavior in .yarnrc.yml
Outside the registrypackage-lock.json, package.jsonpnpm-lock.yaml, package.jsonyarn.lock, package.json
Install scriptspackage-lock.json from npm 7 onpnpm-lock.yaml with requiresBuildNot recorded in the lockfile
No lockfilepackage.jsonpackage.jsonpackage.json
Floating specifierpackage.jsonpackage.jsonpackage.json

npm-shrinkwrap.json reads as package-lock.json. A lockfile covers the manifest beside it and, at a workspace root, every manifest below it, along with each project the angular.json beside it lists and each folder holding an Nx project.json below an nx.json. A Bun or Deno lockfile covers its manifest too, though its entries are not read.

A URL the lockfile records on the public registry is judged the way its package manager fetches it: npm swaps it for the registry it is configured with unless the .npmrc beside the lockfile sets replace-registry-host to keep it, and Yarn 1 always moves the yarnpkg.com and npmjs.org hosts to https://. Yarn 2 and later refuse a registry over http:// unless unsafeHttpWhitelist allows its host, so one the .yarnrc.yml does not allow is a lead, and they never checksum a package they lock with conditions, built for some platforms only, so such an entry needs no hash. An .npmrc that sets ignore-scripts switches off the install scripts of the lockfile beside it.

A lockfile covers a manifest even when the scan names only a folder beneath it, but one the scan leaves out, such as one Git ignores, covers nothing. Where the hook cannot read the project's Git state, as in a worktree or a folder below the repository root, it gathers the manifests whose coverage that leaves unconfirmed under one lead. The other ecosystems (Swift Package Manager, CocoaPods, Dart pub, Mix, Paket, and sbt) are not read, and neither are Conda, setup.py, and setup.cfg.

CLI options​

OptionValueDescription
--dira directoryScope a scan to a directory. Repeats and combines with --file.
--filea fileScope a scan to a single file. Repeats and combines with --dir.

With no option it scans the whole project.

Choose what it scans​

It leaves out what Git ignores. To leave out more, or to scan what Git ignores, give dependency settings of its own:

npx lagune write add --ignore examples --checker dependency
{
"checkers": {
"dependency": { "gitignore": false, "ignore": ["examples"] }
}
}

Configure the hooks covers every setting.

팁

The hook reads the files, never the registry: whether a package is a typosquat, whether a version has a known vulnerability, and whether CI installs from the lockfile are judgment the dependency specialization still covers.

자주 묻는 질문

No. It reads the dependency files on disk and nothing else, so it answers offline and never installs, audits, or changes a dependency.

pip merges every index it searches and installs the highest version it finds anywhere, so whoever can publish a package of the same name on any of those indexes decides what installs. uv's default index strategy stops at the first index that has the package, which is why only its unsafe strategies count.

A git source, an install script, or a floating range is how many projects legitimately work. It becomes a risk once someone outside the project can change what it resolves to, which the specialization weighs against the rest of the code.