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).
33 lines
1022 B
JavaScript
33 lines
1022 B
JavaScript
#!/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();
|