Files
cve-dashboard/backend/migrations/add_ivanti_os_fields.js
Jordan Ramos 416bfd2e28 Add Infoblox DNS lookup, Scan Posture page, and Ivanti OS fields
- Infoblox WAPI integration (read-only) for resolving IPs to FQDNs
  - backend/helpers/infobloxApi.js — Basic auth, host/PTR/IPv6 lookups
  - backend/routes/infoblox.js — /api/infoblox endpoints
  - Globe icon on Reporting page hostName/dns columns for one-click DNS lookup
  - Pending: WAPI credentials with API access permissions

- Scan Posture page for Access Ops platform/version tracking
  - backend/routes/scanPosture.js
  - frontend/src/components/pages/ScanPosturePage.js
  - Page visibility and nav drawer entries

- Ivanti findings OS field enrichment
  - Migration to add os_name/os_class/os_version columns
  - Backfill script for existing findings
  - ivantiFindings route updates to persist OS data on sync
2026-08-21 10:33:46 -06:00

42 lines
1.8 KiB
JavaScript

// Migration: Add operating system fields to ivanti_findings
// Captures operatingSystemScanner data from the Ivanti/RiskSense API response.
// These fields enable grouping findings by platform and code version for the
// Scan Posture executive dashboard.
//
// Fields:
// os_name — full OS string from API (e.g., "Cisco NX-OS", "Red Hat Enterprise Linux 8.6")
// os_family — OS family (e.g., "Linux", "Not Reported")
// os_vendor — vendor string (e.g., "Red Hat", "Cisco", "Not Reported")
//
// Idempotent — safe to run multiple times.
const pool = require('../db');
async function run() {
console.log('Starting migration: add_ivanti_os_fields...');
try {
await pool.query(`ALTER TABLE ivanti_findings ADD COLUMN IF NOT EXISTS os_name TEXT DEFAULT NULL`);
console.log('✓ os_name column added (or already exists)');
await pool.query(`ALTER TABLE ivanti_findings ADD COLUMN IF NOT EXISTS os_family TEXT DEFAULT NULL`);
console.log('✓ os_family column added (or already exists)');
await pool.query(`ALTER TABLE ivanti_findings ADD COLUMN IF NOT EXISTS os_vendor TEXT DEFAULT NULL`);
console.log('✓ os_vendor column added (or already exists)');
// Index for platform grouping queries
await pool.query(`CREATE INDEX IF NOT EXISTS idx_findings_os_name ON ivanti_findings(os_name)`);
console.log('✓ idx_findings_os_name index created (or already exists)');
await pool.query(`CREATE INDEX IF NOT EXISTS idx_findings_os_vendor ON ivanti_findings(os_vendor)`);
console.log('✓ idx_findings_os_vendor index created (or already exists)');
} catch (err) {
console.error('Migration error:', err.message);
process.exit(1);
}
console.log('Migration complete.');
process.exit(0);
}
run();