Add failure-safe cluster image capture hook
All checks were successful
CI Smoke / host-smoke (push) Successful in 0s
CI Smoke / container-smoke (push) Successful in 2s

Assistant: codex
Assistant-Model: gpt-6-astra
Assistant-Session: 01a06ecb-456a-71c2-b41e-0755d336e883
This commit is contained in:
codex 2026-09-05 10:04:38 +02:00
parent 05f315be84
commit da42f764c0
4 changed files with 60 additions and 3 deletions

View file

@ -8,6 +8,7 @@ import hashlib
import json
import os
from pathlib import Path
import re
import tempfile
@ -17,7 +18,7 @@ def read_images(path: Path) -> set[str]:
image = line.strip()
if not image or image.startswith("#"):
continue
if any(c.isspace() for c in image) or "/" not in image:
if not re.fullmatch(r"[A-Za-z0-9][A-Za-z0-9._:/@+-]*", image):
raise ValueError("invalid image export")
images.add(image)
if not images: