Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Schema & Change Tracking

Tables

programs

Stores one row per program across all platforms.

ColumnTypeDescription
idSERIALPrimary key
platformTEXTPlatform name (h1, bc, it, ywh, immunefi)
handleTEXTPlatform-specific program handle
urlTEXTUnique program URL
first_seen_atTIMESTAMPWhen the program was first polled
last_seen_atTIMESTAMPLast successful poll
strictINTEGERWhether scope changes should be treated strictly
disabledINTEGER1 if program was removed from the platform
is_ignoredINTEGER1 if user has ignored this program

targets_raw

Raw scope entries as received from the platform.

ColumnTypeDescription
idSERIALPrimary key
program_idINTEGERFK to programs
targetTEXTRaw target string
categoryTEXTNormalized category
descriptionTEXTPlatform-provided description
in_scopeINTEGER1 = in scope, 0 = out of scope
is_bbpINTEGER1 = bug bounty program
first_seen_atTIMESTAMPWhen this target was first seen
last_seen_atTIMESTAMPLast time this target was present

Unique constraint: (program_id, category, target).

targets_ai_enhanced

AI-normalized variants of raw targets. Linked to targets_raw rows.

scope_changes

Change log — one row per detected change (addition, removal, or update).

ColumnTypeDescription
occurred_atTIMESTAMPWhen the change was detected
program_urlTEXTProgram URL
platformTEXTPlatform name
target_normalizedTEXTNormalized target
target_rawTEXTRaw target string
target_ai_normalizedTEXTAI-normalized variant (if applicable)
categoryTEXTTarget category
in_scopeINTEGERScope status
change_typeTEXTadded, removed, or updated

Change detection

When bbscope poll --db runs, it compares the freshly fetched scope against what’s stored in the database:

  • Added: Target exists in the poll but not in the DB.
  • Removed: Target exists in the DB but not in the current poll.
  • Updated: Target exists in both but properties changed (scope status, category, description).

Changes are logged to scope_changes and printed to stdout.

Safety mechanisms

  • Scope wipe protection: If an upsert would remove all targets from a program, the update is aborted (ErrAbortingScopeWipe). This prevents broken pollers from wiping real data.
  • Platform-level safety: If a platform returns 0 programs but the database has >10, the entire platform sync is skipped.
  • Program sync: Programs no longer returned by the platform are marked disabled, not deleted. Their historical data remains queryable.