Skip to content

Commit 8fc5417

Browse files
authored
fix(security): harden GitHub Actions workflows against expression injection (#127)
Move `${{ }}` expressions from `run:` blocks into step-level `env:` blocks, then reference them as properly-quoted shell variables. Part of cloudnative-pg/cloudnative-pg#10113 Assisted-by: Claude Opus 4.6 Signed-off-by: Marco Nenciarini <marco.nenciarini@enterprisedb.com>
1 parent 89fd8f0 commit 8fc5417

3 files changed

Lines changed: 12 additions & 4 deletions

File tree

.github/workflows/bake.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,9 @@ jobs:
6161
CHANGES: ${{ steps.filter.outputs.changes }}
6262
# Input Extension name
6363
INPUT_EXTENSION_NAME: ${{ github.event.inputs.extension_name }}
64+
EVENT_NAME: ${{ github.event_name }}
6465
run: |
65-
if [[ "${{ github.event_name }}" == 'workflow_dispatch' ]]; then
66+
if [[ "${EVENT_NAME}" == 'workflow_dispatch' ]]; then
6667
CHANGES="[\"$INPUT_EXTENSION_NAME\"]"
6768
fi
6869

.github/workflows/bake_targets.yml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,15 +141,20 @@ jobs:
141141
task e2e:setup-env
142142
143143
- name: Generate Chainsaw testing values
144+
env:
145+
MATRIX_IMAGE: ${{ matrix.image }}
146+
EXTENSION_NAME: ${{ inputs.extension_name }}
144147
run: |
145-
task e2e:generate-values EXTENSION_IMAGE="${{ matrix.image }}" TARGET="${{ inputs.extension_name }}"
148+
task e2e:generate-values EXTENSION_IMAGE="${MATRIX_IMAGE}" TARGET="${EXTENSION_NAME}"
146149
147150
- name: Run e2e tests
151+
env:
152+
EXTENSION_NAME: ${{ inputs.extension_name }}
148153
run: |
149154
# Get Kind cluster internal kubeconfig
150155
task e2e:export-kubeconfig KUBECONFIG_PATH=./kubeconfig INTERNAL=true
151156
152-
task e2e:test TARGET="${{ inputs.extension_name }}" KUBECONFIG_PATH="./kubeconfig"
157+
task e2e:test TARGET="${EXTENSION_NAME}" KUBECONFIG_PATH="./kubeconfig"
153158
154159
copytoproduction:
155160
name: Copy images to production

.github/workflows/update_os_libraries.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,10 @@ jobs:
3737

3838
- name: Set extensions output
3939
id: get-extensions
40+
env:
41+
EXTENSIONS_OUTPUT: ${{ steps.get-extensions-dagger.outputs.output }}
4042
run: |
41-
EXTENSIONS='${{ steps.get-extensions-dagger.outputs.output }}'
43+
EXTENSIONS="${EXTENSIONS_OUTPUT}"
4244
echo "extensions=$(echo "$EXTENSIONS" | jq -c .)" >> $GITHUB_OUTPUT
4345
4446
update-extension-os-libs:

0 commit comments

Comments
 (0)