Skip to main content

AdvisorySource

Trait AdvisorySource 

Source
pub trait AdvisorySource {
    // Required methods
    fn name(&self) -> &'static str;
    fn query(&self, components: &[Component]) -> Result<Vec<Advisory>>;
}
Expand description

An advisory database that can be queried for the vulnerabilities affecting a set of components.

An implementation returns Ok(advisories) when the source answered (an empty vector means “no advisories”), and Err when the source could not be reached — an unreachable endpoint, a network error, or an unusable response. run_audit records those failures in AuditReport::failed_sources so a caller can distinguish an incomplete audit from a clean one; a single failing source still never sinks the run.

Required Methods§

Source

fn name(&self) -> &'static str

A short, stable name ("npm", "osv", …) used in Advisory::source and diagnostics.

Source

fn query(&self, components: &[Component]) -> Result<Vec<Advisory>>

Query advisories affecting components. Err means the source was unreachable, not that there were no advisories.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§