fix: queue now uses edited hostname override instead of original Ivanti value

This commit is contained in:
jramos
2026-04-09 15:25:16 -06:00
parent 9b36a58959
commit 1963faf9b8
2 changed files with 13 additions and 6 deletions

View File

@@ -27,20 +27,27 @@ function createIvantiTodoQueueRouter(db, requireAuth) {
*/ */
router.get('/', requireAuth(db), (req, res) => { router.get('/', requireAuth(db), (req, res) => {
db.all( db.all(
`SELECT * FROM ivanti_todo_queue `SELECT q.*,
WHERE user_id = ? o.value AS override_hostname
ORDER BY vendor ASC, created_at ASC`, FROM ivanti_todo_queue q
LEFT JOIN ivanti_finding_overrides o
ON o.finding_id = q.finding_id AND o.field = 'hostName'
WHERE q.user_id = ?
ORDER BY q.vendor ASC, q.created_at ASC`,
[req.user.id], [req.user.id],
(err, rows) => { (err, rows) => {
if (err) { if (err) {
console.error('Error fetching todo queue:', err); console.error('Error fetching todo queue:', err);
return res.status(500).json({ error: 'Internal server error.' }); return res.status(500).json({ error: 'Internal server error.' });
} }
// Parse cves_json back to array for each row // Parse cves_json back to array; prefer overridden hostname
const parsed = rows.map((r) => ({ const parsed = rows.map((r) => ({
...r, ...r,
hostname: r.override_hostname || r.hostname,
cves: r.cves_json ? JSON.parse(r.cves_json) : [], cves: r.cves_json ? JSON.parse(r.cves_json) : [],
})); }));
// Clean up the extra column from the response
parsed.forEach((r) => delete r.override_hostname);
res.json(parsed); res.json(parsed);
} }
); );

View File

@@ -2549,7 +2549,7 @@ export default function VulnerabilityTriagePage({ filterDate, filterEXC }) {
finding_title: finding.title || null, finding_title: finding.title || null,
cves: finding.cves || [], cves: finding.cves || [],
ip_address: finding.ipAddress || null, ip_address: finding.ipAddress || null,
hostname: finding.hostName || null, hostname: finding.overrides?.hostName || finding.hostName || null,
vendor: queueForm.vendor.trim(), vendor: queueForm.vendor.trim(),
workflow_type: queueForm.workflowType, workflow_type: queueForm.workflowType,
}), }),
@@ -2602,7 +2602,7 @@ export default function VulnerabilityTriagePage({ filterDate, filterEXC }) {
finding_title: f.title || null, finding_title: f.title || null,
cves: f.cves || [], cves: f.cves || [],
ip_address: f.ipAddress || null, ip_address: f.ipAddress || null,
hostname: f.hostName || null, hostname: f.overrides?.hostName || f.hostName || null,
} : { finding_id: id }; } : { finding_id: id };
}); });
const res = await fetch(`${API_BASE}/ivanti/todo-queue/batch`, { const res = await fetch(`${API_BASE}/ivanti/todo-queue/batch`, {