Skip to content

Commit 9eeec06

Browse files
committed
ci: scope the PR path to the ci-temp-images robot
Review feedback: the PR path should use the narrowly-scoped credential, not the one that publishes releases. Correct, and it applies to the build job as well as the tests. Everything on this path writes exactly one repository, quay.io/kairos/ci-temp-images: the factory pushes the image under test there, and reusable-qemu-test pulls it back and pushes a bundles-test image alongside it. The kairos+prci robot has Write on that repository and nothing else, which is the whole requirement. QUAY_USERNAME/QUAY_PASSWORD is the credential release.yaml uses to publish permanent images to quay.io/kairos/<flavor>. Sharing it with a path that builds contributor code was already more exposure than the work needed, and it becomes the difference between a bounded and an unbounded leak once kairos#4307 makes that path reachable from a fork. Signed-off-by: Mauro Morales <contact@mauromorales.com>
1 parent 43c0b6f commit 9eeec06

1 file changed

Lines changed: 18 additions & 12 deletions

File tree

.github/workflows/image-pr.yaml

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,12 @@ jobs:
1616
name: ${{ matrix.image_name }}
1717
uses: kairos-io/kairos-factory-action/.github/workflows/reusable-factory.yaml@8952c3a5f4f6255cc63af88cb3637a9684970c8d # v1.1.3
1818
secrets:
19-
registry_username: ${{ secrets.QUAY_USERNAME }}
20-
registry_password: ${{ secrets.QUAY_PASSWORD }}
19+
# The PR path only ever writes quay.io/kairos/ci-temp-images, so it uses
20+
# the kairos+prci robot, which has Write on that repository and nothing
21+
# else. QUAY_USERNAME/QUAY_PASSWORD is the credential release.yaml uses to
22+
# publish permanent images and does not belong on a PR path.
23+
registry_username: ${{ secrets.QUAY_PR_USERNAME }}
24+
registry_password: ${{ secrets.QUAY_PR_PASSWORD }}
2125
strategy:
2226
fail-fast: false
2327
matrix:
@@ -53,12 +57,13 @@ jobs:
5357
kubernetes_distro: ${{ matrix.kubernetes_distro }}
5458
core-tests:
5559
name: ${{ format('core-tests (hadron, amd64, generic) {0}', matrix.test) }}
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.
60+
# Explicit rather than `secrets: inherit`, and scoped to the ci-temp-images
61+
# robot. These jobs boot an image built from the pull request under review;
62+
# they pull it from ci-temp-images and push a bundles-test image back there,
63+
# so Write on that one repository is all they need.
5964
secrets:
60-
QUAY_USERNAME: ${{ secrets.QUAY_USERNAME }}
61-
QUAY_PASSWORD: ${{ secrets.QUAY_PASSWORD }}
65+
QUAY_USERNAME: ${{ secrets.QUAY_PR_USERNAME }}
66+
QUAY_PASSWORD: ${{ secrets.QUAY_PR_PASSWORD }}
6267
uses: ./.github/workflows/reusable-qemu-test.yaml
6368
with:
6469
base_image: "ghcr.io/kairos-io/hadron:v0.5.1"
@@ -86,12 +91,13 @@ jobs:
8691
standard-tests:
8792
name: ${{ format('standard-tests (hadron, amd64, generic) {0}', matrix.test) }}
8893
uses: ./.github/workflows/reusable-qemu-test.yaml
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.
94+
# Explicit rather than `secrets: inherit`, and scoped to the ci-temp-images
95+
# robot. These jobs boot an image built from the pull request under review;
96+
# they pull it from ci-temp-images and push a bundles-test image back there,
97+
# so Write on that one repository is all they need.
9298
secrets:
93-
QUAY_USERNAME: ${{ secrets.QUAY_USERNAME }}
94-
QUAY_PASSWORD: ${{ secrets.QUAY_PASSWORD }}
99+
QUAY_USERNAME: ${{ secrets.QUAY_PR_USERNAME }}
100+
QUAY_PASSWORD: ${{ secrets.QUAY_PR_PASSWORD }}
95101
permissions:
96102
contents: write
97103
security-events: write

0 commit comments

Comments
 (0)