fix(security): server-driven pagination for scan history (#661)

Scan history fetched a fixed 200 most-recent rows and paginated them
client-side, so older scans silently fell off mature nodes where
baselining is most valuable. The list now fetches one page at a time
via offset, with status=completed and imageRefLike filters applied
server-side. Search input is debounced to avoid per-keystroke fetches.
This commit is contained in:
Anso
2026-04-17 14:06:23 -04:00
committed by GitHub
parent c211f655c3
commit 2fce1d3baf
5 changed files with 174 additions and 25 deletions
+9 -1
View File
@@ -2242,7 +2242,7 @@ export class DatabaseService {
public getVulnerabilityScans(
nodeId: number,
opts: { imageRef?: string; limit?: number; offset?: number } = {},
opts: { imageRef?: string; imageRefLike?: string; status?: VulnScanStatus; limit?: number; offset?: number } = {},
): { items: VulnerabilityScan[]; total: number } {
const limit = Math.max(1, Math.min(opts.limit ?? 50, 500));
const offset = Math.max(0, opts.offset ?? 0);
@@ -2252,6 +2252,14 @@ export class DatabaseService {
where.push('image_ref = ?');
params.push(opts.imageRef);
}
if (opts.imageRefLike) {
where.push('image_ref LIKE ?');
params.push(`%${opts.imageRefLike}%`);
}
if (opts.status) {
where.push('status = ?');
params.push(opts.status);
}
const whereSql = where.join(' AND ');
const total = (
this.db