#!/bin/sh # EXTERNAL ARBITER — ground truth OUTSIDE the agent tree (epb-observer, evaluator plane). # Exit 0 only if the external evaluator answers AND its /pubkey bytes still match the # pin captured at seal time (2026-10-06). No local fallback: external truth missing => fail. set -u OBS="${OBSERVER_URL:-https://epb-observer-epb01.pages.dev}" PIN_SHA256="dc1161b389947b5940c30d9dbdbdf288a8502c9ad71481320eb6870999183acb" KEY_ID="epb-obs-1" body=$(curl -fsS --max-time 20 "$OBS/pubkey") || { echo "arbiter: FAIL (no external evaluator)" >&2; exit 2; } got=$(printf '%s' "$body" | sha256sum | cut -d' ' -f1) [ "$got" = "$PIN_SHA256" ] || { echo "arbiter: FAIL (pubkey pin mismatch $got)" >&2; exit 3; } printf '%s' "$body" | grep -Eq "\"key_id\"[[:space:]]*:[[:space:]]*\"$KEY_ID\"" || { echo "arbiter: FAIL (unexpected key_id)" >&2; exit 4; } printf '%s' "$body" | grep -q '"jwk"' || { echo "arbiter: FAIL (no jwk)" >&2; exit 5; } health=$(curl -fsS --max-time 20 "$OBS/health") || { echo "arbiter: FAIL (health unreachable)" >&2; exit 6; } printf '%s' "$health" | grep -Eq '"ok"[[:space:]]*:[[:space:]]*true' || { echo "arbiter: FAIL (health not ok)" >&2; exit 7; } echo "arbiter: EXTERNAL TRUTH OK key_id=$KEY_ID pubkey_sha256=$got" exit 0