Some checks failed
CI / Format (push) Successful in 3s
CI / Clippy (push) Successful in 4m3s
CI / Security Audit (push) Successful in 1m38s
CI / Tests (push) Successful in 4m44s
CI / Detect Changes (push) Successful in 2s
CI / Deploy Agent (push) Successful in 2s
CI / Deploy Dashboard (push) Successful in 2s
CI / Deploy Docs (push) Has been skipped
CI / Deploy MCP (push) Failing after 2s
46 lines
1.2 KiB
Rust
46 lines
1.2 KiB
Rust
use chrono::{DateTime, Utc};
|
|
use serde::{Deserialize, Serialize};
|
|
|
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
|
pub struct VulnRef {
|
|
pub id: String,
|
|
pub source: String,
|
|
pub severity: Option<String>,
|
|
pub url: Option<String>,
|
|
}
|
|
|
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
|
pub struct SbomEntry {
|
|
#[serde(rename = "_id", skip_serializing_if = "Option::is_none")]
|
|
pub id: Option<bson::oid::ObjectId>,
|
|
pub repo_id: String,
|
|
pub name: String,
|
|
pub version: String,
|
|
pub package_manager: String,
|
|
pub license: Option<String>,
|
|
pub purl: Option<String>,
|
|
pub known_vulnerabilities: Vec<VulnRef>,
|
|
#[serde(with = "super::serde_helpers::bson_datetime")]
|
|
pub created_at: DateTime<Utc>,
|
|
#[serde(with = "super::serde_helpers::bson_datetime")]
|
|
pub updated_at: DateTime<Utc>,
|
|
}
|
|
|
|
impl SbomEntry {
|
|
pub fn new(repo_id: String, name: String, version: String, package_manager: String) -> Self {
|
|
let now = Utc::now();
|
|
Self {
|
|
id: None,
|
|
repo_id,
|
|
name,
|
|
version,
|
|
package_manager,
|
|
license: None,
|
|
purl: None,
|
|
known_vulnerabilities: Vec::new(),
|
|
created_at: now,
|
|
updated_at: now,
|
|
}
|
|
}
|
|
}
|