Skip to content

Commit 98fac3d

Browse files
committed
Fix script injection risk by passing inputs via env vars
Move action input interpolation from the shell script body into the env block. This prevents potential script injection via crafted input values, since environment variables are assigned before the shell interprets the script — values can never break out of their string context. This also eliminates the heredoc complexity, improving readability.
1 parent 2765efe commit 98fac3d

1 file changed

Lines changed: 6 additions & 12 deletions

File tree

action.yml

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -48,20 +48,14 @@ runs:
4848
- name: Decide whether the input jobs succeeded or failed
4949
id: outcome
5050
env:
51+
INPUT_ALLOWED_FAILURES: ${{ inputs.allowed-failures }}
52+
INPUT_ALLOWED_SKIPS: ${{ inputs.allowed-skips }}
53+
INPUT_JOBS: ${{ inputs.jobs }}
5154
PYTHONPATH: ${{ github.action_path }}/src
5255
run: |
5356
python -m normalize_needed_jobs_status \
54-
"$(cat << EOM
55-
${{ inputs.allowed-failures }}
56-
EOM
57-
)" \
58-
"$(cat << EOM
59-
${{ inputs.allowed-skips }}
60-
EOM
61-
)" \
62-
"$(cat << EOM
63-
${{ inputs.jobs }}
64-
EOM
65-
)"
57+
"$INPUT_ALLOWED_FAILURES" \
58+
"$INPUT_ALLOWED_SKIPS" \
59+
"$INPUT_JOBS"
6660
shell: bash
6761
...

0 commit comments

Comments
 (0)