Post-Install Scan

Automatically scans dependency manifests after package install commands to detect newly introduced vulnerabilities.

The post-install scan fires after any dependency install command completes, scanning the relevant manifest files to catch vulnerabilities introduced by newly added or updated packages.

PropertyValue
EventPostToolUse
MatcherBash
Scriptpost-install-scan.sh
Timeout120 seconds

Trigger condition

The hook reads tool_input.command from stdin and matches it against 23 install command patterns. If the executed command contains any of these patterns, the scan runs:

PatternEcosystem
npm installnpm
npm inpm
npm addnpm
yarn addnpm
yarn installnpm
pnpm addnpm
pnpm installnpm
pip installpypi
pip3 installpypi
uv pip installpypi
uv addpypi
poetry addpypi
go getgo
go mod tidygo
cargo addcargo
cargo installcargo
bundle installrubygems
bundle addrubygems
gem installrubygems
composer requirepackagist
composer installpackagist
mvn dependency:resolvemaven
gradle dependenciesmaven

Command-to-manifest mapping

When a command matches, the hook determines which manifest files to scan based on the command prefix:

Command prefixManifest files scanned
npm, yarn, pnpmpackage.json, package-lock.json, yarn.lock, pnpm-lock.yaml
pip, uv, poetryrequirements.txt, Pipfile.lock, poetry.lock, uv.lock, pyproject.toml
gogo.mod, go.sum
cargoCargo.toml, Cargo.lock
bundle, gemGemfile, Gemfile.lock
composercomposer.json, composer.lock
mvn, gradlepom.xml, build.gradle, gradle.lockfile

Only manifest files that actually exist in the project root are scanned.

Scan process

For each manifest found, the hook:

  1. Runs vulnetix scan --file <manifest> -f cdx17 to generate a CycloneDX v1.7 SBOM
  2. Saves the SBOM to .vulnetix/scans/<manifest>.<timestamp>.cdx.json
  3. Parses the SBOM with jq to extract vulnerability IDs, severities, package names, and versions
  4. Deduplicates results across all scanned manifests

Example output

After running npm install:

Vulnetix post-install scan: 3 vulnerabilities detected after `npm install`:

* CVE-2024-29041 (high) -- express@4.17.1
* CVE-2024-28849 (medium) -- follow-redirects@1.15.4
* GHSA-rv95-896h-c2vc (moderate) -- webpack-dev-middleware@5.3.3

Run `/vulnetix:fix <vuln-id>` to see remediation options
or `/vulnetix:exploits <vuln-id>` for exploit analysis.

If no vulnerabilities are detected after the install, the hook exits silently without producing output.