Skip to content

Commit e94099c

Browse files
caxu-rhacornett21
authored andcommitted
Harden against template injection attacks in GHA workflows
Signed-off-by: Caleb Xu <caxu@redhat.com>
1 parent b413eae commit e94099c

2 files changed

Lines changed: 8 additions & 4 deletions

File tree

.github/workflows/build-main.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ jobs:
3131
run: echo "RELEASE_TAG=$(git describe --abbrev=0 --tags)" >> "${GITHUB_ENV}"
3232

3333
- name: set short sha
34-
run: echo SHA_SHORT=$(git rev-parse --short HEAD) >> $GITHUB_ENV
34+
run: echo "SHA_SHORT=$(git rev-parse --short HEAD)" >> "${GITHUB_ENV}"
3535

3636
- name: Set up QEMU
3737
uses: docker/setup-qemu-action@06116385d9baf250c9f4dcb4858b16962ea869c3 # v4.1.0
@@ -65,7 +65,9 @@ jobs:
6565
password: ${{ secrets.REGISTRY_PASSWORD }}
6666

6767
- name: Print image url
68-
run: echo "Image pushed to ${{ steps.push-image.outputs.registry-paths }}"
68+
run: echo "Image pushed to ${REGISTRY_PATHS}"
69+
env:
70+
REGISTRY_PATHS: ${{ steps.push-image.outputs.registry-paths }}
6971

7072
outputs:
7173
imageName: ${{ env.IMAGE_NAME }}

.github/workflows/build-release.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ jobs:
2828
persist-credentials: false
2929

3030
- name: Set Env Tags
31-
run: echo RELEASE_TAG=$(echo $GITHUB_REF | cut -d '/' -f 3) >> $GITHUB_ENV
31+
run: echo "RELEASE_TAG=$(echo "${GITHUB_REF}" | cut -d '/' -f 3)" >> "${GITHUB_ENV}"
3232

3333
- name: Set up QEMU
3434
uses: docker/setup-qemu-action@06116385d9baf250c9f4dcb4858b16962ea869c3 # v4.1.0
@@ -61,7 +61,9 @@ jobs:
6161
password: ${{ secrets.REGISTRY_PASSWORD }}
6262

6363
- name: Print image url
64-
run: echo "Image pushed to ${{ steps.push-image.outputs.registry-paths }}"
64+
run: echo "Image pushed to ${REGISTRY_PATHS}"
65+
env:
66+
REGISTRY_PATHS: ${{ steps.push-image.outputs.registry-paths }}
6567

6668
outputs:
6769
imageName: ${{ env.IMAGE_NAME }}

0 commit comments

Comments
 (0)