Expand description
OSV.dev vulnerability scanning.
OsvClient batches dependency versions against the OSV.dev
API (POST /v1/querybatch) and resolves matching advisories
(GET /v1/vulns/{id}), with a semantic cache of its own — not
crate::cache::HttpCache’s entry map, since OSV sends no ETag/Last-Modified
validators and the batch endpoint is a POST with a request-body-dependent
response. See architecture.md §5 for why this is a deliberate deviation
from reusing HttpCache wholesale, and §8 for the four correctness
invariants this module exists to uphold (positional batch results,
pagination truncation, scan observability, and bounded record fan-out).
OsvClient::scan never fails: every dependency passed in gets exactly
one ScanOutcome back, so an OSV outage degrades to an empty-ish map
rather than propagating an error into the LSP response (FR-007).
Structs§
- Advisory
- A single vulnerability advisory, converted from OSV’s wire format at the crate boundary.
- Capped
- A list that may have been truncated when it was produced, paired with the true count of items that existed at the source.
- Dependency
Vulnerabilities - Vulnerability data for one dependency that OSV reported as non-clean.
- FixRecommendation
- A single upgrade target recommended by
DependencyVulnerabilities::recommended_fix. - OsvClient
- Batches dependency versions against OSV.dev and resolves matching
advisories, with its own semantic cache layered on top of
HttpCache’s transport (post_json/get_cached). - Scan
Target - One dependency to query against OSV.
Enums§
- Scan
Outcome - Outcome of scanning one dependency.
- Skip
Reason - Why a dependency produced no advisories.
- Upgrade
Status - Result of checking whether a recommended upgrade target is itself affected.
- Vuln
Severity - Severity bucket derived from an OSV advisory record.
Constants§
- ADVISORY_
DISPLAY_ CAP - Advisories fetched (invariant 3) and rendered (§7) per dependency, plus a
trailing “+N more advisories” entry when
Capped::totalexceeds this.
Functions§
- diagnostic_
severity_ for - Maps a
VulnSeverityto the [DiagnosticSeverity] used to render it. - vulnerability_
keys - Computes the
VulnerabilityMapkey each occurrence inparse_resultshould be scanned/looked-up under.
Type Aliases§
- Vulnerability
Map - Per-scan result map.