Skip to content

Commit 1d13e9a

Browse files
committed
fix permissions
1 parent 45a88db commit 1d13e9a

3 files changed

Lines changed: 21 additions & 2 deletions

File tree

.github/workflows/quality-checks-devcontainer.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,10 @@ on:
2828
jobs:
2929
verify_runtime_image:
3030
uses: ./.github/workflows/verify-runtime-image.yml
31+
permissions:
32+
contents: read
33+
packages: read
34+
attestations: read
3135
with:
3236
runtime_docker_image: ${{ inputs.runtime_docker_image }}
3337

.github/workflows/tag-release-devcontainer.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,10 @@ on:
6161
jobs:
6262
verify_runtime_image:
6363
uses: ./.github/workflows/verify-runtime-image.yml
64+
permissions:
65+
contents: read
66+
packages: read
67+
attestations: read
6468
with:
6569
runtime_docker_image: ${{ inputs.runtime_docker_image }}
6670
registry: ghcr.io

.github/workflows/verify-runtime-image.yml

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,10 +82,21 @@ jobs:
8282
- name: Verify provenance attestation
8383
shell: bash
8484
env:
85-
GH_TOKEN: ${{ github.token }}
85+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
8686
PINNED_IMAGE: ${{ steps.resolve.outputs.pinned_image }}
8787
OWNER: ${{ inputs.owner }}
8888
run: |
8989
set -euo pipefail
90-
gh attestation verify "oci://${PINNED_IMAGE}" --owner "$OWNER"
90+
set +e
91+
VERIFY_OUTPUT="$(gh attestation verify "oci://${PINNED_IMAGE}" --owner "$OWNER" 2>&1)"
92+
VERIFY_STATUS=$?
93+
set -e
94+
95+
if [[ $VERIFY_STATUS -ne 0 ]]; then
96+
echo "$VERIFY_OUTPUT" >&2
97+
echo "::error title=Attestation verification failed::If this is a reusable workflow call, ensure the caller job grants permissions: contents: read, packages: read, attestations: read."
98+
echo "::error title=Attestation verification failed::Also confirm --owner ('${OWNER}') matches the org/user that published the image attestations."
99+
exit 1
100+
fi
101+
91102
echo "Verified attestation for ${PINNED_IMAGE}"

0 commit comments

Comments
 (0)