Initial BSI CSAF mirror

This commit is contained in:
root
2026-11-10 21:44:49 +01:00
commit 54c164197d
7 changed files with 329 additions and 0 deletions
+25
View File
@@ -0,0 +1,25 @@
#!/usr/bin/env python3
import argparse
import json
from pathlib import Path
from sync import parse_index, validate_document
def main():
parser = argparse.ArgumentParser()
parser.add_argument('--root', default='.')
args = parser.parse_args()
root = Path(args.root)
state = json.loads((root / 'state/sync.json').read_text())
selected = parse_index((root / 'data/index.txt').read_bytes(), state['since_year'])
if selected != state['entries']:
raise ValueError('Index and state disagree')
for item in selected:
p = root / 'data/csaf' / item
if not p.is_file():
raise ValueError(f'Missing CSAF document: {item}')
validate_document(p.read_bytes(), item)
print(f'Validated {len(selected)} CSAF documents')
if __name__ == '__main__':
main()