feat(findings): accepted risk, a who/when/why history, strict status values
CI / Check (push) Skipped
CI / Detect Changes (pull_request) Skipped
CI / Deploy Agent (pull_request) Skipped
CI / Deploy Dashboard (pull_request) Skipped
CI / Deploy Docs (pull_request) Skipped
CI / Deploy MCP (pull_request) Skipped
CI / Check (pull_request) Successful in 6m6s

- New status `accepted_risk`. Setting it requires a reason (422 without).
- Every status change a person makes is pushed onto the finding's
  `status_history` with the user, the time and the reason; the detail
  page lists it, and accepting a risk asks for the reason first.
- The status is typed in the API: an unknown value such as `dismissed` is
  refused with 422. It used to be stored as free text and then broke
  every later read of the finding. A status change on a finding that
  does not exist is a 404.
- OSCAL observations carry the finding's status: an accepted risk stays a
  finding against its control, marked as decided on. The MCP findings
  summary counts accepted risks.
- The bulk bar leaves out "accepted risk", which needs a reason per
  finding; format_time moves into the i18n module and is shared.

Tests: the reason rule, the recorded change, refusal of an unknown
status, the OSCAL status prop, and an integration test (MongoDB) of
422 / 422 / 200 / 200 / 404 and the stored history.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EYKjxacrr6K88DruUmP48p
This commit is contained in:
Sharang ParnerkarandClaude Opus 5.5 committed 2026-09-23 16:46:36 +02:00
1 parent a5fb0aa947
commit c465dbab4e
13 files changed
+353 -47

No files matched your search

+22 -6
View File
@@ -185,13 +185,20 @@ fn default_branch() -> String {
#[derive(Deserialize)]
pub struct UpdateStatusRequest {
pub status: String,
/// Typed, so an unknown status is refused (422) instead of being stored
/// and breaking every later read of the finding.
pub status: compliance_core::models::FindingStatus,
/// Why; required for `accepted_risk`.
#[serde(default)]
pub reason: Option<String>,
}
#[derive(Deserialize)]
pub struct BulkUpdateStatusRequest {
pub ids: Vec<String>,
pub status: String,
pub status: compliance_core::models::FindingStatus,
#[serde(default)]
pub reason: Option<String>,
}
#[derive(Deserialize)]
@@ -579,21 +586,30 @@ mod tests {
#[test]
fn update_status_request() {
let r: UpdateStatusRequest = serde_json::from_str(r#"{"status":"resolved"}"#).unwrap();
assert_eq!(r.status, "resolved");
assert_eq!(r.status, compliance_core::models::FindingStatus::Resolved);
assert_eq!(r.reason, None);
}
#[test]
fn bulk_update_status_request() {
let r: BulkUpdateStatusRequest =
serde_json::from_str(r#"{"ids":["a","b"],"status":"dismissed"}"#).unwrap();
serde_json::from_str(r#"{"ids":["a","b"],"status":"false_positive"}"#).unwrap();
assert_eq!(r.ids, vec!["a", "b"]);
assert_eq!(r.status, "dismissed");
assert_eq!(
r.status,
compliance_core::models::FindingStatus::FalsePositive
);
// Not a status: stored, it broke every later read of those findings.
assert!(serde_json::from_str::<BulkUpdateStatusRequest>(
r#"{"ids":["a"],"status":"dismissed"}"#
)
.is_err());
}
#[test]
fn bulk_update_status_empty_ids() {
let r: BulkUpdateStatusRequest =
serde_json::from_str(r#"{"ids":[],"status":"x"}"#).unwrap();
serde_json::from_str(r#"{"ids":[],"status":"open"}"#).unwrap();
assert!(r.ids.is_empty());
}
+80 -10
View File
@@ -4,7 +4,7 @@ use axum::Json;
use mongodb::bson::doc;
use super::dto::*;
use compliance_core::models::Finding;
use compliance_core::models::{Finding, FindingStatus, StatusChange};
use compliance_core::tenant_ctx::TenantCtx;
#[tracing::instrument(skip_all, fields(repo_id = ?filter.repo_id, severity = ?filter.severity, scan_type = ?filter.scan_type))]
@@ -103,6 +103,33 @@ pub async fn get_finding(
}))
}
/// The `$set` and `$push` of a status change by `user`, or 422 when an
/// accepted risk comes without a reason.
fn status_update(
status: &FindingStatus,
reason: Option<&str>,
user: &str,
) -> Result<mongodb::bson::Document, StatusCode> {
let reason = reason.map(str::trim).filter(|r| !r.is_empty());
if *status == FindingStatus::AcceptedRisk && reason.is_none() {
return Err(StatusCode::UNPROCESSABLE_ENTITY);
}
let change = StatusChange {
status: status.clone(),
by: user.to_string(),
at: chrono::Utc::now(),
reason: reason.map(String::from),
};
let status = mongodb::bson::to_bson(status).map_err(|_| StatusCode::BAD_REQUEST)?;
let change = mongodb::bson::to_bson(&change).map_err(|_| StatusCode::BAD_REQUEST)?;
Ok(doc! {
"$set": { "status": status, "updated_at": mongodb::bson::DateTime::now() },
"$push": { "status_history": change },
})
}
/// PATCH /api/v1/findings/{id}/status — change the status, recording who,
/// when and why. 404 when there is no such finding.
#[tracing::instrument(skip_all, fields(finding_id = %id))]
pub async fn update_finding_status(
Extension(agent): AgentExt,
@@ -111,19 +138,22 @@ pub async fn update_finding_status(
Json(req): Json<UpdateStatusRequest>,
) -> Result<Json<serde_json::Value>, StatusCode> {
let oid = mongodb::bson::oid::ObjectId::parse_str(&id).map_err(|_| StatusCode::BAD_REQUEST)?;
let update = status_update(&req.status, req.reason.as_deref(), &tenant.0.user_id)?;
let db = tenant_db(&agent, &tenant).await?;
db.findings()
.update_one(
doc! { "_id": oid },
doc! { "$set": { "status": &req.status, "updated_at": mongodb::bson::DateTime::now() } },
)
let result = db
.findings()
.update_one(doc! { "_id": oid }, update)
.await
.map_err(|_| StatusCode::INTERNAL_SERVER_ERROR)?;
if result.matched_count == 0 {
return Err(StatusCode::NOT_FOUND);
}
Ok(Json(serde_json::json!({ "status": "updated" })))
}
/// PATCH /api/v1/findings/bulk-status — the same change on many findings.
#[tracing::instrument(skip_all)]
pub async fn bulk_update_finding_status(
Extension(agent): AgentExt,
@@ -139,14 +169,12 @@ pub async fn bulk_update_finding_status(
if oids.is_empty() {
return Err(StatusCode::BAD_REQUEST);
}
let update = status_update(&req.status, req.reason.as_deref(), &tenant.0.user_id)?;
let db = tenant_db(&agent, &tenant).await?;
let result = db
.findings()
.update_many(
doc! { "_id": { "$in": oids } },
doc! { "$set": { "status": &req.status, "updated_at": mongodb::bson::DateTime::now() } },
)
.update_many(doc! { "_id": { "$in": oids } }, update)
.await
.map_err(|_| StatusCode::INTERNAL_SERVER_ERROR)?;
@@ -175,3 +203,45 @@ pub async fn update_finding_feedback(
Ok(Json(serde_json::json!({ "status": "updated" })))
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn an_accepted_risk_needs_a_reason() {
assert_eq!(
status_update(&FindingStatus::AcceptedRisk, None, "u").err(),
Some(StatusCode::UNPROCESSABLE_ENTITY)
);
assert_eq!(
status_update(&FindingStatus::AcceptedRisk, Some(" "), "u").err(),
Some(StatusCode::UNPROCESSABLE_ENTITY)
);
assert!(status_update(&FindingStatus::AcceptedRisk, Some("isolated network"), "u").is_ok());
assert!(status_update(&FindingStatus::Resolved, None, "u").is_ok());
}
#[test]
fn a_change_sets_the_status_and_records_who_and_why() {
let update = status_update(&FindingStatus::AcceptedRisk, Some(" isolated "), "u-7")
.unwrap_or_default();
let set = update.get_document("$set").cloned().unwrap_or_default();
assert_eq!(set.get_str("status").ok(), Some("accepted_risk"));
let change = update
.get_document("$push")
.and_then(|p| p.get_document("status_history"))
.cloned()
.unwrap_or_default();
assert_eq!(change.get_str("by").ok(), Some("u-7"));
assert_eq!(change.get_str("reason").ok(), Some("isolated"));
}
#[test]
fn an_unknown_status_is_refused_when_read() {
let bad = serde_json::from_value::<UpdateStatusRequest>(
serde_json::json!({ "status": "wontfix" }),
);
assert!(bad.is_err());
}
}
+78
View File
@@ -176,3 +176,81 @@ async fn pentest_findings_are_added_and_imported_once() {
h.pool.drop_tenant(TENANT).await.ok();
}
#[tokio::test]
async fn status_changes_are_validated_and_recorded() {
let Some(h) = start().await else { return };
let (_, created) = h
.post_json(
"/api/v1/targets",
serde_json::json!({ "name": "gateway", "target_type": "firmware_rtos" }),
)
.await;
let target = created["data"]["_id"]["$oid"].as_str().unwrap().to_string();
let (_, added) = h
.post_json(
&format!("/api/v1/targets/{target}/findings"),
serde_json::json!({ "kind": "pentest", "title": "Debug UART open", "severity": "medium" }),
)
.await;
let id = added["data"]["_id"]["$oid"].as_str().unwrap().to_string();
let path = format!("{}/api/v1/findings/{id}/status", h.base_url);
let patch = |body: serde_json::Value| {
let client = h.client.clone();
let path = path.clone();
async move {
client
.patch(path)
.json(&body)
.send()
.await
.unwrap()
.status()
.as_u16()
}
};
// Act
let unknown = patch(serde_json::json!({ "status": "wontfix" })).await;
let no_reason = patch(serde_json::json!({ "status": "accepted_risk" })).await;
let triaged = patch(serde_json::json!({ "status": "triaged" })).await;
let accepted = patch(serde_json::json!({
"status": "accepted_risk",
"reason": "The UART is behind a sealed housing.",
}))
.await;
let missing = h
.client
.patch(format!(
"{}/api/v1/findings/000000000000000000000000/status",
h.base_url
))
.json(&serde_json::json!({ "status": "resolved" }))
.send()
.await
.unwrap()
.status()
.as_u16();
// Assert
assert_eq!(
(unknown, no_reason, triaged, accepted, missing),
(422, 422, 200, 200, 404)
);
let finding: serde_json::Value = h
.client
.get(format!("{}/api/v1/findings/{id}", h.base_url))
.send()
.await
.unwrap()
.json()
.await
.unwrap();
assert_eq!(finding["data"]["status"], "accepted_risk");
let history = finding["data"]["status_history"].as_array().unwrap();
assert_eq!(history.len(), 2, "{history:#?}");
assert_eq!(history[1]["by"], "dev-user");
assert_eq!(history[1]["reason"], "The UART is behind a sealed housing.");
h.pool.drop_tenant(TENANT).await.ok();
}
+20
View File
@@ -33,6 +33,8 @@ pub enum FindingStatus {
FalsePositive,
Resolved,
Ignored,
/// Known and deliberately not fixed; the reason is in the status history.
AcceptedRisk,
}
impl std::fmt::Display for FindingStatus {
@@ -43,10 +45,24 @@ impl std::fmt::Display for FindingStatus {
Self::FalsePositive => write!(f, "false_positive"),
Self::Resolved => write!(f, "resolved"),
Self::Ignored => write!(f, "ignored"),
Self::AcceptedRisk => write!(f, "accepted_risk"),
}
}
}
/// One change of a finding's status: who made it, when, and why.
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct StatusChange {
pub status: FindingStatus,
/// The user id of whoever changed it.
pub by: String,
#[serde(with = "super::serde_helpers::bson_datetime")]
pub at: DateTime<Utc>,
/// Why; required when a risk is accepted.
#[serde(default)]
pub reason: Option<String>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct Finding {
#[serde(rename = "_id", skip_serializing_if = "Option::is_none")]
@@ -87,6 +103,9 @@ pub struct Finding {
/// How to reproduce the finding, for findings from a manual test.
#[serde(default)]
pub reproduction: Option<String>,
/// Every status change made by a person, oldest first.
#[serde(default)]
pub status_history: Vec<StatusChange>,
#[serde(with = "super::serde_helpers::bson_datetime")]
pub created_at: DateTime<Utc>,
#[serde(with = "super::serde_helpers::bson_datetime")]
@@ -132,6 +151,7 @@ impl Finding {
control_refs: Vec::new(),
reported_by: None,
reproduction: None,
status_history: Vec::new(),
created_at: now,
updated_at: now,
}
+1 -1
View File
@@ -29,7 +29,7 @@ pub use dast::{
DastTarget, DastTargetType, DastVulnType,
};
pub use embedding::{CodeEmbedding, EmbeddingBuildRun, EmbeddingBuildStatus};
pub use finding::{Finding, FindingStatus, Severity};
pub use finding::{Finding, FindingStatus, Severity, StatusChange};
pub use graph::{
CodeEdge, CodeEdgeKind, CodeNode, CodeNodeKind, GraphBuildRun, GraphBuildStatus, ImpactAnalysis,
};
@@ -116,6 +116,9 @@ pub fn assess(findings: &[Finding], at: DateTime<Utc>) -> AssessmentResultsDoc {
ObsProp::new("tool", &finding.scanner),
ObsProp::new("severity", &finding.severity.to_string()),
ObsProp::new("mapping", if is_mapped { "mapped" } else { "unmapped" }),
// An accepted risk is still a finding against the control; the
// status says it was decided on (the reason is in its history).
ObsProp::new("status", &finding.status.to_string()),
];
if let Some(cwe) = &finding.cwe {
props.push(ObsProp::new("cwe", cwe));
@@ -406,6 +409,19 @@ mod tests {
assert!(doc.assessment_results.results[0].observations.is_empty());
}
#[test]
fn an_accepted_risk_stays_a_finding_and_says_so() {
let mut f = finding("f1", Some("CWE-798"), &["cra-ai-8"]);
f.status = FindingStatus::AcceptedRisk;
let doc = assess(&[f], at());
let r = &doc.assessment_results.results[0];
assert_eq!(r.findings.len(), 1, "the control is still not satisfied");
assert!(r.observations[0]
.props
.iter()
.any(|p| p.name == "status" && p.value == "accepted_risk"));
}
#[test]
fn deterministic_and_valid_oscal() {
let mk = || {
@@ -6,7 +6,7 @@ use dioxus::prelude::*;
use compliance_core::models::{ScanPhase, ScanRun, ScanRunStatus};
use crate::i18n::texts::{common, scans};
use crate::i18n::{use_lang, Lang, Text};
use crate::i18n::{format_time, use_lang, Lang, Text};
use crate::infrastructure::scans::fetch_target_scan_runs;
/// How often the history refreshes while a scan is running, in milliseconds.
@@ -134,15 +134,6 @@ fn stage_name(id: &str, lang: Lang) -> String {
scans::stage(id).map_or_else(|| id.to_string(), |t| t.get(lang).to_string())
}
/// When something happened, in the reader's date convention (UTC).
fn format_time(time: &chrono::DateTime<chrono::Utc>, lang: Lang) -> String {
let pattern = match lang {
Lang::De => "%d.%m.%Y %H:%M UTC",
Lang::En => "%Y-%m-%d %H:%M UTC",
};
time.format(pattern).to_string()
}
/// The step a running scan is at, in words. Exhaustive on purpose: a new
/// phase does not compile until it has a name in both languages.
pub fn phase(phase: &ScanPhase) -> Text {
@@ -184,17 +175,6 @@ pub fn phase(phase: &ScanPhase) -> Text {
mod tests {
use super::*;
#[test]
fn times_follow_the_language() {
let t = chrono::DateTime::parse_from_rfc3339("2026-09-30T08:05:00Z")
.map(|t| t.with_timezone(&chrono::Utc));
let Ok(t) = t else {
panic!("fixed timestamp parses");
};
assert_eq!(format_time(&t, Lang::De), "30.09.2026 08:05 UTC");
assert_eq!(format_time(&t, Lang::En), "2026-09-30 08:05 UTC");
}
#[test]
fn unknown_stages_are_shown_by_id() {
assert_eq!(
+20
View File
@@ -93,6 +93,16 @@ pub fn format_bytes(bytes: u64, lang: Lang) -> String {
}
}
/// A moment in the reader's date convention, in UTC: `30.09.2026 08:05 UTC`
/// in German, `2026-09-30 08:05 UTC` in English.
pub fn format_time(time: &chrono::DateTime<chrono::Utc>, lang: Lang) -> String {
let pattern = match lang {
Lang::De => "%d.%m.%Y %H:%M UTC",
Lang::En => "%Y-%m-%d %H:%M UTC",
};
time.format(pattern).to_string()
}
/// Provide the language to the whole app. Call once, in the app shell.
///
/// Server rendering and the first client render use German so hydration
@@ -183,6 +193,16 @@ mod tests {
assert_eq!(format_bytes(3 * 1024 * 1024 * 1024, Lang::En), "3.0 GB");
}
#[test]
fn times_follow_the_language() {
let Ok(t) = chrono::DateTime::parse_from_rfc3339("2026-09-30T08:05:00Z") else {
panic!("fixed timestamp parses");
};
let t = t.with_timezone(&chrono::Utc);
assert_eq!(format_time(&t, Lang::De), "30.09.2026 08:05 UTC");
assert_eq!(format_time(&t, Lang::En), "2026-09-30 08:05 UTC");
}
#[test]
fn text_picks_the_language() {
let t = Text {
+24 -1
View File
@@ -1173,6 +1173,10 @@ pub mod findings {
de: "Ignoriert",
en: "Ignored",
},
FindingStatus::AcceptedRisk => Text {
de: "Risiko akzeptiert",
en: "Accepted risk",
},
}
}
@@ -1220,13 +1224,32 @@ pub mod findings {
];
/// Every status, in the order the forms offer them.
pub const STATUSES: [FindingStatus; 5] = [
pub const STATUSES: [FindingStatus; 6] = [
FindingStatus::Open,
FindingStatus::Triaged,
FindingStatus::Resolved,
FindingStatus::FalsePositive,
FindingStatus::AcceptedRisk,
FindingStatus::Ignored,
];
pub const HISTORY: Text = Text {
de: "Verlauf",
en: "History",
};
pub const REASON: Text = Text {
de: "Begründung",
en: "Reason",
};
pub const ACCEPT_RISK_HINT: Text = Text {
de: "Warum wird das Risiko akzeptiert (z. B. Gerät nur im isolierten Netz)? \
Die Begründung wird mit Name und Zeitpunkt gespeichert.",
en: "Why is the risk accepted (e.g. the device runs only on an isolated \
network)? The reason is stored with your name and the time.",
};
pub const ACCEPT_RISK: Text = Text {
de: "Risiko akzeptieren",
en: "Accept risk",
};
}
/// The SBOM page.
@@ -104,13 +104,17 @@ pub async fn fetch_finding_detail(id: String) -> Result<Finding, ServerFnError>
}
#[server]
pub async fn update_finding_status(id: String, status: String) -> Result<(), ServerFnError> {
pub async fn update_finding_status(
id: String,
status: String,
reason: Option<String>,
) -> Result<(), ServerFnError> {
let resp = super::agent_client::agent_request(
reqwest::Method::PATCH,
&format!("/api/v1/findings/{id}/status"),
)
.await?
.json(&serde_json::json!({ "status": status }))
.json(&serde_json::json!({ "status": status, "reason": reason }))
.send()
.await
.map_err(|e| ServerFnError::new(e.to_string()))?;
@@ -121,11 +125,12 @@ pub async fn update_finding_status(id: String, status: String) -> Result<(), Ser
pub async fn bulk_update_finding_status(
ids: Vec<String>,
status: String,
reason: Option<String>,
) -> Result<(), ServerFnError> {
let resp =
super::agent_client::agent_request(reqwest::Method::PATCH, "/api/v1/findings/bulk-status")
.await?
.json(&serde_json::json!({ "ids": ids, "status": status }))
.json(&serde_json::json!({ "ids": ids, "status": status, "reason": reason }))
.send()
.await
.map_err(|e| ServerFnError::new(e.to_string()))?;
@@ -6,9 +6,10 @@ use crate::components::code_snippet::CodeSnippet;
use crate::components::page_header::PageHeader;
use crate::components::severity_badge::SeverityBadge;
use crate::i18n::texts::{common, findings as tx};
use crate::i18n::use_lang;
use crate::i18n::{format_time, use_lang};
use crate::infrastructure::findings::{location, wire_name};
use crate::pages::findings::status_icon;
use compliance_core::models::FindingStatus;
/// What happened to the last save on this page, shown next to what was saved.
#[derive(Debug, Clone, PartialEq)]
@@ -24,6 +25,9 @@ pub fn FindingDetailPage(id: String) -> Element {
let finding_id = id.clone();
let mut status_save = use_signal(|| SaveState::Idle);
let mut feedback_save = use_signal(|| SaveState::Idle);
// Accepting a risk asks for a reason before it is saved.
let mut accepting = use_signal(|| false);
let mut risk_reason = use_signal(String::new);
let mut finding = use_resource(move || {
let fid = finding_id.clone();
@@ -39,6 +43,7 @@ pub fn FindingDetailPage(id: String) -> Element {
match snapshot {
Some(Some(f)) => {
let finding_id_for_status = id.clone();
let finding_id_for_risk = id.clone();
let finding_id_for_feedback = id.clone();
let existing_feedback = f.developer_feedback.clone().unwrap_or_default();
let where_found = location(f.file_path.as_deref(), f.line_number);
@@ -185,12 +190,16 @@ pub fn FindingDetailPage(id: String) -> Element {
title: "{label}",
disabled: current,
onclick: move |_| {
if status == FindingStatus::AcceptedRisk {
accepting.set(true);
return;
}
let s = wire.clone();
let id = id_clone.clone();
spawn(async move {
// Re-read only after the save: restarting
// at once raced it and showed the old status.
match crate::infrastructure::findings::update_finding_status(id, s).await {
match crate::infrastructure::findings::update_finding_status(id, s, None).await {
Ok(()) => status_save.set(SaveState::Saved),
Err(e) => status_save.set(SaveState::Failed(e.to_string())),
}
@@ -204,9 +213,65 @@ pub fn FindingDetailPage(id: String) -> Element {
}
}
}
if accepting() {
div { style: "margin-top: 10px;",
p { style: "font-size: 13px; color: var(--text-secondary); margin-bottom: 6px;",
{tx::ACCEPT_RISK_HINT.get(lang)}
}
textarea {
style: "width: 100%; min-height: 60px;",
value: "{risk_reason}",
oninput: move |e| risk_reason.set(e.value()),
}
button {
class: "btn btn-primary",
style: "margin-top: 6px;",
disabled: risk_reason().trim().is_empty(),
onclick: move |_| {
let id = finding_id_for_risk.clone();
let reason = risk_reason();
spawn(async move {
match crate::infrastructure::findings::update_finding_status(
id,
wire_name(&FindingStatus::AcceptedRisk),
Some(reason),
)
.await
{
Ok(()) => {
status_save.set(SaveState::Saved);
accepting.set(false);
risk_reason.set(String::new());
}
Err(e) => status_save.set(SaveState::Failed(e.to_string())),
}
finding.restart();
});
},
{tx::ACCEPT_RISK.get(lang)}
}
}
}
SaveNote { state: status_save() }
}
if !f.status_history.is_empty() {
div { class: "card",
div { class: "card-header", {tx::HISTORY.get(lang)} }
ul { style: "margin: 0; padding-left: 18px; font-size: 14px;",
for change in f.status_history.iter().rev() {
li { style: "margin-bottom: 4px;",
strong { {tx::status(&change.status).get(lang)} }
" · {change.by} · {format_time(&change.at, lang)}"
if let Some(reason) = &change.reason {
div { style: "color: var(--text-secondary);", "{tx::REASON.get(lang)}: {reason}" }
}
}
}
}
}
}
div { class: "card",
div { class: "card-header", {tx::FEEDBACK.get(lang)} }
p {
+8 -2
View File
@@ -145,7 +145,12 @@ pub fn FindingsPage(target: String) -> Element {
style: "font-size: 14px; color: var(--text-secondary);",
"{selected_ids().len()} {tx::SELECTED.get(lang)}"
}
for status in tx::STATUSES.into_iter().skip(1) {
// Accepting a risk needs a reason per finding: on its page.
for status in tx::STATUSES
.into_iter()
.skip(1)
.filter(|s| *s != compliance_core::models::FindingStatus::AcceptedRisk)
{
{
let label = tx::status(&status).get(lang);
let wire = wire_name(&status);
@@ -159,7 +164,7 @@ pub fn FindingsPage(target: String) -> Element {
spawn(async move {
// Wait for the save: the list must show what
// was stored, and a refusal must be seen.
match crate::infrastructure::findings::bulk_update_finding_status(ids, s).await {
match crate::infrastructure::findings::bulk_update_finding_status(ids, s, None).await {
Ok(()) => selected_ids.set(Vec::new()),
Err(e) => toasts.push(
ToastType::Error,
@@ -336,5 +341,6 @@ pub fn status_icon(status: &compliance_core::models::FindingStatus) -> Element {
FindingStatus::Resolved => rsx! { Icon { icon: BsCheckCircle, width: 12, height: 12 } },
FindingStatus::FalsePositive => rsx! { Icon { icon: BsXCircle, width: 12, height: 12 } },
FindingStatus::Ignored => rsx! { Icon { icon: BsDashCircle, width: 12, height: 12 } },
FindingStatus::AcceptedRisk => rsx! { Icon { icon: BsShieldCheck, width: 12, height: 12 } },
}
}
+8 -1
View File
@@ -222,7 +222,14 @@ pub async fn findings_summary(
let total: u64 = counts.iter().map(|c| c.count).sum();
let mut status_counts = Vec::new();
for status in &["open", "triaged", "false_positive", "resolved", "ignored"] {
for status in &[
"open",
"triaged",
"false_positive",
"resolved",
"ignored",
"accepted_risk",
] {
let mut filter = base_filter.clone();
filter.insert("status", status);
let count = db