Skip to content

Commit 43c0b6f

Browse files
committed
ci: pass the qemu tests only the secrets they use
reusable-qemu-test.yaml reads QUAY_USERNAME and QUAY_PASSWORD and nothing else, but declares no workflow_call secrets, so its callers have to use `secrets: inherit`. That hands every repository and organisation secret to jobs whose whole purpose is to boot an image built from the pull request under review. Harmless today only by accident: GitHub withholds secrets from pull_request runs originating in a fork, so the jobs that would be interesting to attack never receive anything. That protection disappears the moment a pull_request_target path exists, which is exactly what kairos#4307 is about -- so this is worth fixing before it becomes reachable rather than alongside it. Declares the two secrets on the reusable workflow and passes them explicitly from image-pr.yaml. No behaviour change: the same two values reach the same jobs, and nothing else does. Refs: #4307 Signed-off-by: Mauro Morales <contact@mauromorales.com>
1 parent 73b8a47 commit 43c0b6f

2 files changed

Lines changed: 20 additions & 2 deletions

File tree

.github/workflows/image-pr.yaml

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,12 @@ jobs:
5353
kubernetes_distro: ${{ matrix.kubernetes_distro }}
5454
core-tests:
5555
name: ${{ format('core-tests (hadron, amd64, generic) {0}', matrix.test) }}
56-
secrets: inherit
56+
# Explicit rather than `secrets: inherit`. reusable-qemu-test.yaml only ever
57+
# reads these two, and these jobs boot an image built from the pull request
58+
# under review -- so they get the registry credential and nothing else.
59+
secrets:
60+
QUAY_USERNAME: ${{ secrets.QUAY_USERNAME }}
61+
QUAY_PASSWORD: ${{ secrets.QUAY_PASSWORD }}
5762
uses: ./.github/workflows/reusable-qemu-test.yaml
5863
with:
5964
base_image: "ghcr.io/kairos-io/hadron:v0.5.1"
@@ -81,7 +86,12 @@ jobs:
8186
standard-tests:
8287
name: ${{ format('standard-tests (hadron, amd64, generic) {0}', matrix.test) }}
8388
uses: ./.github/workflows/reusable-qemu-test.yaml
84-
secrets: inherit
89+
# Explicit rather than `secrets: inherit`. reusable-qemu-test.yaml only ever
90+
# reads these two, and these jobs boot an image built from the pull request
91+
# under review -- so they get the registry credential and nothing else.
92+
secrets:
93+
QUAY_USERNAME: ${{ secrets.QUAY_USERNAME }}
94+
QUAY_PASSWORD: ${{ secrets.QUAY_PASSWORD }}
8595
permissions:
8696
contents: write
8797
security-events: write

.github/workflows/reusable-qemu-test.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,14 @@ on:
3737
type: boolean
3838
default: false
3939

40+
secrets:
41+
QUAY_USERNAME:
42+
description: "Registry user for pulling the image under test from ci-temp-images."
43+
required: true
44+
QUAY_PASSWORD:
45+
description: "Registry token matching QUAY_USERNAME."
46+
required: true
47+
4048
jobs:
4149
test: # decentralized k8s needs to run in github hosted workers for network stuff to work
4250
runs-on: ${{ inputs.test == 'provider-decentralized-k8s' && 'ubuntu-24.04' || 'fast' }}

0 commit comments

Comments
 (0)