Verify builder image provenance before release signing and pin latest to main
What changed, and why it matters
This commit hardens the project's release pipeline. It makes sure the 'latest' builder Docker image tag is only updated from the main branch, and it adds a verification step before release builds that proves the builder image was actually published by the official image-building workflow on the main branch. It also checks that the Flutter version inside the builder matches the version declared in the project. These changes reduce the risk that a malicious or mismatched builder image could be used to sign or build release artifacts.
No immediate user action required. Reviewers should verify that the cert-identity-regex correctly anchors the expected workflow identity and that the GH_TOKEN has sufficient permissions to fetch attestations. Consider extending the same provenance verification to any other jobs or images that consume the builder image.
Security signals we found
Supply-chain hardening: builder image provenance verified via GitHub attestations before secrets are used
Tag-pinning: 'latest' Docker tag only updated from main branch
Mutable-tag mitigation: release builds now run from a verified digest instead of :latest
Version consistency check: builder Flutter version asserted against pubspec
Pre-secret verification: attestation check runs before Android keystore is decoded
Evidence from the diff
The patch modifies two GitHub Actions workflows. First, build-builder-image.yml now only pushes the ‘latest’ tag when the workflow runs on refs/heads/main, preventing feature branches or workflow_dispatch from moving ‘latest’. Second, release.yml adds two new steps before Android signing and Linux package builds: (1) ‘Verify builder image provenance’ uses gh attestation verify to confirm the pulled oci:// image digest was attested by the build-builder-image.yml workflow on refs/heads/main, and pins subsequent docker run commands to the verified digest via BUILDER_IMAGE env var; (2) ‘Assert builder Flutter version matches pubspec’ compares the Flutter framework version inside the builder image against needs.version.outputs.flutter_version and fails the build if they differ. The release jobs then use $BUILDER_IMAGE instead of the mutable :latest tag.
Changed components
.github/workflows/build-builder-image.yml.github/workflows/release.ymlghcr.io/magicgrants/skylight-wallet-builder:latest OCI imageAndroid release signing jobLinux package build jobInspect captured patch +59 / −3
### .github/workflows/build-builder-image.yml
@@ -60,7 +60,7 @@ jobs:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=sha,prefix=
- type=raw,value=latest
+ type=raw,value=latest,enable=${{ github.ref == 'refs/heads/main' }}
- name: Build and push Docker image
id: build
### .github/workflows/release.yml
@@ -129,6 +129,34 @@ jobs:
- name: Pull builder image
run: docker pull ghcr.io/magicgrants/skylight-wallet-builder:latest
+ - name: Verify builder image provenance
+ env:
+ GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+ run: |
+ set -euo pipefail
+ IMAGE=ghcr.io/magicgrants/skylight-wallet-builder
+ DIGEST=$(docker inspect --format='{{range .RepoDigests}}{{println .}}{{end}}' "$IMAGE:latest" | grep "^$IMAGE@" | head -n1 | cut -d@ -f2)
+ test -n "$DIGEST"
+ echo "Builder image: $IMAGE@$DIGEST"
+ # The signing build must only ever run inside an image the image
+ # workflow published from main, so a :latest moved by a dispatch from
+ # any other ref is rejected before a single secret is written.
+ gh attestation verify "oci://$IMAGE@$DIGEST" \
+ --repo MAGICGrants/skylight-wallet \
+ --cert-identity-regex '^https://github\.com/(?i:MAGICGrants)/skylight-wallet/\.github/workflows/build-builder-image\.yml@refs/heads/main$'
+ echo "BUILDER_IMAGE=$IMAGE@$DIGEST" >> "$GITHUB_ENV"
+
+ - name: Assert builder Flutter version matches pubspec
+ run: |
+ set -euo pipefail
+ EXPECTED='${{ needs.version.outputs.flutter_version }}'
+ ACTUAL=$(docker run --rm "$BUILDER_IMAGE" flutter --version --machine 2>/dev/null | jq -r '.frameworkVersion')
+ echo "builder Flutter: $ACTUAL / pubspec: $EXPECTED"
+ if [ "$EXPECTED" != "$ACTUAL" ]; then
+ echo "::error::Builder Flutter $ACTUAL does not match pubspec $EXPECTED"
+ exit 1
+ fi
+
- name: Set up Android signing
run: |
echo "${{ secrets.ANDROID_KEYSTORE_BASE64 }}" | base64 -d > ./android/keystore.jks
@@ -149,7 +177,7 @@ jobs:
-v "$PWD:/tmp/skylight" \
-w /tmp/skylight \
-e SOURCE_DATE_EPOCH \
- ghcr.io/magicgrants/skylight-wallet-builder:latest \
+ "$BUILDER_IMAGE" \
bash -c "cp -a /opt/cargo /tmp/skylight-cargo && export CARGO_HOME=/tmp/skylight-cargo && export PUB_CACHE=/tmp/skylight/.pub-cache && flutter pub get --enforce-lockfile && bash scripts/pin-rust-toolchain.sh && flutter build apk --dart-define=DEMO_MODE=true --release --split-per-abi && flutter build appbundle --dart-define=DEMO_MODE=true --release -PplayStore=true"
mkdir -p dist
@@ -180,6 +208,34 @@ jobs:
- name: Pull builder image
run: docker pull ghcr.io/magicgrants/skylight-wallet-builder:latest
+ - name: Verify builder image provenance
+ env:
+ GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+ run: |
+ set -euo pipefail
+ IMAGE=ghcr.io/magicgrants/skylight-wallet-builder
+ DIGEST=$(docker inspect --format='{{range .RepoDigests}}{{println .}}{{end}}' "$IMAGE:latest" | grep "^$IMAGE@" | head -n1 | cut -d@ -f2)
+ test -n "$DIGEST"
+ echo "Builder image: $IMAGE@$DIGEST"
+ # The signing build must only ever run inside an image the image
+ # workflow published from main, so a :latest moved by a dispatch from
+ # any other ref is rejected before a single secret is written.
+ gh attestation verify "oci://$IMAGE@$DIGEST" \
+ --repo MAGICGrants/skylight-wallet \
+ --cert-identity-regex '^https://github\.com/(?i:MAGICGrants)/skylight-wallet/\.github/workflows/build-builder-image\.yml@refs/heads/main$'
+ echo "BUILDER_IMAGE=$IMAGE@$DIGEST" >> "$GITHUB_ENV"
+
+ - name: Assert builder Flutter version matches pubspec
+ run: |
+ set -euo pipefail
+ EXPECTED='${{ needs.version.outputs.flutter_version }}'
+ ACTUAL=$(docker run --rm "$BUILDER_IMAGE" flutter --version --machine 2>/dev/null | jq -r '.frameworkVersion')
+ echo "builder Flutter: $ACTUAL / pubspec: $EXPECTED"
+ if [ "$EXPECTED" != "$ACTUAL" ]; then
+ echo "::error::Builder Flutter $ACTUAL does not match pubspec $EXPECTED"
+ exit 1
+ fi
+
- name: Build Linux packages
run: |
# cargokit builds the Rust plugins with `rustup run stable`, and the
@@ -189,7 +245,7 @@ jobs:
docker run --rm \
-v "$PWD:/workspace" \
-w /workspace \
- ghcr.io/magicgrants/skylight-wallet-builder:latest \
+ "$BUILDER_IMAGE" \
bash -c "flutter pub get --enforce-lockfile && bash scripts/pin-rust-toolchain.sh && flutter build linux --release && ./deb/build_deb.sh --version ${VERSION} && ./appimage/build_appimage.sh --version ${VERSION}"
mkdir -p distWhy this scored 64/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.