20 lines
970 B
Python
20 lines
970 B
Python
"""Install only the pinned official package auditor inside the remote CI image."""
|
|
import hashlib
|
|
import io
|
|
from pathlib import Path
|
|
import urllib.request
|
|
import zipfile
|
|
|
|
url = 'https://fe-static.xhscdn.com/minitool/20261015161653/minitool-zip-builder-1.8.0.skill'
|
|
with urllib.request.urlopen(url, timeout=120) as response:
|
|
archive = zipfile.ZipFile(io.BytesIO(response.read()))
|
|
matches = [name for name in archive.namelist() if name.endswith('scripts/audit_artifact.py')]
|
|
if len(matches) != 1:
|
|
raise SystemExit('Official auditor missing or ambiguous')
|
|
content = archive.read(matches[0])
|
|
if hashlib.sha256(content).hexdigest() != '62ff11eae1d5bb566a6f74b0fa102fe2eb3ffe982b87596aca2f93485cc9de21':
|
|
raise SystemExit('Official auditor changed; review before updating the pinned checksum')
|
|
target = Path('.codex/skills/minitool-zip-builder/scripts/audit_artifact.py')
|
|
target.parent.mkdir(parents=True, exist_ok=True)
|
|
target.write_bytes(content)
|