Skip to content

Commit acb6755

Browse files
nbuckwaltclaude
andcommitted
fix: prevent CMD_EXEC injection via env indirection for user-controlled inputs
Replace direct ${{ inputs.* }} interpolation in run: blocks with env: indirection. Assign each input to a step-level env var and reference $ENV_VAR in shell commands. Files changed: - docker/action.yml: docker_platform, docker_registry, docker_image, docker_tag - misc/action/json-output/action.yml: inputs.json (heredoc → echo "$JSON") - misc/action/find-workflows/action.yml: inputs.url, inputs.query - misc/action/package-downloads/action.yml: inputs.url, inputs.repo, inputs.package Based on SHA c950f6f (v2.23.0). See upstream EnricoMi#737. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent f3a4c8e commit acb6755

File tree

4 files changed

+16
-7
lines changed

4 files changed

+16
-7
lines changed

docker/action.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -220,9 +220,13 @@ runs:
220220
INPUT_LOG_LEVEL: ${{ inputs.log_level }}
221221
# not documented
222222
INPUT_ROOT_LOG_LEVEL: ${{ inputs.root_log_level }}
223+
DOCKER_PLATFORM: ${{ inputs.docker_platform }}
224+
DOCKER_REGISTRY: ${{ inputs.docker_registry }}
225+
DOCKER_IMAGE: ${{ inputs.docker_image }}
226+
DOCKER_TAG: ${{ inputs.docker_tag }}
223227
run: |
224228
# Publish Test Results
225-
platform="${{ inputs.docker_platform }}"
229+
platform="$DOCKER_PLATFORM"
226230
docker run ${platform:+--platform $platform} \
227231
--workdir "/github/workspace" \
228232
--rm \
@@ -314,7 +318,7 @@ runs:
314318
-v "/var/run/docker.sock":"/var/run/docker.sock" \
315319
-v "/home/runner/work/_temp/_github_home":"/github/home" \
316320
-v "$GITHUB_WORKSPACE":"/github/workspace" \
317-
${{ inputs.docker_registry }}/${{ inputs.docker_image }}:${{ inputs.docker_tag }}
321+
$DOCKER_REGISTRY/$DOCKER_IMAGE:$DOCKER_TAG
318322
shell: bash
319323

320324
branding:

misc/action/find-workflows/action.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,11 @@ runs:
3333
id: workflows
3434
env:
3535
GITHUB_TOKEN: ${{ github.token }}
36+
SCRIPT_URL: ${{ inputs.url }}
37+
SCRIPT_QUERY: ${{ inputs.query }}
3638
shell: bash
3739
run: |
38-
python ${{ github.action_path }}/script.py ${{ inputs.url }} ${{ inputs.query }}
40+
python "${{ github.action_path }}/script.py" "$SCRIPT_URL" "$SCRIPT_QUERY"
3941
4042
branding:
4143
icon: 'download-cloud'

misc/action/json-output/action.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ runs:
3838
COMMIT: ${{ fromJSON( inputs.json ).stats.commit }}
3939
REFERENCE: ${{ fromJSON( inputs.json ).stats_with_delta.reference_commit }}
4040
ANNOTATIONS: ${{ fromJSON( inputs.json ).annotations }}
41+
JSON: ${{ inputs.json }}
4142
shell: bash
4243
run: |
4344
echo "title=$TITLE"
@@ -53,9 +54,7 @@ runs:
5354
5455
echo
5556
echo "JSON output:"
56-
cat <<EOF
57-
${{ inputs.json }}
58-
EOF
57+
echo "$JSON"
5958
echo
6059
6160
if [[ "$CONCLUSION" != "success" ]]

misc/action/package-downloads/action.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,13 @@ runs:
3737
3838
- name: Get download info
3939
id: downloads
40+
env:
41+
SCRIPT_URL: ${{ inputs.url }}
42+
SCRIPT_REPO: ${{ inputs.repo }}
43+
SCRIPT_PACKAGE: ${{ inputs.package }}
4044
shell: bash
4145
run: |
42-
python ${{ github.action_path }}/script.py ${{ inputs.url }} ${{ inputs.repo }} ${{ inputs.package }}
46+
python "${{ github.action_path }}/script.py" "$SCRIPT_URL" "$SCRIPT_REPO" "$SCRIPT_PACKAGE"
4347
4448
branding:
4549
icon: 'download-cloud'

0 commit comments

Comments
 (0)