Add IPv6 fallback display for findings without IPv4
Findings with no IPv4 address now display Qualys IPv6 or Primary IPv6 as fallback in the IP column, with a badge indicator: - 'Q' (amber) = Qualys IPv6 from hostAdditionalDetails - 'v6' (indigo) = Primary IPv6 from assetCustomAttributes Priority: IPv4 > Qualys IPv6 > Primary IPv6 Backend changes: - extractFinding now captures qualysIpv6 and primaryIpv6 - New extractQualysIpv6 helper parses hostAdditionalDetails - upsertFindingsBatch stores both fields - API response includes qualysIpv6 and primaryIpv6 - Migration adds qualys_ipv6 and primary_ipv6 columns The Qualys IPv6 is preferred over Primary IPv6 because it resolves in CARD (confirmed via testing with PMADEV-1).
This commit is contained in:
32
backend/migrations/add_ivanti_findings_ipv6_columns.js
Normal file
32
backend/migrations/add_ivanti_findings_ipv6_columns.js
Normal file
@@ -0,0 +1,32 @@
|
||||
#!/usr/bin/env node
|
||||
// Migration: Add qualys_ipv6 and primary_ipv6 columns to ivanti_findings
|
||||
// These capture IPv6 addresses for findings that have no IPv4.
|
||||
// Qualys IPv6 comes from hostAdditionalDetails; Primary IPv6 from assetCustomAttributes.
|
||||
|
||||
const pool = require('../db');
|
||||
|
||||
async function run() {
|
||||
console.log('Adding IPv6 columns to ivanti_findings...');
|
||||
try {
|
||||
await pool.query(`
|
||||
ALTER TABLE ivanti_findings
|
||||
ADD COLUMN IF NOT EXISTS qualys_ipv6 TEXT DEFAULT NULL
|
||||
`);
|
||||
console.log('✓ qualys_ipv6 column added (or already exists)');
|
||||
|
||||
await pool.query(`
|
||||
ALTER TABLE ivanti_findings
|
||||
ADD COLUMN IF NOT EXISTS primary_ipv6 TEXT DEFAULT NULL
|
||||
`);
|
||||
console.log('✓ primary_ipv6 column added (or already exists)');
|
||||
|
||||
console.log('Migration complete.');
|
||||
} catch (err) {
|
||||
console.error('Migration failed:', err.message);
|
||||
process.exit(1);
|
||||
} finally {
|
||||
await pool.end();
|
||||
}
|
||||
}
|
||||
|
||||
run();
|
||||
@@ -30,6 +30,7 @@ const POSTGRES_MIGRATIONS = [
|
||||
'add_queue_remediation_notes_table.js',
|
||||
'add_remediate_workflow_type.js',
|
||||
'add_notifications_table.js',
|
||||
'add_ivanti_findings_ipv6_columns.js',
|
||||
];
|
||||
|
||||
async function runAll() {
|
||||
|
||||
Reference in New Issue
Block a user