Compare commits

...
8 Commits
Author SHA1 Message Date
sharangandClaude Opus 5.5 deda6d4867 chore(release): workspace crates at 0.4.15 (#992)
CI / Agent integration (push) Skipped
CI / Detect Changes (push) Successful in 3s
CI / Deploy Docs (push) Skipped
CI / Deploy MCP (push) Successful in 5m26s
CI / Check (push) Skipped
CI / Deploy Dashboard (push) Successful in 7m50s
CI / Deploy Agent (push) Successful in 10m43s
The crate versions had stayed at 0.4.6 since the first releases; the
running version comes from the release tag. Bumping them to the release
also changes Cargo.toml and Cargo.lock, so the main build after merging
rebuilds the agent, dashboard and MCP images together for v0.4.15.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-12 17:18:39 +00:00
sharangandClaude Opus 5.5 783e075891 fix(dashboard): the Managed Git hint links one docs path in both languages (#980) (#991)
CI / Check (push) Skipped
CI / Agent integration (push) Skipped
CI / Detect Changes (push) Successful in 3s
CI / Deploy Agent (push) Skipped
CI / Deploy Docs (push) Skipped
CI / Deploy MCP (push) Skipped
CI / Deploy Dashboard (push) Successful in 3m56s
On prod, DOCS_URL is the customer docs site, which keeps a page at the
same path under each language root and has no "-en" pages: the English
link to guide/managed-git-en would 404 there. Both languages now link
guide/managed-git.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-12 11:17:59 +00:00
sharangandClaude Opus 5.5 ea1b48dd37 feat(auth): Prüfwerk access for the RBAC step 4 roles (#989) (#990)
CI / Check (push) Skipped
CI / Agent integration (push) Skipped
CI / Detect Changes (push) Successful in 4s
CI / Deploy Docs (push) Successful in 1m11s
CI / Deploy MCP (push) Successful in 4m54s
CI / Deploy Dashboard (push) Successful in 7m12s
CI / Deploy Agent (push) Successful in 9m1s
Decided 2026-11-12: PSIRT and DEVELOPMENT get full access (they triage
findings and run scans); QUALITY, PURCHASING and AUDITOR read only;
PRIVACY and EXTERNAL none, as before. Each parses to its own OrgRole.
Admin-only actions (manual findings, git source, licence decisions) stay
with IT_ADMIN and OWNER; confirming a licence follows full access, so
PSIRT and DEVELOPMENT may confirm.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-12 10:24:59 +00:00
sharangandClaude Opus 5.5 867453b63e fix(dashboard): the target editor fits the window, in sections (#987) (#988)
CI / Check (push) Skipped
CI / Agent integration (push) Skipped
CI / Detect Changes (push) Successful in 3s
CI / Deploy Agent (push) Skipped
CI / Deploy Docs (push) Skipped
CI / Deploy MCP (push) Skipped
CI / Deploy Dashboard (push) Successful in 5m43s
The "Prüfobjekt bearbeiten" dialog was taller than a laptop window and
could not scroll, so its title and Save were out of reach; at 480px its
add-reference row squeezed five controls into one line.

Dialogs now stop at the window height and scroll, with the actions
pinned at the bottom. The target editor is 680px wide and split into
sections (artefacts, add a file, exclusions, projects); adding a
reference puts kind and reference on one line and branch, token and the
button on the next; the upload's archive password gets its own line;
the project picker reads as a section inside a dialog.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-12 10:04:13 +00:00
sharangandClaude Opus 5.5 ca8a662b60 feat(sbom): explain an empty or incomplete SBOM with findings (#979) (#985)
CI / Check (push) Skipped
CI / Agent integration (push) Skipped
CI / Detect Changes (push) Successful in 4s
CI / Deploy Docs (push) Successful in 1m3s
CI / Deploy MCP (push) Successful in 2m44s
CI / Deploy Dashboard (push) Successful in 3m46s
CI / Deploy Agent (push) Successful in 5m55s
Source code without a manifest or lockfile gave an empty SBOM with no
explanation, which reads as "no libraries". Two findings of a new
sbom-coverage check now say why:

- sbom-no-manifest (Medium): code in a language with a package manager
  (Python, JS/TS, Rust, Go, Java/Kotlin, C#, PHP, Ruby, Dart) and no
  manifest or lockfile for it outside vendor directories, one per
  ecosystem. Never for C/C++, Yocto layers, or a tree whose components
  come from its sources (library headers, firmware, CODESYS).
- sbom-dependencies-unresolved (Low): a manifest whose dependencies were
  not resolved, one per manifest the SBOM stage already lists under
  sbom_dependencies; legacy build systems keep their own finding.

Each finding names a concrete way to add the missing file, maps to the
SBOM requirement (cra-ai-23, also bound in the control map) and closes at
the next scan that no longer reports it, as the check completes on every
code scan. Dart is now detected as a source language.

The SBOM page shows an explanation instead of an empty table: where the
SBOM comes from, the target's open findings with their examples and a
link, or a general example. The findings API takes a scanner filter.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-12 09:21:59 +00:00
sharangandClaude Opus 5.5 fc72b6a1f4 feat(findings): copy a finding as ticket text, hint at Breakpilot Git (#980) (#984)
CI / Check (push) Skipped
CI / Agent integration (push) Skipped
CI / Detect Changes (push) Successful in 3s
CI / Deploy Docs (push) Successful in 1m6s
CI / Deploy MCP (push) Successful in 4m58s
CI / Deploy Dashboard (push) Successful in 7m12s
CI / Deploy Agent (push) Successful in 9m5s
The finding page gets an "Als Ticket-Text kopieren" button that copies
the finding as Markdown (title, severity, status, location, description,
the AI assessment, CRA-Themen and a link back to Prüfwerk), confirmed
with "Kopiert". The Markdown is built in Rust; JavaScript only writes it
to the clipboard.

Where the target opens no tickets on its own and the finding has none, a
hint says "Mit Breakpilot Git werden Tickets automatisch angelegt" and
links to connecting a tracker and to the Managed Git guide. The target's
CRA view now says whether a tracker is connected: one with a type is
configured, or the target came from a managed git source.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-12 09:21:46 +00:00
sharangandClaude Opus 5.5 aa022b0d0f fix(auth): OWNER has IT_ADMIN's rights in Prüfwerk (#982) (#983)
CI / Check (push) Skipped
CI / Agent integration (push) Skipped
CI / Detect Changes (push) Successful in 4s
CI / Deploy Docs (push) Successful in 1m17s
CI / Deploy MCP (push) Successful in 4m7s
CI / Deploy Dashboard (push) Successful in 5m11s
CI / Deploy Agent (push) Successful in 6m32s
OrgRole::parse knew only IT_ADMIN, CXO, FINANCE, LEGAL and USER, so an
OWNER got no access at all. OWNER now parses to its own role with full
access, and what only an administrator may do (manual findings, the git
source, licence decisions) asks OrgRole::is_admin (IT_ADMIN or OWNER).
The other new RBAC bundles still get no access.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-12 09:09:48 +00:00
sharangandClaude Opus 5.5 5ea49661d0 fix(dashboard): CRA links read as technical hints, not a legal assessment (#978) (#981)
CI / Check (push) Skipped
CI / Agent integration (push) Skipped
CI / Detect Changes (push) Successful in 3s
CI / Deploy MCP (push) Skipped
CI / Deploy Docs (push) Successful in 1m12s
CI / Deploy Dashboard (push) Successful in 7m8s
CI / Deploy Agent (push) Successful in 9m1s
The scan phase "CRA-Anforderungen zuordnen" could read as legal advice.
It is now "Bezug zu CRA-Themen ermitteln (technischer Hinweis)"; the
finding detail says "CRA-Themen, auf die dieser Befund hinweist" and
"CRA-Themen (Anhang I)"; the CRA status page and the CRA tiles say
"Technische Hinweise, keine rechtliche Bewertung". The docs use the
same wording.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-12 09:02:53 +00:00
51 changed files with 1659 additions and 113 deletions

No files matched your search

Generated
+9 -9
View File
@@ -601,7 +601,7 @@ dependencies = [
[[package]]
name = "compliance-agent"
version = "0.4.6"
version = "0.4.15"
dependencies = [
"axum",
"base64 0.22.1",
@@ -655,7 +655,7 @@ dependencies = [
[[package]]
name = "compliance-core"
version = "0.4.6"
version = "0.4.15"
dependencies = [
"aes-gcm",
"axum",
@@ -687,7 +687,7 @@ dependencies = [
[[package]]
name = "compliance-dashboard"
version = "0.4.6"
version = "0.4.15"
dependencies = [
"async-trait",
"axum",
@@ -725,7 +725,7 @@ dependencies = [
[[package]]
name = "compliance-dast"
version = "0.4.6"
version = "0.4.15"
dependencies = [
"base64 0.22.1",
"chrono",
@@ -745,7 +745,7 @@ dependencies = [
[[package]]
name = "compliance-graph"
version = "0.4.6"
version = "0.4.15"
dependencies = [
"bson",
"chrono",
@@ -770,7 +770,7 @@ dependencies = [
[[package]]
name = "compliance-mcp"
version = "0.4.6"
version = "0.4.15"
dependencies = [
"axum",
"bson",
@@ -793,7 +793,7 @@ dependencies = [
[[package]]
name = "compliance-smoke"
version = "0.4.6"
version = "0.4.15"
dependencies = [
"axum",
"compliance-core",
@@ -928,7 +928,7 @@ dependencies = [
[[package]]
name = "control-map"
version = "0.4.6"
version = "0.4.15"
dependencies = [
"serde",
"serde_json",
@@ -7087,7 +7087,7 @@ dependencies = [
[[package]]
name = "werkbank-exec"
version = "0.4.6"
version = "0.4.15"
dependencies = [
"compliance-core",
"compliance-dast",
+1 -1
View File
@@ -1,6 +1,6 @@
[package]
name = "compliance-agent"
version = "0.4.6"
version = "0.4.15"
edition = "2021"
[lints]
+4
View File
@@ -65,6 +65,10 @@ pub struct FindingsFilter {
pub status: Option<String>,
#[serde(default)]
pub q: Option<String>,
/// Only the findings of one scanner (`Finding::scanner`, e.g.
/// `sbom-coverage`).
#[serde(default)]
pub scanner: Option<String>,
/// Only the findings in one app variant (`Tablet App`): its own, and the
/// groups listing a place in it.
#[serde(default)]
@@ -173,6 +173,9 @@ pub async fn compliance_view(
"data": {
"target_id": id,
"target_name": inputs.target.name,
// Whether Prüfwerk opens tickets for the target's findings; the
// finding page offers Breakpilot Git when it does not.
"issue_tracker_connected": inputs.target.issue_tracker_connected(),
"counts": state_counts(&controls),
"last_scan": inputs.last_run,
"sbom_components": inputs.sbom.len(),
@@ -28,6 +28,9 @@ pub async fn list_findings(
if let Some(scan_type) = &filter.scan_type {
query.insert("scan_type", scan_type);
}
if let Some(scanner) = &filter.scanner {
query.insert("scanner", scanner);
}
if let Some(status) = &filter.status {
query.insert("status", status_filter(status));
}
@@ -6,15 +6,15 @@ use axum::http::StatusCode;
use axum::Json;
use compliance_core::models::GitSourceView;
use compliance_core::tenant::OrgRole;
use compliance_core::tenant_ctx::TenantCtx;
use super::dto::{tenant_db, AgentExt};
use super::ApiResponse;
/// Whether the caller may see the git source: IT administrators and support.
/// Whether the caller may see the git source: administrators (IT_ADMIN,
/// OWNER) and support.
fn may_view(tenant: &TenantCtx) -> bool {
tenant.0.staff.is_some() || tenant.0.org_roles.contains(&OrgRole::ItAdmin)
tenant.0.staff.is_some() || tenant.0.is_admin()
}
/// The source without secrets, plus the webhook URL; `data: null` when the
@@ -292,12 +292,12 @@ pub async fn withdraw(
}
/// Whether the requester may change the policy and decide reviews: LEGAL,
/// IT_ADMIN, or BreakPilot support. USER confirms licences but does not
/// an administrator (IT_ADMIN, OWNER), or BreakPilot support. USER confirms licences but does not
/// decide whether they may be used.
fn may_decide(tenant: &TenantCtx) -> bool {
let ctx = &tenant.0;
ctx.api_key.is_none()
&& (ctx.staff.is_some() || ctx.has_any_role(&[OrgRole::Legal, OrgRole::ItAdmin]))
&& (ctx.staff.is_some() || ctx.is_admin() || ctx.has_any_role(&[OrgRole::Legal]))
}
fn refuse_role() -> Refusal {
@@ -306,7 +306,7 @@ fn refuse_role() -> Refusal {
Json(serde_json::json!({
"error": crate::api::role_gate::FORBIDDEN_ROLE,
"access": "read_only",
"needs": ["LEGAL", "IT_ADMIN"],
"needs": ["LEGAL", "IT_ADMIN", "OWNER"],
})),
)
}
@@ -912,6 +912,7 @@ mod tests {
fn legal_and_it_admin_decide_users_do_not() {
assert!(may_decide(&with_roles(vec![OrgRole::Legal])));
assert!(may_decide(&with_roles(vec![OrgRole::ItAdmin])));
assert!(may_decide(&with_roles(vec![OrgRole::Owner])));
assert!(!may_decide(&with_roles(vec![OrgRole::User])));
assert!(!may_decide(&with_roles(vec![OrgRole::Cxo])));
}
@@ -4,7 +4,7 @@
//!
//! Writing findings into a tenant's record is an administrator's action: the
//! tester is given an account in the customer's organisation with the
//! `IT_ADMIN` role.
//! `IT_ADMIN` (or `OWNER`) role.
use std::sync::Arc;
@@ -16,7 +16,6 @@ use mongodb::bson::{doc, oid::ObjectId};
use serde::{Deserialize, Serialize};
use compliance_core::models::{Finding, ScanType};
use compliance_core::tenant::OrgRole;
use compliance_core::tenant_ctx::TenantCtx;
use super::dto::tenant_db;
@@ -84,9 +83,10 @@ pub struct ImportSummary {
pub duplicates: usize,
}
/// Only an organisation's IT administrator writes findings by hand.
/// Only an organisation's administrator (IT_ADMIN, OWNER) writes findings by
/// hand.
fn require_admin(tenant: &TenantCtx) -> Result<(), StatusCode> {
if tenant.0.org_roles.contains(&OrgRole::ItAdmin) {
if tenant.0.is_admin() {
Ok(())
} else {
Err(StatusCode::FORBIDDEN)
@@ -221,7 +221,7 @@ pub async fn import_findings(
#[cfg(test)]
mod tests {
use super::*;
use compliance_core::tenant::{TenantContext, TenantStatus};
use compliance_core::tenant::{OrgRole, TenantContext, TenantStatus};
fn tenant(roles: Vec<OrgRole>) -> TenantCtx {
TenantCtx(TenantContext {
@@ -241,6 +241,7 @@ mod tests {
#[test]
fn only_an_it_admin_writes_findings() {
assert_eq!(require_admin(&tenant(vec![OrgRole::ItAdmin])), Ok(()));
assert_eq!(require_admin(&tenant(vec![OrgRole::Owner])), Ok(()));
assert_eq!(
require_admin(&tenant(vec![OrgRole::User, OrgRole::Cxo])),
Err(StatusCode::FORBIDDEN)
+6 -4
View File
@@ -2,12 +2,13 @@
//!
//! One middleware for every tenant-scoped route, so no handler can forget it:
//!
//! * `IT_ADMIN`, `USER` — read and write.
//! * `CXO`, `LEGAL` — read only: `GET` / `HEAD` / `OPTIONS`, plus the few
//! * `OWNER`, `IT_ADMIN`, `USER`, `PSIRT`, `DEVELOPMENT` — read and write.
//! * `CXO`, `LEGAL`, `QUALITY`, `PURCHASING`, `AUDITOR` — read only: `GET` / `HEAD` / `OPTIONS`, plus the few
//! `POST` routes that only read ([`READ_ONLY_POSTS`]). `LEGAL` also
//! decides about licences: the licence policy and the legal review
//! ([`ROLE_WRITES`], decided 2026-10-15).
//! * `FINANCE`, or none of these roles — nothing; every request is refused.
//! * `FINANCE`, `PRIVACY`, `EXTERNAL`, or none of these roles — nothing;
//! every request is refused.
//!
//! Refusals are `403 {"error": "forbidden_role", "access": "none" | "read_only"}`.
//!
@@ -18,7 +19,8 @@
//! Werkbank runner and admin APIs (their own token middleware), the health
//! check, and support staff who have not chosen a tenant yet.
//!
//! Handlers may still be stricter (manual findings stay `IT_ADMIN`-only).
//! Handlers may still be stricter (manual findings stay for administrators:
//! `IT_ADMIN` and `OWNER`).
//!
//! API keys (tenant-registry ADR 0001) hold no role. They reach only the
//! routes in [`KEY_SCOPES`], each with the scope it names; every other route
@@ -19,11 +19,19 @@ use tower::ServiceExt;
/// Who is calling.
#[derive(Debug, Clone, Copy)]
enum Caller {
Owner,
ItAdmin,
User,
Cxo,
Legal,
Finance,
Psirt,
Development,
Quality,
Purchasing,
Auditor,
Privacy,
External,
NoRoles,
/// BreakPilot support in a customer's tenant (no org roles of its own).
Staff,
@@ -35,11 +43,19 @@ enum Caller {
fn ctx(caller: Caller) -> Option<TenantContext> {
let roles = match caller {
Caller::Owner => vec![OrgRole::Owner],
Caller::ItAdmin => vec![OrgRole::ItAdmin],
Caller::User => vec![OrgRole::User],
Caller::Cxo => vec![OrgRole::Cxo],
Caller::Legal => vec![OrgRole::Legal],
Caller::Finance => vec![OrgRole::Finance],
Caller::Psirt => vec![OrgRole::Psirt],
Caller::Development => vec![OrgRole::Development],
Caller::Quality => vec![OrgRole::Quality],
Caller::Purchasing => vec![OrgRole::Purchasing],
Caller::Auditor => vec![OrgRole::Auditor],
Caller::Privacy => vec![OrgRole::Privacy],
Caller::External => vec![OrgRole::External],
Caller::NoRoles | Caller::Staff | Caller::Key(_) => vec![],
Caller::Service => return None,
};
@@ -196,11 +212,19 @@ fn routes() -> Vec<(Method, String, bool)> {
async fn roles_decide_reads_and_writes() {
// (caller, may read, may write)
let matrix = [
(Caller::Owner, true, true),
(Caller::ItAdmin, true, true),
(Caller::User, true, true),
(Caller::Cxo, true, false),
(Caller::Legal, true, false),
(Caller::Finance, false, false),
(Caller::Psirt, true, true),
(Caller::Development, true, true),
(Caller::Quality, true, false),
(Caller::Purchasing, true, false),
(Caller::Auditor, true, false),
(Caller::Privacy, false, false),
(Caller::External, false, false),
(Caller::NoRoles, false, false),
(Caller::Staff, true, true),
(Caller::Service, true, true),
+27 -1
View File
@@ -72,11 +72,12 @@ pub enum SbomCoverage {
}
/// The tools that check a target's components rather than its code.
const COMPONENT_TOOLS: [&str; 5] = [
const COMPONENT_TOOLS: [&str; 6] = [
"syft",
"osv",
"dotnet-lifecycle",
"build-lifecycle",
compliance_core::models::SBOM_COVERAGE_SCANNER,
"yocto-release",
];
@@ -513,6 +514,31 @@ mod tests {
);
}
#[test]
fn an_sbom_coverage_finding_is_evidence_against_the_sbom_requirement() {
let map = ControlMap::cra().expect("map");
let mut f = finding(SBOM_CONTROL, FindingStatus::Open);
f.scanner = compliance_core::models::SBOM_COVERAGE_SCANNER.into();
f.rule_id = Some("sbom-dependencies-unresolved".into());
let unresolved = SbomCoverage::Unresolved(vec!["Cargo.toml".into()]);
let statuses = control_statuses(&map, &[f], Some(&python()), &[], &unresolved);
let sbom = status_of(&statuses, SBOM_CONTROL);
assert_eq!(sbom.state, ControlState::NotSatisfied);
assert_eq!(sbom.findings.len(), 1);
// The CVE controls still say why their components were not checked.
for control in ["cra-ai-22", "cra-ai-33"] {
assert_eq!(
status_of(&statuses, control).reason,
Some(NotAssessedReason::DependenciesUnresolved {
manifests: vec!["Cargo.toml".into()]
}),
"{control}"
);
}
}
#[test]
fn a_failed_cve_lookup_claims_nothing_about_component_cves() {
let map = ControlMap::cra().expect("map");
@@ -27,6 +27,7 @@ fn language_of(extension: &str) -> Option<&'static str> {
"cs" => "csharp",
"vb" => "vb",
"swift" => "swift",
"dart" => "dart",
// Objective-C; `.m` is also MATLAB's extension, which only means
// mobsfscan looks at a tree it finds nothing in.
"m" | "mm" => "objc",
+46 -2
View File
@@ -538,7 +538,8 @@ impl PipelineOrchestrator {
// the project's own code, which this deployment may not. Syft reports
// nothing for it, so say so rather than leaving the gap in an SBOM that
// looks complete.
for eco in crate::pipeline::sbom::unlocked_ecosystems(&repo_path, &resolved_nuget) {
let unlocked = crate::pipeline::sbom::unlocked_ecosystems(&repo_path, &resolved_nuget);
for eco in &unlocked {
self.skip_stage(
scan_run_id,
SkippedStage::new(
@@ -549,7 +550,7 @@ impl PipelineOrchestrator {
eco.manifest, eco.problem, eco.remedy
),
)
.about(eco.manifest),
.about(eco.manifest.clone()),
)
.await;
}
@@ -642,6 +643,49 @@ impl PipelineOrchestrator {
}
}
// Why the SBOM is empty or incomplete (#979): code with no manifest
// at all, and manifests whose dependencies were not resolved. Every
// code scan completes this check, so a finding closes at the next
// scan that finds the manifest or lockfile. A firmware SBOM, which
// the firmware step stored before this, counts as an SBOM.
let firmware_sbom = self
.db
.sbom_entries()
.count_documents(doc! {
"repo_id": &repo_id,
"package_manager": {
"$in": crate::pipeline::firmware_sbom::FIRMWARE_MANAGERS.to_vec()
},
})
.limit(1)
.await?
> 0;
let (coverage, entries) = {
let (root, vendor, languages) = (repo_path.clone(), vendor.clone(), languages.clone());
let (target, yocto_layers) = (repo_id.clone(), repo.yocto_layers);
tokio::task::spawn_blocking(move || {
use crate::pipeline::sbom::coverage::{coverage_findings, ScannedTree};
let tree = ScannedTree {
repo_id: &target,
root: &root,
vendor: &vendor,
languages: &languages,
yocto_layers,
firmware_sbom,
};
(
coverage_findings(&tree, &sbom_entries, &unlocked),
sbom_entries,
)
})
.await
.map_err(|e| AgentError::Other(format!("SBOM coverage check: {e}")))?
};
sbom_entries = entries;
run_findings.completed(crate::pipeline::sbom::coverage::SCANNER);
all_findings.extend(coverage);
run_findings.save_new(&self.db, &mut all_findings).await?;
// Stage 3: CVE Scanning
tracing::info!("[{repo_id}] Stage 3: CVE Scanning");
self.update_phase(scan_run_id, ScanPhase::CveScanning).await;
@@ -0,0 +1,623 @@
//! Why an SBOM is empty or incomplete, as findings (#979).
//!
//! The SBOM is built from the manifests and lockfiles in the code. Without
//! them it is empty, which reads as "no libraries" to someone who is not a
//! developer. Two findings say what is missing instead:
//!
//! - [`NO_MANIFEST_RULE`] (Medium): the tree holds code in a language with a
//! package manager, but no manifest or lockfile for it at all;
//! - [`UNRESOLVED_RULE`] (Low): a manifest whose dependencies were not
//! resolved (no lockfile, or one no tool reads), as
//! [`super::unlocked_ecosystems`] reports it.
//!
//! C and C++ have no standard manifest, and a firmware tree's components come
//! from its sources (library headers, the firmware build, a CODESYS archive, a
//! Yocto layer tree): such a tree never gets the first finding. Nothing is
//! guessed and no code is run to resolve dependencies. Both findings belong
//! to [`SCANNER`], which completes on every code scan, so a finding closes at
//! the next scan that no longer reports it.
use std::path::Path;
use compliance_core::models::{Finding, SbomEntry, ScanType, Severity, YOCTO_RECIPE_MANAGER};
use super::UnlockedEcosystem;
use crate::pipeline::dedup::compute_fingerprint;
use crate::pipeline::embedded_versions::EMBEDDED_MANAGER;
use crate::pipeline::vendor::walk_outside;
/// The scanner name of these findings.
pub(crate) const SCANNER: &str = compliance_core::models::SBOM_COVERAGE_SCANNER;
/// Code in a language with a package manager, and no manifest for it.
pub(crate) const NO_MANIFEST_RULE: &str = "sbom-no-manifest";
/// A manifest whose dependencies were not resolved.
pub(crate) const UNRESOLVED_RULE: &str = "sbom-dependencies-unresolved";
/// The weakness both findings stand for: components nobody tracks.
const CWE: &str = "CWE-1104";
/// The CRA requirement both findings are evidence against: the SBOM.
const SBOM_CONTROL: &str = crate::evidence::compliance::SBOM_CONTROL;
/// Languages whose code never asks for a manifest: C and C++ have no
/// standard one, and a Yocto layer tree's recipes are its inventory.
const NO_MANIFEST_LANGUAGES: [&str; 3] = ["c", "cpp", "bitbake"];
/// The `package_manager` values of components read from the sources rather
/// than a manifest: library headers, CODESYS archives, Yocto recipes.
const SOURCE_MANAGERS: [&str; 3] = [EMBEDDED_MANAGER, "codesys", YOCTO_RECIPE_MANAGER];
/// A package ecosystem: the languages that use it, the files that declare
/// or pin its dependencies, and how to add them.
struct Ecosystem {
/// What the finding calls the code (`Python`, `JavaScript/TypeScript`).
name: &'static str,
/// The language codes of [`crate::pipeline::languages`] it covers.
languages: &'static [&'static str],
/// The purl types of its SBOM entries: entries of one mean the SBOM
/// already lists some of its libraries (from committed jars, DLLs or
/// installed packages), so a manifest is not all there is.
purl_types: &'static [&'static str],
/// Whether a file name (lowercased) is one of its manifests or lockfiles.
declares: fn(&str) -> bool,
/// Its manifests, as the finding names them.
manifests: &'static str,
/// A concrete way to add a manifest or lockfile.
example: &'static str,
}
/// The ecosystems the finding covers, in the order the findings list them.
static ECOSYSTEMS: [Ecosystem; 9] = [
Ecosystem {
name: "Python",
languages: &["python"],
purl_types: &["pypi"],
declares: |f| {
(f.starts_with("requirements") && f.ends_with(".txt"))
|| matches!(
f,
"pyproject.toml"
| "setup.py"
| "setup.cfg"
| "pipfile"
| "pipfile.lock"
| "poetry.lock"
| "uv.lock"
| "pdm.lock"
| "environment.yml"
| "environment.yaml"
)
},
manifests: "requirements.txt or pyproject.toml",
example: "run pip freeze > requirements.txt in the project's environment, or declare \
the dependencies in pyproject.toml and run uv lock or poetry lock",
},
Ecosystem {
name: "JavaScript/TypeScript",
languages: &["javascript", "typescript"],
purl_types: &["npm"],
declares: |f| {
matches!(
f,
"package.json"
| "package-lock.json"
| "npm-shrinkwrap.json"
| "yarn.lock"
| "pnpm-lock.yaml"
| "bun.lock"
| "bun.lockb"
| "deno.json"
| "deno.jsonc"
| "deno.lock"
)
},
manifests: "package.json",
example: "declare the dependencies in package.json and run npm install, which writes \
package-lock.json",
},
Ecosystem {
name: "Rust",
languages: &["rust"],
purl_types: &["cargo"],
declares: |f| matches!(f, "cargo.toml" | "cargo.lock"),
manifests: "Cargo.toml",
example: "commit Cargo.toml and Cargo.lock (cargo generate-lockfile writes it)",
},
Ecosystem {
name: "Go",
languages: &["go"],
purl_types: &["golang"],
declares: |f| matches!(f, "go.mod" | "go.sum" | "gopkg.toml" | "gopkg.lock"),
manifests: "go.mod",
example: "run go mod init and go mod tidy, which write go.mod and go.sum, and commit both",
},
Ecosystem {
name: "Java/Kotlin",
languages: &["java", "kotlin"],
purl_types: &["maven"],
declares: |f| {
matches!(
f,
"pom.xml"
| "build.gradle"
| "build.gradle.kts"
| "settings.gradle"
| "settings.gradle.kts"
| "gradle.lockfile"
| "ivy.xml"
)
},
manifests: "pom.xml or build.gradle",
example: "declare the dependencies in a Maven pom.xml or a Gradle build file; with \
Gradle, also commit gradle.lockfile (./gradlew dependencies --write-locks)",
},
Ecosystem {
name: "C#",
languages: &["csharp"],
purl_types: &["nuget"],
// A Unity project (`ProjectVersion.txt`) is the build lifecycle
// check's: without its package manifest it is a legacy build system.
declares: |f| {
[".csproj", ".fsproj", ".vbproj", ".nuspec"]
.iter()
.any(|suffix| f.ends_with(suffix))
|| matches!(
f,
"packages.config"
| "packages.lock.json"
| "directory.packages.props"
| "project.json"
| "projectversion.txt"
)
},
manifests: "a .csproj project file",
example: "reference the NuGet packages in the .csproj project file, set \
RestorePackagesWithLockFile to true and commit the packages.lock.json that \
dotnet restore writes",
},
Ecosystem {
name: "PHP",
languages: &["php"],
purl_types: &["composer"],
declares: |f| matches!(f, "composer.json" | "composer.lock"),
manifests: "composer.json",
example: "declare the dependencies in composer.json and run composer install, which \
writes composer.lock; commit both",
},
Ecosystem {
name: "Ruby",
languages: &["ruby"],
purl_types: &["gem"],
declares: |f| {
f.ends_with(".gemspec") || matches!(f, "gemfile" | "gemfile.lock" | "gems.rb")
},
manifests: "a Gemfile",
example: "declare the gems in a Gemfile and run bundle install, which writes \
Gemfile.lock; commit both",
},
Ecosystem {
name: "Dart",
languages: &["dart"],
purl_types: &["pub"],
declares: |f| matches!(f, "pubspec.yaml" | "pubspec.lock"),
manifests: "pubspec.yaml",
example: "declare the dependencies in pubspec.yaml and run dart pub get (or flutter pub \
get), which writes pubspec.lock; commit both",
},
];
/// What one scan knows about its tree when it asks for these findings.
pub(crate) struct ScannedTree<'a> {
/// The target (`Finding::repo_id`).
pub repo_id: &'a str,
/// The working copy, after the left-out paths were pruned.
pub root: &'a Path,
/// Its vendor directories, which are not the customer's code.
pub vendor: &'a [String],
/// Its source languages ([`crate::pipeline::languages::source_languages`]).
pub languages: &'a [String],
/// Whether the tree is read as Yocto layers.
pub yocto_layers: bool,
/// Whether the target has a firmware SBOM from its sources, which the
/// firmware step stored before this scan of the tree.
pub firmware_sbom: bool,
}
/// The coverage findings of one scan: a [`NO_MANIFEST_RULE`] finding per
/// ecosystem the tree's code needs a manifest for and has none, and an
/// [`UNRESOLVED_RULE`] finding per entry of `unlocked` (other than a legacy
/// build system, which is a finding of the build lifecycle check already).
///
/// # Arguments
///
/// * `tree` - the scanned tree and what the scan detected in it
/// * `sbom` - the components this scan listed, from every source
/// * `unlocked` - the manifests whose dependencies were not resolved
///
/// # Returns
///
/// The findings, with `control_refs` set to the SBOM requirement; empty when
/// the SBOM speaks for the whole tree.
pub(crate) fn coverage_findings(
tree: &ScannedTree<'_>,
sbom: &[SbomEntry],
unlocked: &[UnlockedEcosystem],
) -> Vec<Finding> {
let mut findings: Vec<Finding> = missing_manifests(tree, sbom)
.into_iter()
.map(|eco| no_manifest_finding(tree.repo_id, eco))
.collect();
findings.extend(
unlocked
.iter()
.filter(|eco| !eco.legacy_build)
.map(|eco| unresolved_finding(tree.repo_id, eco)),
);
findings
}
/// The ecosystems whose code the tree holds outside vendor directories, with
/// no manifest or lockfile of theirs anywhere outside them and no component
/// of theirs in `sbom`. Empty for a tree with C, C++ or Yocto layers, and for
/// one whose components come from its sources ([`SOURCE_MANAGERS`], or the
/// firmware SBOM).
fn missing_manifests(tree: &ScannedTree<'_>, sbom: &[SbomEntry]) -> Vec<&'static Ecosystem> {
let has_language = |l: &str| tree.languages.iter().any(|x| x == l);
let from_sources = tree.firmware_sbom
|| sbom
.iter()
.any(|e| SOURCE_MANAGERS.contains(&e.package_manager.as_str()));
if tree.yocto_layers || from_sources || NO_MANIFEST_LANGUAGES.iter().any(|l| has_language(l)) {
return Vec::new();
}
// `pkg:pypi/requests@2` has the purl type `pypi`.
let listed = |eco: &Ecosystem| {
sbom.iter().any(|e| {
e.purl
.as_deref()
.and_then(|p| p.strip_prefix("pkg:"))
.and_then(|p| p.split('/').next())
.is_some_and(|t| eco.purl_types.contains(&t))
})
};
let mut candidates: Vec<&'static Ecosystem> = ECOSYSTEMS
.iter()
.filter(|eco| eco.languages.iter().any(|l| has_language(l)))
.filter(|eco| !listed(eco))
.collect();
if candidates.is_empty() {
return candidates;
}
// One walk for all of them; it stops once each has shown a manifest.
for entry in walk_outside(tree.root, tree.vendor) {
if !entry.file_type().is_file() {
continue;
}
let name = entry.file_name().to_string_lossy().to_ascii_lowercase();
candidates.retain(|eco| !(eco.declares)(&name));
if candidates.is_empty() {
break;
}
}
candidates
}
/// The [`NO_MANIFEST_RULE`] finding for `eco` on target `repo_id`.
fn no_manifest_finding(repo_id: &str, eco: &Ecosystem) -> Finding {
let mut finding = Finding::new(
repo_id.to_string(),
compute_fingerprint(&[repo_id, NO_MANIFEST_RULE, eco.name]),
SCANNER.to_string(),
ScanType::Sbom,
format!(
"No package manifest: the SBOM lists no libraries of the {} code",
eco.name
),
format!(
"The code contains {name} files, but no manifest or lockfile (such as {manifests}) \
that lists the libraries they use. The SBOM is built from these files, so it shows \
none of the {name} libraries, and their known vulnerabilities (CVEs) are not \
checked. An empty SBOM here does not mean that the code uses no libraries.",
name = eco.name,
manifests = eco.manifests,
),
Severity::Medium,
);
finding.remediation = Some(format!(
"Add a manifest or lockfile and commit it. For {}: {}. The finding closes at the next \
scan that finds it.",
eco.name, eco.example
));
stamp(&mut finding, NO_MANIFEST_RULE);
finding
}
/// The [`UNRESOLVED_RULE`] finding for `eco` on target `repo_id`.
fn unresolved_finding(repo_id: &str, eco: &UnlockedEcosystem) -> Finding {
let mut finding = Finding::new(
repo_id.to_string(),
compute_fingerprint(&[repo_id, UNRESOLVED_RULE, &eco.manifest]),
SCANNER.to_string(),
ScanType::Sbom,
format!(
"Dependencies not resolved: the SBOM is incomplete ({})",
eco.manifest
),
format!(
"{} {}. So the versions of these libraries, and of the libraries they pull in, are \
not known: the SBOM does not list them completely, and their known \
vulnerabilities (CVEs) are not checked. Prüfwerk does not run the project's code \
to resolve them.",
eco.manifest, eco.problem
),
Severity::Low,
);
finding.remediation = Some(format!(
"{}. The finding closes at the next scan that finds the lockfile.",
capitalised(eco.remedy)
));
finding.file_path = Some(eco.manifest.clone());
stamp(&mut finding, UNRESOLVED_RULE);
finding
}
/// Give `finding` its rule, weakness and CRA requirement. The control triage
/// judges a finding on its code, which these have none of, so the mapping is
/// set here, as `cra-ai-23` in the control map binds it.
fn stamp(finding: &mut Finding, rule: &str) {
finding.rule_id = Some(rule.to_string());
finding.cwe = Some(CWE.to_string());
finding.control_refs = vec![SBOM_CONTROL.to_string()];
}
/// `text` with its first letter upper-case.
fn capitalised(text: &str) -> String {
let mut chars = text.chars();
chars
.next()
.map(|first| first.to_uppercase().chain(chars).collect())
.unwrap_or_default()
}
#[cfg(test)]
#[allow(clippy::expect_used)]
mod tests {
use super::*;
/// A temporary tree holding `files`, removed on drop.
struct Tree(std::path::PathBuf);
impl Tree {
fn with(files: &[&str]) -> Self {
let root = std::env::temp_dir().join(format!("cs-coverage-{}", uuid::Uuid::new_v4()));
for path in files {
let file = root.join(path);
std::fs::create_dir_all(file.parent().expect("parent")).expect("mkdir");
std::fs::write(file, "x").expect("write");
}
std::fs::create_dir_all(&root).expect("root");
Self(root)
}
}
impl Drop for Tree {
fn drop(&mut self) {
let _ = std::fs::remove_dir_all(&self.0);
}
}
fn langs(codes: &[&str]) -> Vec<String> {
codes.iter().map(|c| c.to_string()).collect()
}
fn findings_for(
files: &[&str],
languages: &[&str],
sbom: &[SbomEntry],
unlocked: &[UnlockedEcosystem],
) -> Vec<Finding> {
let tree = Tree::with(files);
let languages = langs(languages);
let vendor = vec!["vendor".to_string()];
coverage_findings(
&ScannedTree {
repo_id: "t1",
root: &tree.0,
vendor: &vendor,
languages: &languages,
yocto_layers: false,
firmware_sbom: false,
},
sbom,
unlocked,
)
}
fn entry(package_manager: &str, purl: Option<&str>) -> SbomEntry {
let mut e = SbomEntry::new(
"t1".into(),
"lib".into(),
"1.0".into(),
package_manager.into(),
);
e.purl = purl.map(str::to_string);
e
}
fn unlocked(manifest: &str, legacy_build: bool) -> UnlockedEcosystem {
UnlockedEcosystem {
manifest: manifest.into(),
problem: "declares dependencies but no lockfile pins them",
remedy: "commit Cargo.lock",
legacy_build,
}
}
#[test]
fn code_without_any_manifest_is_a_medium_finding_per_ecosystem() {
let found = findings_for(
&["app/main.py", "web/app.ts", "web/util.js"],
&["javascript", "python", "typescript"],
&[],
&[],
);
let titles: Vec<&str> = found.iter().map(|f| f.title.as_str()).collect();
assert_eq!(
titles,
[
"No package manifest: the SBOM lists no libraries of the Python code",
"No package manifest: the SBOM lists no libraries of the JavaScript/TypeScript \
code",
]
);
let python = &found[0];
assert_eq!(python.severity, Severity::Medium);
assert_eq!(python.rule_id.as_deref(), Some(NO_MANIFEST_RULE));
assert_eq!(python.scanner, SCANNER);
assert_eq!(python.control_refs, [SBOM_CONTROL]);
assert_eq!(python.file_path, None);
assert!(python
.remediation
.as_deref()
.is_some_and(|r| r.contains("pip freeze > requirements.txt")));
// Stable across scans, one per ecosystem.
assert_ne!(found[0].fingerprint, found[1].fingerprint);
let again = findings_for(&["main.py"], &["python"], &[], &[]);
assert_eq!(again[0].fingerprint, python.fingerprint);
}
#[test]
fn a_manifest_or_lockfile_anywhere_outside_vendor_code_counts() {
for (manifest, language) in [
("backend/requirements-dev.txt", "python"),
("pyproject.toml", "python"),
("frontend/package.json", "javascript"),
("Cargo.lock", "rust"),
("svc/go.mod", "go"),
("app/build.gradle.kts", "kotlin"),
("pom.xml", "java"),
("src/App/App.csproj", "csharp"),
("composer.json", "php"),
("tool.gemspec", "ruby"),
("app/pubspec.yaml", "dart"),
] {
let found = findings_for(&[manifest], &[language], &[], &[]);
assert!(found.is_empty(), "{manifest} declares {language}");
}
// A vendored library's manifest is not the customer code's.
let found = findings_for(&["vendor/lib/package.json"], &["javascript"], &[], &[]);
assert_eq!(found.len(), 1);
}
#[test]
fn c_cpp_firmware_sources_and_yocto_never_ask_for_a_manifest() {
// An embedded C tree with a flashing script.
assert!(findings_for(&["tools/flash.py"], &["c", "python"], &[], &[]).is_empty());
assert!(findings_for(&["tools/flash.py"], &["cpp", "python"], &[], &[]).is_empty());
assert!(findings_for(&["lib/oe/x.py"], &["bitbake", "python"], &[], &[]).is_empty());
// Components read from the sources are an SBOM.
for manager in ["embedded", "codesys", "yocto-recipe"] {
let sbom = [entry(manager, None)];
assert!(
findings_for(&["main.py"], &["python"], &sbom, &[]).is_empty(),
"{manager}"
);
}
// So are the firmware SBOM and a Yocto layer tree.
let tree = Tree::with(&["main.py"]);
let languages = langs(&["python"]);
for (yocto_layers, firmware_sbom) in [(true, false), (false, true)] {
let found = coverage_findings(
&ScannedTree {
repo_id: "t1",
root: &tree.0,
vendor: &[],
languages: &languages,
yocto_layers,
firmware_sbom,
},
&[],
&[],
);
assert!(
found.is_empty(),
"yocto {yocto_layers}, firmware {firmware_sbom}"
);
}
}
#[test]
fn components_of_the_ecosystem_already_listed_need_no_manifest() {
// Committed jars give Maven components without a pom.xml.
let sbom = [entry("maven", Some("pkg:maven/org.slf4j/slf4j-api@2.0.9"))];
assert!(findings_for(&["Main.java"], &["java"], &sbom, &[]).is_empty());
// Components of another ecosystem do not.
let found = findings_for(&["Main.java", "main.py"], &["java", "python"], &sbom, &[]);
assert_eq!(found.len(), 1);
assert!(found[0].title.contains("Python"));
}
#[test]
fn dart_is_covered() {
let found = findings_for(&["lib/main.dart"], &["dart"], &[], &[]);
assert_eq!(found.len(), 1);
assert!(found[0]
.remediation
.as_deref()
.is_some_and(|r| r.contains("pubspec.lock")));
}
#[test]
fn an_unresolved_manifest_is_a_low_finding_and_legacy_builds_are_not_repeated() {
let found = findings_for(
&["Cargo.toml", "src/main.rs"],
&["rust"],
&[],
&[
unlocked("Cargo.toml", false),
unlocked("app/project.properties", true),
],
);
assert_eq!(found.len(), 1);
let f = &found[0];
assert_eq!(f.severity, Severity::Low);
assert_eq!(f.rule_id.as_deref(), Some(UNRESOLVED_RULE));
assert_eq!(f.file_path.as_deref(), Some("Cargo.toml"));
assert_eq!(f.line_number, None);
assert_eq!(f.control_refs, [SBOM_CONTROL]);
assert_eq!(
f.title,
"Dependencies not resolved: the SBOM is incomplete (Cargo.toml)"
);
assert!(f
.description
.starts_with("Cargo.toml declares dependencies but no lockfile pins them."));
assert_eq!(
f.remediation.as_deref(),
Some("Commit Cargo.lock. The finding closes at the next scan that finds the lockfile.")
);
}
#[test]
fn the_stamped_requirement_is_the_one_the_control_map_binds() {
let map = control_map::ControlMap::cra().expect("map");
for rule in [NO_MANIFEST_RULE, UNRESOLVED_RULE] {
let controls: Vec<&str> = map
.bindings_for_finding(SCANNER, Some(CWE), Some(rule))
.into_iter()
.map(|(entry, _)| entry.control.as_str())
.collect();
assert_eq!(controls, [SBOM_CONTROL], "{rule}");
}
}
#[test]
fn a_tree_without_package_manager_code_has_no_findings() {
assert!(findings_for(&["README.md"], &[], &[], &[]).is_empty());
assert!(findings_for(&["App.swift"], &["swift"], &[], &[]).is_empty());
}
}
@@ -147,6 +147,7 @@ pub(crate) fn unlocked_mobile_ecosystems(root: &Path) -> Vec<UnlockedEcosystem>
manifest,
problem: eco.problem,
remedy: eco.remedy,
legacy_build: false,
})
})
.collect()
@@ -1,5 +1,6 @@
mod cargo_audit;
pub(crate) mod carthage;
pub(crate) mod coverage;
mod distribution;
mod gradle;
mod mobile;
@@ -224,6 +225,9 @@ pub(crate) struct UnlockedEcosystem {
pub problem: &'static str,
/// What to commit so they are.
pub remedy: &'static str,
/// A legacy build system ([`crate::pipeline::build_lifecycle`]), which
/// is a finding of its own already.
pub legacy_build: bool,
}
/// Lockfiles that pin an npm-registry project. Bun's count: npm must never
@@ -266,12 +270,14 @@ pub(crate) fn unlocked_ecosystems(
manifest: "package.json".into(),
problem: "is locked only by bun.lockb, Bun's binary lockfile, which is not read",
remedy: "commit the text bun.lock (`bun install --save-text-lockfile`)",
legacy_build: false,
});
} else if !readable {
out.push(UnlockedEcosystem {
manifest: "package.json".into(),
problem: "declares dependencies but no lockfile pins them",
remedy: "commit package-lock.json, yarn.lock, pnpm-lock.yaml or bun.lock",
legacy_build: false,
});
}
}
@@ -284,6 +290,7 @@ pub(crate) fn unlocked_ecosystems(
manifest: manifest.into(),
problem: "declares dependencies but no lockfile pins them",
remedy: "commit requirements.txt, poetry.lock, Pipfile.lock or uv.lock",
legacy_build: false,
});
}
}
@@ -292,6 +299,7 @@ pub(crate) fn unlocked_ecosystems(
manifest: "Cargo.toml".into(),
problem: "declares dependencies but no lockfile pins them",
remedy: "commit Cargo.lock",
legacy_build: false,
});
}
out.extend(mobile::unlocked_mobile_ecosystems(repo_path));
@@ -307,6 +315,7 @@ pub(crate) fn unlocked_ecosystems(
Packages/manifest.json) whose dependencies cannot be read",
remedy: "migrate the build (Gradle with the Android Gradle Plugin, or a \
current Unity LTS with the Package Manager)",
legacy_build: true,
}),
);
out.extend(nuget::unresolved_projects(repo_path, resolved_nuget));
@@ -250,6 +250,7 @@ pub(crate) fn unresolved_projects(root: &Path, resolved: &[String]) -> Vec<Unloc
remedy: "set <RestorePackagesWithLockFile>true</RestorePackagesWithLockFile> (in the \
project or a Directory.Build.props), restore once and commit \
packages.lock.json",
legacy_build: false,
}]
}
+1 -1
View File
@@ -1,6 +1,6 @@
[package]
name = "compliance-core"
version = "0.4.6"
version = "0.4.15"
edition = "2021"
[lints]
+1 -1
View File
@@ -85,7 +85,7 @@ pub use project::{Project, ProjectKind};
pub use repository::ScanTrigger;
pub use sbom::{
ComponentHash, InImage, InImageBasis, SbomEntry, SbomQuality, SbomQualityCheck,
SbomQualityProfile, VulnRef, YOCTO_RECIPE_MANAGER, YOCTO_RECIPE_SOURCE,
SbomQualityProfile, VulnRef, SBOM_COVERAGE_SCANNER, YOCTO_RECIPE_MANAGER, YOCTO_RECIPE_SOURCE,
};
pub use scan::{
RunErrorCode, RunNote, ScanPhase, ScanRun, ScanRunStatus, ScanStep, ScanType, SkipCode,
+35
View File
@@ -569,6 +569,19 @@ impl OnboardedTarget {
&& classification.suggested != self.target_type;
detected.then_some(classification.suggested)
}
/// Whether Prüfwerk opens tickets for this target's findings on its own:
/// the target came from a managed git source, or an issue tracker of a
/// known type is configured on it. A tracker block without a type opens
/// nothing, so it does not count.
pub fn issue_tracker_connected(&self) -> bool {
self.source_repo.is_some()
|| self
.scan_config
.issue_tracker
.as_ref()
.is_some_and(|tracker| tracker.tracker_type.is_some())
}
}
pub fn default_compliance_profile(target_type: TargetType) -> ComplianceProfile {
@@ -802,6 +815,28 @@ mod tests {
assert_eq!(onboarded.detected_type(&android), None);
}
#[test]
fn a_target_has_a_tracker_when_one_is_set_or_it_is_managed() {
let mut target = OnboardedTarget::new("fw".into(), TargetType::BackendService);
assert!(!target.issue_tracker_connected());
// A tracker block without a type cannot open tickets.
target.scan_config.issue_tracker = Some(IssueTrackerConfig::default());
assert!(!target.issue_tracker_connected());
target.scan_config.issue_tracker = Some(IssueTrackerConfig {
tracker_type: Some(TrackerType::GitLab),
..Default::default()
});
assert!(target.issue_tracker_connected());
// A managed repository's issues are opened by its git source.
let mut managed = OnboardedTarget::new("gt-mobile".into(), TargetType::BackendService);
managed.source_repo = Some(super::super::git_source::SourceRepo {
base_url: "https://kunde.code.example".into(),
repo_id: 7,
full_name: "kunde/gt-mobile".into(),
});
assert!(managed.issue_tracker_connected());
}
fn sample_target() -> OnboardedTarget {
let mut t = OnboardedTarget::new("acme-web".to_string(), TargetType::WebApp);
t.artifacts.push(Artifact::git_repo(
+5
View File
@@ -27,6 +27,11 @@ impl VulnRef {
/// in a layer tree, without a build.
pub const YOCTO_RECIPE_MANAGER: &str = "yocto-recipe";
/// The scanner (`Finding::scanner`) of the findings that say why a target's
/// SBOM is empty or incomplete: code without a manifest, and manifests whose
/// dependencies were not resolved (#979).
pub const SBOM_COVERAGE_SCANNER: &str = "sbom-coverage";
/// Where a [`YOCTO_RECIPE_MANAGER`] component comes from, as the SBOM view,
/// the exports and the evidence say it. Layer overrides, PACKAGECONFIG and
/// what the image installs are not resolved, so the inventory lists more than
+76 -12
View File
@@ -93,11 +93,28 @@ impl std::fmt::Display for TenantStatus {
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[serde(rename_all = "UPPERCASE")]
pub enum OrgRole {
/// The organisation's owner: in Prüfwerk the same rights as `IT_ADMIN`,
/// as on the rest of the platform.
Owner,
ItAdmin,
Cxo,
Finance,
Legal,
User,
/// Product security (RBAC step 4): full access, triages and scans.
Psirt,
/// Development (RBAC step 4): full access, triages and scans.
Development,
/// Quality (RBAC step 4): read only.
Quality,
/// Privacy (RBAC step 4): no access to Prüfwerk.
Privacy,
/// Purchasing (RBAC step 4): read only.
Purchasing,
/// Auditor (RBAC step 4): read only.
Auditor,
/// External (RBAC step 4): no access to Prüfwerk.
External,
/// Anything we haven't enumerated yet — forwards-compatible.
#[serde(other)]
Unknown,
@@ -108,23 +125,43 @@ impl OrgRole {
/// `CXO`, etc.). Round-trips with the JSON layer.
pub fn parse(s: &str) -> Self {
match s {
"OWNER" => OrgRole::Owner,
"IT_ADMIN" => OrgRole::ItAdmin,
"CXO" => OrgRole::Cxo,
"FINANCE" => OrgRole::Finance,
"LEGAL" => OrgRole::Legal,
"USER" => OrgRole::User,
"PSIRT" => OrgRole::Psirt,
"DEVELOPMENT" => OrgRole::Development,
"QUALITY" => OrgRole::Quality,
"PRIVACY" => OrgRole::Privacy,
"PURCHASING" => OrgRole::Purchasing,
"AUDITOR" => OrgRole::Auditor,
"EXTERNAL" => OrgRole::External,
_ => OrgRole::Unknown,
}
}
/// Whether the role administers the organisation: `IT_ADMIN` or `OWNER`.
/// What only an administrator may do (manual findings, the git source)
/// asks this, not for `IT_ADMIN` alone.
pub fn is_admin(&self) -> bool {
matches!(self, OrgRole::Owner | OrgRole::ItAdmin)
}
}
/// What an organisation member may do in Prüfwerk, by their org roles
/// (decided 2026-09-30):
///
/// * `IT_ADMIN`, `USER` — [`ProductAccess::Full`]: read and write.
/// * `CXO`, `LEGAL` — [`ProductAccess::ReadOnly`]: findings, reports, SBOM,
/// evidence and exports, but no change of any kind.
/// * `FINANCE`, or none of these roles — [`ProductAccess::None`].
/// * `OWNER`, `IT_ADMIN`, `USER`, `PSIRT`, `DEVELOPMENT` —
/// [`ProductAccess::Full`]: read and write (`OWNER` added 2026-11-12: it has
/// `IT_ADMIN`'s rights platform-wide; `PSIRT` and `DEVELOPMENT` from RBAC
/// step 4, decided 2026-11-12).
/// * `CXO`, `LEGAL`, `QUALITY`, `PURCHASING`, `AUDITOR` —
/// [`ProductAccess::ReadOnly`]: findings, reports, SBOM, evidence and
/// exports, but no change of any kind.
/// * `FINANCE`, `PRIVACY`, `EXTERNAL`, or none of these roles —
/// [`ProductAccess::None`].
///
/// The strongest role a user holds wins. BreakPilot support sessions are not
/// judged by org roles (see [`TenantContext::product_access`]).
@@ -143,15 +180,20 @@ pub enum ProductAccess {
impl ProductAccess {
/// The access the org `roles` grant.
pub fn for_roles(roles: &[OrgRole]) -> Self {
if roles
.iter()
.any(|r| matches!(r, OrgRole::ItAdmin | OrgRole::User))
{
if roles.iter().any(|r| {
r.is_admin() || matches!(r, OrgRole::User | OrgRole::Psirt | OrgRole::Development)
}) {
Self::Full
} else if roles
.iter()
.any(|r| matches!(r, OrgRole::Cxo | OrgRole::Legal))
{
} else if roles.iter().any(|r| {
matches!(
r,
OrgRole::Cxo
| OrgRole::Legal
| OrgRole::Quality
| OrgRole::Purchasing
| OrgRole::Auditor
)
}) {
Self::ReadOnly
} else {
Self::None
@@ -293,6 +335,11 @@ impl TenantContext {
ProductAccess::for_roles(&self.org_roles)
}
/// True if the caller holds `IT_ADMIN` or `OWNER`.
pub fn is_admin(&self) -> bool {
self.org_roles.iter().any(OrgRole::is_admin)
}
/// True if the caller holds at least one of the listed roles.
pub fn has_any_role(&self, roles: &[OrgRole]) -> bool {
self.org_roles.iter().any(|r| roles.contains(r))
@@ -306,6 +353,14 @@ mod tests {
#[test]
fn org_role_parses_known_values() {
assert_eq!(OrgRole::parse("IT_ADMIN"), OrgRole::ItAdmin);
assert_eq!(OrgRole::parse("OWNER"), OrgRole::Owner);
assert_eq!(OrgRole::parse("PSIRT"), OrgRole::Psirt);
assert_eq!(OrgRole::parse("DEVELOPMENT"), OrgRole::Development);
assert_eq!(OrgRole::parse("QUALITY"), OrgRole::Quality);
assert_eq!(OrgRole::parse("PRIVACY"), OrgRole::Privacy);
assert_eq!(OrgRole::parse("PURCHASING"), OrgRole::Purchasing);
assert_eq!(OrgRole::parse("AUDITOR"), OrgRole::Auditor);
assert_eq!(OrgRole::parse("EXTERNAL"), OrgRole::External);
assert_eq!(OrgRole::parse("CXO"), OrgRole::Cxo);
assert_eq!(OrgRole::parse("USER"), OrgRole::User);
}
@@ -338,6 +393,15 @@ mod tests {
use OrgRole::*;
let cases: &[(&[OrgRole], ProductAccess)] = &[
(&[ItAdmin], ProductAccess::Full),
(&[Owner], ProductAccess::Full),
(&[Psirt], ProductAccess::Full),
(&[Development], ProductAccess::Full),
(&[Quality], ProductAccess::ReadOnly),
(&[Purchasing], ProductAccess::ReadOnly),
(&[Auditor], ProductAccess::ReadOnly),
(&[Privacy], ProductAccess::None),
(&[External], ProductAccess::None),
(&[External, Auditor], ProductAccess::ReadOnly),
(&[User], ProductAccess::Full),
(&[Cxo], ProductAccess::ReadOnly),
(&[Legal], ProductAccess::ReadOnly),
+1 -1
View File
@@ -1,6 +1,6 @@
[package]
name = "compliance-dashboard"
version = "0.4.6"
version = "0.4.15"
edition = "2021"
default-run = "compliance-dashboard"
+186 -1
View File
@@ -638,6 +638,56 @@ code {
color: var(--text-primary);
}
/* ── A finding as ticket text, and the Breakpilot Git hint ── */
.ticket-bar {
display: flex;
flex-wrap: wrap;
align-items: center;
gap: 8px 12px;
margin-bottom: 16px;
}
.ticket-bar .btn {
display: inline-flex;
align-items: center;
gap: 6px;
font-size: 12.5px;
padding: 5px 10px;
}
.ticket-copied {
display: inline-flex;
align-items: center;
gap: 4px;
font-size: 12.5px;
color: var(--success);
}
.ticket-copy-failed {
color: var(--danger);
}
.ticket-hint {
display: inline-flex;
flex-wrap: wrap;
align-items: center;
gap: 4px 6px;
margin: 0;
font-size: 12.5px;
color: var(--text-secondary);
}
.ticket-hint svg {
color: var(--accent);
flex-shrink: 0;
}
.ticket-hint a {
color: var(--accent);
font-weight: 500;
}
/* ── Page Header ── */
@@ -1275,6 +1325,108 @@ tbody tr:last-child td {
margin-top: 20px;
}
/* A dialog never grows past the window: its content scrolls, and the actions
stay pinned at the bottom so Save is always reachable. */
.modal-dialog {
max-height: calc(100vh - 32px);
max-height: calc(100dvh - 32px);
overflow-y: auto;
overscroll-behavior: contain;
}
.modal-dialog .modal-actions {
position: sticky;
bottom: -18px;
margin: 20px -18px -18px;
padding: 12px 18px;
background: var(--bg-card-solid);
border-top: 1px solid var(--border);
}
/* Forms with sections (the target editor). */
.modal-dialog.modal-wide {
max-width: 680px;
}
.modal-section {
border-top: 1px solid var(--border);
margin-top: 16px;
padding-top: 14px;
}
.modal-section > .target-subhead {
margin-top: 0;
}
/* A stored artifact: its reference, token state and actions on one line. */
.artifact-row {
display: flex;
flex-wrap: wrap;
align-items: center;
gap: 8px;
padding: 6px 0;
}
.artifact-row-ref {
flex: 1 1 100%;
font-size: 13px;
overflow-wrap: anywhere;
}
.form-fields .artifact-row input {
flex: 1 1 200px;
width: auto;
}
/* Adding a reference: kind and reference on one line, branch, token and the
button on the next, all filling the width. */
.artifact-add {
display: flex;
flex-wrap: wrap;
align-items: flex-end;
gap: 10px;
margin-top: 10px;
}
.artifact-add .form-group {
margin: 0;
}
.artifact-add-kind {
flex: 1 1 200px;
}
.artifact-add-ref {
flex: 1 1 280px;
}
.artifact-add-branch {
flex: 1 1 160px;
}
.artifact-add-token {
flex: 1 1 200px;
}
/* Inside a dialog the project picker is a section like the others, not a
framed box. */
.modal-dialog .project-picker {
margin: 0;
padding: 0;
border: 0;
}
.modal-dialog .project-picker legend {
padding: 0;
margin-bottom: 6px;
font-family: var(--font-mono);
font-size: 11px;
font-weight: 500;
letter-spacing: 0.06em;
text-transform: uppercase;
color: var(--text-tertiary);
}
/* The portal's default button: surface, hairline border. */
.btn-secondary {
background: var(--bg-card);
@@ -2725,6 +2877,33 @@ tbody tr:last-child td {
margin-bottom: 16px;
}
/* The empty component table (#979): why, and what to add. */
.sbom-empty p {
margin: 0 0 10px;
font-size: 14px;
line-height: 1.5;
}
.sbom-empty-findings {
margin: 0;
padding: 0;
list-style: none;
display: grid;
gap: 12px;
}
.sbom-empty-findings li {
padding: 10px 12px;
border-left: 3px solid var(--accent);
background: var(--accent-muted);
border-radius: 4px;
}
.sbom-empty-findings li p {
margin: 4px 0 6px;
color: var(--text-secondary);
}
.sbom-quality-head {
margin: 0 0 4px;
font-size: 15px;
@@ -5726,13 +5905,19 @@ tbody tr:last-child td {
.artifact-upload-row .form-group {
margin: 0;
min-width: 160px;
flex: 1 1 200px;
}
.artifact-upload-file {
flex: 1;
flex: 2 1 260px;
min-width: 220px;
}
/* The archive password gets its own line: its label is long. */
.artifact-upload-row .artifact-upload-password {
flex: 1 1 100%;
}
.artifact-upload-note {
font-size: 12.5px;
color: var(--success);
@@ -66,7 +66,7 @@ pub fn ArtifactUpload(target_id: String, on_uploaded: EventHandler<()>) -> Eleme
}
// Firmware images and build outputs are never unpacked.
if kind() != "firmware_image" && kind() != "build_output" {
div { class: "form-group",
div { class: "form-group artifact-upload-password",
label { {common::ARCHIVE_PASSWORD.get(lang)} }
input {
r#type: "password",
@@ -5,7 +5,7 @@
use dioxus::prelude::*;
use crate::app::Route;
use crate::i18n::texts::{common, cra_tiles as tx};
use crate::i18n::texts::{common, compliance, cra_tiles as tx};
use crate::i18n::use_lang;
use crate::infrastructure::evidence::fetch_compliance;
use crate::pages::compliance::{ControlRow, STATES};
@@ -157,7 +157,7 @@ pub fn CraTiles(target_id: String, control: Option<String>) -> Element {
}
}
}
p { class: "ct-hint", {tx::HINT.get(lang)} }
p { class: "ct-hint", {tx::HINT.get(lang)} " " {compliance::NOT_LEGAL_ADVICE.get(lang)} }
}
}
}
@@ -514,7 +514,10 @@ pub fn phase(phase: &ScanPhase) -> Text {
ScanPhase::MobileStatic => ("Mobile-App-Analyse", "Mobile app analysis"),
ScanPhase::ContainerScan => ("Container-Analyse", "Container analysis"),
ScanPhase::LlmTriage => ("Befunde bewerten", "Triaging findings"),
ScanPhase::ControlTriage => ("CRA-Anforderungen zuordnen", "Mapping CRA requirements"),
ScanPhase::ControlTriage => (
"Bezug zu CRA-Themen ermitteln (technischer Hinweis)",
"Finding links to CRA topics (technical hint)",
),
ScanPhase::SemanticControlMapping => ("Controls zuordnen", "Mapping controls"),
ScanPhase::GroundedControlChecks => {
("Controls im Code prüfen", "Checking controls in code")
+96 -14
View File
@@ -2131,8 +2131,8 @@ pub mod findings {
en: "CRA",
};
pub const CONTROLS_HINT: Text = Text {
de: "CRA-Anforderungen, für die dieser Befund relevant ist",
en: "CRA requirements this finding is evidence for",
de: "CRA-Themen, auf die dieser Befund hinweist",
en: "CRA topics this finding points to",
};
pub const COL_STATUS: Text = Text {
de: "Status",
@@ -2183,8 +2183,8 @@ pub mod findings {
en: "The target's CRA status",
};
pub const CRA_REFS: Text = Text {
de: "CRA-Anforderungen (Anhang I)",
en: "CRA requirements (Annex I)",
de: "CRA-Themen (Anhang I)",
en: "CRA topics (Annex I)",
};
pub const CONFIDENCE: Text = Text {
de: "Konfidenz",
@@ -2240,6 +2240,42 @@ pub mod findings {
de: "Erfasst von",
en: "Reported by",
};
/// The button that copies one finding as Markdown for a ticket.
pub const COPY_TICKET: Text = Text {
de: "Als Ticket-Text kopieren",
en: "Copy as ticket text",
};
pub const COPIED: Text = Text {
de: "Kopiert",
en: "Copied",
};
pub const COPY_FAILED: Text = Text {
de: "Kopieren fehlgeschlagen",
en: "Copy failed",
};
/// Shown on a finding whose target opens no tickets on its own.
pub const TICKET_HINT: Text = Text {
de: "Mit Breakpilot Git werden Tickets automatisch angelegt.",
en: "With Breakpilot Git, tickets are created automatically.",
};
pub const CONNECT_TRACKER: Text = Text {
de: "Tracker für dieses Prüfobjekt anbinden",
en: "Connect a tracker to this target",
};
pub const MANAGED_GIT_GUIDE: Text = Text {
de: "Anleitung Managed Git",
en: "Managed Git guide",
};
/// The copied ticket text's section on the CRA topics.
pub const CRA_TOPICS: Text = Text {
de: "CRA-Themen",
en: "CRA topics",
};
/// The copied ticket text's link back to the finding.
pub const OPEN_IN_PRUEFWERK: Text = Text {
de: "Im Prüfwerk öffnen",
en: "Open in Prüfwerk",
};
/// A finding status in words. Exhaustive: a new status needs both.
pub fn status(status: &FindingStatus) -> Text {
@@ -2481,6 +2517,10 @@ pub mod findings {
de: "Build-System und Plattform",
en: "Build system and platform",
},
compliance_core::models::SBOM_COVERAGE_SCANNER => Text {
de: "Vollständigkeit der Stückliste",
en: "SBOM completeness",
},
"clamav" => Text {
de: "Schadsoftware (ClamAV)",
en: "Malware (ClamAV)",
@@ -2858,6 +2898,41 @@ pub mod sbom {
de: "Die Komponenten Ihrer Software, ihre Lizenzen und bekannte Schwachstellen (CVE)",
en: "Software bill of materials: dependencies, licenses and known vulnerabilities",
};
/// The empty state of the component table (#979).
pub const EMPTY_TITLE: Text = Text {
de: "Keine Komponenten gefunden",
en: "No components found",
};
/// Why the component table is empty.
pub const EMPTY_WHY: Text = Text {
de: "Die Stückliste entsteht aus den Paketmanifesten und Lockfiles im Code (etwa \
requirements.txt, package-lock.json oder Cargo.lock), aus den Firmware-Quellen \
oder aus einem SPS-Projektarchiv. Die letzte Prüfung hat dort keine Komponenten \
gefunden. Das heißt nicht, dass die Software keine Bibliotheken verwendet.",
en: "The SBOM is built from the package manifests and lockfiles in the code (such as \
requirements.txt, package-lock.json or Cargo.lock), from the firmware sources or \
from a PLC project archive. The last scan found no components there. That does \
not mean the software uses no libraries.",
};
/// How to fill the component table, by example.
pub const EMPTY_EXAMPLE: Text = Text {
de: "Zum Beispiel: Für Python schreibt pip freeze > requirements.txt die Bibliotheken \
in eine requirements.txt, für JavaScript schreibt npm install die \
package-lock.json, für Rust gehört die Cargo.lock ins Repository. Nach der \
nächsten Prüfung stehen die Komponenten hier.",
en: "For example: for Python, pip freeze > requirements.txt writes the libraries to a \
requirements.txt; for JavaScript, npm install writes package-lock.json; for Rust, \
commit Cargo.lock. After the next scan the components are listed here.",
};
/// Above the open findings that say what is missing.
pub const EMPTY_FINDINGS: Text = Text {
de: "Was in diesem Prüfobjekt fehlt und wie Sie es ergänzen:",
en: "What this target is missing, and how to add it:",
};
pub const OPEN_FINDING: Text = Text {
de: "Zum Befund",
en: "Open the finding",
};
pub const PACKAGES_TAB: Text = Text {
de: "Pakete",
en: "Packages",
@@ -3681,8 +3756,13 @@ pub mod compliance {
en: "CRA status",
};
pub const SUBTITLE: Text = Text {
de: "Befunde aus der Prüfung, zugeordnet zu den grundlegenden Anforderungen des Cyber Resilience Act (Anhang I)",
en: "Scan findings mapped to the Cyber Resilience Act's essential requirements (Annex I)",
de: "Befunde aus der Prüfung mit Bezug zu den Themen der grundlegenden Anforderungen des Cyber Resilience Act (Anhang I)",
en: "Scan findings linked to the topics of the Cyber Resilience Act's essential requirements (Annex I)",
};
/// Shown with every CRA status view: the mapping is a technical hint (#978).
pub const NOT_LEGAL_ADVICE: Text = Text {
de: "Technische Hinweise, keine rechtliche Bewertung.",
en: "Technical hints, not a legal assessment.",
};
pub const OPEN: Text = Text {
de: "CRA-Status anzeigen",
@@ -3856,6 +3936,7 @@ pub mod compliance {
"csharp" => "C#",
"vb" => "Visual Basic",
"swift" => "Swift",
"dart" => "Dart",
"structured_text" => "Structured Text",
"plcopen" => "PLCopen XML",
other => other,
@@ -4651,8 +4732,9 @@ mod run_error_tests {
}
}
/// What a user's org role allows (`IT_ADMIN` / `USER` everything, `CXO` /
/// `LEGAL` reading, `FINANCE` and no role nothing).
/// What a user's org role allows (`OWNER` / `IT_ADMIN` / `USER` / `PSIRT` /
/// `DEVELOPMENT` everything; `CXO` / `LEGAL` / `QUALITY` / `PURCHASING` /
/// `AUDITOR` reading; `FINANCE`, `PRIVACY`, `EXTERNAL` and no role nothing).
pub mod access {
use super::Text;
@@ -5043,8 +5125,8 @@ pub mod license_review {
en: "No licence is known for this component. Confirm its licence first; then it can be approved or rejected.",
};
pub const CONFIRM_FIRST_OTHERS: Text = Text {
de: "Lizenz zuerst bestätigen (IT_ADMIN oder USER)",
en: "Licence to be confirmed first (IT_ADMIN or USER)",
de: "Lizenz zuerst bestätigen (eine Rolle mit Schreibzugriff)",
en: "Licence to be confirmed first (a role that may change data)",
};
pub const IN_TARGETS: Text = Text {
de: "in {n} Prüfobjekten",
@@ -5143,12 +5225,12 @@ pub mod license_review {
en: "Licence policy",
};
pub const POLICY_HINT: Text = Text {
de: "Was eine Lizenz braucht, bevor die Komponente verwendet wird. Ändern dürfen LEGAL und IT_ADMIN.",
en: "What a licence needs before the component is used. LEGAL and IT_ADMIN may change it.",
de: "Was eine Lizenz braucht, bevor die Komponente verwendet wird. Ändern dürfen LEGAL, IT_ADMIN und OWNER.",
en: "What a licence needs before the component is used. LEGAL, IT_ADMIN and OWNER may change it.",
};
pub const POLICY_READ_ONLY: Text = Text {
de: "Nur LEGAL und IT_ADMIN können die Richtlinie ändern.",
en: "Only LEGAL and IT_ADMIN can change the policy.",
de: "Nur LEGAL, IT_ADMIN und OWNER können die Richtlinie ändern.",
en: "Only LEGAL, IT_ADMIN and OWNER can change the policy.",
};
pub const POLICY_CATEGORY: Text = Text {
de: "Art der Lizenz",
@@ -18,6 +18,8 @@ pub struct FindingsQuery {
pub status: String,
pub repo_id: String,
pub q: String,
/// One scanner (`Finding::scanner`), or empty for all.
pub scanner: String,
/// One app variant (`Tablet App`), or empty for all.
pub variant: String,
/// One folder of the folder chart (`src/`, `src/*`, `/`), or empty.
@@ -104,6 +106,9 @@ pub async fn fetch_findings(query: FindingsQuery) -> Result<FindingsListResponse
if !query.status.is_empty() {
path.push_str(&format!("&status={}", query.status));
}
if !query.scanner.is_empty() {
path.push_str(&format!("&scanner={}", query.scanner));
}
if !query.repo_id.is_empty() {
path.push_str(&format!("&repo_id={}", query.repo_id));
}
@@ -193,7 +193,7 @@ pub struct LicenseCheckData {
/// Whether the requester may decide reviews and change the policy.
#[serde(default)]
pub may_decide: bool,
/// Whether the requester may confirm licences (IT_ADMIN, USER).
/// Whether the requester may confirm licences (any role with full access).
#[serde(default)]
pub may_confirm: bool,
}
@@ -79,6 +79,7 @@ pub fn CompliancePage(id: String) -> Element {
div { class: "target-head-text",
h2 { {tx::TITLE.get(lang)} }
p { class: "target-head-meta", {tx::SUBTITLE.get(lang)} }
p { class: "target-head-meta", {tx::NOT_LEGAL_ADVICE.get(lang)} }
}
div { class: "target-head-actions",
EvidencePackButton { target_id: id.clone() }
@@ -7,14 +7,14 @@ use crate::components::code_snippet::CodeSnippet;
use crate::components::markdown::render_markdown;
use crate::components::page_header::PageHeader;
use crate::components::severity_badge::SeverityBadge;
use crate::i18n::texts::{common, findings as tx, graph as graph_tx};
use crate::i18n::{format_count, format_time, use_lang};
use crate::i18n::texts::{common, finding_breakdown, findings as tx, graph as graph_tx};
use crate::i18n::{format_count, format_time, use_lang, Lang};
use crate::infrastructure::evidence::{fetch_catalog_controls, CatalogControl};
use crate::infrastructure::findings::{location, mask_secrets, wire_name};
use crate::infrastructure::graph::fetch_impact;
use crate::pages::findings::status_icon;
use crate::pages::graph_view::impact_has_content;
use compliance_core::models::{FindingStatus, ReviewReason, ScanType};
use compliance_core::models::{Finding, FindingStatus, ReviewReason, ScanType};
/// What happened to the last save on this page, shown next to what was saved.
#[derive(Debug, Clone, PartialEq)]
@@ -38,6 +38,9 @@ pub fn FindingDetailPage(id: String) -> Element {
// before it is saved.
let mut reasoning_for = use_signal(|| Option::<FindingStatus>::None);
let mut risk_reason = use_signal(String::new);
// The last copy as ticket text: `Some(true)` copied, `Some(false)` the
// browser refused; cleared after a moment.
let mut ticket_copied = use_signal(|| Option::<bool>::None);
let mut finding = use_resource(move || {
let fid = finding_id.clone();
@@ -137,6 +140,58 @@ pub fn FindingDetailPage(id: String) -> Element {
.iter()
.cloned()
.partition(|c| c.starts_with("cra-"));
let cra_topics: Vec<(String, Option<String>)> = cra_refs
.into_iter()
.map(|c| {
let title = control_title(&c);
(c, title)
})
.collect();
// Offer Breakpilot Git only once the agent said the target opens
// no tickets (not while loading), and not on a finding with one.
let show_ticket_hint = f.tracker_issue_url.is_none()
&& status_data
.as_ref()
.and_then(|d| d["issue_tracker_connected"].as_bool())
== Some(false);
let tracker_guide = docs_page(
&me.docs_url,
"guide/repositories#connecting-an-issue-tracker",
);
// The same path in both languages: the customer docs site
// (prod's `DOCS_URL`) keeps each page at one path per language
// root and has no `-en` pages.
let managed_git_guide = docs_page(&me.docs_url, "guide/managed-git");
// `move` closures take ownership (like a Python closure capturing
// by value), so the copy handler gets its own clones.
let finding_for_copy = f.clone();
let topics_for_copy = cra_topics.clone();
let finding_id_for_copy = id.clone();
let copy_ticket = move |_: MouseEvent| {
let link = format!(
"{}{}",
page_origin(),
Route::FindingDetailPage {
id: finding_id_for_copy.clone()
}
);
let text = ticket_markdown(&finding_for_copy, &topics_for_copy, &link, lang);
spawn(async move {
// A JSON string is a valid JavaScript string literal.
let copied = match serde_json::to_string(&text) {
Ok(literal) => document::eval(&format!(
"await navigator.clipboard.writeText({literal}); return true;"
))
.await
.is_ok(),
Err(_) => false,
};
ticket_copied.set(Some(copied));
#[cfg(feature = "web")]
gloo_timers::future::TimeoutFuture::new(2_000).await;
ticket_copied.set(None);
});
};
rsx! {
div { class: "back-nav",
button {
@@ -176,6 +231,40 @@ pub fn FindingDetailPage(id: String) -> Element {
}
}
div { class: "ticket-bar",
button {
class: "btn btn-ghost",
onclick: copy_ticket,
Icon { icon: BsClipboard, width: 14, height: 14 }
" {tx::COPY_TICKET.get(lang)}"
}
span { class: "ticket-copied", role: "status",
match ticket_copied() {
Some(true) => rsx! {
Icon { icon: BsCheckLg, width: 14, height: 14 }
" {tx::COPIED.get(lang)}"
},
Some(false) => rsx! {
span { class: "ticket-copy-failed", {tx::COPY_FAILED.get(lang)} }
},
None => rsx! {},
}
}
if show_ticket_hint {
p { class: "ticket-hint",
Icon { icon: BsInfoCircle, width: 14, height: 14 }
span { {tx::TICKET_HINT.get(lang)} }
a { href: "{tracker_guide}", target: "_blank", rel: "noopener",
{tx::CONNECT_TRACKER.get(lang)}
}
span { "·" }
a { href: "{managed_git_guide}", target: "_blank", rel: "noopener",
{tx::MANAGED_GIT_GUIDE.get(lang)}
}
}
}
}
div { class: "card",
div { class: "card-header", {tx::DESCRIPTION.get(lang)} }
// A semgrep rule's message is Markdown (paragraphs, code
@@ -220,10 +309,10 @@ pub fn FindingDetailPage(id: String) -> Element {
if !f.control_refs.is_empty() {
span { style: "opacity: 0.7;", {tx::CRA_REFS.get(lang)} }
ul { class: "finding-refs",
for c in cra_refs {
for (c, title) in cra_topics {
li {
span { class: "badge badge-info", "{c}" }
if let Some(title) = control_title(&c) {
if let Some(title) = title {
span { " {title}" }
}
}
@@ -579,10 +668,92 @@ fn tracker_note(
Some(format!("{} {login}", tx::tracker_change(kind).get(lang)))
}
/// One finding as Markdown for a ticket the user opens by hand: title,
/// severity, status, location, description, the AI's assessment, the CRA
/// topics and a link back. A committed secret is shortened as on screen.
///
/// # Arguments
///
/// * `finding` - the finding shown on the page
/// * `cra_topics` - its CRA control ids, each with its title when known
/// * `link` - the finding's page in Prüfwerk
/// * `lang` - the UI language, for the labels
///
/// # Returns
///
/// The Markdown text, ending in a newline.
fn ticket_markdown(
finding: &Finding,
cra_topics: &[(String, Option<String>)],
link: &str,
lang: Lang,
) -> String {
let shown = |text: &str| {
if finding.scan_type == ScanType::SecretDetection {
mask_secrets(text.trim())
} else {
text.trim().to_string()
}
};
let mut md = format!(
"## {}\n\n- **{}:** {}\n- **{}:** {}\n",
finding.title,
tx::COL_SEVERITY.get(lang),
finding_breakdown::severity(&finding.severity).get(lang),
tx::COL_STATUS.get(lang),
tx::finding_status(finding).get(lang),
);
if let Some(place) = location(finding.file_path.as_deref(), finding.line_number) {
md.push_str(&format!("- **{}:** `{place}`\n", tx::WHERE.get(lang)));
}
md.push_str(&format!(
"\n### {}\n\n{}\n",
tx::DESCRIPTION.get(lang),
shown(&finding.description)
));
if let Some(rationale) = &finding.triage_rationale {
md.push_str(&format!(
"\n### {}\n\n{}\n",
tx::TRIAGE.get(lang),
shown(rationale)
));
}
if !cra_topics.is_empty() {
md.push_str(&format!("\n### {}\n\n", tx::CRA_TOPICS.get(lang)));
for (id, title) in cra_topics {
match title {
Some(title) => md.push_str(&format!("- `{id}` {title}\n")),
None => md.push_str(&format!("- `{id}`\n")),
}
}
}
md.push_str(&format!(
"\n[{}]({link})\n",
tx::OPEN_IN_PRUEFWERK.get(lang)
));
md
}
/// A page of the docs site: `docs_url` is the site's root as configured
/// (`/docs/` or a full URL, with or without the trailing slash), `page` the
/// path below it (`guide/managed-git`).
fn docs_page(docs_url: &str, page: &str) -> String {
format!("{}/{page}", docs_url.trim_end_matches('/'))
}
/// The dashboard's origin (`https://pruefwerk.example`) in the browser; empty
/// elsewhere, which leaves a link relative.
fn page_origin() -> String {
#[cfg(feature = "web")]
if let Some(origin) = web_sys::window().and_then(|w| w.location().origin().ok()) {
return origin;
}
String::new()
}
#[cfg(test)]
mod tests {
use super::*;
use crate::i18n::Lang;
use compliance_core::models::{AuthInfo, StatusChange};
fn change(by: &str, by_name: Option<&str>) -> StatusChange {
@@ -664,4 +835,85 @@ mod tests {
assert_eq!(changed_by(&c, &me(), Lang::De), "Benutzer 0b7d51aa");
assert_eq!(changed_by(&c, &me(), Lang::En), "User 0b7d51aa");
}
fn sql_injection() -> Finding {
let mut f = Finding::new(
"repo".to_string(),
"fp".to_string(),
"semgrep".to_string(),
ScanType::Sast,
"SQL-Injection im Login".to_string(),
"Die Abfrage setzt Benutzereingaben direkt ein.\n".to_string(),
compliance_core::models::Severity::High,
);
f.file_path = Some("src/login.rs".to_string());
f.line_number = Some(42);
f.triage_rationale = Some("Erreichbar über das Login-Formular.".to_string());
f
}
#[test]
fn the_ticket_text_holds_the_finding_and_a_link_back() {
let topics = vec![
(
"cra-ai-2c".to_string(),
Some("Schutz vor unbefugtem Zugriff".to_string()),
),
("cra-ai-2f".to_string(), None),
];
let md = ticket_markdown(
&sql_injection(),
&topics,
"https://pruefwerk.example/findings/abc",
Lang::De,
);
assert_eq!(
md,
"## SQL-Injection im Login\n\n\
- **Schweregrad:** Hoch\n\
- **Status:** Offen\n\
- **Fundstelle:** `src/login.rs:42`\n\
\n### Beschreibung\n\nDie Abfrage setzt Benutzereingaben direkt ein.\n\
\n### Einschätzung\n\nErreichbar über das Login-Formular.\n\
\n### CRA-Themen\n\n\
- `cra-ai-2c` Schutz vor unbefugtem Zugriff\n\
- `cra-ai-2f`\n\
\n[Im Prüfwerk öffnen](https://pruefwerk.example/findings/abc)\n"
);
}
#[test]
fn the_ticket_text_leaves_out_what_the_finding_lacks() {
let mut f = sql_injection();
f.file_path = None;
f.triage_rationale = None;
let md = ticket_markdown(&f, &[], "/findings/abc", Lang::En);
assert!(md.contains("- **Severity:** High\n"));
assert!(!md.contains("Location"));
assert!(!md.contains("Triage"));
assert!(!md.contains("CRA topics"));
assert!(md.ends_with("\n[Open in Prüfwerk](/findings/abc)\n"));
}
#[test]
fn the_ticket_text_shortens_a_committed_secret() {
let mut f = sql_injection();
f.scan_type = ScanType::SecretDetection;
f.description = "Token ghp_a1B2c3D4e5F6g7H8i9J0 im Code".to_string();
let md = ticket_markdown(&f, &[], "/findings/abc", Lang::De);
assert!(!md.contains("ghp_a1B2c3D4e5F6g7H8i9J0"));
assert!(md.contains("ghp_••••••••"));
}
#[test]
fn a_docs_page_joins_the_configured_root() {
assert_eq!(
docs_page("/docs/", "guide/managed-git"),
"/docs/guide/managed-git"
);
assert_eq!(
docs_page("https://docs.example/pruefwerk/", "guide/managed-git"),
"https://docs.example/pruefwerk/guide/managed-git"
);
}
}
@@ -99,6 +99,7 @@ pub fn FindingsPage(
path: path_filter(),
sort_by: sort_by(),
sort_order: sort_order(),
..Default::default()
};
async move {
if grouped_view {
+71 -1
View File
@@ -1,4 +1,5 @@
use compliance_core::models::{LicenseConclusion, YOCTO_RECIPE_MANAGER};
use compliance_core::finding_breakdown::OPEN_STATUS_FILTER;
use compliance_core::models::{LicenseConclusion, SBOM_COVERAGE_SCANNER, YOCTO_RECIPE_MANAGER};
use dioxus::prelude::*;
use crate::app::Route;
@@ -13,6 +14,7 @@ use crate::components::pagination::Pagination;
use crate::components::toast::{ToastType, Toasts};
use crate::i18n::texts::{common, license_edit as lx, license_review as rx, sbom as tx};
use crate::i18n::{use_lang, Lang};
use crate::infrastructure::findings::{fetch_findings, FindingsQuery};
use crate::infrastructure::sbom::*;
use compliance_core::models::ReviewDecision;
@@ -109,6 +111,16 @@ pub fn SbomPage(target: String, #[props(default)] ecosystem: String) -> Element
}
});
// Only the target narrows the table: an empty one then means the SBOM
// is empty, not that nothing matched a filter.
let unfiltered = move || {
pm_filter().is_empty()
&& search_q().is_empty()
&& vuln_toggle().is_none()
&& license_filter().is_empty()
&& in_image_filter().is_none()
};
// ── SBOM quality of the selected target (#496) ──
let sbom_quality = use_resource(move || {
let repo = repo_filter();
@@ -336,6 +348,9 @@ pub fn SbomPage(target: String, #[props(default)] ecosystem: String) -> Element
// ── SBOM table ──
match &*sbom.read() {
Some(Some(resp)) if resp.data.is_empty() && unfiltered() => rsx! {
SbomEmpty { target_id: repo_filter() }
},
Some(Some(resp)) => {
let total_pages = resp.total.unwrap_or(0).div_ceil(50).max(1);
rsx! {
@@ -1039,6 +1054,61 @@ fn epss_label(epss: &EpssData) -> String {
)
}
/// The component table's empty state (#979): why the SBOM is empty, and the
/// target's open findings that say what it is missing and how to add it, or
/// an example where there are none (all targets, or code such as C that has
/// no standard manifest).
#[component]
fn SbomEmpty(target_id: ReadSignal<String>) -> Element {
let lang = use_lang()();
let findings = use_resource(move || async move {
let repo_id = target_id();
if repo_id.is_empty() {
return Vec::new();
}
fetch_findings(FindingsQuery {
page: 1,
repo_id,
scanner: SBOM_COVERAGE_SCANNER.to_string(),
status: OPEN_STATUS_FILTER.to_string(),
..Default::default()
})
.await
.map(|resp| resp.data)
.unwrap_or_default()
});
let findings = findings.read().clone().unwrap_or_default();
rsx! {
section { class: "card sbom-empty",
h3 { class: "sbom-quality-head", {tx::EMPTY_TITLE.get(lang)} }
p { {tx::EMPTY_WHY.get(lang)} }
if findings.is_empty() {
p { {tx::EMPTY_EXAMPLE.get(lang)} }
} else {
p { {tx::EMPTY_FINDINGS.get(lang)} }
ul { class: "sbom-empty-findings",
for finding in findings {
{
let id = finding.id.map(|id| id.to_hex()).unwrap_or_default();
rsx! {
li { key: "{id}",
strong { "{finding.title}" }
if let Some(remediation) = &finding.remediation {
p { "{remediation}" }
}
Link { to: Route::FindingDetailPage { id: id.clone() },
{tx::OPEN_FINDING.get(lang)}
}
}
}
}
}
}
}
}
}
}
/// The selected target's SBOM quality score: one line per profile, the checks
/// it does not meet folded under it.
fn sbom_quality_card(resp: SbomQualityResponse, lang: Lang) -> Element {
+16 -11
View File
@@ -573,7 +573,7 @@ fn TargetEditor(
};
rsx! {
div { class: "modal-overlay",
div { class: "modal-dialog form-fields",
div { class: "modal-dialog modal-wide form-fields",
h3 { {tx::EDIT_TITLE.get(lang)} }
div { class: "form-group",
label { {tx::COL_NAME.get(lang)} }
@@ -609,10 +609,11 @@ fn TargetEditor(
}
}
}
label { style: "font-weight: 600;", {tx::ARTIFACTS.get(lang)} }
div { class: "modal-section",
h4 { class: "target-subhead", {tx::ARTIFACTS.get(lang)} }
for (i, a) in edit_arts().iter().enumerate() {
div { style: "display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 4px 0; flex-wrap: wrap;",
span { style: "font-size: 0.9em;",
div { class: "artifact-row",
span { class: "artifact-row-ref",
span { style: "opacity: 0.7;", "{kinds::artifact_kind(&a.kind, lang)}: " }
span { style: "font-family: monospace;", "{a.source_ref}" }
if a.token.as_deref() == Some("") {
@@ -626,7 +627,6 @@ fn TargetEditor(
r#type: "password",
autocomplete: "off",
placeholder: tx::NEW_TOKEN.get(lang),
style: "flex: 1; min-width: 180px;",
oninput: move |e| {
let v = e.value();
edit_arts.write()[i].token = (!v.is_empty()).then_some(v);
@@ -655,8 +655,8 @@ fn TargetEditor(
}
}
}
div { style: "display: flex; gap: 8px; align-items: flex-end; margin-top: 8px;",
div { class: "form-group", style: "margin: 0;",
div { class: "artifact-add",
div { class: "form-group artifact-add-kind",
label { {tx::KIND.get(lang)} }
select {
value: "{e_kind}",
@@ -669,7 +669,7 @@ fn TargetEditor(
}
}
}
div { class: "form-group", style: "margin: 0; flex: 1;",
div { class: "form-group artifact-add-ref",
label { {tx::REFERENCE.get(lang)} }
input {
r#type: "text",
@@ -678,7 +678,7 @@ fn TargetEditor(
}
}
if e_kind() == "git_repo" {
div { class: "form-group", style: "margin: 0;",
div { class: "form-group artifact-add-branch",
label { {tx::BRANCH.get(lang)} }
input {
r#type: "text",
@@ -686,7 +686,7 @@ fn TargetEditor(
oninput: move |e| e_branch.set(e.value()),
}
}
div { class: "form-group", style: "margin: 0;",
div { class: "form-group artifact-add-token",
label { {tx::TOKEN.get(lang)} }
input {
r#type: "password",
@@ -724,6 +724,8 @@ fn TargetEditor(
if let Some(err) = e_source_err.clone() {
div { style: "color: var(--danger, #d33); font-size: 0.85em;", "{err}" }
}
}
div { class: "modal-section",
h4 { class: "target-subhead", {tx::UPLOAD_TITLE.get(lang)} }
ArtifactUpload {
target_id: eid.clone(),
@@ -734,7 +736,8 @@ fn TargetEditor(
on_saved.call(());
},
}
div { class: "form-group",
}
div { class: "modal-section form-group",
label { {tx::EXCLUDE_TITLE.get(lang)} }
textarea {
rows: "3",
@@ -751,6 +754,7 @@ fn TargetEditor(
div { style: "color: var(--danger, #d33); font-size: 0.85em;", "{err}" }
}
}
div { class: "modal-section",
match projects.read().clone() {
Some(Ok(list)) => rsx! { ProjectPicker { projects: list, selected: edit_projects } },
Some(Err(e)) => rsx! {
@@ -758,6 +762,7 @@ fn TargetEditor(
},
None => rsx! {},
}
}
div { class: "modal-actions",
button {
class: "btn btn-secondary",
+1 -1
View File
@@ -1,6 +1,6 @@
[package]
name = "compliance-dast"
version = "0.4.6"
version = "0.4.15"
edition = "2021"
[lints]
+1 -1
View File
@@ -1,6 +1,6 @@
[package]
name = "compliance-graph"
version = "0.4.6"
version = "0.4.15"
edition = "2021"
[lints]
+1 -1
View File
@@ -1,6 +1,6 @@
[package]
name = "compliance-mcp"
version = "0.4.6"
version = "0.4.15"
edition = "2021"
[dependencies]
+1 -1
View File
@@ -1,6 +1,6 @@
[package]
name = "compliance-smoke"
version = "0.4.6"
version = "0.4.15"
edition = "2021"
description = "Tiny Axum service exercising compliance-core M7.1 tenant gating. Run smoke.sh against it before merging anything that touches the auth/tenant path."
+1 -1
View File
@@ -1,6 +1,6 @@
[package]
name = "control-map"
version = "0.4.6"
version = "0.4.15"
edition = "2021"
[lints]
+23
View File
@@ -1254,6 +1254,29 @@
"legacy-build-system-no-sbom"
],
"check": "The product's components must be declared in a machine-readable form an SBOM can be built from; a build system that declares none (Eclipse/ADT, Unity without its package manifest) violates it."
},
{
"tool": "sbom-coverage",
"scan_type": "sbom",
"languages": [
"python",
"javascript",
"typescript",
"rust",
"go",
"java",
"kotlin",
"csharp",
"php",
"ruby",
"dart"
],
"cwe": [],
"rules": [
"sbom-no-manifest",
"sbom-dependencies-unresolved"
],
"check": "The product's components must be declared in a manifest or lockfile an SBOM can be built from; code in a language with a package manager and no manifest, or a manifest whose dependencies are not resolved, violates it."
}
],
"note": null,
+1 -1
View File
@@ -52,7 +52,7 @@ export default withMermaid(defineConfig({
{ text: 'Stückliste (SBOM) und Lizenzen', link: '/guide/sbom' },
{ text: 'Schwachstellen bewerten (VEX)', link: '/guide/vex' },
{ text: 'Assessing vulnerabilities (English)', link: '/guide/vex-en' },
{ text: 'CRA-Anforderungen', link: '/features/control-mapping' },
{ text: 'Bezug zu CRA-Themen', link: '/features/control-mapping' },
{ text: 'Daten und Aufbewahrung', link: '/guide/data-retention' },
],
},
+5
View File
@@ -1,5 +1,10 @@
# Compliance Control Mapping
::: info Technical hint, not a legal assessment
The link between a finding and a CRA topic is a technical hint from the scan.
It is not a legal assessment and not a conformity assessment.
:::
Control mapping connects the scanner's raw output — deterministic tool findings and the code itself — to the **compliance controls** each piece of evidence supports. A hardcoded credential stops being just "CWE-798 from semgrep" and becomes evidence for *"cra-ai-8: no default passwords"* and, at scale, master control *`mc-31761` hardcoded_secrets_detection*. Findings carry those references (`control_refs`) into the dashboard and out over the MCP server as OSCAL, so the compliance report is built from real, grounded findings rather than a questionnaire.
## The core principle: tools detect, the LLM judges
+21 -2
View File
@@ -75,8 +75,8 @@ in this order:
- **Beschreibung** (Description) -- what the issue is.
- **Fundstelle** (Location) -- the **Prüfobjekt** (a click opens its CRA
status), **Datei** (file and line), **Werkzeug** (tool), **Regel** (rule) and
**CRA-Anforderungen (Anhang I)**: the CRA Annex I requirements the finding is
mapped to, each with its title. Controls from the BreakPilot catalog are
**CRA-Themen (Anhang I)**: the CRA Annex I topics the finding points to (a
technical hint, not a legal assessment), each with its title. Controls from the BreakPilot catalog are
folded under **+N Kontrollen aus dem BreakPilot-Katalog**; click it to see
each control with what it requires.
- **Einschätzung** (Triage rationale) -- the automated review's reasoning, where
@@ -93,6 +93,24 @@ in this order:
- **Ihre Einschätzung** (Developer feedback) -- a free-text note, saved when you
leave the field.
### Turning a finding into a ticket
Below the badges, **Als Ticket-Text kopieren** (Copy as ticket text) copies
this one finding to the clipboard as Markdown: title, severity, status,
location (file and line), description, the automated review's assessment, the
**CRA-Themen** (CRA topics) and a link back to the finding in Prüfwerk. Paste
it into a new ticket in any tracker; **Kopiert** (Copied) confirms the copy.
The labels follow the dashboard's language, and a committed secret is
shortened as on the page.
When the finding's target has no issue tracker connected and the finding has
no ticket yet, a hint beside the button reads "Mit Breakpilot Git werden
Tickets automatisch angelegt" (With Breakpilot Git, tickets are created
automatically). It links to
[Connecting an Issue Tracker](/guide/repositories#connecting-an-issue-tracker)
and to [Managed Git](/guide/managed-git). A target counts as connected when an
issue tracker is configured on it or its repository comes from Managed Git.
## Severity Levels
| Severity | Description | Typical Examples |
@@ -116,6 +134,7 @@ The most common types in a scan of source code:
| **OAuth** | Prüfwerk's own pattern rules |
| **Code-Qualität** (Lint) | Linters, where the deployment runs them |
| **SPS-Steuerungslogik** (PLC control logic) | Prüfwerk's PLC analyser, see [SPS / PLC (CODESYS)](/guide/plc) |
| **Vollständigkeit der Stückliste** (SBOM completeness) | Code without a manifest or lockfile, and manifests whose dependencies were not resolved, see [SBOM](/guide/sbom#when-the-sbom-is-empty-or-incomplete) |
| **Penetrationstest**, **Dynamische Prüfung (DAST)** | Entered or imported by hand, see [Befunde aus manuellen Tests](/guide/manual-findings) |
## Statuses
+7 -7
View File
@@ -17,8 +17,8 @@ in the sidebar switches it to English.
- **PLC control logic** -- security rules for IEC 61131-3 programs
- **AI triage** -- an LLM reviews each new finding and gives a confidence,
a rationale and a remediation; findings it doubts are marked for review
- **CRA mapping** -- findings are assigned to the CRA Annex I requirements they
are evidence for
- **CRA topics** -- each finding is linked to the CRA Annex I topics it points
to (a technical hint, not a legal assessment)
## The Overview
@@ -35,11 +35,11 @@ What you can do in Prüfwerk depends on your role in the workspace:
| Role | Prüfwerk |
| --- | --- |
| `IT_ADMIN`, `USER` | everything: add targets, run scans, triage findings |
| `CXO`, `LEGAL` | read only: view and export findings, reports, SBOM, evidence |
| `FINANCE`, or none of these | no access |
| `OWNER`, `IT_ADMIN`, `USER`, `PSIRT`, `DEVELOPMENT` | everything: add targets, run scans, triage findings |
| `CXO`, `LEGAL`, `QUALITY`, `PURCHASING`, `AUDITOR` | read only: view and export findings, reports, SBOM, evidence |
| `FINANCE`, `PRIVACY`, `EXTERNAL`, or none of these | no access |
Only `IT_ADMIN` can add or import findings by hand.
Only `IT_ADMIN` and `OWNER` can add or import findings by hand.
## Quick Walkthrough
@@ -67,7 +67,7 @@ again later, click **Prüfung starten** (Run scan) in the target's row on the
### 3. View findings
Open **Befunde** (Findings) in the sidebar. Each finding has a severity, a
description, the code where it was found, the CRA requirements it concerns and,
description, the code where it was found, the CRA topics it points to and,
where available, a remediation. Record your decision with the status buttons.
## Next Steps
+8 -7
View File
@@ -38,9 +38,9 @@ Was Sie in Prüfwerk tun können, hängt von Ihrer Rolle im Arbeitsbereich ab:
| Rolle | Prüfwerk |
| --- | --- |
| IT-Administration (`IT_ADMIN`), Benutzer (`USER`) | alles: Prüfobjekte anlegen, prüfen, Befunde bewerten |
| Geschäftsführung (`CXO`), Recht (`LEGAL`) | nur lesen: Befunde, Berichte, Stückliste, Nachweise ansehen und exportieren |
| Finanzen (`FINANCE`) oder keine dieser Rollen | kein Zugriff |
| Inhaber (`OWNER`), IT-Administration (`IT_ADMIN`), Benutzer (`USER`), Produktsicherheit (`PSIRT`), Entwicklung (`DEVELOPMENT`) | alles: Prüfobjekte anlegen, prüfen, Befunde bewerten |
| Geschäftsführung (`CXO`), Recht (`LEGAL`), Qualität (`QUALITY`), Einkauf (`PURCHASING`), Prüfer (`AUDITOR`) | nur lesen: Befunde, Berichte, Stückliste, Nachweise ansehen und exportieren |
| Finanzen (`FINANCE`), Datenschutz (`PRIVACY`), Extern (`EXTERNAL`) oder keine dieser Rollen | kein Zugriff |
Befunde von Hand anlegen oder importieren kann nur die IT-Administration.
@@ -126,7 +126,7 @@ Zeile), das **Werkzeug**, das ihn gefunden hat, und in der Spalte **CRA** die
Anforderungen, für die er relevant ist.
Ein Klick auf einen Befund öffnet die Einzelheiten: **Beschreibung**,
**Fundstelle**, den betroffenen **Code**, die **CRA-Anforderungen (Anhang I)**
**Fundstelle**, den betroffenen **Code**, die **CRA-Themen (Anhang I)**
und, wo vorhanden, eine **Behebung**. Mit **Status ändern** halten Sie fest, wie
Sie mit dem Befund umgehen, zum Beispiel **Behoben**, **Fehlalarm – Regel**
(die Regel hat bei unproblematischem Code angeschlagen),
@@ -172,7 +172,8 @@ dieses Prüfobjekts:
„Geprüft, keine Befunde“ erscheint also nur dort, wo tatsächlich geprüft wurde.
Befunde werden am Code nachgeprüft, bevor sie einer Anforderung zugeordnet
werden. Der CRA-Status zeigt, welche Anforderungen im Code geprüft sind; er ist
keine Konformitätsbewertung.
keine Konformitätsbewertung. Die Zuordnung der Befunde ist ein technischer
Hinweis, keine rechtliche Bewertung.
## 7. Nachweispaket
@@ -210,8 +211,8 @@ Sie echte Befunde, bevor Sie eigenen Code hochladen. Siehe
CODESYS-Projekt auswertet
- [Prüfungen](/guide/scanning): wie Prüfungen ausgelöst werden und welche
Schritte sie haben
- [CRA-Anforderungen](/features/control-mapping): wie Befunde den
Anforderungen zugeordnet werden
- [Bezug zu CRA-Themen](/features/control-mapping): wie Befunde mit den
Themen des CRA verknüpft werden (technischer Hinweis)
- [Daten und Aufbewahrung](/guide/data-retention): wo Prüfwerk Ihren Code und
die Ergebnisse speichert und wann sie gelöscht werden
+4
View File
@@ -80,3 +80,7 @@ Issues are deduplicated using the same fingerprint hash that deduplicates findin
## Linked Issues in Finding Detail
When viewing a [finding's detail page](/guide/findings#finding-detail), you will see a **Verknüpftes Ticket** (Linked issue) section if an issue was created for that finding. This provides a direct link to the external tracker issue, making it easy to jump between the security context in Prüfwerk and the development workflow in your tracker.
## Without a Connected Tracker
Without a tracker, open the ticket by hand: **Als Ticket-Text kopieren** (Copy as ticket text) on the finding's page copies the finding as Markdown, ready to paste into a new ticket. On a target without a tracker the page also points to Breakpilot Git, where tickets are created automatically. See [Turning a finding into a ticket](/guide/findings#turning-a-finding-into-a-ticket).
+2 -2
View File
@@ -10,7 +10,7 @@ Two ways to add them, both on a target's details under **Targets**:
- **Import a report**: a tool's report as a whole, in SARIF 2.1.0 or OWASP
ZAP's JSON report.
Only the organisation's administrators (`IT_ADMIN`) can add or import findings.
Only the organisation's administrators (`IT_ADMIN`, `OWNER`) can add or import findings.
A tester working for a customer is invited into that customer's organisation
with that role.
@@ -59,4 +59,4 @@ curl -X POST "$AGENT/api/v1/targets/$TARGET/findings/import?format=sarif&kind=pe
`format` is `sarif` or `zap`; `kind` is `pentest` or `dast`. The import answers
with `{"total": …, "imported": …, "duplicates": …}`. A document that is not
the named format is refused with 422, and a user without `IT_ADMIN` with 403.
the named format is refused with 422, and a user without `IT_ADMIN` or `OWNER` with 403.
+45 -3
View File
@@ -86,6 +86,41 @@ and is not judged.
Firmware images, container images and app packages are not unpacked yet; their
components come from the source code.
### When the SBOM is empty or incomplete
An SBOM without components does not mean the software uses no libraries:
the code may simply not declare them. Two findings of the type
**Vollständigkeit der Stückliste** (SBOM completeness) say so, both mapped to
the CRA requirement *Software Bill of Materials (SBOM)*:
| Rule | Severity | When |
|------|----------|------|
| `sbom-no-manifest` | Medium | The code is in a language with a package manager (Python, JavaScript/TypeScript, Rust, Go, Java/Kotlin, C#, PHP, Ruby, Dart), but the tree holds no manifest or lockfile for it anywhere outside vendor directories, and the SBOM lists no component of that ecosystem. One finding per ecosystem. |
| `sbom-dependencies-unresolved` | Low | A manifest exists, but its dependencies were not resolved: no lockfile, or one no tool reads (`bun.lockb`, Gradle without dependency locking, `<PackageReference>` without `packages.lock.json`). One finding per manifest, the same gap that is listed under **Nicht ausgeführt**. A legacy build system is reported by its own finding instead (see above). |
Each finding says why the SBOM is empty or incomplete and how to add the
missing file, for example:
- **Python** -- `pip freeze > requirements.txt` in the project's environment,
or the dependencies in `pyproject.toml` and `uv lock` or `poetry lock`;
- **JavaScript/TypeScript** -- the dependencies in `package.json`;
`npm install` writes `package-lock.json`;
- **Rust** -- commit `Cargo.toml` and `Cargo.lock`;
- **Go** -- `go mod init` and `go mod tidy` write `go.mod` and `go.sum`;
- **Java/Kotlin** -- a Maven `pom.xml` or a Gradle build file, with Gradle
also `gradle.lockfile`;
- **C#** -- the NuGet packages in the `.csproj` file and the
`packages.lock.json` that `dotnet restore` writes;
- **PHP**, **Ruby**, **Dart** -- `composer.json`/`composer.lock`,
`Gemfile`/`Gemfile.lock`, `pubspec.yaml`/`pubspec.lock`.
C and C++ have no standard manifest, so their code never raises
`sbom-no-manifest`; neither does a tree whose components come from its
sources (library headers, the firmware build, a CODESYS archive, Yocto
layers) or a PLC target. Prüfwerk does not guess the components or run the
project's code to resolve them. A finding closes at the next scan that
finds the manifest or lockfile.
## Known vulnerabilities
Package dependencies are matched against [OSV.dev](https://osv.dev/). Libraries
@@ -123,6 +158,12 @@ complete scan.
Open **Stückliste** in the sidebar. The **Pakete** (Packages) tab lists the
components of all targets, 50 per page.
When a target has no components at all, the tab says why instead of showing
an empty table: where the SBOM comes from, and the target's open
[SBOM completeness findings](#when-the-sbom-is-empty-or-incomplete), each with
its example and a link to the finding. Without such a finding (all targets,
or C/C++ code) it gives a general example.
### Charts for one target
With one target picked, two bar charts open the tab ("Diagramm"; "Tabelle"
@@ -231,7 +272,8 @@ Copyleft-licensed dependencies can require you to release your source code under
### Confirming a license
Where the scan finds no license (**Unknown**) or a wrong one, people with the
IT_ADMIN or USER role can confirm the license themselves; CXO and LEGAL can
a role that may change data (OWNER, IT_ADMIN, USER, PSIRT, DEVELOPMENT) can confirm
the license themselves; read-only roles (CXO, LEGAL, QUALITY, PURCHASING, AUDITOR) can
read the confirmations (LEGAL decides about them in the
[legal review](#license-policy-and-legal-review)).
@@ -285,9 +327,9 @@ announced period (60 days unless changed) is listed in advance.
The default policy forbids nothing: copyleft, bought and unknown licenses
of shipped components need a review, everything else is allowed. Only the
LEGAL and IT_ADMIN roles can change the policy; everyone else can read it.
LEGAL, IT_ADMIN and OWNER roles can change the policy; everyone else can read it.
**The review.** People with the **LEGAL** role (and IT_ADMIN) decide the
**The review.** People with the **LEGAL** role (and IT_ADMIN or OWNER) decide the
components *Zur Prüfung*:
1. Click **Freigeben** in a row, or tick several rows and click
+5 -4
View File
@@ -51,9 +51,10 @@ names while the scan runs.
9. **AI triage** (*Befunde bewerten*) -- an LLM reviews each new finding, gives
a confidence and a rationale and, where possible, a remediation. Findings it
doubts are set to **Zu prüfen** (see [Understanding Findings](/guide/findings#statuses)).
10. **Control mapping** (*CRA-Anforderungen zuordnen*, *Controls zuordnen*) --
findings are assigned to the CRA Annex I requirements and to the controls of
the BreakPilot catalog they are evidence for. The mapping is checked against
10. **Control mapping** (*Bezug zu CRA-Themen ermitteln (technischer Hinweis)*,
*Controls zuordnen*) -- each finding is linked to the CRA Annex I topics and
the controls of the BreakPilot catalog it points to. This is a technical
hint, not a legal assessment. The mapping is checked against
the code first. It asks the model about each finding, so it can take several
minutes.
11. **Checking controls in code** (*Controls im Code prüfen*) -- requirements
@@ -175,7 +176,7 @@ as a clean result: the CRA requirements it checks show as **Nicht geprüft**.
| **Testdaten (fixtures, testdata)** | Testdaten, von der ganzen Prüfung ausgenommen (Codeanalyse, Stückliste, CVEs): *(directories)* | Nothing; for information. Findings an earlier scan reported there are closed as test data. |
| **Ausgenommene Pfade** | In den Einstellungen des Prüfobjekts ausgenommen, von der ganzen Prüfung ausgenommen (Codeanalyse, Stückliste, CVEs): *(paths)* | Nothing; for information. Change the list under **Bearbeiten**. |
| e.g. **Statische Codeanalyse (Semgrep)**, **C/C++-Analyse (cppcheck)** | *(tool)* wurde nicht fertig; was es prüft, gilt als nicht bewertet. | Start the scan again; if it recurs, contact support. |
| **Abhängigkeiten (SBOM)** | *(manifest)* ohne Lockfile: Die Versionen der Abhängigkeiten und ihre CVEs sind nicht bekannt. | Commit the lockfile (see below). |
| **Abhängigkeiten (SBOM)** | *(manifest)* ohne Lockfile: Die Versionen der Abhängigkeiten und ihre CVEs sind nicht bekannt. | Commit the lockfile (see below). The same gap is a Low finding, `sbom-dependencies-unresolved`, which closes once the lockfile is there; see [SBOM](/guide/sbom#when-the-sbom-is-empty-or-incomplete). |
| e.g. **Firmware-Binäranalyse**, **Container-Analyse**, **Mobile-App-Analyse** | e.g. Firmware-Images werden noch nicht entpackt … | Nothing analyses these files yet; scan the source code instead. |
| **SPS-Bibliotheken (SBOM)** | *(file)* ist kein lesbares CODESYS-Projektarchiv. | Export the archive again with *File → Project Archive*, with the referenced libraries ticked. |
| **SPS-Projekt (natives Format)** | CODESYS-Projekt im nativen Format, Steuerungslogik nicht geprüft: *(files)* … | Export the POUs as PLCopen XML (*Project → Export PLCopenXML*) and add the export to the target; see [PLC / SPS](/guide/plc), which also has a script that exports it automatically. |
+1 -1
View File
@@ -1,6 +1,6 @@
[package]
name = "werkbank-exec"
version = "0.4.6"
version = "0.4.15"
edition = "2021"
description = "Shared dynamic-execution logic: soft-PLC provisioning + industrial-protocol probing, used by the compliance agent and the Werkbank runner."