Skip to content

Architecture

iomi edited this page Nov 25, 2026 · 23 revisions

Architecture

Dep-Vet is one Rust binary: a CLI, a library, a Claude Code hook, and an MCP server. Nothing executes package code.

Pipeline

command
  -> parse spec / lockfile / config
  -> registry client(s)          (npm, PyPI, crates, Go, JSR, RubyGems, NuGet, Maven, Composer)
  -> OSV + EPSS + CISA KEV       (per version, batched where possible)
  -> deps.dev Scorecard          (per repository, weekly cache)
  -> signals                     (pure: PackageMeta + now -> findings)
  -> allowlist / policy          (downgrade or add findings, still visible)
  -> report                      (human, JSON, SARIF, SBOM)

Two branches never fetch metadata:

  • tree reads a resolved package-lock.json graph.
  • workflows and mcp-config read local text and never start a server.

plan is the only resolver, and it never downloads a tarball: npm reads packuments, Maven reads POMs.

Modules

Area Files
Surface cli.rs, main.rs, report.rs, progress.rs, branding.rs
Model model.rs, date.rs, version.rs, cache.rs, http.rs, netpolicy.rs
Registry clients registry.rs, pypi.rs, crates.rs, go.rs, jsr.rs, rubygems.rs, nuget.rs, maven.rs, composer.rs
Trees lockfile.rs, graph.rs, plan.rs, maven_plan.rs
Intelligence osv.rs, exploit.rs, scorecard.rs, license.rs, typosquat.rs, signals.rs
Archives archive/, rules.rs, inspect.rs, provenance.rs
Automation guard.rs, intent.rs, hook/, mcp.rs, workflows.rs, mcp_config.rs
Output/integration sarif.rs, sbom.rs, watch.rs, update.rs

Invariants

  1. Exit 3 means could not check. It is never folded into 0/1/2.
  2. Missing signals are labelled. not checked appears in human and JSON reports; absence is not agreement.
  3. Every finding cites evidence. A rule without a linkable source does not ship.
  4. No execution. Archives are extracted in memory with caps; package code is never run.
  5. Untrusted input stays untrusted. Registry JSON drives URL validation, archive caps, path checks, and bounded parsing.
  6. The cache policy is deliberate. Fresh entries skip the network; stale entries only cover transient failures; 404 never falls back.

Network and cache

  • Registry metadata: 24 hours.
  • Advisories: five minutes, with a 24-hour stale cap and disclosure.
  • Scorecard: weekly.
  • Verified archives: 30 days, re-verified on load.
  • Update hint: 24 hours, one attempt, two seconds, six-hour negative cache.
  • All archive/provenance URLs pass netpolicy: https, ecosystem allowlists, public IPs, DNS filtering, manual bounded redirects.
  • DEPVET_*_BASE overrides are gated by DEPVET_ALLOW_INSECURE_BASES=1 or --dev-registry.

Agent surfaces

  • guard parses an install command (best effort) and audits named packages.
  • hook claude spawns guard --check --json with an 8-second budget and maps verdicts to Claude's permission protocol.
  • mcp speaks newline-delimited JSON-RPC over stdio with three tools and never draws progress output on stdout.

Testing shape

tests/cli.rs runs the real binary against a local fake registry and fake OSV, EPSS, KEV, Scorecard, and archive servers. No test reaches the public internet or the real cache. The suite also covers worktree/ref handling, Windows paths, and inotify watch behavior per platform.

Clone this wiki locally