Reject stale native runtime build provenance before release staging

This commit is contained in:
karl committed 2026-10-13 13:04:58 +02:00
1 parent ea2c3f4691
commit 07bbcb76e8
12 files changed
+204 -9

No files matched your search

+4 -2
View File
@@ -16,6 +16,7 @@ import struct
import subprocess
import tarfile
import tempfile
from embeddinggemma2.runtime_provenance import verify as verify_provenance
ROOT = Path(__file__).resolve().parents[1]
MAX_FILE = 256 * 1024 * 1024
@@ -70,7 +71,7 @@ def dynamic(path):
return values
def runtime_files(runtime):
def runtime_files(runtime, root=ROOT):
inventory = runtime / "runtime-libraries.json"
regular(inventory, runtime)
if inventory.stat().st_size > 65536:
@@ -80,6 +81,7 @@ def runtime_files(runtime):
records = manifest.get("libraries") if isinstance(manifest, dict) else None
if not isinstance(manifest, dict) or manifest.get("platform") != "linux" or not isinstance(records, list) or not 1 <= len(records) <= 64:
raise ValueError("Invalid Linux runtime inventory")
verify_provenance(manifest, root)
expected = {"searchi-gemma-worker": {"sha256": manifest.get("worker_sha256")}}
core = {}
for record in records:
@@ -176,7 +178,7 @@ def package(root, executable, runtime, media, output, llama_license=None, compre
root, executable, runtime, media, output = map(Path, (root, executable, runtime, media, output))
regular(executable, executable.parent)
elf_x64(executable)
expected = runtime_files(runtime)
expected = runtime_files(runtime, root)
cli_metadata = dynamic(executable)
if (cli_metadata.get("RPATH") or cli_metadata.get("RUNPATH")
or set(cli_metadata.get("NEEDED", [])) - SYSTEM):