DevelopVulnerabilities
@holtkeeper/vuln-index
Vulnerability matching for a whole fleet without checkouts: the resolved packages of every repository’s dependency graph (@holtkeeper/depgraph) are looked up in OSV in one batch, and each repository gets an AuditReport (@holtkeeper/vuln) from the result. The server runs it as the vulnerability index duty, see Vulnerability index.
Only npm and Go are covered, the ecosystems depgraph reads. Other ecosystems still need osv-scanner in a checkout (the audit analyzer).
Inventory
Section titled “Inventory”inventoryOf(data: DepgraphData, { isInternal? }): Inventory— the third-party packages of thepackageslayers asInventoryPackage { ecosystem, name, version, source }, deduplicated:- npm: every
packagenode with a registry version (links,file:and other non-versions are left out);sourceis the lockfile the layer came from:package-lock.json,npm-shrinkwrap.json,pnpm-lock.yaml,yarn.lockor the textbun.lock, with the directory in front for a nested project (editor/yarn.lock) (npm aliases count under the real package name; the binarybun.lockbis not read, see @holtkeeper/depgraph-js); - Go: only modules a main or workspace module requires in its
go.mod(the graph’s edges from workspace nodes; since Go 1.17 that lists every module providing a built package, while the rest ofgo mod graphcomes from other modules’go.modfiles and is never compiled), at the version the resolver selects (selected !== false), without thevprefix (how OSV and osv-scanner spell them);sourceis the module’sgo.mod(<dir>/go.modfromgo mod graph (<dir>), the single module’s directory otherwise) orgo.work; - packages
isInternalnames (the fleet’s own packages) are left out, so a public advisory for the same name never matches.
- npm: every
Inventory.problemsays why the inventory must not be audited: a graph source failed (its packages are missing) or there is nopackageslayer (no lockfile the index reads). Callers write no report then.INDEXED_ECOSYSTEMS—npm,Go.
Matching
Section titled “Matching”matchPackages({ client, cache, packages, concurrency?, signal? }): Promise<MatchResult>— oneOsvClient.queryBatchover the distinct package versions, then the full record of every advisory found, taken fromcachewhile itsmodifiedtime is unchanged and fetched otherwise (concurrency, default 8, at once).MatchResulthasrecords(advisories perpackageKey, unaffected packages absent),queriedandfetched. Advisories OSV no longer knows are left out; any other OSV failure throws, so a failed lookup never reads as “not affected”.packageKey({ ecosystem, name, version })— the key ofrecords.VulnRecordCache { get(id), set(id, { modified, record }) }andkvRecordCache(kv, { ttlSeconds? })— oneKvStorekey per advisory (vuln-index:osv:<id>), expiring after 30 days by default.
Reports
Section titled “Reports”indexAuditReport({ packages, records, allowlist?, traits?, now? }): AuditReport— findings fromfindingsForPackageof @holtkeeper/vuln-osv for every package, the allowlist applied withapplyAllowlistasrunAuditapplies it, no fix attempts.scannerisINDEX_SCANNER(osv-index). Findings are sorted by source, package, version and id, so equal inputs give equal reports.sameAuditState(a, b)— whether two reports have the same active and allowlisted findings and expired entries, in any order; the scanner and fix attempts do not count. Lets a caller skip writing a record that changes nothing, also against a reportosv-scannermade.fixableKeys(report)— active findings with a fixed version as<advisory>|<ecosystem>|<package>|<version>, sorted. A key that was not there before means a fix run has something new to work on: a new advisory, an advisory that got its first fixed version, or another resolved version of the package.