Skip to main content
Version: Local Β· In Progress

Tenable Cloud Sync

The Tenable sync service connects ThreatWeaver to the Tenable.io cloud platform via the Export API v2. It pulls asset and vulnerability data in chunks, normalizes it into the ThreatWeaver data model, and stores it in PostgreSQL.

Sync Architecture​

Sync Modes​

ModeDescription
Full SyncExports all vulnerabilities and assets from Tenable.io. Used for initial setup or periodic full refresh.
Incremental SyncExports only records modified since the last sync timestamp. Used for regular scheduled updates.
Assets OnlyExports only the asset inventory, skipping vulnerabilities.
Vulnerabilities OnlyExports only vulnerability data, skipping assets.

Sync Configuration​

Syncs can be triggered manually or run on a schedule:

  • Manual sync -- Admin triggers via POST /api/sync/start with optional date range and scope
  • Scheduled sync -- Configured frequency (in hours) runs automatically via the sync scheduler
  • Resume -- A failed or interrupted sync can be resumed by passing the resumeJobId parameter

Chunk Processing​

The Tenable Export API delivers data in chunks. The sync service processes each chunk sequentially:

  1. Request chunk -- Fetch the next chunk from the Export API
  2. Normalize -- Map Tenable field names to ThreatWeaver schema, classify OS categories (Windows Server, Workstation, Linux, Network), and standardize severity levels
  3. Deduplication -- Prevent duplicate records via upsert logic keyed on Tenable plugin ID + asset ID
  4. Persist -- Insert or update records in PostgreSQL using TypeORM
  5. Progress update -- Emit SSE (Server-Sent Events) progress event with chunk count, percentage, and ETA

ETA Calculation​

The sync status endpoint (GET /api/sync/status) computes a real-time ETA:

  • Only calculated after 15% progress (earlier estimates are unreliable)
  • Based on elapsed time divided by fraction complete
  • Capped at 4 hours (14400 seconds) -- beyond this threshold, the estimate likely indicates a stalled sync
  • Returned as etaSeconds in the status response

Data Normalization​

During sync, raw Tenable data is transformed:

Raw FieldNormalized FieldLogic
asset.operating_systemos_categoryClassified into Windows Server, Workstation, Linux, macOS, Network Device via regex rules
severity (1-4)severity (info/low/medium/high/critical)Mapped to standard severity labels
plugin_outputVulnerability descriptionSanitized and truncated for display
first_found / last_foundfirstSeen / lastSeenISO date conversion

Sync History and Logging​

Every sync operation is logged as a SyncJob entity with:

  • Start and end timestamps
  • Trigger type (manual / scheduled)
  • Triggered-by user email
  • Progress percentage
  • Chunk counts (total, processed, failed)
  • Final status (completed / failed / cancelled)
  • Error messages if applicable

The sync history is viewable at /admin/sync in the UI.

API Endpoints​

MethodPathDescription
GET/api/sync/statusCurrent sync status with progress and ETA
POST/api/sync/startStart a new sync (admin only)
GET/api/sync/historyList past sync jobs
POST/api/sync/cancelCancel a running sync