feat(dashboard): CRA Annex I tiles and the scan history chart (#957) #973
No files matched your search
@@ -29,6 +29,7 @@ pub mod projects;
|
||||
pub use pentest_handlers as pentest;
|
||||
pub mod sbom;
|
||||
pub mod sbom_ecosystems;
|
||||
pub mod scan_changes;
|
||||
pub mod scans;
|
||||
pub mod support;
|
||||
pub mod target_input;
|
||||
|
||||
@@ -0,0 +1,141 @@
|
||||
//! A target's "Verlauf" (#957): what each of its last scans changed, the
|
||||
//! CVE alerts found new and those found gone ([`compliance_core::scan_changes`]).
|
||||
//!
|
||||
//! Reads the tenant's own database; the org-role middleware lets every role
|
||||
//! that may read call it, like the other target reads.
|
||||
|
||||
use axum::extract::{Extension, Path, Query};
|
||||
use axum::http::StatusCode;
|
||||
use axum::Json;
|
||||
use mongodb::bson::{doc, oid::ObjectId, DateTime as BsonDateTime, Document};
|
||||
use serde::{Deserialize, Deserializer};
|
||||
|
||||
use compliance_core::models::{CveAlert, ScanRun};
|
||||
use compliance_core::scan_changes::{changes, ScanChange, DEFAULT_SCANS, MAX_SCANS};
|
||||
use compliance_core::tenant_ctx::TenantCtx;
|
||||
|
||||
use super::dto::{collect_cursor_async, tenant_db, AgentExt, ApiResponse, ApiResult};
|
||||
|
||||
/// The query of [`target_scan_changes`].
|
||||
#[derive(Debug, Deserialize)]
|
||||
pub struct ChangesQuery {
|
||||
/// The last scans to show, `1..=50` (clamped); 20 when not given.
|
||||
#[serde(default = "default_limit", deserialize_with = "de_limit")]
|
||||
pub limit: usize,
|
||||
}
|
||||
|
||||
fn default_limit() -> usize {
|
||||
DEFAULT_SCANS
|
||||
}
|
||||
|
||||
/// Clamp a caller-supplied number of scans to `1..=MAX_SCANS`.
|
||||
fn de_limit<'de, D: Deserializer<'de>>(d: D) -> Result<usize, D::Error> {
|
||||
Ok(usize::deserialize(d)?.clamp(1, MAX_SCANS))
|
||||
}
|
||||
|
||||
/// Log a database error and answer 500.
|
||||
fn db_error(what: &str) -> impl FnOnce(mongodb::error::Error) -> StatusCode + '_ {
|
||||
move |e| {
|
||||
tracing::warn!("scan changes: {what} failed: {e}");
|
||||
StatusCode::INTERNAL_SERVER_ERROR
|
||||
}
|
||||
}
|
||||
|
||||
/// `GET /api/v1/targets/{id}/scan-changes[?limit=20]` — the target's last
|
||||
/// scans, oldest first, each with the CVE alerts found new and gone since
|
||||
/// the completed scan before it (most severe first), its status and its new
|
||||
/// findings. The target's first completed scan is marked `baseline`. 404
|
||||
/// for a target the tenant does not have.
|
||||
#[tracing::instrument(skip_all, fields(target_id = %id))]
|
||||
pub async fn target_scan_changes(
|
||||
Extension(agent): AgentExt,
|
||||
tenant: TenantCtx,
|
||||
Path(id): Path<String>,
|
||||
Query(query): Query<ChangesQuery>,
|
||||
) -> ApiResult<Vec<ScanChange>> {
|
||||
let oid = ObjectId::parse_str(&id).map_err(|_| StatusCode::BAD_REQUEST)?;
|
||||
let db = tenant_db(&agent, &tenant).await?;
|
||||
// Only whether it exists: its id is all that is read.
|
||||
db.onboarded_targets()
|
||||
.clone_with_type::<Document>()
|
||||
.find_one(doc! { "_id": oid })
|
||||
.projection(doc! { "_id": 1 })
|
||||
.await
|
||||
.map_err(db_error("reading the target"))?
|
||||
.ok_or(StatusCode::NOT_FOUND)?;
|
||||
|
||||
let runs: Vec<ScanRun> = collect_cursor_async(
|
||||
db.scan_runs()
|
||||
.find(doc! { "repo_id": &id })
|
||||
.sort(doc! { "started_at": -1 })
|
||||
.limit(i64::try_from(query.limit).unwrap_or(i64::MAX))
|
||||
.await
|
||||
.map_err(db_error("listing the runs"))?,
|
||||
)
|
||||
.await;
|
||||
// Where the window of the oldest shown scan starts: the end of the
|
||||
// completed scan before it, if there is one.
|
||||
let since = match runs.iter().map(|r| r.started_at).min() {
|
||||
Some(oldest) => db
|
||||
.scan_runs()
|
||||
.find_one(doc! {
|
||||
"repo_id": &id,
|
||||
"status": "completed",
|
||||
"started_at": { "$lt": BsonDateTime::from_chrono(oldest) },
|
||||
})
|
||||
.sort(doc! { "started_at": -1 })
|
||||
.await
|
||||
.map_err(db_error("finding the scan before"))?
|
||||
.and_then(|run| run.completed_at),
|
||||
None => None,
|
||||
};
|
||||
|
||||
let mut filter = doc! { "repo_id": &id };
|
||||
if let Some(since) = since {
|
||||
let since = BsonDateTime::from_chrono(since);
|
||||
filter.insert(
|
||||
"$or",
|
||||
vec![
|
||||
doc! { "created_at": { "$gt": since } },
|
||||
doc! { "resolved_at": { "$gt": since } },
|
||||
],
|
||||
);
|
||||
}
|
||||
let alerts: Vec<CveAlert> = collect_cursor_async(
|
||||
db.cve_alerts()
|
||||
.find(filter)
|
||||
.projection(doc! {
|
||||
"summary": 0, "llm_impact_summary": 0, "advisories": 0, "exploitation": 0,
|
||||
})
|
||||
.await
|
||||
.map_err(db_error("loading the alerts"))?,
|
||||
)
|
||||
.await;
|
||||
|
||||
let data = changes(&runs, since, &alerts);
|
||||
Ok(Json(ApiResponse {
|
||||
total: Some(data.len() as u64),
|
||||
data,
|
||||
page: None,
|
||||
}))
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
fn query(text: &str) -> ChangesQuery {
|
||||
let uri: axum::http::Uri = format!("/x?{text}").parse().unwrap_or_default();
|
||||
Query::<ChangesQuery>::try_from_uri(&uri)
|
||||
.map(|q| q.0)
|
||||
.unwrap_or(ChangesQuery { limit: 0 })
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn the_limit_is_clamped_and_defaults_to_twenty() {
|
||||
assert_eq!(query("").limit, DEFAULT_SCANS);
|
||||
assert_eq!(query("limit=0").limit, 1);
|
||||
assert_eq!(query("limit=999").limit, MAX_SCANS);
|
||||
assert_eq!(query("limit=5").limit, 5);
|
||||
}
|
||||
}
|
||||
@@ -161,6 +161,11 @@ fn routes() -> Vec<(Method, String, bool)> {
|
||||
format!("/api/v1/targets/{ID}/top-updates"),
|
||||
false,
|
||||
),
|
||||
(
|
||||
Method::GET,
|
||||
format!("/api/v1/targets/{ID}/scan-changes"),
|
||||
false,
|
||||
),
|
||||
(Method::GET, "/api/v1/licenses/conclusions".into(), false),
|
||||
(Method::PUT, "/api/v1/licenses/conclusions".into(), true),
|
||||
(
|
||||
|
||||
@@ -143,6 +143,11 @@ pub fn build_router() -> Router {
|
||||
"/api/v1/targets/{id}/top-updates",
|
||||
get(handlers::cve_history::target_top_updates),
|
||||
)
|
||||
// What each scan changed, for the target's "Verlauf" (#957).
|
||||
.route(
|
||||
"/api/v1/targets/{id}/scan-changes",
|
||||
get(handlers::scan_changes::target_scan_changes),
|
||||
)
|
||||
.route("/api/v1/targets/{id}/vex", get(handlers::vex::export_vex))
|
||||
.route("/api/v1/targets/{id}/csaf", get(handlers::vex::export_csaf))
|
||||
.route("/api/v1/targets/{id}/enisa", get(handlers::vex::list_enisa))
|
||||
|
||||
@@ -0,0 +1,148 @@
|
||||
//! A target's "Verlauf" (#957) through the real API: per scan the CVE
|
||||
//! alerts found new and gone since the completed scan before it.
|
||||
//!
|
||||
//! Runs against a live Mongo (`TEST_MONGODB_URI`) and skips cleanly without
|
||||
//! one.
|
||||
|
||||
#![allow(clippy::expect_used, clippy::unwrap_used)]
|
||||
|
||||
mod common;
|
||||
|
||||
use chrono::{DateTime, Duration, Utc};
|
||||
use compliance_core::models::{CveAlert, CveSource, ScanRun, ScanRunStatus, ScanTrigger};
|
||||
use mongodb::bson::{doc, oid::ObjectId, Document};
|
||||
use serde_json::Value;
|
||||
|
||||
use common::TestServer;
|
||||
|
||||
const TARGET: &str = "665f1c2ab0c4d1e2f3a4b5c7";
|
||||
|
||||
async fn mongo_reachable() -> bool {
|
||||
let uri = std::env::var("TEST_MONGODB_URI")
|
||||
.unwrap_or_else(|_| "mongodb://root:example@localhost:27017/?authSource=admin".into());
|
||||
let Ok(client) = mongodb::Client::with_uri_str(&uri).await else {
|
||||
return false;
|
||||
};
|
||||
client
|
||||
.database("admin")
|
||||
.run_command(doc! { "ping": 1 })
|
||||
.await
|
||||
.is_ok()
|
||||
}
|
||||
|
||||
/// Store a run of the target that started `start` and ended `end`.
|
||||
async fn run(
|
||||
db: &mongodb::Database,
|
||||
status: ScanRunStatus,
|
||||
start: DateTime<Utc>,
|
||||
end: Option<DateTime<Utc>>,
|
||||
) {
|
||||
let mut run = ScanRun::new(TARGET.into(), ScanTrigger::Scheduled);
|
||||
run.status = status;
|
||||
run.started_at = start;
|
||||
run.completed_at = end;
|
||||
db.collection::<ScanRun>("scan_runs")
|
||||
.insert_one(&run)
|
||||
.await
|
||||
.unwrap();
|
||||
}
|
||||
|
||||
/// Store an alert of the target found at `created`, gone at `resolved`.
|
||||
async fn alert(
|
||||
db: &mongodb::Database,
|
||||
cve: &str,
|
||||
created: DateTime<Utc>,
|
||||
resolved: Option<DateTime<Utc>>,
|
||||
) {
|
||||
let mut a = CveAlert::new(
|
||||
cve.into(),
|
||||
TARGET.into(),
|
||||
"openssl".into(),
|
||||
"3.0.9".into(),
|
||||
CveSource::Osv,
|
||||
);
|
||||
a.severity = Some("HIGH".into());
|
||||
a.created_at = created;
|
||||
a.resolved_at = resolved;
|
||||
db.collection::<CveAlert>("cve_alerts")
|
||||
.insert_one(&a)
|
||||
.await
|
||||
.unwrap();
|
||||
}
|
||||
|
||||
/// The CVE ids of a change's `side` (`new_cves` or `gone_cves`).
|
||||
fn cves(change: &Value, side: &str) -> Vec<String> {
|
||||
change[side]
|
||||
.as_array()
|
||||
.unwrap()
|
||||
.iter()
|
||||
.map(|c| c["cve"].as_str().unwrap().to_string())
|
||||
.collect()
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn each_scan_shows_the_cves_it_found_new_and_gone() {
|
||||
if !mongo_reachable().await {
|
||||
eprintln!("SKIP scan_changes: no MongoDB reachable");
|
||||
return;
|
||||
}
|
||||
let server = TestServer::start().await;
|
||||
let uri = std::env::var("TEST_MONGODB_URI")
|
||||
.unwrap_or_else(|_| "mongodb://root:example@localhost:27017/?authSource=admin".into());
|
||||
let db = mongodb::Client::with_uri_str(&uri)
|
||||
.await
|
||||
.unwrap()
|
||||
.database(&server.tenant_db_name());
|
||||
db.collection::<Document>("onboarded_targets")
|
||||
.insert_one(doc! { "_id": ObjectId::parse_str(TARGET).unwrap(), "name": "Pumpe", "target_type": "software" })
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
// Arrange: three scans, the middle one failed; one CVE from the first
|
||||
// scan goes in the last, one comes with it.
|
||||
let t0 = Utc::now() - Duration::days(3);
|
||||
let hour = |h: i64| t0 + Duration::hours(h);
|
||||
run(&db, ScanRunStatus::Completed, hour(0), Some(hour(1))).await;
|
||||
run(&db, ScanRunStatus::Failed, hour(24), Some(hour(25))).await;
|
||||
run(&db, ScanRunStatus::Completed, hour(48), Some(hour(49))).await;
|
||||
alert(&db, "CVE-2026-1001", hour(1), Some(hour(49))).await;
|
||||
alert(&db, "CVE-2026-1002", hour(1), None).await;
|
||||
alert(&db, "CVE-2026-1003", hour(49), None).await;
|
||||
|
||||
// Act
|
||||
let resp = server
|
||||
.get(&format!("/api/v1/targets/{TARGET}/scan-changes"))
|
||||
.await;
|
||||
assert_eq!(resp.status(), 200);
|
||||
let body: Value = resp.json().await.unwrap();
|
||||
let changes = body["data"].as_array().unwrap();
|
||||
|
||||
// Assert: oldest first; the first is the baseline, the failed one
|
||||
// changes nothing, the last has one new and one gone.
|
||||
assert_eq!(changes.len(), 3);
|
||||
assert_eq!(changes[0]["baseline"], true);
|
||||
assert!(cves(&changes[0], "new_cves").is_empty());
|
||||
assert_eq!(changes[1]["status"], "failed");
|
||||
assert!(cves(&changes[1], "new_cves").is_empty());
|
||||
assert_eq!(cves(&changes[2], "new_cves"), ["CVE-2026-1003"]);
|
||||
assert_eq!(cves(&changes[2], "gone_cves"), ["CVE-2026-1001"]);
|
||||
|
||||
// With a limit the oldest scans drop out, and the window of the first
|
||||
// shown one starts at the end of the completed scan before it.
|
||||
let resp = server
|
||||
.get(&format!("/api/v1/targets/{TARGET}/scan-changes?limit=1"))
|
||||
.await;
|
||||
let body: Value = resp.json().await.unwrap();
|
||||
let changes = body["data"].as_array().unwrap();
|
||||
assert_eq!(changes.len(), 1);
|
||||
assert_eq!(changes[0]["baseline"], false);
|
||||
assert_eq!(cves(&changes[0], "new_cves"), ["CVE-2026-1003"]);
|
||||
|
||||
// An unknown target is a 404.
|
||||
let resp = server
|
||||
.get("/api/v1/targets/665f1c2ab0c4d1e2f3a4b5ff/scan-changes")
|
||||
.await;
|
||||
assert_eq!(resp.status(), 404);
|
||||
|
||||
server.cleanup().await;
|
||||
}
|
||||
@@ -20,6 +20,7 @@ pub mod net_guard;
|
||||
pub mod purl;
|
||||
pub mod sbom_docs;
|
||||
pub mod sbom_ecosystems;
|
||||
pub mod scan_changes;
|
||||
pub mod scan_matrix;
|
||||
pub mod spdx_license;
|
||||
#[cfg(feature = "telemetry")]
|
||||
|
||||
@@ -0,0 +1,226 @@
|
||||
//! What each scan of a target changed: the CVE alerts it found new and those
|
||||
//! it found gone (#957, the "Verlauf" view).
|
||||
//!
|
||||
//! Computed from the stored alerts and runs alone, no snapshots. A completed
|
||||
//! scan's window runs from the end of the completed scan before it to its own
|
||||
//! end; an alert counts as new in the window its `created_at` falls in, and
|
||||
//! as gone in the window its `resolved_at` falls in. A target's first
|
||||
//! completed scan is its baseline: what it found is the whole SBOM, not a
|
||||
//! change. A scan that did not complete (queued, running, failed,
|
||||
//! interrupted) changes nothing: what came in meanwhile belongs to the next
|
||||
//! completed scan.
|
||||
//!
|
||||
//! Only an alert's current state is stored, so an alert reported again after
|
||||
//! it was resolved loses its `resolved_at` and is not seen as gone back then
|
||||
//! (as in [`crate::cve_history`]). Alerts the daily CVE monitor adds between
|
||||
//! two scans count for the next scan, which is when its report shows them.
|
||||
|
||||
use chrono::{DateTime, Utc};
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use crate::models::notification::{parse_severity, NotificationSeverity};
|
||||
use crate::models::{CveAlert, ScanRun, ScanRunStatus};
|
||||
|
||||
/// The scans a history shows unless asked otherwise.
|
||||
pub const DEFAULT_SCANS: usize = 20;
|
||||
/// The most scans a history may show.
|
||||
pub const MAX_SCANS: usize = 50;
|
||||
|
||||
/// One CVE alert a scan found new or gone.
|
||||
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
|
||||
pub struct CveChange {
|
||||
/// The CVE id (or the advisory's, when it has no CVE alias).
|
||||
pub cve: String,
|
||||
pub package: String,
|
||||
pub version: String,
|
||||
pub severity: NotificationSeverity,
|
||||
}
|
||||
|
||||
impl CveChange {
|
||||
fn of(alert: &CveAlert) -> Self {
|
||||
Self {
|
||||
cve: alert.cve().to_string(),
|
||||
package: alert.affected_package.clone(),
|
||||
version: alert.affected_version.clone(),
|
||||
severity: parse_severity(alert.severity.as_deref(), alert.cvss_score),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// What one scan changed.
|
||||
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
|
||||
pub struct ScanChange {
|
||||
/// The run's id (hex).
|
||||
pub run_id: String,
|
||||
pub status: ScanRunStatus,
|
||||
pub started_at: DateTime<Utc>,
|
||||
#[serde(default)]
|
||||
pub completed_at: Option<DateTime<Utc>>,
|
||||
/// New findings the scan stored.
|
||||
#[serde(default)]
|
||||
pub new_findings: u32,
|
||||
/// The target's first completed scan: no changes, it set the start.
|
||||
#[serde(default)]
|
||||
pub baseline: bool,
|
||||
/// The CVE alerts found new in the scan's window, most severe first.
|
||||
pub new_cves: Vec<CveChange>,
|
||||
/// The CVE alerts found gone in the scan's window, most severe first.
|
||||
pub gone_cves: Vec<CveChange>,
|
||||
}
|
||||
|
||||
/// The changes of `runs` (one target's, any order) from `alerts` (the same
|
||||
/// target's), oldest scan first.
|
||||
///
|
||||
/// # Arguments
|
||||
///
|
||||
/// * `runs` - the scans to show
|
||||
/// * `since` - when the completed scan before them ended; `None` when they
|
||||
/// go back to the target's first scan
|
||||
/// * `alerts` - the target's CVE alerts (at least those created or resolved
|
||||
/// after `since`)
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
/// ```
|
||||
/// use compliance_core::scan_changes::changes;
|
||||
///
|
||||
/// assert!(changes(&[], None, &[]).is_empty());
|
||||
/// ```
|
||||
pub fn changes(
|
||||
runs: &[ScanRun],
|
||||
since: Option<DateTime<Utc>>,
|
||||
alerts: &[CveAlert],
|
||||
) -> Vec<ScanChange> {
|
||||
let mut sorted: Vec<&ScanRun> = runs.iter().collect();
|
||||
sorted.sort_by_key(|r| r.started_at);
|
||||
let mut start = since;
|
||||
let mut out = Vec::with_capacity(sorted.len());
|
||||
for run in sorted {
|
||||
let end = run
|
||||
.completed_at
|
||||
.filter(|_| run.status == ScanRunStatus::Completed);
|
||||
let (new_cves, gone_cves) = match (start, end) {
|
||||
(Some(from), Some(to)) => {
|
||||
let within = |at: DateTime<Utc>| from < at && at <= to;
|
||||
(
|
||||
ranked(alerts.iter().filter(|a| within(a.created_at))),
|
||||
ranked(alerts.iter().filter(|a| a.resolved_at.is_some_and(&within))),
|
||||
)
|
||||
}
|
||||
_ => (Vec::new(), Vec::new()),
|
||||
};
|
||||
let baseline = end.is_some() && start.is_none();
|
||||
if end.is_some() {
|
||||
start = end;
|
||||
}
|
||||
out.push(ScanChange {
|
||||
run_id: run.id.map(|id| id.to_hex()).unwrap_or_default(),
|
||||
status: run.status.clone(),
|
||||
started_at: run.started_at,
|
||||
completed_at: run.completed_at,
|
||||
new_findings: run.new_findings_count,
|
||||
baseline,
|
||||
new_cves,
|
||||
gone_cves,
|
||||
});
|
||||
}
|
||||
out
|
||||
}
|
||||
|
||||
/// `alerts` as changes, the most severe first, then by package and CVE.
|
||||
fn ranked<'a>(alerts: impl Iterator<Item = &'a CveAlert>) -> Vec<CveChange> {
|
||||
let mut list: Vec<CveChange> = alerts.map(CveChange::of).collect();
|
||||
list.sort_by(|a, b| {
|
||||
b.severity
|
||||
.cmp(&a.severity)
|
||||
.then_with(|| a.package.cmp(&b.package))
|
||||
.then_with(|| a.cve.cmp(&b.cve))
|
||||
});
|
||||
list
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
#[allow(clippy::unwrap_used)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use crate::models::{CveSource, ScanTrigger};
|
||||
|
||||
fn at(hour: u32) -> DateTime<Utc> {
|
||||
format!("2026-11-10T{hour:02}:00:00Z").parse().unwrap()
|
||||
}
|
||||
|
||||
fn run(started: u32, status: ScanRunStatus, completed: Option<u32>) -> ScanRun {
|
||||
let mut run = ScanRun::new("t1".into(), ScanTrigger::Scheduled);
|
||||
run.id = Some(bson::oid::ObjectId::new());
|
||||
run.status = status;
|
||||
run.started_at = at(started);
|
||||
run.completed_at = completed.map(at);
|
||||
run
|
||||
}
|
||||
|
||||
fn alert(cve: &str, severity: &str, created: u32, resolved: Option<u32>) -> CveAlert {
|
||||
let mut a = CveAlert::new(
|
||||
cve.into(),
|
||||
"t1".into(),
|
||||
"openssl".into(),
|
||||
"3.0.9".into(),
|
||||
CveSource::Osv,
|
||||
);
|
||||
a.severity = Some(severity.into());
|
||||
a.created_at = at(created);
|
||||
a.resolved_at = resolved.map(at);
|
||||
a
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn each_completed_scan_gets_what_came_and_went_since_the_one_before() {
|
||||
let runs = [
|
||||
run(1, ScanRunStatus::Completed, Some(2)),
|
||||
run(3, ScanRunStatus::Failed, Some(4)),
|
||||
run(5, ScanRunStatus::Completed, Some(6)),
|
||||
run(7, ScanRunStatus::Running, None),
|
||||
];
|
||||
let alerts = [
|
||||
// Found by the first scan: its baseline, not a change.
|
||||
alert("CVE-2026-0001", "high", 2, Some(6)),
|
||||
// Added by the monitor while the failed scan ran: the next
|
||||
// completed scan reports it.
|
||||
alert("CVE-2026-0002", "critical", 4, None),
|
||||
alert("CVE-2026-0003", "low", 6, None),
|
||||
];
|
||||
|
||||
let changes = changes(&runs, None, &alerts);
|
||||
|
||||
// The first scan is the baseline; the failed and the running scan
|
||||
// change nothing.
|
||||
let baselines: Vec<bool> = changes.iter().map(|c| c.baseline).collect();
|
||||
assert_eq!(baselines, [true, false, false, false]);
|
||||
assert!(changes[0].new_cves.is_empty());
|
||||
assert!(changes[1].new_cves.is_empty() && changes[3].new_cves.is_empty());
|
||||
let new: Vec<&str> = changes[2].new_cves.iter().map(|c| c.cve.as_str()).collect();
|
||||
assert_eq!(new, ["CVE-2026-0002", "CVE-2026-0003"], "most severe first");
|
||||
let gone: Vec<&str> = changes[2]
|
||||
.gone_cves
|
||||
.iter()
|
||||
.map(|c| c.cve.as_str())
|
||||
.collect();
|
||||
assert_eq!(gone, ["CVE-2026-0001"]);
|
||||
assert_eq!(
|
||||
changes[2].new_cves[0].severity,
|
||||
NotificationSeverity::Critical
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn a_history_that_starts_later_takes_its_window_from_the_scan_before() {
|
||||
let runs = [run(5, ScanRunStatus::Completed, Some(6))];
|
||||
let alerts = [
|
||||
alert("CVE-2026-0001", "high", 2, None),
|
||||
alert("CVE-2026-0002", "high", 4, None),
|
||||
];
|
||||
let changes = changes(&runs, Some(at(3)), &alerts);
|
||||
assert!(!changes[0].baseline);
|
||||
let new: Vec<&str> = changes[0].new_cves.iter().map(|c| c.cve.as_str()).collect();
|
||||
assert_eq!(new, ["CVE-2026-0002"]);
|
||||
}
|
||||
}
|
||||
@@ -7869,3 +7869,213 @@ span.repo-crumb-name {
|
||||
line-height: 1.25;
|
||||
overflow-wrap: anywhere;
|
||||
}
|
||||
|
||||
/* ── CRA Annex I tiles (#957) ── */
|
||||
.ct-card,
|
||||
.sh-card {
|
||||
display: grid;
|
||||
gap: 12px;
|
||||
}
|
||||
|
||||
.ct-head,
|
||||
.sh-head {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: baseline;
|
||||
justify-content: space-between;
|
||||
gap: 8px 16px;
|
||||
}
|
||||
|
||||
.ct-title,
|
||||
.sh-title {
|
||||
font-size: 15px;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.ct-legend,
|
||||
.sh-legend {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 6px 14px;
|
||||
color: var(--text-secondary);
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.ct-legend-item {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
}
|
||||
|
||||
.ct-swatch {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
min-width: 20px;
|
||||
height: 16px;
|
||||
padding: 0 3px;
|
||||
border-radius: 3px;
|
||||
font-size: 10px;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
/* Ten to a row, as the 40 requirements make four rows; five on a phone. */
|
||||
.ct-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(10, minmax(0, 1fr));
|
||||
gap: 6px;
|
||||
}
|
||||
|
||||
@media (max-width: 720px) {
|
||||
.ct-grid {
|
||||
grid-template-columns: repeat(5, minmax(0, 1fr));
|
||||
}
|
||||
}
|
||||
|
||||
.ct-tile {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: space-between;
|
||||
min-height: 56px;
|
||||
padding: 6px 8px;
|
||||
border: 1px solid transparent;
|
||||
border-radius: var(--radius);
|
||||
font-family: var(--font-mono);
|
||||
font-size: 12px;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.ct-tile:hover,
|
||||
.ct-tile:focus-visible {
|
||||
outline: 2px solid var(--text-primary);
|
||||
outline-offset: 1px;
|
||||
}
|
||||
|
||||
.ct-tile-mark {
|
||||
align-self: flex-end;
|
||||
font-family: var(--font-body);
|
||||
font-size: 13px;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
/* A state's colour, always with its sign beside it. */
|
||||
.ct-ok { background: var(--success); color: #fff; }
|
||||
.ct-bad { background: var(--danger); color: #fff; }
|
||||
.ct-open { background: var(--warning-bg); border-color: var(--border-bright); color: var(--text-primary); }
|
||||
.ct-partial { background: var(--info-bg); border-color: var(--border-bright); color: var(--text-primary); }
|
||||
.ct-process { background: var(--bg-elevated); border-color: var(--border-bright); color: var(--text-secondary); }
|
||||
|
||||
.ct-hint,
|
||||
.sh-hint {
|
||||
color: var(--text-tertiary);
|
||||
font-size: 12.5px;
|
||||
}
|
||||
|
||||
.ct-crumbs {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: center;
|
||||
gap: 4px;
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
.ct-crumbs a {
|
||||
color: var(--accent);
|
||||
}
|
||||
|
||||
.ct-back {
|
||||
margin-left: auto;
|
||||
}
|
||||
|
||||
.ct-detail {
|
||||
display: grid;
|
||||
gap: 12px;
|
||||
}
|
||||
|
||||
/* ── Verlauf: per scan, new CVEs above the line, gone below (#957) ── */
|
||||
.sh-swatch {
|
||||
display: inline-block;
|
||||
width: 10px;
|
||||
height: 10px;
|
||||
margin-right: 6px;
|
||||
border-radius: 2px;
|
||||
vertical-align: -1px;
|
||||
}
|
||||
|
||||
.sh-new { background: #B3452F; }
|
||||
.sh-gone { background: #2a78d6; }
|
||||
|
||||
.sh-toggle {
|
||||
margin-left: auto;
|
||||
}
|
||||
|
||||
.sh-chart {
|
||||
display: flex;
|
||||
gap: 4px;
|
||||
padding-bottom: 4px;
|
||||
overflow-x: auto;
|
||||
contain: inline-size;
|
||||
}
|
||||
|
||||
.sh-scan {
|
||||
display: grid;
|
||||
grid-template-rows: 80px 1px 80px auto auto;
|
||||
justify-items: center;
|
||||
flex: 1 1 0;
|
||||
min-width: 44px;
|
||||
padding: 4px 2px;
|
||||
border-radius: var(--radius-sm);
|
||||
color: var(--text-secondary);
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.sh-scan:hover,
|
||||
.sh-scan:focus-visible {
|
||||
background: var(--bg-card-hover);
|
||||
}
|
||||
|
||||
.sh-up,
|
||||
.sh-down {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.sh-up { align-items: flex-end; }
|
||||
.sh-down { align-items: flex-start; }
|
||||
|
||||
.sh-bar {
|
||||
width: 60%;
|
||||
max-width: 28px;
|
||||
}
|
||||
|
||||
/* Rounded at the data end, square at the line. */
|
||||
.sh-up .sh-bar { border-radius: 4px 4px 0 0; }
|
||||
.sh-down .sh-bar { border-radius: 0 0 4px 4px; }
|
||||
|
||||
.sh-axis {
|
||||
width: 100%;
|
||||
background: var(--border-strong);
|
||||
}
|
||||
|
||||
.sh-day {
|
||||
margin-top: 4px;
|
||||
font-size: 11px;
|
||||
font-variant-numeric: tabular-nums;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
/* Kept to its column; the tooltip names the full status. */
|
||||
.sh-status {
|
||||
max-width: 100%;
|
||||
margin-top: 2px;
|
||||
overflow: hidden;
|
||||
font-size: 10px;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.sh-note {
|
||||
margin-top: 12px;
|
||||
font-size: 12.5px;
|
||||
}
|
||||
@@ -24,14 +24,17 @@ pub enum Route {
|
||||
// The target's views (#957), one tab each (`findings`, `cves`,
|
||||
// `components`, `licences`, `cra`, `history`; see `RepoView`). On the
|
||||
// CVE tab `?cve_severity=high&cve_vex=open` opens the CVE list
|
||||
// narrowed to that cell of the grid; `all` leaves a side open,
|
||||
// neither shows the grid.
|
||||
#[route("/targets/:id/views/:view?:cve_severity&:cve_vex")]
|
||||
// narrowed to that cell of the grid (`all` leaves a side open,
|
||||
// neither shows the grid); on the CRA tab `?control=cra-ai-3` one
|
||||
// requirement; on the history tab `?scan=<run id>` one scan.
|
||||
#[route("/targets/:id/views/:view?:cve_severity&:cve_vex&:control&:scan")]
|
||||
TargetViewsPage {
|
||||
id: String,
|
||||
view: String,
|
||||
cve_severity: Option<String>,
|
||||
cve_vex: Option<String>,
|
||||
control: Option<String>,
|
||||
scan: Option<String>,
|
||||
},
|
||||
#[route("/targets/:id/compliance")]
|
||||
CompliancePage { id: String },
|
||||
@@ -101,6 +104,8 @@ impl Route {
|
||||
view: view.slug().to_string(),
|
||||
cve_severity: None,
|
||||
cve_vex: None,
|
||||
control: None,
|
||||
scan: None,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -213,18 +218,39 @@ mod tests {
|
||||
view: "cves".to_string(),
|
||||
cve_severity: Some("high".to_string()),
|
||||
cve_vex: Some("open".to_string()),
|
||||
control: None,
|
||||
scan: None,
|
||||
};
|
||||
// The router writes a `&` after each argument that is set.
|
||||
assert_eq!(
|
||||
cell.to_string(),
|
||||
"/targets/t1/views/cves?cve_severity=high&cve_vex=open"
|
||||
"/targets/t1/views/cves?cve_severity=high&cve_vex=open&"
|
||||
);
|
||||
assert_eq!(Route::from_str(&cell.to_string()).ok(), Some(cell));
|
||||
|
||||
// A CRA requirement and a scan read back the same way.
|
||||
for (view, control, scan) in [
|
||||
("cra", Some("cra-ai-3"), None),
|
||||
("history", None, Some("665f1c2ab0c4d1e2f3a4b5c6")),
|
||||
] {
|
||||
let route = Route::TargetViewsPage {
|
||||
id: "t1".to_string(),
|
||||
view: view.to_string(),
|
||||
cve_severity: None,
|
||||
cve_vex: None,
|
||||
control: control.map(String::from),
|
||||
scan: scan.map(String::from),
|
||||
};
|
||||
assert_eq!(Route::from_str(&route.to_string()).ok(), Some(route));
|
||||
}
|
||||
|
||||
let column = Route::TargetViewsPage {
|
||||
id: "t1".to_string(),
|
||||
view: "cves".to_string(),
|
||||
cve_severity: None,
|
||||
cve_vex: Some("open".to_string()),
|
||||
control: None,
|
||||
scan: None,
|
||||
};
|
||||
assert_eq!(Route::from_str(&column.to_string()).ok(), Some(column));
|
||||
|
||||
|
||||
@@ -0,0 +1,191 @@
|
||||
//! The CRA Annex I view of a target (#957): its 40 requirements as tiles,
|
||||
//! coloured by state and marked with a sign, so the state is never told by
|
||||
//! colour alone. A tile opens the requirement with what its state rests on.
|
||||
|
||||
use dioxus::prelude::*;
|
||||
|
||||
use crate::app::Route;
|
||||
use crate::i18n::texts::{common, cra_tiles as tx};
|
||||
use crate::i18n::use_lang;
|
||||
use crate::infrastructure::evidence::fetch_compliance;
|
||||
use crate::pages::compliance::{ControlRow, STATES};
|
||||
use crate::pages::target_views::RepoView;
|
||||
|
||||
/// A tile's sign and CSS tone for a control `state` (as the API names it).
|
||||
fn mark(state: &str) -> (&'static str, &'static str) {
|
||||
match state {
|
||||
"not_satisfied" => ("!", "ct-bad"),
|
||||
"not_assessed" => ("?", "ct-open"),
|
||||
"partial" => ("~", "ct-partial"),
|
||||
"no_violation_found" => ("OK", "ct-ok"),
|
||||
_ => ("–", "ct-process"),
|
||||
}
|
||||
}
|
||||
|
||||
/// The short name a tile shows for control `id`: `cra-ai-7` is `AI-07`;
|
||||
/// another id stays as it is.
|
||||
fn short_id(id: &str) -> String {
|
||||
id.strip_prefix("cra-ai-")
|
||||
.and_then(|n| n.parse::<u32>().ok())
|
||||
.map_or_else(|| id.to_string(), |n| format!("AI-{n:02}"))
|
||||
}
|
||||
|
||||
/// `controls` in tile order: by the number of their id, others last.
|
||||
fn in_tile_order(mut controls: Vec<serde_json::Value>) -> Vec<serde_json::Value> {
|
||||
let number = |c: &serde_json::Value| {
|
||||
c["control"]
|
||||
.as_str()
|
||||
.and_then(|id| id.strip_prefix("cra-ai-"))
|
||||
.and_then(|n| n.parse::<u32>().ok())
|
||||
.unwrap_or(u32::MAX)
|
||||
};
|
||||
controls.sort_by_key(number);
|
||||
controls
|
||||
}
|
||||
|
||||
/// The tiles of target `target_id`, or, with `control` (from the URL) set,
|
||||
/// that requirement with its state, findings and reasons.
|
||||
#[component]
|
||||
pub fn CraTiles(target_id: String, control: Option<String>) -> Element {
|
||||
let lang = use_lang()();
|
||||
let id = target_id.clone();
|
||||
let view = use_resource(move || {
|
||||
let id = id.clone();
|
||||
async move { fetch_compliance(id).await.ok() }
|
||||
});
|
||||
let Some(loaded) = view.read().clone() else {
|
||||
return rsx! { div { class: "loading", {common::LOADING.get(lang)} } };
|
||||
};
|
||||
let Some(data) = loaded else {
|
||||
return rsx! { div { class: "card", p { {tx::LOAD_FAILED.get(lang)} } } };
|
||||
};
|
||||
let controls = in_tile_order(data["controls"].as_array().cloned().unwrap_or_default());
|
||||
let to_tile = |control: Option<String>| Route::TargetViewsPage {
|
||||
id: target_id.clone(),
|
||||
view: RepoView::Cra.slug().to_string(),
|
||||
cve_severity: None,
|
||||
cve_vex: None,
|
||||
control,
|
||||
scan: None,
|
||||
};
|
||||
|
||||
if let Some(wanted) = control {
|
||||
let back = to_tile(None);
|
||||
let Some(chosen) = controls
|
||||
.iter()
|
||||
.find(|c| c["control"].as_str() == Some(wanted.as_str()))
|
||||
.cloned()
|
||||
else {
|
||||
return rsx! {
|
||||
div { class: "card",
|
||||
p { {tx::UNKNOWN.get(lang)} }
|
||||
Link { class: "repo-view-list", to: back, {tx::BACK.get(lang)} }
|
||||
}
|
||||
};
|
||||
};
|
||||
let state = chosen["state"].as_str().unwrap_or_default().to_string();
|
||||
let (label, badge) = STATES
|
||||
.iter()
|
||||
.find(|(s, _, _)| *s == state)
|
||||
.map_or(("", "badge"), |(_, label, badge)| (label.get(lang), *badge));
|
||||
return rsx! {
|
||||
nav { class: "ct-crumbs", "aria-label": tx::BREADCRUMB.get(lang),
|
||||
Link { to: back.clone(), "CRA" }
|
||||
span { "aria-hidden": "true", " › " }
|
||||
strong { "{short_id(&wanted)} {chosen[\"title\"].as_str().unwrap_or_default()}" }
|
||||
Link { class: "btn btn-sm btn-ghost ct-back", to: back, {tx::BACK.get(lang)} }
|
||||
}
|
||||
section { class: "card ct-detail",
|
||||
p { span { class: "{badge}", "{label}" } }
|
||||
ul { class: "cra-controls",
|
||||
ControlRow { control: chosen, lang, show_reason: true }
|
||||
}
|
||||
Link {
|
||||
class: "repo-view-list",
|
||||
to: Route::CompliancePage { id: target_id.clone() },
|
||||
{tx::ALL_REQUIREMENTS.get(lang)}
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
rsx! {
|
||||
section { class: "card ct-card", "aria-label": tx::TITLE.get(lang),
|
||||
div { class: "ct-head",
|
||||
h3 { class: "ct-title", {tx::title(controls.len(), lang)} }
|
||||
div { class: "ct-legend",
|
||||
for (state, label, _) in STATES {
|
||||
{
|
||||
let (sign, tone) = mark(state);
|
||||
let n = controls.iter().filter(|c| c["state"].as_str() == Some(state)).count();
|
||||
rsx! {
|
||||
span { key: "{state}", class: "ct-legend-item",
|
||||
span { class: "ct-swatch {tone}", "aria-hidden": "true", "{sign}" }
|
||||
"{label.get(lang)} ({n})"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
div { class: "ct-grid",
|
||||
for c in controls.iter() {
|
||||
{
|
||||
let id = c["control"].as_str().unwrap_or_default().to_string();
|
||||
let state = c["state"].as_str().unwrap_or_default();
|
||||
let (sign, tone) = mark(state);
|
||||
let state_label = STATES
|
||||
.iter()
|
||||
.find(|(s, _, _)| *s == state)
|
||||
.map_or("", |(_, label, _)| label.get(lang));
|
||||
let tip = format!(
|
||||
"{}: {} ({state_label})",
|
||||
short_id(&id),
|
||||
c["title"].as_str().unwrap_or_default()
|
||||
);
|
||||
rsx! {
|
||||
Link {
|
||||
key: "{id}",
|
||||
class: "ct-tile {tone}",
|
||||
title: "{tip}",
|
||||
"aria-label": "{tip}",
|
||||
to: to_tile(Some(id.clone())),
|
||||
span { class: "ct-tile-id", "{short_id(&id)}" }
|
||||
span { class: "ct-tile-mark", "{sign}" }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
p { class: "ct-hint", {tx::HINT.get(lang)} }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn a_tile_names_its_requirement_short_and_in_number_order() {
|
||||
assert_eq!(short_id("cra-ai-7"), "AI-07");
|
||||
assert_eq!(short_id("cra-ai-40"), "AI-40");
|
||||
assert_eq!(short_id("custom"), "custom");
|
||||
let ordered = in_tile_order(vec![
|
||||
serde_json::json!({ "control": "cra-ai-10" }),
|
||||
serde_json::json!({ "control": "other" }),
|
||||
serde_json::json!({ "control": "cra-ai-2" }),
|
||||
]);
|
||||
let ids: Vec<&str> = ordered
|
||||
.iter()
|
||||
.filter_map(|c| c["control"].as_str())
|
||||
.collect();
|
||||
assert_eq!(ids, ["cra-ai-2", "cra-ai-10", "other"]);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn every_state_has_its_own_sign() {
|
||||
let signs: Vec<&str> = STATES.iter().map(|(s, _, _)| mark(s).0).collect();
|
||||
assert_eq!(signs, ["!", "?", "~", "OK", "–"]);
|
||||
}
|
||||
}
|
||||
@@ -62,6 +62,8 @@ fn list_route(target_id: &str, filter: Option<CveFilter>) -> Route {
|
||||
view: RepoView::Cves.slug().to_string(),
|
||||
cve_severity: severity,
|
||||
cve_vex: vex,
|
||||
control: None,
|
||||
scan: None,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -373,6 +375,7 @@ mod tests {
|
||||
view,
|
||||
cve_severity,
|
||||
cve_vex,
|
||||
..
|
||||
} = list_route("t1", filter)
|
||||
else {
|
||||
panic!("not the target page");
|
||||
|
||||
@@ -7,6 +7,7 @@ pub mod code_snippet;
|
||||
pub mod component_overview;
|
||||
pub mod copy_button;
|
||||
pub mod cra_bar;
|
||||
pub mod cra_tiles;
|
||||
pub mod cve_matrix;
|
||||
pub mod cve_trend;
|
||||
pub mod demo_targets;
|
||||
@@ -29,6 +30,7 @@ pub mod pagination;
|
||||
pub mod pentest_wizard;
|
||||
pub mod projects;
|
||||
pub mod scan_coverage;
|
||||
pub mod scan_history;
|
||||
pub mod scan_runs;
|
||||
pub mod severity_badge;
|
||||
pub mod sidebar;
|
||||
|
||||
@@ -0,0 +1,254 @@
|
||||
//! The "Verlauf" view of a target (#957): per scan, the CVE alerts it found
|
||||
//! new above the line and those it found gone below it, with the run's
|
||||
//! status. A scan opens the list of what it changed.
|
||||
|
||||
use chrono::{DateTime, Utc};
|
||||
use compliance_core::models::ScanRunStatus;
|
||||
use compliance_core::scan_changes::{CveChange, ScanChange};
|
||||
use dioxus::prelude::*;
|
||||
|
||||
use crate::app::Route;
|
||||
use crate::components::scan_runs::status_badge;
|
||||
use crate::components::severity_badge::SeverityBadge;
|
||||
use crate::i18n::texts::{common, scan_history as tx};
|
||||
use crate::i18n::{use_lang, Lang};
|
||||
use crate::infrastructure::scan_changes::fetch_scan_changes;
|
||||
use crate::pages::target_views::RepoView;
|
||||
|
||||
/// The height of the taller bar side, in pixels.
|
||||
const BAR_HEIGHT: u64 = 80;
|
||||
|
||||
/// A bar's height for `count` when the largest count is `max`: at least
|
||||
/// 2 px for any change, so a single CVE is never drawn as none.
|
||||
fn bar_px(count: usize, max: usize) -> u64 {
|
||||
if count == 0 || max == 0 {
|
||||
return 0;
|
||||
}
|
||||
(count as u64 * BAR_HEIGHT).div_ceil(max as u64).max(2)
|
||||
}
|
||||
|
||||
/// A scan's day as the chart labels it: `10.11.` / `11/10`.
|
||||
fn day(at: &DateTime<Utc>, lang: Lang) -> String {
|
||||
match lang {
|
||||
Lang::De => at.format("%d.%m.").to_string(),
|
||||
Lang::En => at.format("%m/%d").to_string(),
|
||||
}
|
||||
}
|
||||
|
||||
/// The view of target `target_id`: the chart (or its table), or, with
|
||||
/// `scan` (a run id, from the URL) set, what that scan changed.
|
||||
#[component]
|
||||
pub fn ScanHistory(target_id: String, scan: Option<String>) -> Element {
|
||||
let lang = use_lang()();
|
||||
let mut as_table = use_signal(|| false);
|
||||
let id = target_id.clone();
|
||||
let history = use_resource(move || {
|
||||
let id = id.clone();
|
||||
async move { fetch_scan_changes(id).await.ok() }
|
||||
});
|
||||
let Some(loaded) = history.read().clone() else {
|
||||
return rsx! { div { class: "loading", {common::LOADING.get(lang)} } };
|
||||
};
|
||||
let Some(changes) = loaded else {
|
||||
return rsx! { div { class: "card", p { {tx::LOAD_FAILED.get(lang)} } } };
|
||||
};
|
||||
let to_scan = |scan: Option<String>| Route::TargetViewsPage {
|
||||
id: target_id.clone(),
|
||||
view: RepoView::History.slug().to_string(),
|
||||
cve_severity: None,
|
||||
cve_vex: None,
|
||||
control: None,
|
||||
scan,
|
||||
};
|
||||
if changes.is_empty() {
|
||||
return rsx! { div { class: "card", p { class: "target-muted", {tx::NO_SCANS.get(lang)} } } };
|
||||
}
|
||||
|
||||
if let Some(run_id) = scan {
|
||||
let back = to_scan(None);
|
||||
return match changes.into_iter().find(|c| c.run_id == run_id) {
|
||||
Some(change) => rsx! {
|
||||
ScanDetail { target_id: target_id.clone(), change, back }
|
||||
},
|
||||
None => rsx! {
|
||||
div { class: "card",
|
||||
p { {tx::UNKNOWN.get(lang)} }
|
||||
Link { class: "repo-view-list", to: back, {tx::BACK.get(lang)} }
|
||||
}
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
let max = changes
|
||||
.iter()
|
||||
.map(|c| c.new_cves.len().max(c.gone_cves.len()))
|
||||
.max()
|
||||
.unwrap_or(0);
|
||||
rsx! {
|
||||
section { class: "card sh-card", "aria-label": tx::TITLE.get(lang),
|
||||
div { class: "sh-head",
|
||||
h3 { class: "sh-title", {tx::TITLE.get(lang)} }
|
||||
div { class: "sh-legend",
|
||||
span { span { class: "sh-swatch sh-new", "aria-hidden": "true" } {tx::NEW.get(lang)} }
|
||||
span { span { class: "sh-swatch sh-gone", "aria-hidden": "true" } {tx::GONE.get(lang)} }
|
||||
}
|
||||
// A toggle: the label stays, the pressed state changes.
|
||||
button {
|
||||
class: "btn btn-sm btn-ghost sh-toggle",
|
||||
"aria-pressed": "{as_table()}",
|
||||
onclick: move |_| as_table.toggle(),
|
||||
{tx::TABLE.get(lang)}
|
||||
}
|
||||
}
|
||||
if as_table() {
|
||||
div { class: "table-wrapper",
|
||||
table {
|
||||
thead {
|
||||
tr {
|
||||
th { {tx::SCAN.get(lang)} }
|
||||
th { {tx::STATUS.get(lang)} }
|
||||
th { class: "co-num", {tx::NEW.get(lang)} }
|
||||
th { class: "co-num", {tx::GONE.get(lang)} }
|
||||
}
|
||||
}
|
||||
tbody {
|
||||
for c in changes.iter().rev() {
|
||||
tr { key: "{c.run_id}",
|
||||
td {
|
||||
Link { to: to_scan(Some(c.run_id.clone())), "{day(&c.started_at, lang)}" }
|
||||
}
|
||||
td { {status_badge(&c.status).1.get(lang)} }
|
||||
td { class: "co-num", "{c.new_cves.len()}" }
|
||||
td { class: "co-num", "{c.gone_cves.len()}" }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
div { class: "sh-chart", role: "list",
|
||||
for c in changes.iter() {
|
||||
{
|
||||
let tip = tx::tip(&day(&c.started_at, lang), c, status_badge(&c.status).1.get(lang), lang);
|
||||
let up = bar_px(c.new_cves.len(), max);
|
||||
let down = bar_px(c.gone_cves.len(), max);
|
||||
let (badge, _) = status_badge(&c.status);
|
||||
let label = if c.baseline {
|
||||
tx::BASELINE.get(lang)
|
||||
} else {
|
||||
status_badge(&c.status).1.get(lang)
|
||||
};
|
||||
rsx! {
|
||||
Link {
|
||||
key: "{c.run_id}",
|
||||
class: "sh-scan",
|
||||
role: "listitem",
|
||||
title: "{tip}",
|
||||
"aria-label": "{tip}",
|
||||
to: to_scan(Some(c.run_id.clone())),
|
||||
span { class: "sh-up", span { class: "sh-bar sh-new", style: "height: {up}px;" } }
|
||||
span { class: "sh-axis", "aria-hidden": "true" }
|
||||
span { class: "sh-down", span { class: "sh-bar sh-gone", style: "height: {down}px;" } }
|
||||
span { class: "sh-day", "{day(&c.started_at, lang)}" }
|
||||
if c.baseline || c.status != ScanRunStatus::Completed {
|
||||
span { class: "{badge} sh-status", "{label}" }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
p { class: "sh-hint", {tx::HINT.get(lang)} }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// What scan `change` of target `target_id` changed: its CVEs found new and
|
||||
/// gone, most severe first, and its new findings; `back` returns to the
|
||||
/// chart.
|
||||
#[component]
|
||||
fn ScanDetail(target_id: String, change: ScanChange, back: Route) -> Element {
|
||||
let lang = use_lang()();
|
||||
let rows: Vec<(bool, CveChange)> = change
|
||||
.new_cves
|
||||
.iter()
|
||||
.cloned()
|
||||
.map(|c| (true, c))
|
||||
.chain(change.gone_cves.iter().cloned().map(|c| (false, c)))
|
||||
.collect();
|
||||
rsx! {
|
||||
nav { class: "ct-crumbs", "aria-label": tx::BREADCRUMB.get(lang),
|
||||
Link { to: back.clone(), {tx::ROOT.get(lang)} }
|
||||
span { "aria-hidden": "true", " › " }
|
||||
strong { {tx::scan_of(&day(&change.started_at, lang), lang)} }
|
||||
span { class: "target-muted", " · {tx::summary(change.new_cves.len(), change.gone_cves.len(), lang)}" }
|
||||
Link { class: "btn btn-sm btn-ghost ct-back", to: back, {tx::BACK.get(lang)} }
|
||||
}
|
||||
section { class: "card",
|
||||
if change.baseline {
|
||||
p { class: "target-muted", {tx::BASELINE_HINT.get(lang)} }
|
||||
} else if rows.is_empty() {
|
||||
p { class: "target-muted", {tx::NO_CHANGE.get(lang)} }
|
||||
} else {
|
||||
div { class: "table-wrapper",
|
||||
table {
|
||||
thead {
|
||||
tr {
|
||||
th { {tx::CHANGE.get(lang)} }
|
||||
th { "CVE" }
|
||||
th { {tx::COMPONENT.get(lang)} }
|
||||
th { {tx::VERSION.get(lang)} }
|
||||
th { {tx::SEVERITY.get(lang)} }
|
||||
}
|
||||
}
|
||||
tbody {
|
||||
for (i, (new, c)) in rows.into_iter().enumerate() {
|
||||
tr { key: "{i}",
|
||||
td { if new { {tx::NEW_ONE.get(lang)} } else { {tx::GONE_ONE.get(lang)} } }
|
||||
td { code { "{c.cve}" } }
|
||||
td { "{c.package}" }
|
||||
td { code { "{c.version}" } }
|
||||
td {
|
||||
SeverityBadge {
|
||||
severity: serde_json::to_value(&c.severity)
|
||||
.ok()
|
||||
.and_then(|v| v.as_str().map(String::from))
|
||||
.unwrap_or_default(),
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if change.new_findings > 0 {
|
||||
Link { class: "repo-view-list", to: Route::findings(target_id.clone()),
|
||||
{tx::new_findings(change.new_findings, lang)}
|
||||
}
|
||||
}
|
||||
p { class: "target-muted sh-note", {tx::COMPONENTS_NOTE.get(lang)} }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn bars_scale_to_the_largest_change_and_one_cve_shows() {
|
||||
assert_eq!(bar_px(0, 9), 0);
|
||||
assert_eq!(bar_px(9, 9), BAR_HEIGHT);
|
||||
assert_eq!(bar_px(1, 1000), 2);
|
||||
assert_eq!(bar_px(3, 0), 0);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn a_scans_day_reads_as_in_each_language() {
|
||||
let at: DateTime<Utc> = "2026-11-10T08:00:00Z".parse().unwrap_or_default();
|
||||
assert_eq!(day(&at, Lang::De), "10.11.");
|
||||
assert_eq!(day(&at, Lang::En), "11/10");
|
||||
}
|
||||
}
|
||||
@@ -6641,21 +6641,6 @@ pub mod repo_views {
|
||||
de: "Alle Befunde als Liste",
|
||||
en: "All findings as a list",
|
||||
};
|
||||
pub const CRA_COMING: Text = Text {
|
||||
de: "Die 40 Anforderungen als Kacheln folgen. Bis dahin der Stand als Balken und die \
|
||||
Prüfung als Liste.",
|
||||
en: "The 40 requirements as tiles are to follow. Until then the status as a bar and \
|
||||
the check as a list.",
|
||||
};
|
||||
pub const CRA_LIST: Text = Text {
|
||||
de: "Zur CRA-Prüfung",
|
||||
en: "To the CRA check",
|
||||
};
|
||||
pub const HISTORY_COMING: Text = Text {
|
||||
de: "Das Diagramm je Scan (neue und behobene CVEs) folgt. Bis dahin die Scans als Liste.",
|
||||
en: "The chart per scan (new and fixed CVEs) is to follow. Until then the scans as a \
|
||||
list.",
|
||||
};
|
||||
pub const LICENCE: Text = Text {
|
||||
de: "Lizenz",
|
||||
en: "Licence",
|
||||
@@ -6696,3 +6681,184 @@ pub mod repo_views {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// The CRA Annex I tiles of a target's views (#957).
|
||||
pub mod cra_tiles {
|
||||
use super::super::Lang;
|
||||
use super::Text;
|
||||
|
||||
pub const TITLE: Text = Text {
|
||||
de: "CRA Annex I",
|
||||
en: "CRA Annex I",
|
||||
};
|
||||
pub const BREADCRUMB: Text = Text {
|
||||
de: "Anforderung",
|
||||
en: "Requirement",
|
||||
};
|
||||
pub const HINT: Text = Text {
|
||||
de: "Klick auf eine Kachel: die Anforderung mit den Befunden und Gründen dahinter.",
|
||||
en: "Click a tile: the requirement with the findings and reasons behind it.",
|
||||
};
|
||||
pub const BACK: Text = Text {
|
||||
de: "← Zurück zum Raster",
|
||||
en: "← Back to the grid",
|
||||
};
|
||||
pub const UNKNOWN: Text = Text {
|
||||
de: "Diese Anforderung gibt es für dieses Prüfobjekt nicht.",
|
||||
en: "This target has no such requirement.",
|
||||
};
|
||||
pub const ALL_REQUIREMENTS: Text = Text {
|
||||
de: "Alle Anforderungen als Liste",
|
||||
en: "All requirements as a list",
|
||||
};
|
||||
pub const LOAD_FAILED: Text = Text {
|
||||
de: "Der CRA-Stand konnte nicht geladen werden.",
|
||||
en: "The CRA status could not be loaded.",
|
||||
};
|
||||
|
||||
/// The grid's heading: `CRA Annex I: 40 Anforderungen`.
|
||||
pub fn title(count: usize, lang: Lang) -> String {
|
||||
match lang {
|
||||
Lang::De => format!("CRA Annex I: {count} Anforderungen"),
|
||||
Lang::En => format!("CRA Annex I: {count} requirements"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// The "Verlauf" of a target's views (#957): what each scan changed.
|
||||
pub mod scan_history {
|
||||
use super::super::Lang;
|
||||
use super::Text;
|
||||
use compliance_core::scan_changes::ScanChange;
|
||||
|
||||
pub const TITLE: Text = Text {
|
||||
de: "Was jeder Scan verändert hat",
|
||||
en: "What each scan changed",
|
||||
};
|
||||
pub const ROOT: Text = Text {
|
||||
de: "Verlauf",
|
||||
en: "History",
|
||||
};
|
||||
pub const BREADCRUMB: Text = Text {
|
||||
de: "Scan",
|
||||
en: "Scan",
|
||||
};
|
||||
pub const NEW: Text = Text {
|
||||
de: "CVEs neu",
|
||||
en: "New CVEs",
|
||||
};
|
||||
pub const GONE: Text = Text {
|
||||
de: "CVEs weg",
|
||||
en: "CVEs gone",
|
||||
};
|
||||
pub const NEW_ONE: Text = Text {
|
||||
de: "neu",
|
||||
en: "new",
|
||||
};
|
||||
pub const GONE_ONE: Text = Text {
|
||||
de: "weg",
|
||||
en: "gone",
|
||||
};
|
||||
pub const TABLE: Text = Text {
|
||||
de: "Tabelle",
|
||||
en: "Table",
|
||||
};
|
||||
pub const SCAN: Text = Text {
|
||||
de: "Scan",
|
||||
en: "Scan",
|
||||
};
|
||||
pub const STATUS: Text = Text {
|
||||
de: "Status",
|
||||
en: "Status",
|
||||
};
|
||||
pub const CHANGE: Text = Text {
|
||||
de: "Änderung",
|
||||
en: "Change",
|
||||
};
|
||||
pub const COMPONENT: Text = Text {
|
||||
de: "Komponente",
|
||||
en: "Component",
|
||||
};
|
||||
pub const VERSION: Text = Text {
|
||||
de: "Version",
|
||||
en: "Version",
|
||||
};
|
||||
pub const SEVERITY: Text = Text {
|
||||
de: "Schweregrad",
|
||||
en: "Severity",
|
||||
};
|
||||
pub const BASELINE: Text = Text {
|
||||
de: "Start",
|
||||
en: "Start",
|
||||
};
|
||||
pub const HINT: Text = Text {
|
||||
de: "Oben neu, unten verschwunden. Klick auf einen Scan: was er verändert hat.",
|
||||
en: "New above, gone below. Click a scan: what it changed.",
|
||||
};
|
||||
pub const BASELINE_HINT: Text = Text {
|
||||
de: "Der erste vollständige Scan: Er legt den Stand fest, mit dem die späteren \
|
||||
verglichen werden.",
|
||||
en: "The first complete scan: it sets the state the later ones are compared with.",
|
||||
};
|
||||
pub const NO_CHANGE: Text = Text {
|
||||
de: "Keine CVE neu oder weg.",
|
||||
en: "No CVE new or gone.",
|
||||
};
|
||||
pub const NO_SCANS: Text = Text {
|
||||
de: "Noch kein Scan.",
|
||||
en: "No scan yet.",
|
||||
};
|
||||
pub const UNKNOWN: Text = Text {
|
||||
de: "Diesen Scan gibt es im Verlauf nicht mehr.",
|
||||
en: "This scan is no longer in the history.",
|
||||
};
|
||||
pub const BACK: Text = Text {
|
||||
de: "← Zurück zum Verlauf",
|
||||
en: "← Back to the history",
|
||||
};
|
||||
pub const LOAD_FAILED: Text = Text {
|
||||
de: "Der Verlauf konnte nicht geladen werden.",
|
||||
en: "The history could not be loaded.",
|
||||
};
|
||||
pub const COMPONENTS_NOTE: Text = Text {
|
||||
de: "Welche Komponenten ein Scan hinzugefügt, aktualisiert oder entfernt hat, \
|
||||
speichert Prüfwerk noch nicht; die CVEs oben zeigen, wo sich etwas bewegt hat.",
|
||||
en: "Prüfwerk does not store yet which components a scan added, updated or removed; \
|
||||
the CVEs above show where something moved.",
|
||||
};
|
||||
|
||||
/// The drill's heading: `Scan vom 10.11.`.
|
||||
pub fn scan_of(day: &str, lang: Lang) -> String {
|
||||
match lang {
|
||||
Lang::De => format!("Scan vom {day}"),
|
||||
Lang::En => format!("Scan of {day}"),
|
||||
}
|
||||
}
|
||||
|
||||
/// `3 CVEs neu, 1 weg`.
|
||||
pub fn summary(new: usize, gone: usize, lang: Lang) -> String {
|
||||
match lang {
|
||||
Lang::De => format!("{new} CVEs neu, {gone} weg"),
|
||||
Lang::En => format!("{new} CVEs new, {gone} gone"),
|
||||
}
|
||||
}
|
||||
|
||||
/// A scan column's tooltip: `Scan 10.11.: 3 CVEs neu, 1 weg (Abgeschlossen)`.
|
||||
pub fn tip(day: &str, change: &ScanChange, status: &str, lang: Lang) -> String {
|
||||
format!(
|
||||
"{} {day}: {} ({status})",
|
||||
SCAN.get(lang),
|
||||
summary(change.new_cves.len(), change.gone_cves.len(), lang)
|
||||
)
|
||||
}
|
||||
|
||||
/// The link to the findings: `2 neue Befunde`.
|
||||
pub fn new_findings(count: u32, lang: Lang) -> String {
|
||||
match (count, lang) {
|
||||
(1, Lang::De) => "1 neuer Befund".to_string(),
|
||||
(n, Lang::De) => format!("{n} neue Befunde"),
|
||||
(1, Lang::En) => "1 new finding".to_string(),
|
||||
(n, Lang::En) => format!("{n} new findings"),
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -26,6 +26,7 @@ pub mod projects;
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
pub mod sbom;
|
||||
pub mod sbom_ecosystems;
|
||||
pub mod scan_changes;
|
||||
pub mod scans;
|
||||
pub mod stats;
|
||||
pub mod support;
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
//! What each of a target's scans changed, for its "Verlauf" view (#957).
|
||||
|
||||
use compliance_core::scan_changes::ScanChange;
|
||||
use dioxus::prelude::*;
|
||||
|
||||
/// Target `id`'s last scans, oldest first, with the CVE alerts each found
|
||||
/// new and gone (`GET /api/v1/targets/{id}/scan-changes`).
|
||||
#[server]
|
||||
pub async fn fetch_scan_changes(id: String) -> Result<Vec<ScanChange>, ServerFnError> {
|
||||
let resp = super::agent_client::agent_get(&format!("/api/v1/targets/{id}/scan-changes"))
|
||||
.await?
|
||||
.send()
|
||||
.await
|
||||
.map_err(|e| ServerFnError::new(e.to_string()))?;
|
||||
let body: serde_json::Value = super::agent_client::json_or_error(resp).await?;
|
||||
serde_json::from_value(body["data"].clone()).map_err(|e| ServerFnError::new(e.to_string()))
|
||||
}
|
||||
@@ -16,7 +16,7 @@ use crate::infrastructure::evidence::{fetch_compliance, CraCounts};
|
||||
|
||||
/// The label and badge of each control state, in the order the page lists
|
||||
/// them: violated first, requirements evidenced outside the code last.
|
||||
const STATES: [(&str, Text, &str); 5] = [
|
||||
pub(crate) const STATES: [(&str, Text, &str); 5] = [
|
||||
("not_satisfied", tx::NOT_SATISFIED, "badge badge-critical"),
|
||||
("not_assessed", tx::NOT_ASSESSED, "badge badge-medium"),
|
||||
("partial", tx::PARTIAL, "badge badge-info"),
|
||||
@@ -166,7 +166,7 @@ pub fn CompliancePage(id: String) -> Element {
|
||||
/// state rests on (the findings against it, or why it was not assessed,
|
||||
/// unless `show_reason` is off because the group states it once).
|
||||
#[component]
|
||||
fn ControlRow(control: serde_json::Value, lang: Lang, show_reason: bool) -> Element {
|
||||
pub(crate) fn ControlRow(control: serde_json::Value, lang: Lang, show_reason: bool) -> Element {
|
||||
let findings = control["findings"].as_array().cloned().unwrap_or_default();
|
||||
// The control map's notes are engineering prose in English; in German
|
||||
// the group's hint says the same.
|
||||
|
||||
@@ -10,10 +10,10 @@ use dioxus_free_icons::Icon;
|
||||
|
||||
use crate::app::Route;
|
||||
use crate::components::component_overview::ComponentOverview;
|
||||
use crate::components::cra_bar::CraBar;
|
||||
use crate::components::cra_tiles::CraTiles;
|
||||
use crate::components::cve_matrix::CveView;
|
||||
use crate::components::finding_breakdown::FindingBreakdownView;
|
||||
use crate::components::scan_runs::ScanRunList;
|
||||
use crate::components::scan_history::ScanHistory;
|
||||
use crate::i18n::texts::{common, repo_views as tx};
|
||||
use crate::i18n::{format_count, use_lang, Lang};
|
||||
use crate::infrastructure::evidence::{fetch_compliance, CraCounts};
|
||||
@@ -163,14 +163,17 @@ pub fn TodayLink(target_id: String) -> Element {
|
||||
}
|
||||
}
|
||||
|
||||
/// The views of target `id`, tab `view` open. `cve_severity` and `cve_vex`
|
||||
/// are the CVE grid's cell from the URL query (see [`CveView`]).
|
||||
/// The views of target `id`, tab `view` open. From the URL query:
|
||||
/// `cve_severity` and `cve_vex` are the CVE grid's cell (see [`CveView`]),
|
||||
/// `control` the CRA requirement and `scan` the scan opened.
|
||||
#[component]
|
||||
pub fn TargetViewsPage(
|
||||
id: String,
|
||||
view: String,
|
||||
cve_severity: Option<String>,
|
||||
cve_vex: Option<String>,
|
||||
control: Option<String>,
|
||||
scan: Option<String>,
|
||||
) -> Element {
|
||||
let lang = use_lang()();
|
||||
let current = RepoView::from_slug(&view);
|
||||
@@ -251,20 +254,10 @@ pub fn TargetViewsPage(
|
||||
LicencesTab { target_id: id.clone() }
|
||||
},
|
||||
RepoView::Cra => rsx! {
|
||||
section { class: "card",
|
||||
match status.as_ref().and_then(|s| serde_json::from_value::<CraCounts>(s["counts"].clone()).ok()) {
|
||||
Some(counts) => rsx! { CraBar { counts } },
|
||||
None => rsx! { div { class: "loading", {common::LOADING.get(lang)} } },
|
||||
}
|
||||
p { class: "target-muted", {tx::CRA_COMING.get(lang)} }
|
||||
Link { class: "repo-view-list", to: Route::CompliancePage { id: id.clone() }, {tx::CRA_LIST.get(lang)} }
|
||||
}
|
||||
CraTiles { target_id: id.clone(), control }
|
||||
},
|
||||
RepoView::History => rsx! {
|
||||
section { class: "card",
|
||||
p { class: "target-muted", {tx::HISTORY_COMING.get(lang)} }
|
||||
ScanRunList { target_id: id.clone() }
|
||||
}
|
||||
ScanHistory { target_id: id.clone(), scan }
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,9 +31,10 @@ The targets grouped by the projects from the portal, a target in several
|
||||
projects under each, those in none under **Ohne Projekt**. Each project shows
|
||||
how many targets and open critical and high CVEs with a fix it has, and their
|
||||
30-day trend. Each target is a card: its open CVEs with a fix and their trend
|
||||
(opens its **Stückliste**), its bar for the 40 requirements of CRA Annex I
|
||||
(opens its CRA status), its last scan, and links to its **Befunde** and
|
||||
**Stückliste**. The target's name opens its page. A project shows its first
|
||||
(opens its **CVEs & VEX** view), its bar for the 40 requirements of CRA Annex I
|
||||
(opens its CRA status), its open decisions in each of the four **Heute**
|
||||
buckets (each opens **Heute** for that target and bucket), its last scan, and
|
||||
links to its **Befunde** and **Stückliste**. The target's name opens its page. A project shows its first
|
||||
six targets; the rest are on **Prüfobjekte**.
|
||||
|
||||
## Als Nächstes (Next up)
|
||||
|
||||
@@ -173,8 +173,16 @@ content was not checked.
|
||||
|
||||
## The Target's Page
|
||||
|
||||
A click on a target in the **Prüfobjekte** list opens its page. At the top are
|
||||
its name, type and artifacts, and the buttons:
|
||||
A click on a target in the **Prüfobjekte** list opens its page. Above it, the
|
||||
breadcrumb leads back to **Überblick** and names the target's projects. At the
|
||||
top are its name, type and artifacts, and two buttons:
|
||||
|
||||
- **Alle Ansichten** (All views) -- the target's views, see below.
|
||||
- **N heute zu entscheiden** (N to decide today) -- opens **Heute** with this
|
||||
target's decisions; it reads **Heute nichts zu entscheiden** when there are
|
||||
none.
|
||||
|
||||
Below them, the tools:
|
||||
|
||||
- **Prüfung starten** (Run scan) -- starts a scan now.
|
||||
- **Nachweispaket herunterladen** (Download evidence pack) -- a ZIP with the
|
||||
@@ -207,6 +215,34 @@ Below them:
|
||||
runs, entered by hand or imported; see
|
||||
[Befunde aus manuellen Tests](/guide/manual-findings).
|
||||
|
||||
### The target's views
|
||||
|
||||
**Alle Ansichten** opens six tabs, each with a figure beside its name. Every
|
||||
view starts with a chart; a click on a bar, a cell or a tile opens the list
|
||||
behind it, already narrowed, and the address holds the selection, so a link
|
||||
opens the same view.
|
||||
|
||||
| Tab | Chart | A click opens |
|
||||
|-----|-------|---------------|
|
||||
| **Befunde** (Findings) | Open findings by type, stacked by severity, and where they lie by folder | The findings list filtered to that type, severity or folder |
|
||||
| **CVEs & VEX** | The CVEs by severity and VEX status | The CVEs of that cell |
|
||||
| **Komponenten** (Components) | The updates that remove the most CVEs, and the components per ecosystem | The update's CVEs, or the **Stückliste** filtered to the ecosystem |
|
||||
| **Lizenzen** (Licences) | The components per licence group | The licences of that group and the components using each |
|
||||
| **CRA Annex I** | The 40 requirements as tiles, coloured by state and marked: **!** findings assigned, **?** not checked, **~** partly checked, **OK** checked without findings, **–** not checkable in code | The requirement with its state, the findings against it and the reason |
|
||||
| **Verlauf** (History) | Per scan, the CVEs it found new above the line and those it found gone below it, and the scan's status | What the scan changed: each CVE new or gone, with component, version and severity |
|
||||
|
||||
The figure beside **CRA Annex I** counts the requirements checked without a
|
||||
finding, of all 40.
|
||||
|
||||
In **Verlauf**, a scan's window runs from the end of the completed scan before
|
||||
it to its own end: a CVE counts as new in the window it was found in, and as
|
||||
gone in the window a complete scan no longer found it. The target's first
|
||||
complete scan is marked **Start**; what it found is the starting point, not a
|
||||
change. A scan that did not complete changes nothing, so CVEs found in the
|
||||
meantime (by the daily CVE check, say) count for the next complete scan.
|
||||
Prüfwerk does not store yet which components each scan added, updated or
|
||||
removed.
|
||||
|
||||
## Editing a Target
|
||||
|
||||
**Bearbeiten** on the target's page opens **Prüfobjekt bearbeiten**. There you
|
||||
|
||||
Reference in new issue
Block a user