oficina / equipo Public

Clone
git clone https://amadan.net/oficina/equipo

Plain git — no account needed to clone.

Download

Download this file

1#!/usr/bin/env python3
2"""Verify pinned Codex bytes without starting a provider process."""
3import hashlib
4import os
5from pathlib import Path
6import platform
7import re
8import shutil
9import sys
10
11root = Path(__file__).resolve().parent.parent
12codex = root / "internal/runner/provider/codex"
13# The release pin on x86-64; the same release's arm64 build on an arm64
14# CI machine (pins.go), where no release runs.
15if platform.machine().lower() in ("aarch64", "arm64"):
16 pin = re.search(r'ExecutableSHA256Arm64\s+= "([a-f0-9]{64})"', (codex / "pins.go").read_text())
17else:
18 pin = re.search(r'const ExecutableSHA256 = "([a-f0-9]{64})"', (codex / "launcher.go").read_text())
19path = os.environ.get("EQUIPO_CODEX_PATH") or shutil.which("codex")
20try:
21 if not pin or not path or not os.access(path, os.X_OK):
22 sys.exit(1)
23 with open(path, "rb") as binary:
24 if hashlib.file_digest(binary, "sha256").hexdigest() != pin[1]:
25 sys.exit(1)
26except OSError:
27 sys.exit(1)
28