Verify in CI
Fail a build or a deploy when a receipt does not verify or the gateway's measurements are not on the release list.
What to check in CI#
- Attest the gateway and check its measurements against the release list (Attest the gateway).
- Send a canary request with a fixed prompt, keep the exact bytes, and verify its receipt at the level you require.
The job needs a key with the inference and receipts.read scopes, stored as a CI secret in PANWARD_API_KEY, and the warden command line on the runner.
warden from the gateway repository in an earlier step of the job (Warden command line). What is not available yet.A minimal job#
The script exits non-zero, and fails the job, when any check fails. It works in any CI system that runs a shell.
#!/bin/sh set -eu # 1. The gateway runs a published release in a genuine enclave. warden attest api.eu.panward.ai --releases releases.json # 2. A canary request with a fixed prompt, keeping the exact bytes. cat > request.json <<'EOF' {"model": "z-ai/glm-5.3", "messages": [{"role": "user", "content": "Reply with the word ready."}]} EOF curl -s https://api.eu.panward.ai/v1/chat/completions \ -D headers.txt -o response.bin \ -H "Authorization: Bearer $PANWARD_API_KEY" \ -H "Content-Type: application/json" \ --data-binary @request.json RECEIPT_ID=$(grep -i '^panward-receipt-id:' headers.txt | cut -d' ' -f2 | tr -d '\r') # 3. Wait until the receipt is final: 60 seconds at most. for attempt in $(seq 1 30); do curl -s https://api.eu.panward.ai/v1/receipts/$RECEIPT_ID \ -H "Authorization: Bearer $PANWARD_API_KEY" -o receipt.json if [ "$(jq -r .status receipt.json)" = final ]; then break; fi sleep 2 done # 4. Verify the receipt against the bytes. A non-zero exit code fails the job. warden verify receipt.json --request request.json --response response.bin --require-content
--require-content makes Warden exit with code 4 when your bytes were not checked, so a job cannot pass on the signature alone (Verdicts and exit codes).
In GitHub Actions or GitLab CI, keep the script and your release file in the repository and run them in a job. The key is stored as a secret named PANWARD_API_KEY and the file names it only; the gateway repository and the commit you build Warden from are plain variables.
# .github/workflows/verify-panward.yml
name: Verify Panward
on:
pull_request:
schedule:
- cron: "17 6 * * *"
permissions:
contents: read
jobs:
verify:
runs-on: ubuntu-latest
timeout-minutes: 20
env:
# A repository secret (Settings, Secrets and variables, Actions), read by name.
PANWARD_API_KEY: ${{ secrets.PANWARD_API_KEY }}
steps:
- uses: actions/checkout@v4
- name: Build warden from the gateway repository at a recorded commit
env:
PANWARD_GATEWAY_REPO: ${{ vars.PANWARD_GATEWAY_REPO }}
WARDEN_COMMIT: ${{ vars.WARDEN_COMMIT }}
run: |
git clone "$PANWARD_GATEWAY_REPO" gateway
git -C gateway checkout "$WARDEN_COMMIT"
cargo build --release -p warden --manifest-path gateway/Cargo.toml
echo "$PWD/gateway/target/release" >> "$GITHUB_PATH"
- name: Attest, send a canary request, verify its receipt
run: |
test -n "$PANWARD_API_KEY" || { echo "the secret PANWARD_API_KEY is not set"; exit 1; }
sh ci-verify.sh
- name: Require the level
run: |
LEVEL=$(jq -r '.events[] | select(.type == "upstream.verified") | .level' receipt.json)
test "$LEVEL" = sealed_model_signed || { echo "level: $LEVEL"; exit 1; }# .gitlab-ci.yml
# PANWARD_API_KEY: a masked and protected CI/CD variable (Settings, CI/CD, Variables), read by name.
verify-panward:
image: rust:1-bookworm
timeout: 20 minutes
rules:
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
- if: $CI_PIPELINE_SOURCE == "schedule"
before_script:
- apt-get update && apt-get install -y --no-install-recommends jq
- git clone "$PANWARD_GATEWAY_REPO" gateway
- git -C gateway checkout "$WARDEN_COMMIT"
- cargo build --release -p warden --manifest-path gateway/Cargo.toml
- export PATH="$PWD/gateway/target/release:$PATH"
script:
- test -n "$PANWARD_API_KEY" || { echo "the variable PANWARD_API_KEY is not set"; exit 1; }
- sh ci-verify.sh
- LEVEL=$(jq -r '.events[] | select(.type == "upstream.verified") | .level' receipt.json)
- 'test "$LEVEL" = sealed_model_signed || { echo "level: $LEVEL"; exit 1; }'Require a level#
The receipt states the level the gateway reached in its upstream.verified event. Fail the job unless it is the one you require, for example sealed_model_signed, which is reached by non-streamed requests on models that list it.
$ LEVEL=$(jq -r '.events[] | select(.type == "upstream.verified") | .level' receipt.json) $ test "$LEVEL" = sealed_model_signed || { echo "level: $LEVEL"; exit 1; }
Handle release rollouts#
New gateway releases are announced at least 7 days before they serve traffic, and old and new releases are both valid during a rollout. Read the release list at run time instead of pinning one release, and alert on a measurement that is not listed.
GET /api/public/releases is part of the contract and is not served yet. Keep the release file you give Warden with --releases up to date. What is not available yet.Verify a sample of production receipts#
A scheduled job can take receipt ids your application stored, with their bytes if you keep them, fetch each receipt and run warden verify on it.
Keep secrets safe#
Give the CI key only the scopes it needs, and restrict it by IP address where your CI has fixed egress addresses (Restrict a key).
Cost#
One small request per run is billed like any other. Receipts and verification are free.