Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 51 additions & 0 deletions .github/actions/verify-seal/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# Verify OpenAdapt Seal (GitHub Action)

Offline cryptographic verification for [OpenAdapt](https://github.com/OpenAdaptAI/OpenAdapt) run receipts (`record/run/v1` DSSE envelopes and `openadapt.receipt-card/v1` public cards).

- **Zero network egress** during verification: checks Ed25519 signatures and receipt invariants strictly against local pinned key material.
- **Fail-closed**: exits with code `1` on any missing receipt, missing/unknown key, malformed JSON, or tampered payload/signature.
- **GitHub Step Summary**: writes a concise verification table to `$GITHUB_STEP_SUMMARY` and exposes `verified`, `receipt-id`, `outcome`, and `reason` step outputs.

## Usage

```yaml
- uses: OpenAdaptAI/OpenAdapt/.github/actions/verify-seal@main
with:
receipt: path/to/receipt.json
public-key: path/to/public-key.pem # Ed25519 PEM or openadapt.receipt-keys/v1 JSON
```

### Inputs

| Input | Required | Default | Description |
| --- | --- | --- | --- |
| `receipt` | Yes | — | Path to `receipt.json` (`record/run/v1` DSSE envelope or public card). |
| `public-key` | No* | `""` | Path to an Ed25519 public key `.pem` file or `openadapt.receipt-keys/v1` JSON registry. |
| `keys` | No* | `""` | Path to an `openadapt.receipt-keys/v1` pinned key registry JSON file. |
| `key-role` | No | `this_computer` | Signer role assigned when `public-key` is a raw PEM file (`this_computer`, `customer_key`, `openadapt_cloud`, `public_log`, `demo`). |
| `openings` | No | `""` | Optional path to a `receipt.private.json` openings sidecar. |
| `python-version` | No | `3.12` | Python version used to run verification. |
| `install-mode` | No | `auto` | `auto` (local `packages/types` if present, else PyPI), `pypi`, or `skip`. |

\* At least one of `public-key` or `keys` must be supplied; verification fails closed if no trusted key is configured.

### Outputs

| Output | Description |
| --- | --- |
| `verified` | `'true'` when offline verification passes, `'false'` otherwise. |
| `receipt-id` | Verified run/receipt identifier (empty on failure). |
| `outcome` | Recorded run outcome (`VERIFIED`, `STOPPED`, etc.; empty on failure). |
| `reason` | Empty on success, or the fail-closed refusal reason code on failure. |

### Example Step Summary

> ### ✅ Verified by OpenAdapt Seal
>
> | Field | Value |
> | --- | --- |
> | **Status** | Verified offline (Ed25519) |
> | **Receipt ID** | `run_2026_11_22_001` |
> | **Run Outcome** | `VERIFIED` |
> | **Ed25519 Signature** | Signed by customer key |
> | **Offline Verification** | `openadapt verify path/to/receipt.json` |
109 changes: 109 additions & 0 deletions .github/actions/verify-seal/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
name: "Verify OpenAdapt Seal"
description: "Offline cryptographic verification of OpenAdapt run receipts (record/run/v1) with GitHub Step Summary."
author: "OpenAdaptAI"

branding:
icon: "shield"
color: "green"

inputs:
receipt:
description: "Path to an OpenAdapt receipt JSON file (DSSE record/run/v1 envelope or openadapt.receipt-card/v1)."
required: true
public-key:
description: "Optional path to an Ed25519 public key PEM file or an openadapt.receipt-keys/v1 JSON registry."
required: false
default: ""
keys:
description: "Optional path to an openadapt.receipt-keys/v1 JSON pinned key registry."
required: false
default: ""
key-role:
description: "Trusted signer role assigned when public-key is a raw Ed25519 PEM file (this_computer, customer_key, openadapt_cloud, public_log, or demo)."
required: false
default: "this_computer"
openings:
description: "Optional path to a receipt.private.json openings sidecar."
required: false
default: ""
accepted-outcomes:
description: "Comma-separated list of receipt outcomes that pass the gate (default: VERIFIED)."
required: false
default: "VERIFIED"
allow-demo:
description: "Set to 'true' to accept receipts signed only by a demo-role key (default: 'false')."
required: false
default: "false"
python-version:
description: "Python version used to run offline verification."
required: false
default: "3.12"
install-mode:
description: "Dependency install mode: auto (local packages/types if present, else PyPI), pypi, or skip."
required: false
default: "auto"

outputs:
verified:
description: "'true' if the receipt passed offline cryptographic verification, otherwise 'false'."
value: ${{ steps.verify.outputs.verified }}
receipt-id:
description: "The verified run or receipt identifier, or empty on failure."
value: ${{ steps.verify.outputs.receipt-id }}
outcome:
description: "The recorded run outcome from the verified receipt (e.g. VERIFIED, STOPPED), or empty on failure."
value: ${{ steps.verify.outputs.outcome }}
reason:
description: "Empty on success, or the fail-closed refusal reason code on failure."
value: ${{ steps.verify.outputs.reason }}

runs:
using: "composite"
steps:
- name: Set up Python
if: inputs.install-mode != 'skip'
uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7.1.0
with:
python-version: ${{ inputs.python-version }}

- name: Install offline verifier dependencies
if: inputs.install-mode != 'skip'
shell: bash
env:
ACTION_PATH: ${{ github.action_path }}
INSTALL_MODE: ${{ inputs.install-mode }}
run: |
set -euo pipefail
python -m pip install --quiet --disable-pip-version-check --require-hashes -r "${ACTION_PATH}/requirements.txt"

- name: Verify OpenAdapt Seal offline
id: verify
shell: bash
env:
ACTION_PATH: ${{ github.action_path }}
INSTALL_MODE: ${{ inputs.install-mode }}
INPUT_RECEIPT: ${{ inputs.receipt }}
INPUT_PUBLIC_KEY: ${{ inputs.public-key }}
INPUT_KEYS: ${{ inputs.keys }}
INPUT_KEY_ROLE: ${{ inputs.key-role }}
INPUT_OPENINGS: ${{ inputs.openings }}
INPUT_ACCEPTED_OUTCOMES: ${{ inputs.accepted-outcomes }}
INPUT_ALLOW_DEMO: ${{ inputs.allow-demo }}
run: |
set -euo pipefail
LOCAL_TYPES="${ACTION_PATH}/../../../packages/types"
if [ "$INSTALL_MODE" = "auto" ] && [ -f "${LOCAL_TYPES}/pyproject.toml" ]; then
export PYTHONPATH="${LOCAL_TYPES}${PYTHONPATH:+:${PYTHONPATH}}"
fi
EXTRA_ARGS=()
if [ "${INPUT_ALLOW_DEMO}" = "true" ]; then
EXTRA_ARGS+=(--allow-demo)
fi
python "${ACTION_PATH}/verify_seal.py" \
--receipt "${INPUT_RECEIPT}" \
--public-key "${INPUT_PUBLIC_KEY}" \
--keys "${INPUT_KEYS}" \
--key-role "${INPUT_KEY_ROLE}" \
--openings "${INPUT_OPENINGS}" \
--accepted-outcomes "${INPUT_ACCEPTED_OUTCOMES}" \
"${EXTRA_ARGS[@]}"
Loading