Files
2026-11-10 17:48:35 +01:00

17 lines
662 B
Python

#!/usr/bin/env python3
"""Validate mirrored records and the sync manifest."""
import json
from pathlib import Path
root = Path(__file__).resolve().parents[1]
state = json.loads((root / 'state/sync.json').read_text())
files = list((root / 'data').rglob('CVE-*.json'))
if not files or len(files) != state['records']:
raise SystemExit(f'Record count mismatch: expected {state["records"]}, got {len(files)}')
for path in files:
with path.open(encoding='utf-8') as f:
record = json.load(f)
if record.get('cveMetadata', {}).get('cveId') != path.stem:
raise SystemExit(f'Invalid record {path}')
print(f'Validated {len(files)} CVE records')