Policy
Six rule families and the supply-chain signals each registry supports. One evaluation per install.
A Chainsaw policy is a set of rules you write, and Chainsaw evaluates every install once against six rule families and the supply-chain signals each registry supports. A failing package is refused before it reaches the build.
-
01 · Monitor
Every rule ships here
decision recorded, install still succeeds
-
02 · You review the data
- what would have fired
- exceptions, with expiry
-
03 · Enforce
Refused or quarantined
audit record on every decision
Core rule families
Which rule families can a Chainsaw policy combine?
A rule family is a group of conditions that match on one kind of package data, and a Chainsaw policy combines six.
| Rule family | Matches on |
|---|---|
| Vulnerability gating | CVE, CVSS, EPSS exploit probability, CISA KEV |
| License enforcement | SPDX identifier, direct and transitive separately |
| Version and age rules | minimum version, deprecated or EOL, semver range, minimum age, per-version cooldown |
| Provenance verification | npm provenance, Sigstore, sum.golang.org, PGP, InRelease / repomd |
| Client-context rules | prod vs dev, repository, CI job, region |
| VEX-aware exceptions | reviewer, reason, expiry; chainsaw exception create --cve --decision --vex-note |
Supply-chain attack signals
What CVE-based scanners miss
A supply-chain attack signal is a check beyond CVE matching, and Chainsaw runs up to all 25 on npm and PyPI and 22 on RubyGems: 4 always on, the rest where each registry supports them. The 15 below span all ecosystems. To see them against real attacks, read the axios and Mini Shai-Hulud teardowns, or how the same rules handle package names AI tools invent.
| Signal | Policy field | Named attack | Behaviour |
|---|---|---|---|
| Install-script exfiltration | hasInstallScript · installScriptFetchesRemote | PhantomRaven pattern | Lifecycle hooks that run remote fetches or decode base64 payloads. Refused before the hook fires. |
| Fresh-version cooldown | cooldownDays | Account-takeover class | Quarantines any version published inside your cooldown window. Absent date metadata fails open, never quarantining on a guess. |
| Maintainer-account takeover | publisherChanged | Axios v1.14.1 pattern | A surprise publisher on a popular dependency refuses pending review. npm, PyPI, RubyGems, NuGet and Maven. |
| Version-number anomalies | versionAnomaly · versionAnomalyKinds | Kinds: semver_regression, major_skip, timestamp_regression. | |
| Publish-velocity worm bursts | publishVelocityAnomaly | Shai-Hulud pattern | A rolling 24-hour counter per publisher. Threshold is tunable. |
| Reserved-namespace dependency confusion | reservedNamespaces | Birsan pattern | Your internal names, reserved against public registries. One-click curated starters per ecosystem. |
| Typosquat detection | isSuspectedTyposquat | BK-tree, homoglyph and word-reorder matchers across fifteen ecosystems. Dart/pub gets CVE and typosquat coverage only, no malicious-package prevention. | |
| Docker malware feed | isKnownMalicious (docker) | Matched by digest and by name-plus-tag. A hit drops the trust score to -100. | |
| Per-layer image enforcement | Container image analysis | Walks every image layer with Trivy; a clean tag no longer guarantees a clean image. | |
| OS-package hash-chain provenance | hasProvenance (apt/yum/dnf) | InRelease for APT, repomd.xml.asc for Yum/DNF. Debian and Fedora keyrings ship embedded. | |
| Linux distro CVE detection | distroCVE (alpine/debian/rhel/oracle) | Native detectors for Alpine, Debian, Red Hat and Oracle Linux, each distro stream on its own cadence. | |
| Hugging Face malware feed | isKnownMalicious (huggingface) | Bundled HF-native coordinate-match feed, shipped in-process. | |
| Repo liveness and ownership match | trustScoreMin | A composite trust score per package. Set the floor you're comfortable with. | |
| Checksum fail-closed enforcement | checksum mode | Log, quarantine or block per ecosystem. Tells a real mismatch from an upstream that never published a hash. |
Where refusals surface
Where do refusals show up?
Every fired rule lands in Findings, with severity summary cards and the refused findings queued for triage by priority.
Coverage matrix
Attack class, mechanism and data source
The coverage matrix is a table with one row per attack class. If a cell is empty for an ecosystem, the detection is absent from the product for that ecosystem.
| Attack class · mechanism | Ecosystems | Data source |
|---|---|---|
Known vulnerability (CVE)Vulnerability gate matches CVE IDs and scores by CVSS, EPSS exploit probability, and CISA KEV membership. KEV cross-reference runs after the CVE merge so known-exploited issues sort to the top. | npm, PyPI, Maven, Cargo, RubyGems, NuGet, Composer, Go, Pub, Swift, Docker and Homebrew formulae; no advisory source for APT, Yum, DNF, CocoaPods or Hugging Face | OSV, GHSA, NVD, FIRST EPSS, CISA KEV, Aqua Trivy DB, Homebrew advisory database |
TyposquattingBK-tree, homoglyph, and word-reorder matchers against curated popular-package seeds. Low-risk gate on APT/Yum/DNF. | 15 ecosystems (BK-tree); APT/Yum/DNF low-risk gate | Curated popular-package seeds per ecosystem |
Dependency confusionThe proxy refuses a public-registry package whose name matches a namespace you have reserved, so the Birsan substitution is stopped at the fetch with no per-package allow-listing. Evaluated on every ecosystem, but only for the patterns you declare: a recommended starter pack ships and the proxy warns at startup when none is applied, because your namespaces are not knowable in advance. | Universal (operator-declared namespaces) | Operator-declared reserved namespaces; recommended starter pack in configs/reserved_namespaces_defaults.yaml |
Known malwareDigest and name+tag match against the OpenSSF malicious-package and malware indexes, plus a bundled Docker and Hugging Face malware feed. | npm, PyPI, RubyGems, Cargo, Packagist, NuGet, Hugging Face, Docker, Swift | OpenSSF malicious-packages, OpenSSF malware feed, Docker malware feed, GHSA (Swift) |
Hidden Unicode / Trojan SourceRefuses packages carrying zero-width, bidi-override, or Unicode-tag characters (GlassWorm, Trojan Source). Bounded scan: 500 files / 50 MiB per artifact. | All artifact-bearing ecosystems | Static source scan (no external feed required) |
Install-script exfiltrationPhantomRaven-style detection flags lifecycle hooks that fetch remote payloads or shell out — curl/wget, urllib, requests.get, subprocess, child_process.exec, eval. | npm, PyPI (setup.py / pyproject), RubyGems, Cargo, Composer | Static + AST analysis of declared lifecycle scripts |
Maintainer-account takeoverCompares the current maintainer set against publish history (Axios-style ATO); surprise publishers block pending review. Maintainer tenure / reputation / account history feed the verdict. | npm, PyPI, RubyGems, NuGet, Maven/Gradle | Per-registry publisher history + maintainer reputation feeds |
Publish-velocity worm burstsRolling 24-hour publish-velocity counter per publisher trips on Shai-Hulud-style worm bursts when one account pushes dozens of tainted versions. | npm, PyPI, RubyGems, NuGet, Maven/Gradle | Per-publisher publish-rate telemetry from registry events |
Broken provenance / unsigned artifactSLSA / Sigstore chain verification per ecosystem, with a post-merge signature-verify pass that projects the provenance verdict for closure. | npm, PyPI, Maven/Gradle, RubyGems, Go, NuGet, Cargo, Docker, Swift, CocoaPods, Hugging Face, APT, Yum, DNF, Homebrew (current bottle) | SLSA attestations, Sigstore transparency log |
Tampered artifact (checksum mismatch)Declared-versus-actual hash verification with log / quarantine / block outcomes per policy. | npm, PyPI, RubyGems, Composer, Maven, Gradle, NuGet, Cargo; Homebrew bottles are refused unless the formula index declares their digest | Registry-declared hashes + computed artifact digest |
Manifest confusion / lockfile-only artifactFormat-specific mismatch detection (PyPI wheel-vs-sdist sub-provider) plus shrinkwrap / lock-file-only artifacts that ship without source. | npm (shrinkwrap), PyPI (wheel/sdist), plus cross-format manifest checks | Static manifest + lockfile inspection |
Malicious package behaviour (code smell)Nine static sub-detectors on the artifact bytes — eval, network, shell, filesystem, env-var access, native binary, high-entropy strings, URL strings, minified code. npm-only capability scanner emits first-class cap.* signals behind a flag. | All artifact-bearing ecosystems (capability scan: npm) | Static analysis of package artifact contents (not user source) |
Trivial / decoy packageFlags trivial_package and too_many_files heuristics that mark empty decoys or grossly over-stuffed artifacts. | All artifact-bearing ecosystems | Artifact structure heuristics |
Malicious AI model / agent artifactThree sub-providers detect unsafe pickle opcodes — unwrapping zip-container .pt/.bin checkpoints and modeling the pickle stack + memo so nested and obfuscated payloads are caught — plus mismatched model cards and agent-tool artifacts; a post-merge pass verifies the agent-tool artifact. | Hugging Face / model registries | Static model-artifact inspection |
Repo liveness / ownership mismatchRepolink probes the upstream source-repository URL; Repository Trust Traits check liveness, ownership match, non-existent author, suspicious-star bursts, and first-time collaborators. | All ecosystems with a linkable upstream repo | Upstream repository metadata + community signals |
Abandoned / unpopular dependencyDeprecated / archived / stale detection (OpenSSF Scorecard-adjacent) reads the repolink output; download-count fetch powers maint.unpopular_package with a fail-open SevUnknown when the count can't be fetched. Registry metadata supplies publish date, licences, maintainers. | npm, PyPI (download counts); all ecosystems (metadata + maintenance) | OpenSSF Scorecard signals, npm/PyPI weekly downloads, registry manifests |
Internal, private & vendored packages
Does the policy cover internal and private packages?
Yes. The same Chainsaw policy covers packages you host, proxy privately or vendor. Reserved
namespaces such as @acme/*, com.acme.* and acme. refuse public
packages that squat on internal names. Reserved namespaces are the fix for dependency confusion, the
attack Alex Birsan published, in which a public package takes the place of a private one. Chainsaw
proxies a private registry on Artifactory, Nexus, Cloudsmith, GitHub Packages or CodeArtifact under
the same policy, so an existing artifact manager stays in place. Internal npm and PyPI packages
published to Chainsaw are served on the same URL as the public registry when no public package has
that name; other formats use a separate hosted repository. Vendored copies in vendor/
and third_party/ appear in the SBOM, attributed to the upstream project. Git and HTTP
URL dependencies raise their own signals, sc.git_url_dependency and
sc.http_url_dependency, so code that never came from a registry still shows up in the
decision.
| Reserved namespaces | @acme/*, com.acme.*, acme.: public squatters refused |
|---|---|
| Private registries | Artifactory, Nexus, Cloudsmith, GitHub Packages, CodeArtifact |
| Vendored copies | vendor/, third_party/ in the SBOM, attributed upstream |
| Git and HTTP URL dependencies | sc.git_url_dependency, sc.http_url_dependency |
Rollout
How do I roll out a package policy without breaking builds?
Monitor mode is the first step: ship every new Chainsaw rule in monitor mode, review what would have fired, then switch rules to enforce one at a time. In monitor mode Chainsaw records the decision for each install and the install still succeeds, so CI jobs and laptops keep working. A few seeded rules, such as known-exploited CVEs and packages first published less than a day ago, block from day one. Findings lists the packages each rule would have refused, ranked for triage. For a package your team needs, add an exception with a reviewer, a reason and an expiry. On Team and Enterprise, policy proposals, including ones an AI agent drafts over MCP, go to Billy, the approval queue, which shows the diff and the installs the change would have affected over the last week; an organisation can also require approval before an exception takes effect. After the switch, a failing package is refused or quarantined, and every decision writes a signed audit row.
Fresh-version cooldown
How do I block npm packages published in the last few days?
Chainsaw holds new versions for 48 hours by default: on npm, PyPI and Composer the proxy hides versions younger than the hold so a range resolves to an older release, and on most other formats, including Maven, Go and Cargo, an exact pin to a younger version is refused.
For a longer window, set the cooldownDays policy field in whole days. Package age asks
how old the package is; cooldown asks how old the requested version is. The cooldown rule runs on every registry that exposes a per-version
publish date, including npm, PyPI, Maven, Go and Cargo, and fails open when a registry returns no date.
The seeded cooldown rule uses 10 days and starts in monitor mode, so set it to block once the data
looks right. Without the proxy, npm 11 documents a similar client
setting, min-release-age=1 in ~/.npmrc.
Seeded rules
Which Chainsaw rules block installs from day one?
A seeded rule is a default rule Chainsaw ships with, and five seeded rules block from day one; every other rule starts in monitor mode. The five refuse a package with a CVE in the CISA Known Exploited Vulnerabilities catalog, a package first published less than 1 day ago, an install script which fetches a remote URL, code which executes at import time, and bidi Unicode characters in published source, the Trojan Source pattern. Install-script and import-time checks run on the first download, so some malicious releases are refused before any feed lists them. On top of the seeded rules, the proxy holds every new version for 48 hours by default; on npm, PyPI and Composer a version range resolves to an older release during the hold, and on most other formats an exact pin to a younger version is refused. The 1-day rule asks how old the package is; the hold asks how old the requested version is. Every other rule, including the 10-day cooldown and the publisher-change signal, records what the rule would refuse without stopping the install, until a team switches the rule to block.
After a refusal
What happens when an install fails a Chainsaw policy?
The result of a failed install is a refusal with a reason: when an install fails an enforced
Chainsaw rule, the proxy refuses or quarantines the package before the package reaches the build,
and the error names the rule, the reason and the exception path. A developer sees the reason in
the install output. Every decision, allowed, monitored or refused, writes a signed audit row with
the rule, reason, user, repository, CI job and timestamp. Webhooks post to any endpoint when an
install is refused, on every plan, and on Enterprise the audit log streams to Splunk HEC, Microsoft
Sentinel or IBM QRadar. A team that needs the package files an exception with a reviewer, a reason
and an expiry. When a feed or the database is degraded, Chainsaw fails open by default and writes
the gap to the audit trail; with CHAINSAW_COVERAGE_MODE=closed, Chainsaw refuses any
package it could not check.
Ready to roll out?
Ship your first rule in monitor mode
Any Chainsaw rule can run in monitor mode first: refusals are recorded, not enforced, and every install still succeeds. Flip the rule to block once you have seen the data.