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
+11
View File
@@ -7544,10 +7544,21 @@ app.post('/api/security/scan/stack', authMiddleware, async (req: Request, res: R
app.get('/api/security/scans', authMiddleware, (req: Request, res: Response) => {
try {
const imageRef = typeof req.query.imageRef === 'string' ? req.query.imageRef : undefined;
const imageRefLike =
typeof req.query.imageRefLike === 'string' && req.query.imageRefLike.trim()
? req.query.imageRefLike.trim()
: undefined;
const statusParam = typeof req.query.status === 'string' ? req.query.status : undefined;
const status =
statusParam === 'completed' || statusParam === 'in_progress' || statusParam === 'failed'
? statusParam
: undefined;
const limit = req.query.limit ? Number(req.query.limit) : undefined;
const offset = req.query.offset ? Number(req.query.offset) : undefined;
const result = DatabaseService.getInstance().getVulnerabilityScans(req.nodeId, {
imageRef,
imageRefLike,
status,
limit,
offset,
});