feat(findings): a scan closes what it no longer finds and reopens what returns
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 7m21s

Until now a finding stayed open forever once stored: fixing the code
changed nothing, and moved code left a duplicate behind.

At the end of a code scan (after write_back, so a failed run closes
nothing), RunFindings::resolve_missing sets Resolved on the target's
findings that a scanner which completed in this run stored earlier but did
not report again, if nobody decided about them yet (open, triaged,
needs_review). A finding whose file now lies in vendor code is closed with
that reason instead. save_new reopens a Resolved finding that a completed
scanner reports again.

Only scanners whose completion is known count: semgrep, cppcheck, gitleaks
and the GDPR/OAuth patterns. Lint (a linter can fail inside a stage that
succeeds) and the LLM checks (not repeatable) close nothing; manual and
imported findings are never a scan's; PLC targets are not covered yet.

Every such change is in the status history as a StatusChange with
`by = "pruefwerk-scan"` and a `scan` entry (kind, run id); the dashboard
shows "Prüfwerk-Scan" and the reason in German or English.

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-10-05 15:04:19 +02:00
1 parent a66b7a5991
commit d4834d2a98
9 files changed
+472 -18

No files matched your search

@@ -180,6 +180,7 @@ fn status_update(
support: actor.support,
at: chrono::Utc::now(),
reason: reason.map(String::from),
scan: None,
};
let status = mongodb::bson::to_bson(status).map_err(|_| StatusCode::BAD_REQUEST)?;
let change = mongodb::bson::to_bson(&change).map_err(|_| StatusCode::BAD_REQUEST)?;
+163 -7
View File
@@ -5,13 +5,20 @@
//! change them (severity, status, rationale, control refs);
//! [`RunFindings::write_back`] stores those changes on the rows already saved,
//! without undoing a status a person set in the meantime.
//!
//! At the end of a scan, [`RunFindings::resolve_missing`] marks resolved the
//! findings a scanner that completed did not report again, and
//! [`RunFindings::save_new`] reopens a resolved finding that is reported
//! again. Only scanners whose run is known to have completed count (see
//! [`RunFindings::completed`]): a tool that failed quietly must not close
//! everything it found before.
use std::collections::{HashMap, HashSet};
use futures_util::TryStreamExt;
use mongodb::bson::{doc, oid::ObjectId, to_bson, Bson, Document};
use compliance_core::models::{Finding, FindingStatus};
use compliance_core::models::{Finding, FindingStatus, ScanChangeKind, StatusChange};
use crate::database::Database;
use crate::error::AgentError;
@@ -23,8 +30,20 @@ pub struct RunFindings {
inserted: HashMap<String, ObjectId>,
/// Already stored by an earlier run; never saved again.
earlier: HashSet<String>,
/// Scanners (`Finding::scanner`) that completed in this run, so their
/// findings this run did not see are gone from the code.
completed: HashSet<String>,
}
/// Statuses a scan may close: nobody has decided about the finding yet. A
/// false positive, an accepted risk, an ignored finding and a wrong mapping
/// are a person's decision and stay as they are.
const UNDECIDED: [&str; 3] = ["open", "triaged", "needs_review"];
/// How many findings one update names: keeps each query small however many a
/// scan closes.
const UPDATE_CHUNK: usize = 500;
impl RunFindings {
/// Nothing saved yet for the run `scan_run_id`.
pub fn new(scan_run_id: &str) -> Self {
@@ -32,9 +51,17 @@ impl RunFindings {
scan_run_id: scan_run_id.to_string(),
inserted: HashMap::new(),
earlier: HashSet::new(),
completed: HashSet::new(),
}
}
/// Record that `scanner` ran to completion over the whole tree. Call it
/// before saving that scanner's findings, so a resolved one it reports
/// again is reopened.
pub fn completed(&mut self, scanner: &str) {
self.completed.insert(scanner.to_string());
}
/// How many findings this run saw first.
pub fn new_count(&self) -> u32 {
u32::try_from(self.inserted.len()).unwrap_or(u32::MAX)
@@ -67,18 +94,37 @@ impl RunFindings {
return Ok(0);
}
// Which of them an earlier run already stored (fingerprints only).
let stored: HashSet<String> = db
// Which of them an earlier run already stored.
let stored_rows: Vec<Document> = db
.findings()
.clone_with_type::<Document>()
.find(doc! { "fingerprint": { "$in": unknown.iter().collect::<Vec<_>>() } })
.projection(doc! { "fingerprint": 1 })
.projection(doc! { "fingerprint": 1, "status": 1, "scanner": 1 })
.await?
.try_collect::<Vec<Document>>()
.await?
.into_iter()
.try_collect()
.await?;
let stored: HashSet<String> = stored_rows
.iter()
.filter_map(|d| d.get_str("fingerprint").ok().map(str::to_owned))
.collect();
// A resolved finding its completed scanner reports again is back.
let reopen: Vec<ObjectId> = stored_rows
.iter()
.filter(|d| d.get_str("status") == Ok("resolved"))
.filter(|d| {
d.get_str("scanner")
.is_ok_and(|scanner| self.completed.contains(scanner))
})
.filter_map(|d| d.get_object_id("_id").ok())
.collect();
self.set_status(
db,
&reopen,
&["resolved"],
FindingStatus::Open,
ScanChangeKind::FoundAgain,
)
.await?;
// The first finding of each new fingerprint (a scan can report the
// same one twice).
@@ -188,6 +234,116 @@ impl RunFindings {
Ok(new_findings)
}
/// Mark resolved the findings of `target_id` that a scanner which
/// completed in this run stored earlier but did not report this time.
/// Call it once, after [`Self::write_back`] succeeded: a run that fails
/// part-way must not close anything.
///
/// The scan covers one tree per run, so everything it saw is in this
/// object; a run over several trees would need one seen-set for all.
///
/// # Arguments
///
/// * `db` - the tenant database
/// * `target_id` - the scanned target (`Finding::repo_id`)
/// * `vendor` - the tree's vendor directories: a finding whose file now
/// lies in one is closed as vendor code, not as fixed
///
/// # Returns
///
/// How many findings were closed.
///
/// # Errors
///
/// A database error.
pub async fn resolve_missing(
&self,
db: &Database,
target_id: &str,
vendor: &[String],
) -> Result<u32, AgentError> {
if self.completed.is_empty() {
return Ok(0);
}
let candidates: Vec<Document> = db
.findings()
.clone_with_type::<Document>()
.find(doc! {
"repo_id": target_id,
"scanner": { "$in": self.completed.iter().collect::<Vec<_>>() },
"status": { "$in": UNDECIDED.to_vec() },
})
.projection(doc! { "fingerprint": 1, "file_path": 1 })
.await?
.try_collect()
.await?;
let (mut fixed, mut vendored) = (Vec::new(), Vec::new());
for row in &candidates {
let (Ok(id), Ok(fingerprint)) = (row.get_object_id("_id"), row.get_str("fingerprint"))
else {
continue;
};
if self.inserted.contains_key(fingerprint) || self.earlier.contains(fingerprint) {
continue;
}
let in_vendor = row
.get_str("file_path")
.is_ok_and(|file| crate::pipeline::vendor::in_vendor_dir(file, vendor));
if in_vendor {
vendored.push(id);
} else {
fixed.push(id);
}
}
for (ids, kind) in [
(&fixed, ScanChangeKind::NoLongerFound),
(&vendored, ScanChangeKind::NowVendorCode),
] {
self.set_status(db, ids, &UNDECIDED, FindingStatus::Resolved, kind)
.await?;
}
let closed = u32::try_from(fixed.len() + vendored.len()).unwrap_or(u32::MAX);
if closed > 0 {
tracing::info!(
scan_run_id = %self.scan_run_id,
fixed = fixed.len(),
vendored = vendored.len(),
"resolved findings the scan no longer reports"
);
}
Ok(closed)
}
/// Move the findings `ids` whose status is still one of `from` to `to`,
/// with a history entry saying this run did it and why. The `from` guard
/// leaves alone a finding a person changed in the meantime.
async fn set_status(
&self,
db: &Database,
ids: &[ObjectId],
from: &[&str],
to: FindingStatus,
kind: ScanChangeKind,
) -> Result<(), AgentError> {
if ids.is_empty() {
return Ok(());
}
let change = bson_of(&StatusChange::by_scan(to.clone(), kind, &self.scan_run_id))?;
let to = bson_of(&to)?;
for chunk in ids.chunks(UPDATE_CHUNK) {
db.findings()
.update_many(
doc! { "_id": { "$in": chunk.to_vec() }, "status": { "$in": from.to_vec() } },
doc! {
"$set": { "status": to.clone(), "updated_at": mongodb::bson::DateTime::now() },
"$push": { "status_history": change.clone() },
},
)
.await?;
}
Ok(())
}
/// Give each finding this run saved its row id.
fn stamp_ids(&self, findings: &mut [Finding]) {
for finding in findings.iter_mut() {
+29 -6
View File
@@ -193,7 +193,10 @@ impl PipelineOrchestrator {
.instrument(tracing::info_span!("stage_sast"))
.await
{
Ok(output) => all_findings.extend(output.findings),
Ok(output) => {
run_findings.completed("semgrep");
all_findings.extend(output.findings);
}
Err(e) => {
tracing::warn!("[{repo_id}] Semgrep failed: {e}");
// A failed analysis must not read as clean code.
@@ -213,7 +216,10 @@ impl PipelineOrchestrator {
.instrument(tracing::info_span!("stage_sast_cpp"))
.await
{
Ok(output) => all_findings.extend(output.findings),
Ok(output) => {
run_findings.completed("cppcheck");
all_findings.extend(output.findings);
}
Err(e) => {
tracing::warn!("[{repo_id}] cppcheck failed: {e}");
self.skip_stage(
@@ -367,22 +373,32 @@ impl PipelineOrchestrator {
self.update_phase(scan_run_id, ScanPhase::PatternScanning)
.await;
{
let mut pattern_findings: Vec<Finding> = async {
let (mut pattern_findings, completed) = async {
let mut findings = Vec::new();
let mut completed = Vec::new();
let gdpr = GdprPatternScanner::new();
match gdpr.scan(&repo_path, &repo_id).await {
Ok(output) => findings.extend(output.findings),
Ok(output) => {
completed.push(gdpr.name().to_string());
findings.extend(output.findings);
}
Err(e) => tracing::warn!("[{repo_id}] GDPR pattern scan failed: {e}"),
}
let oauth = OAuthPatternScanner::new();
match oauth.scan(&repo_path, &repo_id).await {
Ok(output) => findings.extend(output.findings),
Ok(output) => {
completed.push(oauth.name().to_string());
findings.extend(output.findings);
}
Err(e) => tracing::warn!("[{repo_id}] OAuth pattern scan failed: {e}"),
}
findings
(findings, completed)
}
.instrument(tracing::info_span!("stage_pattern_scanning"))
.await;
for scanner in &completed {
run_findings.completed(scanner);
}
outside_vendor(&mut pattern_findings);
all_findings.extend(pattern_findings);
}
@@ -400,6 +416,7 @@ impl PipelineOrchestrator {
.await
{
Ok(mut output) => {
run_findings.completed("gitleaks");
outside_vendor(&mut output.findings);
all_findings.extend(output.findings);
}
@@ -526,6 +543,12 @@ impl PipelineOrchestrator {
// an earlier run stored.
let new_findings = run_findings.write_back(&self.db, &mut all_findings).await?;
let new_count = run_findings.new_count();
// Findings a completed scanner no longer reports are gone from the
// code. Lint (a linter can fail on its own without the stage failing)
// and the LLM checks (not repeatable) do not close anything.
run_findings
.resolve_missing(&self.db, &repo_id, &vendor)
.await?;
// Replace this stage's SBOM entries (not the firmware or CODESYS ones,
// which their own steps own). Entries store the target id as a hex
+146
View File
@@ -0,0 +1,146 @@
//! Findings a scan no longer reports are closed, and reopened when reported
//! again. Runs against a live Mongo (`TEST_MONGODB_URI`) and skips cleanly
//! without one.
#![allow(clippy::expect_used, clippy::unwrap_used)]
use compliance_agent::database::{Database, DatabasePool};
use compliance_agent::pipeline::finding_store::RunFindings;
use compliance_core::models::{
Finding, FindingStatus, ScanChangeKind, ScanType, Severity, StatusChange,
};
use mongodb::bson::doc;
const TENANT: &str = "resolve-findings";
const TARGET: &str = "target-1";
fn finding(fingerprint: &str, scanner: &str, file: &str) -> Finding {
let mut f = Finding::new(
TARGET.into(),
fingerprint.into(),
scanner.into(),
ScanType::Sast,
format!("issue {fingerprint}"),
"desc".into(),
Severity::High,
);
f.file_path = Some(file.into());
f
}
async fn row(db: &Database, fingerprint: &str) -> Finding {
db.findings()
.find_one(doc! { "fingerprint": fingerprint })
.await
.unwrap()
.unwrap()
}
/// The reason a scan recorded on the last history entry of `f`.
fn last_scan_change(f: &Finding) -> Option<ScanChangeKind> {
f.status_history
.last()
.filter(|c| c.by == StatusChange::SCAN_ACTOR)
.and_then(|c| c.scan.as_ref())
.map(|s| s.kind)
}
#[tokio::test]
async fn a_scan_closes_what_it_no_longer_finds_and_reopens_what_returns() {
let uri = std::env::var("TEST_MONGODB_URI")
.unwrap_or_else(|_| "mongodb://root:example@localhost:27017/?authSource=admin".into());
let prefix = format!(
"resolve_{}",
&uuid::Uuid::new_v4().simple().to_string()[..10]
);
let Ok(pool) = DatabasePool::connect(&uri, &prefix).await else {
eprintln!("SKIP resolve_findings: no MongoDB reachable at {uri}");
return;
};
let db = pool.for_tenant_id(TENANT).await.unwrap();
// Arrange: an earlier scan stored these.
let mut decided = finding("fp-false-positive", "semgrep", "src/c.c");
decided.status = FindingStatus::FalsePositive;
let mut other_target = finding("fp-other-target", "semgrep", "src/a.c");
other_target.repo_id = "target-2".into();
db.findings()
.insert_many([
finding("fp-kept", "semgrep", "src/a.c"),
finding("fp-fixed", "semgrep", "src/b.c"),
finding("fp-vendor", "semgrep", "Drivers/STM32F4xx_HAL_Driver/x.c"),
finding("fp-lint", "clippy", "src/lib.rs"),
decided,
other_target,
])
.await
.unwrap();
// A run in which no scanner completed closes nothing.
let idle = RunFindings::new("run-idle");
assert_eq!(idle.resolve_missing(&db, TARGET, &[]).await.unwrap(), 0);
// Act: semgrep completes and reports only fp-kept.
let mut run = RunFindings::new("run-2");
run.completed("semgrep");
let mut seen = vec![finding("fp-kept", "semgrep", "src/a.c")];
run.write_back(&db, &mut seen).await.unwrap();
let vendor = vec!["Drivers".to_string()];
let closed = run.resolve_missing(&db, TARGET, &vendor).await.unwrap();
// Assert: fixed and vendored closed, each with its reason; the rest kept.
assert_eq!(closed, 2);
let fixed = row(&db, "fp-fixed").await;
assert_eq!(fixed.status, FindingStatus::Resolved);
assert_eq!(
last_scan_change(&fixed),
Some(ScanChangeKind::NoLongerFound)
);
let vendored = row(&db, "fp-vendor").await;
assert_eq!(vendored.status, FindingStatus::Resolved);
assert_eq!(
last_scan_change(&vendored),
Some(ScanChangeKind::NowVendorCode)
);
assert_eq!(row(&db, "fp-kept").await.status, FindingStatus::Open);
assert_eq!(
row(&db, "fp-false-positive").await.status,
FindingStatus::FalsePositive,
"a person's decision stays"
);
assert_eq!(
row(&db, "fp-lint").await.status,
FindingStatus::Open,
"a scanner that did not complete closes nothing"
);
assert_eq!(
row(&db, "fp-other-target").await.status,
FindingStatus::Open,
"another target's findings are not touched"
);
// Act: the fixed finding comes back. A scanner that did not complete in
// this run does not reopen it; one that did, does.
let mut quiet = RunFindings::new("run-3");
quiet
.save_new(&db, &mut [finding("fp-fixed", "semgrep", "src/b.c")])
.await
.unwrap();
assert_eq!(row(&db, "fp-fixed").await.status, FindingStatus::Resolved);
let mut again = RunFindings::new("run-4");
again.completed("semgrep");
again
.save_new(&db, &mut [finding("fp-fixed", "semgrep", "src/b.c")])
.await
.unwrap();
let reopened = row(&db, "fp-fixed").await;
assert_eq!(reopened.status, FindingStatus::Open);
assert_eq!(
last_scan_change(&reopened),
Some(ScanChangeKind::FoundAgain)
);
assert_eq!(reopened.status_history.len(), 2);
pool.drop_tenant(TENANT).await.ok();
}
+53 -1
View File
@@ -89,6 +89,57 @@ pub struct StatusChange {
/// Why; required when a risk is accepted.
#[serde(default)]
pub reason: Option<String>,
/// Set when a scan changed the status rather than a person: why, and
/// which run.
#[serde(default, skip_serializing_if = "Option::is_none")]
pub scan: Option<ScanStatusChange>,
}
impl StatusChange {
/// The `by` of every change a scan made.
pub const SCAN_ACTOR: &'static str = "pruefwerk-scan";
/// A change the scan run `scan_run_id` made, for the reason `kind`.
///
/// # Arguments
///
/// * `status` - the status the finding moves to
/// * `kind` - why the scan changed it
/// * `scan_run_id` - the run that changed it
pub fn by_scan(status: FindingStatus, kind: ScanChangeKind, scan_run_id: &str) -> Self {
Self {
status,
by: Self::SCAN_ACTOR.to_string(),
by_name: None,
support: false,
at: Utc::now(),
reason: None,
scan: Some(ScanStatusChange {
kind,
scan_run_id: scan_run_id.to_string(),
}),
}
}
}
/// Why a scan changed a finding's status.
#[derive(Debug, Clone, Copy, Serialize, Deserialize, PartialEq, Eq)]
#[serde(rename_all = "snake_case")]
pub enum ScanChangeKind {
/// The scanner that reported it completed and did not report it again:
/// the code was fixed or removed (or moved, which reports it anew).
NoLongerFound,
/// Its file now lies in vendor code, which is left out of the findings.
NowVendorCode,
/// A finding marked resolved was reported again.
FoundAgain,
}
/// The scan behind a [`StatusChange`].
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct ScanStatusChange {
pub kind: ScanChangeKind,
pub scan_run_id: String,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
@@ -131,7 +182,8 @@ 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.
/// Every status change, oldest first: those made by a person, and those
/// a scan made ([`StatusChange::scan`]).
#[serde(default)]
pub status_history: Vec<StatusChange>,
#[serde(with = "super::serde_helpers::bson_datetime")]
+3 -1
View File
@@ -31,7 +31,9 @@ pub use dast::{
DastTarget, DastTargetType, DastVulnType,
};
pub use embedding::{CodeEmbedding, EmbeddingBuildRun, EmbeddingBuildStatus};
pub use finding::{Finding, FindingStatus, Severity, StatusChange};
pub use finding::{
Finding, FindingStatus, ScanChangeKind, ScanStatusChange, Severity, StatusChange,
};
pub use git_source::{GitSource, GitSourceView, SourceRepo, GIT_SOURCE_ID};
pub use graph::{
CodeEdge, CodeEdgeKind, CodeNode, CodeNodeKind, GraphBuildRun, GraphBuildStatus, ImpactAnalysis,
+25
View File
@@ -1653,6 +1653,31 @@ pub mod findings {
de: "Verlauf",
en: "History",
};
/// Who made a status change a scan made.
pub const BY_SCAN: Text = Text {
de: "Prüfwerk-Scan",
en: "Prüfwerk scan",
};
/// Why a scan changed a finding's status.
pub fn scan_change(kind: compliance_core::models::ScanChangeKind) -> Text {
use compliance_core::models::ScanChangeKind;
match kind {
ScanChangeKind::NoLongerFound => Text {
de: "Bei der Prüfung nicht mehr gefunden.",
en: "No longer found by the scan.",
},
ScanChangeKind::NowVendorCode => Text {
de: "Liegt jetzt in Herstellercode, der von den Befunden ausgenommen ist.",
en: "Now lies in vendor code, which is left out of the findings.",
},
ScanChangeKind::FoundAgain => Text {
de: "Bei der Prüfung erneut gefunden.",
en: "Found again by the scan.",
},
}
}
/// A user of the tenant whose name is not known.
pub const SOMEONE: Text = Text {
de: "Benutzer",
@@ -341,6 +341,9 @@ pub fn FindingDetailPage(id: String) -> Element {
{changed_by(change, &me, lang)}
}
" · {format_time(&change.at, lang)}"
if let Some(scan) = &change.scan {
div { style: "color: var(--text-secondary);", {tx::scan_change(scan.kind).get(lang)} }
}
if let Some(reason) = &change.reason {
div { style: "color: var(--text-secondary);", "{tx::REASON.get(lang)}: {reason}" }
}
@@ -451,6 +454,9 @@ fn changed_by(
me: &compliance_core::models::AuthInfo,
lang: crate::i18n::Lang,
) -> String {
if change.scan.is_some() {
return tx::BY_SCAN.get(lang).to_string();
}
if let Some(name) = change.by_name.as_deref().filter(|n| !n.trim().is_empty()) {
return name.to_string();
}
@@ -475,6 +481,7 @@ mod tests {
support: false,
at: chrono::Utc::now(),
reason: None,
scan: None,
}
}
@@ -502,6 +509,17 @@ mod tests {
assert_eq!(changed_by(&c, &me(), Lang::De), "Sharang Parnerkar");
}
#[test]
fn a_change_a_scan_made_names_the_scan() {
let c = StatusChange::by_scan(
FindingStatus::Resolved,
compliance_core::models::ScanChangeKind::NoLongerFound,
"run-1",
);
assert_eq!(changed_by(&c, &me(), Lang::De), "Prüfwerk-Scan");
assert_eq!(changed_by(&c, &me(), Lang::En), "Prüfwerk scan");
}
#[test]
fn an_old_change_of_someone_else_shows_a_short_id() {
let c = change("0b7d51aa-9f1c-4e33-8a1f-2d8c1e0f9a77", None);
+34 -3
View File
@@ -108,7 +108,7 @@ under **Status ändern**; the change takes effect at once.
| **Offen** (Open) | New, not yet decided. |
| **Zu prüfen** (Needs review) | The automated review doubts the finding: the AI triage dismissed it or was not confident, or the control check did not confirm the CRA requirements it was mapped to. It stays in the list until a person decides; no finding is ever hidden automatically. |
| **Bewertet** (Triaged) | Reviewed and confirmed as a real issue, still to be fixed. The AI triage also sets this when it confirms a finding. |
| **Behoben** (Resolved) | Fixed. |
| **Behoben** (Resolved) | Fixed. A scan also sets it when it no longer finds the issue (see [Closed by the scan](#closed-and-reopened-by-the-scan)). |
| **Fehlalarm – Regel** (False positive – rule) | The rule fired on code that is not a problem. The finding is not real. |
| **Fehlalarm – Zuordnung** (False positive – mapping) | The finding may be real, but it does not violate the CRA requirement it was mapped to. **Needs a reason.** The finding keeps its CRA references, so it stays on record which mapping was wrong. |
| **Risiko akzeptiert** (Accepted risk) | Known and deliberately not fixed, e.g. because the device runs only on an isolated network. **Needs a reason.** |
@@ -137,6 +137,36 @@ under **Status ändern**; the change takes effect at once.
Every status change, with or without a reason, is added to the finding's
**Verlauf** (history): the status, who set it, when, and the reason.
### Closed and reopened by the scan
When a scan completes, it sets **Behoben** on every finding it reported
earlier but no longer finds, as long as nobody has decided about it yet
(**Offen**, **Bewertet** or **Zu prüfen**). The **Verlauf** shows
*Prüfwerk-Scan* and why:
- *Bei der Prüfung nicht mehr gefunden* -- the code was changed or removed.
- *Liegt jetzt in Herstellercode* -- the file now counts as vendor code, which
is left out of the findings.
A finding marked **Behoben** (by you or by the scan) that a later scan finds
again goes back to **Offen** (*Bei der Prüfung erneut gefunden*).
What the scan never changes:
- **Fehlalarm**, **Risiko akzeptiert** and **Ignoriert**: those are your
decisions.
- Findings you entered or imported by hand (penetration test, DAST).
- Findings of a tool that did not complete in that scan (it is listed under
**Nicht ausgeführt**): a failed analysis says nothing about the code.
- Findings of the linters and of the AI checks, and of SPS/PLC projects (not
yet).
- A scheduled scan that finds no new commits does not scan, so it closes
nothing.
Findings are tied to a file and line. When code moves (lines added above it),
the same issue is reported at its new line as a new finding, and the old one
is closed as no longer found.
### Recommended Flow
1. A scan finds something new. It starts as **Offen**, or as **Bewertet** or
@@ -144,8 +174,9 @@ Every status change, with or without a reason, is added to the finding's
2. Read the **Einschätzung** and the **Code**.
3. Decide: **Bewertet** if it needs fixing, one of the two false-alarm statuses
if it does not apply, **Risiko akzeptiert** if you will not fix it.
4. After the fix, set **Behoben**. A later scan does not change the status of a
finding it already knows, and does not close a finding on its own.
4. After the fix, scan again: the scan sets **Behoben** when the issue is gone.
You can also set it yourself; if a later scan finds the issue again, it is
reopened.
## Human in the Loop