CodeQL / Checkout of untrusted code in a non-privileged context
Potential unsafe checkout of untrusted pull request on non-privileged workflow.
Canonical architecture for the AIEN ecosystem: flows, boundaries, ADRs, and the map from design to implementation repositories.
Brought by drakestapleton
Potential unsafe checkout of untrusted pull request on non-privileged workflow.
git checkout -b patch-565f63f4b860a784 12e8c7de510f85c61ae8809a9b15467c51233783 curl -fsSL https://interplane.io/drakestapleton/aien-architecture-mv/patches/565f63f4b860a784.patch | git am
github-import 1
aien-dev/aien-architecture-mv
374
ed495d613286d0ad6e09b0c1c1c75bb681bb50c9
{"kind":"github-import","owner":"aien-dev","repo":"aien-architecture-mv","number":374,"url":"https://github.com/aien-dev/aien-architecture-mv/pull/374","export_sha256":"967c79e26a893657b5cdaa45efd442be5dbd2ecfe68e25f9a8c1b5da4d60d452","imported_utc":"2026-11-18T16:38:04Z","metadata":"unavailable","state_derived":true}
diff --git a/.github/workflows/aien-verification.yml b/.github/workflows/aien-verification.yml index f6d20ea..db05d70 100644 --- a/.github/workflows/aien-verification.yml +++ b/.github/workflows/aien-verification.yml @@ -4,9 +4,16 @@ # qualifies Alpha builds instead: the local pipeline pushes annotated tags alpha/YYYYMMDD.N. # AIEN Checks (pull_request, push to main): advisory. crumb verify, then for enrolled repos # (.aien/verify.pub on origin/main) the portable smoke set named at origin/main. +# AIEN Pinned-omc Gates (pull_request, push to main): advisory. On a hosted AArch64 runner, births +# the omc pinned in tools/zero-legacy/omega.pin from seed-0 and runs the host gates that need only +# that compiler: ARCH-CAPABILITY-REGISTER, ARCH-DOCTRINE, ARCH-ZERO-LEGACY-CLOSURE and +# ARCH-SCRIPT-TESTS (#363). # AIEN Alpha (push of an alpha/* tag): the tagged commit must be on main; its signed Spark bundle # from aien-receipts must verify (--require-full) against the trust anchors on origin/main. -# GitHub-hosted compute builds only the pinned verifier tools, never this repository's code. +# GitHub-hosted compute builds only the pinned verifier tools, never this repository's code, with two +# exceptions that are checkers, not shipped code: the crumb tool, and the seeded .om checkers that the +# pinned omc compiles in the pinned-omc job. That omc is born from seed-0 with no C toolchain, and every +# gate refuses it unless it hashes as omega.pin says. name: AIEN on: @@ -99,9 +106,8 @@ jobs: cd "$GITHUB_WORKSPACE" git status --porcelain --untracked-files=normal - # ARCH-DOCTRINE is `requires: host` since #316 (tools/doctrine/doctrine.om needs the pinned - # AArch64 omc); on this x86 runner its step exits 3 = NOT_RUN. It leaves this set once the - # base ref carries that manifest. + # ARCH-DOCTRINE and the other gates that need the pinned AArch64 omc are `requires: host`, so + # they stay out of this set; the pinned-omc job below runs them on an AArch64 runner. - name: Portable smoke set (gates whose requires is only portable, named at the base ref) if: steps.anchors.outputs.enrolled == 'true' run: | @@ -124,6 +130,69 @@ jobs: done exit $fail + pinned-omc-gates: + name: AIEN Pinned-omc Gates + if: github.event_name == 'pull_request' || github.ref == 'refs/heads/main' + # The seed chain and omc write AArch64 Linux ELF, so this job needs an arm64 runner. + runs-on: ubuntu-24.04-arm + timeout-minutes: 20 + steps: + - name: Checkout the head under test + uses: actions/checkout@v4 + + # The pin is read from the head under test because the gates check AIEN_OMC against that same + # file; a PR that moves the pin is tested with the compiler it names. + - name: Read the compiler pin (tools/zero-legacy/omega.pin) + id: pin + run: | + pin=tools/zero-legacy/omega.pin + repo=$(sed -n 's|^repo: .*github\.com[:/]\(.*\)\.git$|\1|p' "$pin") + commit=$(sed -n 's/^commit: //p' "$pin") + omc_sha256=$(sed -n 's/^omc_sha256: //p' "$pin") + printf '%s' "$commit" | grep -Eqx '[0-9a-f]{40}' || { echo "::error::$pin: commit is not 40 hex"; exit 1; } + printf '%s' "$omc_sha256" | grep -Eqx '[0-9a-f]{64}' || { echo "::error::$pin: omc_sha256 is not 64 hex"; exit 1; } + [ -n "$repo" ] || { echo "::error::$pin: no github.com repo"; exit 1; } + echo "repo=$repo" >> "$GITHUB_OUTPUT" + echo "commit=$commit" >> "$GITHUB_OUTPUT" + echo "omc_sha256=$omc_sha256" >> "$GITHUB_OUTPUT" + echo "omc pin: $repo@$commit, omc sha256 $omc_sha256" + + - name: Checkout the pinned Omega seed (${{ steps.pin.outputs.repo }} @ ${{ steps.pin.outputs.commit }}) + uses: actions/checkout@v4 + with: + repository: ${{ steps.pin.outputs.repo }} + ref: ${{ steps.pin.outputs.commit }} + path: .omega-seed + + - name: Birth omc from seed-0 outside the candidate tree and check its hash + run: | + mv .omega-seed "$RUNNER_TEMP/omega-seed" + cd "$RUNNER_TEMP/omega-seed" + sh seed/omega-from-seed.sh + have=$(sha256sum seed/out/omc | cut -d' ' -f1) + if [ "$have" != "${{ steps.pin.outputs.omc_sha256 }}" ]; then + echo "::error::seed-born omc hashes $have, omega.pin pins ${{ steps.pin.outputs.omc_sha256 }}" + exit 1 + fi + echo "AIEN_OMC=$RUNNER_TEMP/omega-seed/seed/out/omc" >> "$GITHUB_ENV" + cd "$GITHUB_WORKSPACE" + git status --porcelain --untracked-files=normal + + # Each step is the `run:` of its manifest under tests/gates/. Exit 3 is NOT_RUN and fails + # this job, since the pinned compiler is present here. + - name: Host gates that need only the pinned omc + run: | + fail=0 + for step in capreg doctrine zero-legacy script-tests; do + echo "::group::run.sh $step" + rc=0 + timeout 600 bash tests/gates/run.sh "$step" || rc=$? + echo "::endgroup::" + if [ "$rc" -eq 0 ]; then echo "$step: PASS"; else echo "::error::$step: exit $rc, not PASS"; fail=1; fi + done + git status --porcelain --untracked-files=normal + exit $fail + alpha: name: AIEN Alpha if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/alpha/') diff --git a/tests/gates/arch-capability-register.gate b/tests/gates/arch-capability-register.gate index c6748f8..249519a 100644 --- a/tests/gates/arch-capability-register.gate +++ b/tests/gates/arch-capability-register.gate @@ -1,5 +1,5 @@ # tests/gates/arch-capability-register.gate -# seeded .om checker accepts the CUDA capability register and its view, refuses 22 bad fixtures and a planted row (no hosted job) +# seeded .om checker accepts the CUDA capability register and its view, refuses 22 bad fixtures and a planted row (hosted: AIEN Pinned-omc Gates on ubuntu-24.04-arm) gate: ARCH-CAPABILITY-REGISTER manifest_version: 2 owner: aien-architecture diff --git a/tests/gates/arch-script-tests.gate b/tests/gates/arch-script-tests.gate index 88183d0..0a4dc92 100644 --- a/tests/gates/arch-script-tests.gate +++ b/tests/gates/arch-script-tests.gate @@ -1,6 +1,6 @@ # tests/gates/arch-script-tests.gate # Mirrors hosted: offline tests of scripts/pr-gate.sh, rebase-crumb.sh and the seeded .om candidate checkers -# tools/candidate/check_candidate.om, check_pins.om with their parity corpus (not a hosted job; NOT_RUN without the pinned AIEN_OMC) +# tools/candidate/check_candidate.om, check_pins.om with their parity corpus (hosted: AIEN Pinned-omc Gates on ubuntu-24.04-arm; NOT_RUN without the pinned AIEN_OMC) gate: ARCH-SCRIPT-TESTS manifest_version: 2 owner: aien-architecture diff --git a/tests/gates/arch-zero-legacy-closure.gate b/tests/gates/arch-zero-legacy-closure.gate index 6680cd3..e1f5fc5 100644 --- a/tests/gates/arch-zero-legacy-closure.gate +++ b/tests/gates/arch-zero-legacy-closure.gate @@ -1,5 +1,5 @@ # tests/gates/arch-zero-legacy-closure.gate -# #316: seeded .om closure checker refuses the hostile fixture tree and accepts the clean one (no hosted job) +# #316: seeded .om closure checker refuses the hostile fixture tree and accepts the clean one (hosted: AIEN Pinned-omc Gates on ubuntu-24.04-arm) gate: ARCH-ZERO-LEGACY-CLOSURE manifest_version: 2 owner: aien-architecture diff --git a/tools/capreg/README.md b/tools/capreg/README.md index e3451aa..56ace56 100644 --- a/tools/capreg/README.md +++ b/tools/capreg/README.md @@ -68,3 +68,20 @@ AIEN_OMC="$omc" ../../tests/gates/run.sh capreg Exit codes: 0 pass; 1 the register (or view) fails a rule, one `FAIL line N: rule` per finding on stderr; 3 NOT_RUN (evidence mode with a missing clone); 64 usage; 65 register unreadable or over 500000 bytes; 100 + code on a trap. Capacities: 1024 records, a 999000-byte view. + +## Where the gate runs + +`tests/gates/arch-capability-register.gate` says `requires: - host`: it needs the pinned AArch64 omc +of `../zero-legacy/omega.pin`. Without `AIEN_OMC`, `run.sh capreg` exits 3 (NOT_RUN). + +- **Hosted CI, every PR and every push to main:** the `AIEN Pinned-omc Gates` job of + `.github/workflows/aien-verification.yml` runs on an `ubuntu-24.04-arm` runner. It checks out the + omega-mv commit named in `omega.pin`, births omc from seed-0 with `sh seed/omega-from-seed.sh`, + refuses a compiler whose sha256 differs from `omc_sha256`, and runs `tests/gates/run.sh capreg` + (with `doctrine`, `zero-legacy` and `script-tests`). A red or NOT_RUN step fails the job. Like the + rest of that workflow it is advisory: main requires no status check. +- **The hosted AIEN Checks job** (x86) runs only `crumb verify` and the gates that require only + `portable`, so it never runs this gate. +- **On the Spark:** `AIEN_OMC=<pinned omc> tests/gates/run.sh capreg`, and `aien-alpha + aien-architecture <sha>`, which runs every gate. A hosted run is a run on GitHub's AArch64 runner, + not a signed Spark receipt. diff --git a/tools/doctrine/README.md b/tools/doctrine/README.md index 7de7d02..b19d0d8 100644 --- a/tools/doctrine/README.md +++ b/tools/doctrine/README.md @@ -65,8 +65,9 @@ commands stop on failure rather than falling through to an older gate binary. `gate.om` exits 3 when the compiler's native sha256 differs from `omega.pin`; otherwise its exit is the checker's (0/1/2) and it prints `AIEN-OBS doctrine_sha256 "<sha256 of build/doctrine>"` before the run and `AIEN-OBS doctrine_exit N` after it. The gate manifest -`tests/gates/arch-doctrine.gate` is `requires: host` (the compiler is AArch64 only); the hosted -x86 job can no longer run it and sees NOT_RUN until the base ref carries that manifest. +`tests/gates/arch-doctrine.gate` is `requires: host` (the compiler is AArch64 only), so the hosted +x86 AIEN Checks job skips it. The hosted `AIEN Pinned-omc Gates` job runs it on an +`ubuntu-24.04-arm` runner with omc born from seed-0 at the `omega.pin` commit (#363). ## Oracle and corpus @@ -121,8 +122,9 @@ the script's own stderr line, which is identical. - `ROOT` defaults to `.`; the script defaulted to its own parent directory, which a program with no fixed location cannot know. -NOT_RUN: nothing in this directory has been run under the hosted x86 workflow (AArch64 compiler -only); `aien-test run ARCH-DOCTRINE` was not run here, only `tests/gates/run.sh doctrine`. +NOT_RUN: nothing in this directory runs under the hosted x86 workflow (AArch64 compiler only); +`aien-test run ARCH-DOCTRINE` was not run here, only `tests/gates/run.sh doctrine`, which is also +what the hosted AArch64 job runs. ## Bootstrap rejection regression (NOT_RUN)