Filter yanked advisories (#108) (#109)

This commit is contained in:
Sosthene-Guedon 2021-05-10 07:15:04 +02:00 committed by GitHub
parent 468a86c92e
commit 1e1ac2ad0a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -43,10 +43,14 @@ impl DependencyAnalyzer {
let query = database::Query::new().package_version(name, version); let query = database::Query::new().package_version(name, version);
if let Some(db) = advisory_db { if let Some(db) = advisory_db {
let vulnerabilities = db.query(&query); let vulnerabilities: Vec<_> = db
.query(&query)
.into_iter()
.filter(|vuln| !vuln.metadata.yanked)
.map(|v| v.to_owned())
.collect();
if !vulnerabilities.is_empty() { if !vulnerabilities.is_empty() {
dep.vulnerabilities = dep.vulnerabilities = vulnerabilities;
vulnerabilities.into_iter().map(|v| v.to_owned()).collect();
} }
} }
} }