feat(csaf): a bought-in component's supplier CSAF advisories, kept per tenant (#1025)
CI / Check (push) Skipped
CI / Detect Changes (pull_request) Skipped
CI / Deploy Agent (pull_request) Skipped
CI / Deploy Dashboard (pull_request) Skipped
CI / Deploy Docs (pull_request) Skipped
CI / Deploy MCP (pull_request) Skipped
CI / Agent integration (pull_request) Canceled after 4m12s
CI / Check (pull_request) Canceled after 4m15s

A target can now name who supplies it: the supplier, its name for the
product, the version in use and its CSAF provider (`supplier` on create
and update; `provider-metadata.json` must be an https URL, else 422; an
empty name removes it).

The provider's TLP:WHITE advisories are fetched through the guarded
client with the shared feed's code, but stored in the tenant's own
database (`supplier_csaf_advisories`), never in the shared index: a
provider one tenant names is never matched against another tenant's
components. They are refreshed daily after the shared index, once after
start, and right away when a target's provider is set.

A scan matches them against the product itself (an SBOM entry of
manager `supplier-product`, by the supplier's name and version for it,
only in that supplier's advisories) and against its components by purl,
raising CSAF alerts with the supplier's remediation and fixed versions.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Q9inRcu428A2iNjDHPEAT9
This commit is contained in:
Sharang ParnerkarandClaude Opus 5.5 committed 2026-11-16 23:20:19 +01:00
1 parent 0ab8fc186e
commit 724ed578d2
11 files changed
+505 -5

No files matched your search

+126 -1
View File
@@ -43,6 +43,73 @@ pub struct CreateTargetRequest {
/// The target's artifacts by reference; files are uploaded afterwards.
#[serde(default)]
pub artifacts: Vec<ArtifactInput>,
/// Who supplies the component, for one bought in (#1025).
#[serde(default)]
pub supplier: Option<SupplierInput>,
}
/// A supplier as a client sends it (#1025). An empty `name` removes it.
#[derive(Debug, Deserialize, utoipa::ToSchema)]
pub struct SupplierInput {
/// The supplier's name; empty removes the supplier.
pub name: String,
/// The supplier's name for the product, as its advisories name it.
#[serde(default)]
pub product: Option<String>,
/// The product's version in use.
#[serde(default)]
pub version: Option<String>,
/// The supplier's CSAF `provider-metadata.json`, an https URL. Its public
/// advisories are fetched for this workspace only.
#[serde(default)]
#[schema(example = "https://supplier.example/.well-known/csaf/provider-metadata.json")]
pub csaf_provider: Option<String>,
}
impl SupplierInput {
/// The supplier to store; `None` removes it.
///
/// # Errors
///
/// 422 for a CSAF provider that is not an https URL.
pub fn build(self) -> Result<Option<compliance_core::models::SupplierComponent>, StatusCode> {
let text = |v: Option<String>| v.map(|t| t.trim().to_string()).filter(|t| !t.is_empty());
let name = self.name.trim().to_string();
if name.is_empty() {
return Ok(None);
}
let csaf_provider = text(self.csaf_provider);
if let Some(url) = &csaf_provider {
let https = reqwest::Url::parse(url)
.is_ok_and(|u| u.scheme() == "https" && u.host_str().is_some());
if !https {
return Err(StatusCode::UNPROCESSABLE_ENTITY);
}
}
Ok(Some(compliance_core::models::SupplierComponent {
name,
product: text(self.product),
version: text(self.version),
csaf_provider,
}))
}
}
/// Fetch the advisories of tenant `tenant_id`'s supplier providers now, in
/// the background, when `supplier` names one: a provider just set is then
/// matched by the next scan, not only after the nightly refresh.
fn refresh_supplier_csaf(
agent: &Arc<ComplianceAgent>,
tenant_id: &str,
supplier: Option<&compliance_core::models::SupplierComponent>,
) {
if supplier.and_then(|s| s.csaf_provider.as_ref()).is_none() {
return;
}
let (agent, tenant_id) = (Arc::clone(agent), tenant_id.to_string());
tokio::spawn(async move {
crate::pipeline::csaf_feed::refresh_supplier_advisories(&agent, &tenant_id).await;
});
}
/// The body of [`update_target`]. A field left out keeps its stored value.
@@ -67,6 +134,9 @@ pub struct UpdateTargetRequest {
/// keeps the token and uploaded file of the stored artifact it matches.
#[serde(default)]
pub artifacts: Option<Vec<ArtifactInput>>,
/// Who supplies the component (#1025); an empty `name` removes it.
#[serde(default)]
pub supplier: Option<SupplierInput>,
}
/// One applicable-scan option, serialized for the wizard.
@@ -304,6 +374,9 @@ pub async fn create_target(
) -> Result<Json<ApiResponse<OnboardedTarget>>, StatusCode> {
let mut target = OnboardedTarget::new(req.name, req.target_type);
target.description = req.description;
if let Some(supplier) = req.supplier {
target.supplier = supplier.build()?;
}
target.artifacts = merge_artifacts(&agent.secrets, &req.artifacts, &[]).map_err(|e| {
tracing::error!("storing a credential: {e}");
StatusCode::SERVICE_UNAVAILABLE
@@ -316,6 +389,7 @@ pub async fn create_target(
.await
.map_err(|_| StatusCode::INTERNAL_SERVER_ERROR)?;
target.id = res.inserted_id.as_object_id();
refresh_supplier_csaf(&agent, &tenant.0.tenant_id, target.supplier.as_ref());
let target_id = target.id.map(|id| id.to_hex()).unwrap_or_default();
agent.emit_usage(
&tenant.0.tenant_id,
@@ -516,10 +590,29 @@ pub async fn update_target(
);
}
let mut update = doc! {};
let mut supplier = None;
if let Some(input) = req.supplier {
supplier = input.build()?;
match &supplier {
Some(s) => {
set.insert(
"supplier",
to_bson(s).map_err(|_| StatusCode::INTERNAL_SERVER_ERROR)?,
);
}
None => {
update.insert("$unset", doc! { "supplier": "" });
}
}
}
update.insert("$set", set);
db.onboarded_targets()
.update_one(doc! { "_id": oid }, doc! { "$set": set })
.update_one(doc! { "_id": oid }, update)
.await
.map_err(|_| StatusCode::INTERNAL_SERVER_ERROR)?;
refresh_supplier_csaf(&agent, &tenant.0.tenant_id, supplier.as_ref());
// Background and best-effort: the registry being down never fails the
// change itself.
if let (Some(entry), Some(registry)) = (projects_audit, agent.registry.clone()) {
@@ -1438,6 +1531,38 @@ pub async fn trigger_target_scan(
mod filter_tests {
use super::*;
#[test]
fn a_supplier_needs_a_name_and_an_https_csaf_provider() {
let input = |name: &str, provider: Option<&str>| SupplierInput {
name: name.into(),
product: Some(" Pump Remote ".into()),
version: Some("".into()),
csaf_provider: provider.map(String::from),
};
let url = "https://supplier.example/.well-known/csaf/provider-metadata.json";
let built = input(" Example GmbH ", Some(url)).build().unwrap().unwrap();
assert_eq!(built.name, "Example GmbH");
assert_eq!(built.product.as_deref(), Some("Pump Remote"));
assert_eq!(built.version, None, "blank is none");
assert_eq!(built.csaf_provider.as_deref(), Some(url));
assert_eq!(
input(" ", Some(url)).build(),
Ok(None),
"an empty name removes it"
);
for bad in [
"http://supplier.example/provider-metadata.json",
"file:///etc/passwd",
"not a url",
] {
assert_eq!(
input("Example GmbH", Some(bad)).build(),
Err(StatusCode::UNPROCESSABLE_ENTITY),
"{bad}"
);
}
}
#[test]
fn a_scan_asked_for_new_content_is_change_driven() {
use compliance_core::models::ScanTrigger;
+135
View File
@@ -93,6 +93,26 @@ impl Provider {
max_age: Some(CISA_MAX_AGE),
}
}
/// A supplier's provider a tenant named for a bought-in component (#1025),
/// keyed by its metadata URL ([`supplier_key`]).
pub(crate) fn supplier(metadata_url: &str) -> Self {
Self {
name: supplier_key(metadata_url),
metadata_url: metadata_url.to_string(),
feed_filter: None,
max_age: None,
}
}
}
/// The prefix of a supplier provider's key, which tells its advisories from
/// the shared providers' ([`Provider::supplier`]).
pub(crate) const SUPPLIER_PREFIX: &str = "supplier:";
/// The key a supplier's advisories are stored and matched under.
pub(crate) fn supplier_key(metadata_url: &str) -> String {
format!("{SUPPLIER_PREFIX}{}", metadata_url.trim())
}
/// The providers `PW_CSAF_PROVIDERS` names: `off` (none), unset or `default`
@@ -224,6 +244,19 @@ impl MongoAdvisoryStore {
pub(crate) fn collection(&self) -> &mongodb::Collection<StoredAdvisory> {
&self.collection
}
/// The collection of a tenant's supplier advisories (#1025), in the
/// tenant's own database.
pub(crate) const SUPPLIER_COLLECTION: &'static str = "supplier_csaf_advisories";
/// The advisories of the suppliers a tenant named (#1025), in its own
/// database: a provider one tenant chooses is never matched against
/// another tenant's components.
pub(crate) fn supplier(tenant_db: &mongodb::Database) -> Self {
Self {
collection: tenant_db.collection(Self::SUPPLIER_COLLECTION),
}
}
}
impl AdvisoryStore for MongoAdvisoryStore {
@@ -566,6 +599,81 @@ pub(crate) async fn refresh_index(admin_db: &mongodb::Database, guard: NetGuard)
refresh(&fetch, &store, &providers, Limits::default()).await;
}
/// The supplier providers a tenant's active targets name (#1025), once each.
pub(crate) fn supplier_providers(
targets: &[compliance_core::models::OnboardedTarget],
) -> Vec<Provider> {
let mut urls: Vec<&str> = targets
.iter()
.filter(|t| t.archived_at.is_none())
.filter_map(|t| t.supplier.as_ref()?.csaf_provider.as_deref())
.map(str::trim)
.filter(|u| !u.is_empty())
.collect();
urls.sort_unstable();
urls.dedup();
urls.into_iter().map(Provider::supplier).collect()
}
/// Bounds of one refresh of a tenant's supplier advisories: fewer than the
/// shared index, as one tenant's suppliers publish fewer.
fn supplier_limits() -> Limits {
Limits {
max_advisories: 200,
concurrency: 2,
budget: Duration::from_secs(5 * 60),
}
}
/// Refresh the advisories of the supplier providers tenant `tenant_id`'s
/// targets name (#1025), into its own database, through the guarded client.
/// Logs and returns on any failure.
pub(crate) async fn refresh_supplier_advisories(
agent: &crate::agent::ComplianceAgent,
tenant_id: &str,
) {
let db = match agent.db_pool.for_tenant_id(tenant_id).await {
Ok(db) => db,
Err(e) => {
tracing::warn!(tenant_id, "supplier CSAF advisories not refreshed: {e}");
return;
}
};
let targets: Vec<compliance_core::models::OnboardedTarget> = match db
.onboarded_targets()
.find(doc! { "supplier.csaf_provider": { "$exists": true }, "archived_at": null })
.await
{
Ok(cursor) => cursor.try_collect().await.unwrap_or_default(),
Err(e) => {
tracing::warn!(tenant_id, "supplier CSAF providers not read: {e}");
return;
}
};
let providers = supplier_providers(&targets);
if providers.is_empty() {
return;
}
let fetch = match HttpFetch::new(agent.net_guard) {
Ok(fetch) => fetch,
Err(e) => {
tracing::warn!(tenant_id, "supplier CSAF advisories not refreshed: {e}");
return;
}
};
let store = MongoAdvisoryStore::supplier(db.inner());
let counts = refresh(&fetch, &store, &providers, supplier_limits()).await;
let stored: usize = counts.values().map(|c| c.stored).sum();
let failed: usize = counts.values().map(|c| c.failed).sum();
tracing::info!(
tenant_id,
providers = providers.len(),
stored,
failed,
"supplier CSAF advisories refreshed"
);
}
/// A store for tests: advisories in memory.
#[cfg(test)]
#[derive(Default)]
@@ -632,6 +740,33 @@ impl AdvisoryStore for MemoryStore {
mod tests {
use super::*;
#[test]
fn a_tenants_supplier_providers_are_its_active_targets_once_each() {
use compliance_core::models::{OnboardedTarget, SupplierComponent, TargetType};
let url = "https://supplier.example/.well-known/csaf/provider-metadata.json";
let target = |provider: Option<&str>, archived: bool| {
let mut t = OnboardedTarget::new("c".into(), TargetType::FirmwareBareMetal);
t.supplier = Some(SupplierComponent {
name: "Example GmbH".into(),
product: None,
version: None,
csaf_provider: provider.map(String::from),
});
t.archived_at = archived.then(chrono::Utc::now);
t
};
let providers = supplier_providers(&[
target(Some(url), false),
target(Some(&format!(" {url} ")), false),
target(Some("https://gone.example/provider-metadata.json"), true),
target(None, false),
]);
assert_eq!(providers.len(), 1);
assert_eq!(providers[0].metadata_url, url);
assert_eq!(providers[0].name, format!("{SUPPLIER_PREFIX}{url}"));
assert!(providers[0].feed_filter.is_none() && providers[0].max_age.is_none());
}
/// A provider answering from a table; counts requests.
#[derive(Default)]
struct Fake(HashMap<String, Vec<u8>>, std::sync::Mutex<Vec<String>>);
@@ -88,6 +88,14 @@ fn names(p: &AdvisoryProduct, provider: &str, entry: &SbomEntry) -> bool {
{
return true;
}
// A bought-in product (#1025), by its supplier's name for it, only in
// that supplier's own advisories.
if entry.package_manager == crate::pipeline::sbom::supplied::SUPPLIER_PRODUCT_MANAGER
&& provider.starts_with(crate::pipeline::csaf_feed::SUPPLIER_PREFIX)
&& p.covers(&entry.name, &entry.version)
{
return true;
}
let (Some(theirs), Some(ours)) = (p.purl.as_deref(), entry.purl.as_deref()) else {
return false;
};
@@ -292,6 +300,52 @@ mod tests {
e
}
#[test]
fn a_bought_in_product_is_matched_only_by_its_own_suppliers_advisory() {
// #1025: the product itself, named as its supplier names it, against
// that supplier's advisories; the same advisory under a shared
// provider's key does not name it.
let advisory = codesys_advisory();
let product = |version: &str| {
let mut e = SbomEntry::new(
"t".into(),
"CODESYS Control for Linux SL".into(),
version.into(),
crate::pipeline::sbom::supplied::SUPPLIER_PRODUCT_MANAGER.into(),
);
e.evidence = vec!["supplied by Example GmbH".into()];
e
};
let supplier = crate::pipeline::csaf_feed::supplier_key(
"https://supplier.example/.well-known/csaf/provider-metadata.json",
);
let mut entries = vec![product("3.5.16.0"), product("3.5.22.40")];
let mut alerts = Vec::new();
let n = apply(
"t",
&mut entries,
&[(supplier, advisory.clone())],
&mut alerts,
);
assert_eq!(n, 1, "only the version below the fix");
assert_eq!(alerts[0].cve_id, "CVE-2026-90001");
assert_eq!(alerts[0].affected_version, "3.5.16.0");
let mut entries = vec![product("3.5.16.0")];
let mut alerts = Vec::new();
let n = apply(
"t",
&mut entries,
&[("siemens".to_string(), advisory)],
&mut alerts,
);
assert_eq!(
n, 0,
"a shared provider's advisory does not name a supplier product"
);
}
#[test]
fn a_codesys_runtime_below_the_fix_gets_the_advisory() {
let advisories = vec![("codesys".to_string(), codesys_advisory())];
+45 -1
View File
@@ -144,6 +144,43 @@ impl PipelineOrchestrator {
/// Add what the vendor advisories say about `entries` to `alerts`
/// (#515). Best-effort: an index that cannot be read leaves them as
/// they are.
/// Match `entries` against the advisories of the supplier this target is
/// bought from (#1025), stored for this tenant only: the product itself
/// by name and version, and its components by purl.
async fn match_supplier_advisories(
&self,
repo: &RepoView,
target_id: &str,
entries: &mut [SbomEntry],
alerts: &mut Vec<CveAlert>,
) {
use crate::pipeline::csaf_match::AdvisoryIndex;
let Some(url) = repo
.supplier
.as_ref()
.and_then(|s| s.csaf_provider.as_deref())
else {
return;
};
let providers = [crate::pipeline::csaf_feed::supplier_key(url)];
let (_, purls) = crate::pipeline::csaf_match::wanted(entries);
let store = crate::pipeline::csaf_feed::MongoAdvisoryStore::supplier(self.db.inner());
match store.relevant(&providers, &purls).await {
Ok(advisories) if advisories.is_empty() => {}
Ok(advisories) => {
let matched =
crate::pipeline::csaf_match::apply(target_id, entries, &advisories, alerts);
tracing::info!(
target_id,
advisories = advisories.len(),
matched,
"supplier CSAF advisories matched"
);
}
Err(e) => tracing::warn!(target_id, "supplier CSAF advisories not read: {e}"),
}
}
async fn match_advisories(
&self,
target_id: &str,
@@ -634,7 +671,12 @@ impl PipelineOrchestrator {
&repo_id,
));
let yocto_recipes = yocto.recipes;
let supplied = self.read_supplier_sboms(repo, &repo_id).await?;
let mut supplied = self.read_supplier_sboms(repo, &repo_id).await?;
supplied.extend(
repo.supplier
.as_ref()
.and_then(|s| crate::pipeline::sbom::supplied::product_entry(s, &repo_id)),
);
for entry in embedded
.into_iter()
.chain(codesys)
@@ -856,6 +898,8 @@ impl PipelineOrchestrator {
self.match_advisories(&repo_id, &mut sbom_entries, &mut cve_alerts)
.await;
self.match_supplier_advisories(repo, &repo_id, &mut sbom_entries, &mut cve_alerts)
.await;
self.enrich_cves(&repo_id, &mut cve_alerts, &mut sbom_entries)
.await;
@@ -63,6 +63,8 @@ pub struct RepoView {
/// The target's supplier SBOMs (#1025) as ingested, each with the name it
/// was uploaded under. Set by the caller; empty from [`Self::from_target`].
pub supplier_sboms: Vec<(std::path::PathBuf, String)>,
/// Who supplies the component, for one bought in (#1025).
pub supplier: Option<compliance_core::models::SupplierComponent>,
}
impl RepoView {
@@ -99,6 +101,7 @@ impl RepoView {
exclude_paths: target.scan_config.exclude_paths.clone(),
build_outputs: Vec::new(),
supplier_sboms: Vec::new(),
supplier: target.supplier.clone(),
};
if let Some(git) = &code.git {
view.default_branch = git.default_branch.clone();
@@ -29,6 +29,31 @@ pub const MAX_COMPONENTS: usize = 100_000;
/// none, or that has no purl.
pub(crate) const SUPPLIER_MANAGER: &str = "supplier";
/// The package manager of the bought-in product itself, as its supplier
/// names it: matched by name and version against that supplier's own CSAF
/// advisories ([`product_entry`]).
pub(crate) const SUPPLIER_PRODUCT_MANAGER: &str = "supplier-product";
/// The bought-in product itself as an SBOM entry of target `repo_id`, when
/// its supplier names it with a version and publishes CSAF advisories to
/// match it against; `None` otherwise (nothing could check it).
pub(crate) fn product_entry(
supplier: &compliance_core::models::SupplierComponent,
repo_id: &str,
) -> Option<SbomEntry> {
supplier.csaf_provider.as_deref()?;
let product = non_blank(supplier.product.clone())?;
let version = non_blank(supplier.version.clone())?;
let mut entry = SbomEntry::new(
repo_id.to_string(),
product,
version,
SUPPLIER_PRODUCT_MANAGER.to_string(),
);
entry.evidence = vec![format!("supplied by {}", supplier.name.trim())];
Some(entry)
}
/// Why a supplier SBOM cannot be read.
#[derive(Debug, thiserror::Error, PartialEq, Eq)]
pub enum SuppliedSbomError {
@@ -469,6 +494,27 @@ mod tests {
);
}
#[test]
fn the_product_itself_is_listed_only_where_its_supplier_can_be_asked() {
use compliance_core::models::SupplierComponent;
let supplier = |provider: Option<&str>, version: Option<&str>| SupplierComponent {
name: " Example GmbH ".into(),
product: Some("Pump Remote".into()),
version: version.map(String::from),
csaf_provider: provider.map(String::from),
};
let url = "https://supplier.example/.well-known/csaf/provider-metadata.json";
let entry = product_entry(&supplier(Some(url), Some("4.2")), "t1").unwrap();
assert_eq!(
(entry.name.as_str(), entry.version.as_str()),
("Pump Remote", "4.2")
);
assert_eq!(entry.package_manager, SUPPLIER_PRODUCT_MANAGER);
assert_eq!(entry.evidence, ["supplied by Example GmbH"]);
assert!(product_entry(&supplier(None, Some("4.2")), "t1").is_none());
assert!(product_entry(&supplier(Some(url), None), "t1").is_none());
}
#[test]
fn an_xml_sbom_with_a_dtd_is_refused() {
let xml = r#"<?xml version="1.0"?>
+10
View File
@@ -86,6 +86,7 @@ pub async fn start_scheduler(agent: &ComplianceAgent) -> Result<(), AgentError>
Box::pin(async move {
crate::pipeline::csaf_feed::refresh_index(&agent.db_pool.admin_db(), agent.net_guard)
.await;
refresh_supplier_advisories(&agent).await;
})
})
.map_err(|e| AgentError::Scheduler(format!("Failed to create CSAF job: {e}")))?;
@@ -101,6 +102,7 @@ pub async fn start_scheduler(agent: &ComplianceAgent) -> Result<(), AgentError>
startup_agent.net_guard,
)
.await;
refresh_supplier_advisories(&startup_agent).await;
});
// Managed git sync (#439): the organisation's repositories against the
@@ -191,6 +193,14 @@ pub async fn start_scheduler(agent: &ComplianceAgent) -> Result<(), AgentError>
///
/// We never panic out of this function — the scheduler must keep
/// firing even if the registry is offline.
/// Each tenant's supplier CSAF advisories (#1025), one tenant after the
/// other, after the shared index.
async fn refresh_supplier_advisories(agent: &ComplianceAgent) {
for tenant_id in scheduler_tenants(agent).await {
crate::pipeline::csaf_feed::refresh_supplier_advisories(agent, &tenant_id).await;
}
}
pub(crate) async fn scheduler_tenants(agent: &ComplianceAgent) -> Vec<String> {
if let Some(registry) = agent.registry.as_ref() {
match registry.list_tenants().await {
@@ -413,3 +413,52 @@ async fn a_new_supplier_sbom_replaces_the_one_before_it() {
server.cleanup().await;
}
#[tokio::test]
async fn a_targets_supplier_is_set_checked_and_removed() {
let server = TestServer::start().await;
let id = firmware_target(&server, "bought-in-gearbox").await;
let path = format!("/api/v1/targets/{id}");
// `.invalid` never resolves: the refresh started in the background
// reaches no network.
let url = "https://supplier.invalid/.well-known/csaf/provider-metadata.json";
let resp = server
.patch(
&path,
&json!({ "supplier": {
"name": " Example GmbH ", "product": "Gearbox Control", "version": "2.1",
"csaf_provider": url
} }),
)
.await;
assert_eq!(resp.status(), 200);
let body: serde_json::Value = resp.json().await.unwrap();
assert_eq!(
body["data"]["supplier"],
json!({ "name": "Example GmbH", "product": "Gearbox Control", "version": "2.1",
"csaf_provider": url })
);
// A provider that is not an https URL is refused, and nothing changes.
let resp = server
.patch(
&path,
&json!({ "supplier": { "name": "Example GmbH",
"csaf_provider": "http://supplier.invalid/x.json" } }),
)
.await;
assert_eq!(resp.status(), 422);
let body: serde_json::Value = server.get(&path).await.json().await.unwrap();
assert_eq!(body["data"]["supplier"]["csaf_provider"], url);
// An empty name removes the supplier.
let resp = server
.patch(&path, &json!({ "supplier": { "name": "" } }))
.await;
assert_eq!(resp.status(), 200);
let body: serde_json::Value = resp.json().await.unwrap();
assert!(body["data"].get("supplier").is_none(), "{body}");
server.cleanup().await;
}
+1 -1
View File
@@ -71,7 +71,7 @@ pub use onboarding::{
default_compliance_profile, Artifact, ArtifactAuth, ArtifactKind, Classification,
ComplianceFramework, ComplianceProfile, DetectedFact, ExternalRef, ExternalSystem,
GitArtifactConfig, IssueTrackerConfig, LastScan, OnboardedTarget, PlcArtifactConfig, PlcFormat,
TargetScanConfig, TargetType, TargetTypeCandidate, WebArtifactConfig,
SupplierComponent, TargetScanConfig, TargetType, TargetTypeCandidate, WebArtifactConfig,
};
pub use oscal::OscalDocument;
pub use oscal_assessment::{assess, AssessmentResultsDoc, ControlLinker};
+24
View File
@@ -699,6 +699,11 @@ pub struct OnboardedTarget {
with = "super::serde_helpers::opt_bson_datetime"
)]
pub included_until: Option<DateTime<Utc>>,
/// Who supplies the component, for a component bought in (#1025): the
/// supplier, its product and version, and where it publishes its CSAF
/// advisories. `None` for what the tenant makes itself.
#[serde(default, skip_serializing_if = "Option::is_none")]
pub supplier: Option<SupplierComponent>,
/// Creation timestamp.
#[serde(
default = "chrono::Utc::now",
@@ -713,6 +718,24 @@ pub struct OnboardedTarget {
pub updated_at: DateTime<Utc>,
}
/// A component bought in from a supplier (#1025).
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub struct SupplierComponent {
/// The supplier's name.
pub name: String,
/// The supplier's name for the product, as its advisories name it.
#[serde(default, skip_serializing_if = "Option::is_none")]
pub product: Option<String>,
/// The product's version in use.
#[serde(default, skip_serializing_if = "Option::is_none")]
pub version: Option<String>,
/// The supplier's CSAF provider metadata (`provider-metadata.json`, an
/// https URL). Its public (TLP:WHITE) advisories are fetched for this
/// tenant only and matched against the product and its components.
#[serde(default, skip_serializing_if = "Option::is_none")]
pub csaf_provider: Option<String>,
}
impl OnboardedTarget {
/// A new target of the given type. It has no webhook secret: storing one
/// needs the agent's encryption key, and webhooks are off until a secret
@@ -742,6 +765,7 @@ impl OnboardedTarget {
billing: super::metering::TargetBilling::default(),
included_choice: None,
included_until: None,
supplier: None,
created_at: now,
updated_at: now,
}
+12 -2
View File
@@ -111,8 +111,18 @@ go through the same CVE groups, VEX statements and ENISA drafts.
An SBOM that lists nothing is refused rather than read as empty: read as
empty, it would make every known CVE of the component look fixed.
- **A new version from the supplier:** upload it to the same target. Each scan
reads the target's supplier SBOMs.
- **A new version from the supplier:** upload it to the same target. It
replaces the previous one.
- **The supplier and its advisories:** a target can name its supplier: the
supplier's name, its name for the product, the version in use, and its CSAF
provider (`supplier` in the target API, with `provider-metadata.json` as an
https URL). Prüfwerk then fetches the supplier's public (TLP:WHITE) CSAF
advisories. It fetches them daily, and right away when the provider is set.
They are kept for your workspace only and never matched against another
workspace's components. A scan matches them against the product itself by
the supplier's name and version for it, and against its components by purl.
A matching advisory raises a CVE alert with the supplier's remediation and
fixed versions.
### When the SBOM is empty or incomplete