From d2f47bcd07c084a25a41c35824549a0a40e21ffc Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Mon, 2 Nov 2026 00:23:49 +0000 Subject: [PATCH 1/2] Pin Actions to release SHAs and scope release tokens to publish. Every workflow action is pinned to the commit of its current release tag. id-token, attestations, and packages:write are granted only on the publish job, which now also pushes the image and writes the attestations. Checkouts that do not push set persist-credentials: false, and Dependabot updates the pins. Co-authored-by: aien-spark --- .github/dependabot.yml | 6 +++ .github/workflows/ci.yml | 34 +++++++++++----- .github/workflows/release.yml | 77 +++++++++++++++-------------------- 3 files changed, 62 insertions(+), 55 deletions(-) create mode 100644 .github/dependabot.yml diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..5ace460 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,6 @@ +version: 2 +updates: + - package-ecosystem: "github-actions" + directory: "/" + schedule: + interval: "weekly" diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index fe15825..b63cd39 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -19,14 +19,18 @@ jobs: pins: runs-on: ubuntu-24.04-arm steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0 + with: + persist-credentials: false - run: sh scripts/check-pins.sh seed-deb: runs-on: ubuntu-24.04-arm timeout-minutes: 30 steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0 + with: + persist-credentials: false - name: Birth omc from the seed (scripts/omc-from-seed.sh) env: CONTROL: ${{ inputs.control || 'none' }} @@ -64,7 +68,7 @@ jobs: . ./pins.env sh scripts/sbom.sh "build/omega-mv-$OMEGA_MV_COMMIT" build/omc > dist/omc.spdx.json pipx run --spec 'spdx-tools==0.8.3' pyspdxtools -i dist/omc.spdx.json - - uses: actions/upload-artifact@v4 + - uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 with: name: deb path: dist/ @@ -73,7 +77,9 @@ jobs: runs-on: ubuntu-24.04-arm timeout-minutes: 30 steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0 + with: + persist-credentials: false - name: Fetch the pinned archive once run: | . ./pins.env @@ -116,8 +122,10 @@ jobs: runs-on: ubuntu-24.04-arm timeout-minutes: 30 steps: - - uses: actions/checkout@v4 - - uses: cachix/install-nix-action@v31 + - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0 + with: + persist-credentials: false + - uses: cachix/install-nix-action@75c75c31ebece974e48ebc36b4ad125bd97bd97b # v31.11.3 - run: nix --version - name: nix build (seed birth + pinned-hash check + hello check inside the derivation) run: nix build -L .#omc && ls -l result/bin/omc && sha256sum result/bin/omc @@ -141,7 +149,9 @@ jobs: runs-on: ubuntu-24.04-arm timeout-minutes: 90 steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0 + with: + persist-credentials: false - name: Install Guix (Ubuntu package) and authorize the official substitute servers run: | set -eu @@ -173,7 +183,9 @@ jobs: runs-on: ubuntu-24.04-arm timeout-minutes: 30 steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0 + with: + persist-credentials: false - name: makepkg in Arch Linux ARM (menci/archlinuxarm), .SRCINFO must match run: | docker run --rm -v "$PWD/aur:/src:ro" menci/archlinuxarm:latest bash -euc ' @@ -197,8 +209,10 @@ jobs: runs-on: ubuntu-24.04-arm timeout-minutes: 30 steps: - - uses: actions/checkout@v4 - - uses: docker/setup-buildx-action@v3 + - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0 + with: + persist-credentials: false + - uses: docker/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f # v3.12.0 - name: Build the image from the seed inside BusyBox run: docker buildx build --platform linux/arm64 --load -t omc:ci docker/ - name: The image compiles examples/hello.om diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 99171b3..b668acb 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -13,10 +13,10 @@ jobs: timeout-minutes: 30 permissions: contents: read - id-token: write - attestations: write steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0 + with: + persist-credentials: false - name: Birth omc from the seed run: sh scripts/omc-from-seed.sh build - name: Assemble dist/ @@ -35,45 +35,50 @@ jobs: sudo dpkg -i dist/omc_*_arm64.deb d=$(mktemp -d); cp examples/hello.om "$d"; cd "$d" omc < hello.om > hello; chmod +x hello; [ "$(./hello)" = "omega 55" ] - - uses: actions/attest-build-provenance@v2 - with: - subject-path: | - dist/omc-linux-arm64 - dist/omc_*_arm64.deb - - uses: actions/attest-sbom@v2 - with: - subject-path: dist/omc-linux-arm64 - sbom-path: dist/omc.spdx.json - - uses: actions/upload-artifact@v4 + - uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 with: name: dist path: dist/ - image: + publish: + needs: [build] runs-on: ubuntu-24.04-arm timeout-minutes: 30 + # id-token, attestations, and packages:write are granted only here. build has contents: read. permissions: - contents: read - packages: write + contents: write id-token: write attestations: write - outputs: - digest: ${{ steps.push.outputs.digest }} - tag: ${{ steps.tag.outputs.tag }} + packages: write steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0 + with: + persist-credentials: false + - uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0 + with: + name: dist + path: dist + - uses: actions/attest-build-provenance@e8998f949152b193b063cb0ec769d69d929409be # v2.4.0 + with: + subject-path: | + dist/omc-linux-arm64 + dist/omc_*_arm64.deb + - uses: actions/attest-sbom@bd218ad0dbcb3e146bd073d1d9c6d78e08aa8a0b # v2.4.0 + with: + subject-path: dist/omc-linux-arm64 + sbom-path: dist/omc.spdx.json - id: tag run: | . ./pins.env echo "tag=$(printf '%s' "$OMC_VERSION" | tr '+' '-')" >> "$GITHUB_OUTPUT" - - uses: docker/setup-buildx-action@v3 - - uses: docker/login-action@v3 + - uses: docker/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f # v3.12.0 + - uses: docker/login-action@c94ce9fb468520275223c153574b00df6fe4bcc9 # v3.7.0 with: registry: ghcr.io username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - id: push - uses: docker/build-push-action@v6 + uses: docker/build-push-action@10e90e3645eae34f1e60eeb005ba3a3d33f178e8 # v6.19.2 with: context: docker platforms: linux/arm64 @@ -82,7 +87,7 @@ jobs: tags: | ghcr.io/aien-dev/omc:${{ steps.tag.outputs.tag }} ghcr.io/aien-dev/omc:latest - - uses: actions/attest-build-provenance@v2 + - uses: actions/attest-build-provenance@e8998f949152b193b063cb0ec769d69d929409be # v2.4.0 with: subject-name: ghcr.io/aien-dev/omc subject-digest: ${{ steps.push.outputs.digest }} @@ -92,24 +97,6 @@ jobs: set -eu docker run --rm -i "ghcr.io/aien-dev/omc@${{ steps.push.outputs.digest }}" < examples/hello.om > hello chmod +x hello; out=$(./hello); echo "hello prints: $out"; [ "$out" = "omega 55" ] - - publish: - needs: [build, image] - runs-on: ubuntu-24.04-arm - permissions: - contents: write - packages: read - steps: - - uses: actions/checkout@v4 - - uses: actions/download-artifact@v4 - with: - name: dist - path: dist - - uses: docker/login-action@v3 - with: - registry: ghcr.io - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - name: gh attestation verify (binary, .deb, SBOM, image) env: GH_TOKEN: ${{ github.token }} @@ -119,12 +106,12 @@ jobs: gh attestation verify omc-linux-arm64 --repo "$GITHUB_REPOSITORY" gh attestation verify omc_*_arm64.deb --repo "$GITHUB_REPOSITORY" gh attestation verify omc-linux-arm64 --repo "$GITHUB_REPOSITORY" --predicate-type https://spdx.dev/Document/v2.3 - gh attestation verify "oci://ghcr.io/aien-dev/omc@${{ needs.image.outputs.digest }}" --repo "$GITHUB_REPOSITORY" + gh attestation verify "oci://ghcr.io/aien-dev/omc@${{ steps.push.outputs.digest }}" --repo "$GITHUB_REPOSITORY" - name: Publish the GitHub Release env: GH_TOKEN: ${{ github.token }} - DIGEST: ${{ needs.image.outputs.digest }} - TAG: ${{ needs.image.outputs.tag }} + DIGEST: ${{ steps.push.outputs.digest }} + TAG: ${{ steps.tag.outputs.tag }} run: | set -eu . ./pins.env From 26293ab8fdc1da6e3c1539808c32df9f84dd2b56 Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Mon, 2 Nov 2026 00:32:15 +0000 Subject: [PATCH 2/2] Keep contents:write off the release image build. The image job again pushes and attests, with the same token it had before this PR, and it also attests the dist files. publish only has contents:write and packages:read. BuildKit is pinned to the current buildx-stable-1 index digest. Co-authored-by: aien-spark --- .github/workflows/release.yml | 40 +++++++++++++++++++++++++++++------ 1 file changed, 33 insertions(+), 7 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index b668acb..9786f90 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -40,16 +40,18 @@ jobs: name: dist path: dist/ - publish: + image: needs: [build] runs-on: ubuntu-24.04-arm timeout-minutes: 30 - # id-token, attestations, and packages:write are granted only here. build has contents: read. permissions: - contents: write + contents: read + packages: write id-token: write attestations: write - packages: write + outputs: + digest: ${{ steps.push.outputs.digest }} + tag: ${{ steps.tag.outputs.tag }} steps: - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0 with: @@ -71,7 +73,11 @@ jobs: run: | . ./pins.env echo "tag=$(printf '%s' "$OMC_VERSION" | tr '+' '-')" >> "$GITHUB_OUTPUT" + # Default image is the floating tag moby/buildkit:buildx-stable-1. + # Pinned to that tag's index digest (BuildKit v0.33.1). - uses: docker/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f # v3.12.0 + with: + driver-opts: image=moby/buildkit@sha256:cec9f139f45e93c5c69c60f8b07cfad9f43f4ef6b6a6cd917527fea5ff2e3dea - uses: docker/login-action@c94ce9fb468520275223c153574b00df6fe4bcc9 # v3.7.0 with: registry: ghcr.io @@ -97,6 +103,26 @@ jobs: set -eu docker run --rm -i "ghcr.io/aien-dev/omc@${{ steps.push.outputs.digest }}" < examples/hello.om > hello chmod +x hello; out=$(./hello); echo "hello prints: $out"; [ "$out" = "omega 55" ] + + publish: + needs: [build, image] + runs-on: ubuntu-24.04-arm + permissions: + contents: write + packages: read + steps: + - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0 + with: + persist-credentials: false + - uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0 + with: + name: dist + path: dist + - uses: docker/login-action@c94ce9fb468520275223c153574b00df6fe4bcc9 # v3.7.0 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} - name: gh attestation verify (binary, .deb, SBOM, image) env: GH_TOKEN: ${{ github.token }} @@ -106,12 +132,12 @@ jobs: gh attestation verify omc-linux-arm64 --repo "$GITHUB_REPOSITORY" gh attestation verify omc_*_arm64.deb --repo "$GITHUB_REPOSITORY" gh attestation verify omc-linux-arm64 --repo "$GITHUB_REPOSITORY" --predicate-type https://spdx.dev/Document/v2.3 - gh attestation verify "oci://ghcr.io/aien-dev/omc@${{ steps.push.outputs.digest }}" --repo "$GITHUB_REPOSITORY" + gh attestation verify "oci://ghcr.io/aien-dev/omc@${{ needs.image.outputs.digest }}" --repo "$GITHUB_REPOSITORY" - name: Publish the GitHub Release env: GH_TOKEN: ${{ github.token }} - DIGEST: ${{ steps.push.outputs.digest }} - TAG: ${{ steps.tag.outputs.tag }} + DIGEST: ${{ needs.image.outputs.digest }} + TAG: ${{ needs.image.outputs.tag }} run: | set -eu . ./pins.env