Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions modules/analysis/src/endpoints/tests/latest_filters.rs
Original file line number Diff line number Diff line change
Expand Up @@ -518,7 +518,7 @@ async fn parse_ids_find_only_exact_matches(
#[test_context(TrustifyContext)]
#[rstest]
#[test_log::test(actix_web::test)]
async fn test_tc2578(
async fn test_tc2758(
ctx: &TrustifyContext,
#[values(false, true)] prime_cache: bool,
) -> Result<(), anyhow::Error> {
Expand Down Expand Up @@ -579,8 +579,8 @@ async fn test_tc2578(
"relationship": "package",
"descendants": [
{
"node_id": "pkg:maven/org.jboss.eap/wildfly-ee-aggregate-javadocs@7.4.0.GA-redhat-00005?classifier=javadocs&type=jar",
"name": "wildfly-ee-aggregate-javadocs",
"node_id": "pkg:generic/pom.xml?checksum=sha256%3A974823188145bdb517f9692341a237bdee75c8312d3c86ae0fc4d390225bb923",
"name": "pom.xml",
"relationship": "dependency",
}]
}]
Expand Down
2 changes: 1 addition & 1 deletion modules/fundamental/tests/vuln/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ async fn issue_1840(ctx: &TrustifyContext) -> Result<(), anyhow::Error> {
.analyze_purls(["pkg:rpm/redhat/gnutls@3.7.6-23.el9?arch=aarch64"], &ctx.db)
.await?;

println!("{:#?}", result);
log::debug!("{:#?}", result);

// check number of PURLs

Expand Down
41 changes: 41 additions & 0 deletions modules/ingestor/src/graph/sbom/common/cryptographic_asset.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
use crate::graph::sbom::{Checksum, ReferenceSource, common::node::NodeCreator};
use sea_orm::{ConnectionTrait, DbErr};
use uuid::Uuid;

pub struct CryptographicAssetCreator {
nodes: NodeCreator,
}

impl CryptographicAssetCreator {
pub fn new(sbom_id: Uuid) -> Self {
Self {
nodes: NodeCreator::new(sbom_id),
}
}

pub fn with_capacity(sbom_id: Uuid, capacity_files: usize) -> Self {
Self {
nodes: NodeCreator::with_capacity(sbom_id, capacity_files),
}
}

pub fn add<I, C>(&mut self, node_id: String, name: String, checksums: I)
where
I: IntoIterator<Item = C>,
C: Into<Checksum>,
{
self.nodes.add(node_id.clone(), name, checksums);
}

pub async fn create(self, db: &impl ConnectionTrait) -> Result<(), DbErr> {
self.nodes.create(db).await?;

Ok(())
}
}

impl<'a> ReferenceSource<'a> for CryptographicAssetCreator {
fn references(&'a self) -> impl IntoIterator<Item = &'a str> {
self.nodes.references()
}
}
41 changes: 41 additions & 0 deletions modules/ingestor/src/graph/sbom/common/machine_learning_model.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
use crate::graph::sbom::{Checksum, ReferenceSource, common::node::NodeCreator};
use sea_orm::{ConnectionTrait, DbErr};
use uuid::Uuid;

pub struct MachineLearningModelCreator {
nodes: NodeCreator,
}

impl MachineLearningModelCreator {
pub fn new(sbom_id: Uuid) -> Self {
Self {
nodes: NodeCreator::new(sbom_id),
}
}

pub fn with_capacity(sbom_id: Uuid, capacity_files: usize) -> Self {
Self {
nodes: NodeCreator::with_capacity(sbom_id, capacity_files),
}
}

pub fn add<I, C>(&mut self, node_id: String, name: String, checksums: I)
where
I: IntoIterator<Item = C>,
C: Into<Checksum>,
{
self.nodes.add(node_id.clone(), name, checksums);
}

pub async fn create(self, db: &impl ConnectionTrait) -> Result<(), DbErr> {
self.nodes.create(db).await?;

Ok(())
}
}

impl<'a> ReferenceSource<'a> for MachineLearningModelCreator {
fn references(&'a self) -> impl IntoIterator<Item = &'a str> {
self.nodes.references()
}
}
4 changes: 4 additions & 0 deletions modules/ingestor/src/graph/sbom/common/mod.rs
Original file line number Diff line number Diff line change
@@ -1,16 +1,20 @@
mod checksum;
mod cryptographic_asset;
mod external;
mod file;
mod license;
mod licensing_info;
mod machine_learning_model;
mod node;
mod package;
mod relationship;

pub use checksum::*;
pub use cryptographic_asset::*;
pub use external::*;
pub use file::*;
pub use license::*;
pub use licensing_info::*;
pub use machine_learning_model::*;
pub use package::*;
pub use relationship::*;
6 changes: 3 additions & 3 deletions modules/ingestor/src/graph/sbom/common/package.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,10 @@ impl PackageCreator {
}
}

pub fn add<I, C>(
pub fn add<'a, I, C>(
&mut self,
node_info: NodeInfoParam,
refs: impl IntoIterator<Item = PackageReference>,
refs: impl Iterator<Item = &'a PackageReference>,
checksums: I,
) where
I: IntoIterator<Item = C>,
Expand All @@ -77,7 +77,7 @@ impl PackageCreator {
self.cpe_refs.push(sbom_package_cpe_ref::ActiveModel {
sbom_id: Set(self.sbom_id),
node_id: Set(node_info.node_id.clone()),
cpe_id: Set(cpe),
cpe_id: Set(*cpe),
});
}
PackageReference::Purl(purl) => {
Expand Down
Loading
Loading