interplane.Get Omega
Read in your language

aien-receipts

Append-only AIEN verification receipts, indexed by repository and exact source commit. Read verdicts, signatures and retained logs before making a claim.

Brought by drakestapleton

branch main Branches Tags History

aien-receipts / .github / workflows / audit-attest.yml

81 lines · 3393 bytes Raw Blame History
1# Org audit stamps: re-check every new stamp on a GitHub-hosted runner, then sign it.
2# Scope (ADR 0033 addendum, aien-dev/aien-architecture-mv#337): runs only for audit/stamps/**.
3# A stamp is attested only when stamp.py validates it and, for public repositories,
4# verify.py reproduces every reproducible check output byte for byte at the stamped commit.
5name: audit-attest
6
7on:
8 push:
9 branches: [main]
10 paths: ["audit/stamps/**"]
11
12permissions: {}
13
14concurrency:
15 group: audit-attest
16 cancel-in-progress: false
17
18jobs:
19 attest:
20 runs-on: ubuntu-24.04
21 timeout-minutes: 120
22 permissions:
23 contents: read
24 id-token: write # Sigstore signing identity for the attestation
25 attestations: write # store the attestation on this repository
26 steps:
27 - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
28 with:
29 fetch-depth: 0
30 persist-credentials: false
31 - uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7.1.0
32 with:
33 python-version: "3.12"
34 - name: Install pinned tools (sha256-checked against audit/tools/tools.lock.json)
35 run: python3 audit/tools/install_tools.py "$RUNNER_TEMP/tools"
36 - name: Tests
37 run: python3 -m unittest discover -s audit/tests
38 env:
39 AUDIT_TOOLS: ${{ runner.temp }}/tools
40 - name: Re-check new stamps
41 id: check
42 env:
43 BEFORE: ${{ github.event.before }}
44 AFTER: ${{ github.sha }}
45 AUDIT_TOOLS: ${{ runner.temp }}/tools
46 run: |
47 set -euo pipefail
48 git diff --name-only --diff-filter=AM "$BEFORE" "$AFTER" -- audit/stamps \
49 | awk -F/ 'NF >= 5 { print $1 "/" $2 "/" $3 "/" $4 }' | sort -u > "$RUNNER_TEMP/stamps.txt"
50 : > "$RUNNER_TEMP/subjects.txt"
51 while read -r d; do
52 [ -f "$d/stamp.json" ] || { echo "::error::$d has files but no stamp.json"; exit 1; }
53 vis=$(python3 -c 'import json,sys; print(json.load(open(sys.argv[1]))["subject"]["visibility"])' "$d/stamp.json")
54 if [ "$vis" = public ]; then
55 repo=$(basename "$(dirname "$d")"); sha=$(basename "$d")
56 gd="$RUNNER_TEMP/src/$repo"
57 git init -q "$gd"
58 git -C "$gd" fetch -q "https://github.com/${GITHUB_REPOSITORY_OWNER}/$repo" "$sha"
59 git -C "$gd" worktree add -q --detach "$gd-wt" "$sha"
60 python3 audit/tools/verify.py "$d" --rerun "$gd" --worktree "$gd-wt" --tools "$AUDIT_TOOLS"
61 else
62 # private: nobody outside can re-run it; validated and signed as self-reported
63 python3 audit/tools/verify.py "$d"
64 fi
65 find "$d" -type f | sort >> "$RUNNER_TEMP/subjects.txt"
66 done < "$RUNNER_TEMP/stamps.txt"
67 if [ -s "$RUNNER_TEMP/subjects.txt" ]; then
68 echo "any=true" >> "$GITHUB_OUTPUT"
69 else
70 echo "any=false" >> "$GITHUB_OUTPUT"
71 fi
72 {
73 echo "subjects<<EOF"
74 cat "$RUNNER_TEMP/subjects.txt"
75 echo "EOF"
76 } >> "$GITHUB_OUTPUT"
77 - name: Sign
78 if: steps.check.outputs.any == 'true'
79 uses: actions/attest-build-provenance@4d101475d8b20a2381f78447822ac1eab6504dd8 # v4.2.2
80 with:
81 subject-path: ${{ steps.check.outputs.subjects }}