Skip to content

Commit

Permalink
feat: add two example entries fro GHSA data
Browse files Browse the repository at this point in the history
  • Loading branch information
ctron committed Jan 15, 2025
1 parent 88fa55c commit e08aacb
Showing 1 changed file with 29 additions and 1 deletion.
30 changes: 29 additions & 1 deletion server/src/sample_data.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ async fn add_osv(
source: &str,
base: Option<&str>,
branch: Option<&str>,
start_year: Option<u16>,
description: &str,
) -> anyhow::Result<()> {
add(
Expand All @@ -49,7 +50,7 @@ async fn add_osv(
branch: branch.map(ToString::to_string),
path: base.map(|s| s.into()),
years: Default::default(),
start_year: None,
start_year,
}),
)
.await
Expand Down Expand Up @@ -228,6 +229,7 @@ pub async fn sample_data(db: trustify_common::db::Database) -> anyhow::Result<()
"https://github.com/pypa/advisory-database",
Some("vulns"),
None,
None,
"Python Packaging Advisory Database",
)
.await?;
Expand All @@ -238,6 +240,7 @@ pub async fn sample_data(db: trustify_common::db::Database) -> anyhow::Result<()
"https://github.com/psf/advisory-database",
Some("advisories"),
None,
None,
"Python Software Foundation Advisory Database",
)
.await?;
Expand All @@ -248,6 +251,7 @@ pub async fn sample_data(db: trustify_common::db::Database) -> anyhow::Result<()
"https://github.com/RConsortium/r-advisory-database",
Some("vulns"),
None,
None,
"RConsortium Advisory Database",
)
.await?;
Expand All @@ -258,6 +262,7 @@ pub async fn sample_data(db: trustify_common::db::Database) -> anyhow::Result<()
"https://github.com/google/oss-fuzz-vulns",
Some("vulns"),
None,
None,
"OSS-Fuzz vulnerabilities",
)
.await?;
Expand All @@ -268,9 +273,32 @@ pub async fn sample_data(db: trustify_common::db::Database) -> anyhow::Result<()
"https://github.com/rustsec/advisory-db",
Some("crates"),
Some("osv"),
None,
"RustSec Advisory Database",
)
.await?;

add_osv(
&importer,
"osv-github",
"https://github.com/github/advisory-database",
Some("advisories"),
None,
None,
"GitHub Advisory Database",
)
.await?;

add_osv(
&importer,
"osv-github-2024",
"https://github.com/github/advisory-database",
Some("advisories"),
None,
Some(2024),
"GitHub Advisory Database (starting 2024)",
)
.await?;

Ok(())
}

0 comments on commit e08aacb

Please sign in to comment.