Refresh scanner details of findings that are seen again

A rescan only touched the timestamp of findings it had seen before, so a
newly published fix version, a changed severity and the package source
never reached existing rows. The repository now updates those fields
while keeping first_seen and the status the user set.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
Dennis Nemec
2026-09-03 19:50:18 +02:00
parent aba2c69416
commit 70cf25fc7f
5 changed files with 93 additions and 23 deletions

View File

@ -595,17 +595,18 @@ impl FindingRepository for MemFindings {
self.0.lock().unwrap().push(finding.clone());
Ok(())
}
async fn touch(
async fn refresh(
&self,
ids: &[Uuid],
updates: &[(Uuid, RawFinding)],
last_seen: chrono::DateTime<Utc>,
) -> Result<(), DomainError> {
self.0
.lock()
.unwrap()
.iter_mut()
.filter(|f| ids.contains(&f.id))
.for_each(|f| f.last_seen = last_seen);
let mut v = self.0.lock().unwrap();
for (id, raw) in updates {
if let Some(f) = v.iter_mut().find(|f| f.id == *id) {
f.raw = raw.clone();
f.last_seen = last_seen;
}
}
Ok(())
}
async fn set_status(&self, id: Uuid, status: FindingStatus) -> Result<(), DomainError> {