Skip to content

Commit a78d1e2

Browse files
fix: prevent script injection in GitHub Actions workflows (#1583)
## Summary - Move `inputs.*` template expressions out of `run:` scripts and into `env:` blocks across two workflow files - Replace `$(pwd)` with `${{ github.workspace }}` in `rl-secure.yml` to maintain correct path resolution after the env var refactor ## Files changed - `.github/actions/rl-scanner/action.yml` — `inputs.artifact-path` and `inputs.version` - `.github/workflows/rl-secure.yml` — `inputs.artifact-name` and artifact path construction ## Security impact Interpolating `${{ inputs.* }}` directly into `run:` scripts allows shell metacharacters in user-controlled input to break out of the intended command context. Routing through `env:` variables ensures values are treated as data, not inline script. > **Note:** `.github/actions/framework/action.yml` was excluded because its inputs contain shell operators (`>`, `|`, `&&`) that require inline expansion, and they are not user-controlled.
1 parent 99d3cab commit a78d1e2

2 files changed

Lines changed: 10 additions & 6 deletions

File tree

.github/actions/rl-scanner/action.yml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,16 +40,18 @@ runs:
4040
RLSECURE_SITE_KEY: ${{ env.RLSECURE_SITE_KEY }}
4141
SIGNAL_HANDLER_TOKEN: ${{ env.SIGNAL_HANDLER_TOKEN }}
4242
PYTHONUNBUFFERED: 1
43+
ARTIFACT_PATH: ${{ inputs.artifact-path }}
44+
VERSION: ${{ inputs.version }}
4345
run: |
44-
if [ ! -f "${{ inputs.artifact-path }}" ]; then
45-
echo "Artifact not found: ${{ inputs.artifact-path }}"
46+
if [ ! -f "$ARTIFACT_PATH" ]; then
47+
echo "Artifact not found: $ARTIFACT_PATH"
4648
exit 1
4749
fi
4850
4951
rl-wrapper \
50-
--artifact "${{ inputs.artifact-path }}" \
52+
--artifact "$ARTIFACT_PATH" \
5153
--name "${{ github.event.repository.name }}" \
52-
--version "${{ inputs.version }}" \
54+
--version "$VERSION" \
5355
--repository "${{ github.repository }}" \
5456
--commit "${{ github.sha }}" \
5557
--build-env "github_actions" \

.github/workflows/rl-secure.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,10 @@ jobs:
4343
node: ${{ inputs.node-version }}
4444

4545
- name: Create tgz build artifact
46+
env:
47+
ARTIFACT_NAME: ${{ inputs.artifact-name }}
4648
run: |
47-
tar -czvf ${{ inputs.artifact-name }} *
49+
tar -czvf "$ARTIFACT_NAME" *
4850
4951
- id: get_version
5052
uses: ./.github/actions/get-version
@@ -53,7 +55,7 @@ jobs:
5355
id: rl-scan-conclusion
5456
uses: ./.github/actions/rl-scanner
5557
with:
56-
artifact-path: "$(pwd)/${{ inputs.artifact-name }}"
58+
artifact-path: "${{ github.workspace }}/${{ inputs.artifact-name }}"
5759
version: "${{ steps.get_version.outputs.version }}"
5860
env:
5961
RLSECURE_LICENSE: ${{ secrets.RLSECURE_LICENSE }}

0 commit comments

Comments
 (0)