Scope vulnerability data to live images and add manual rescan - #235
Merged
Conversation
Introduce VulnerabilityRescanControl for image/container tables to allow manual rescans and display last scan timestamps. Update ApplicationViewService and view models to expose image version IDs and scan times. Adjust dashboard to count vulnerabilities only for images backing running containers, excluding retired images. Refine ScanCleanupBackgroundService to purge findings for deactivated, non-live images immediately. Extend IVulnerabilityEnrichmentService for single-image rescans. Improve logging for rescans targeting missing images. Add and update unit tests for new features and logic. Enhance UI hints and styling for scan status and rescans. Update project configuration and copyright.
The images parameter in RunRefreshAsync now requires a List<ImageVersion> instead of IReadOnlyList<ImageVersion>. This narrows the accepted argument type and requires callers to provide a List, not just any IReadOnlyList implementation.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Pull Request
📖 Description
The dashboard previously counted active vulnerability findings for every image version that had ever been scanned, including image versions no longer backing any running container. Digging into the scan pipeline showed the same gap one level deeper: the batch vulnerability scan kept rescanning (and thus kept alive) any image version with so much as a historical container snapshot, so retired image versions and their findings never aged out of the database.
This PR:
VulnerabilityRescanControlcomponent and a newIVulnerabilityEnrichmentService.RefreshImageVersionAsyncmethod that rescans a single image version without touching findings elsewhere in the fleet.🎫 Issues
N/A
👩💻 Reviewer Notes
VulnerabilityEnrichmentService.RefreshAsyncandScanCleanupBackgroundService.ExecuteCoreAsyncare the core behavior changes; the rest is UI plumbing (new DTO fields, a new shared component, wiring into three pages).VulnerabilityEnrichmentServiceTests.csrelied on a retired image version staying scan-eligible solely because of a stale container snapshot; they were updated to use setups that stay legitimately live, and one was repurposed into a direct regression test for the eligibility fix.📑 Test Plan
Added/updated unit and component tests covering: the scan-eligibility fix and its regression case, the new single-image rescan method, the cleanup job's immediate purge for non-live image versions vs. the retained 30-day window for still-live ones, the new DTO fields on the runtime-container and observed-image projections, and the new
VulnerabilityRescanControlcomponent (success, failure, and never-scanned states).✅ Checklist
General
UI-specific
⏭ Next Steps
/vulnerabilitiesfleet-wide overview page intentionally remains unscoped (shows all active findings, including ones not currently backing a running container); worth revisiting if the dashboard's narrower scope should extend there too.SharedBaseImageswas left read-only; the sameVulnerabilityRescanControlcould be added there later if a manual rescan trigger is wanted for base images as well.