Skip to content

Commit c4ff355

Browse files
committed
fix(release): secure workflows against shell injection
- Modify `release_create_rc.yaml`, `release_prepare.yaml`, `release_process_backports.yaml`, and `release_promote_rc.yaml` to pass workflow inputs as environment variables instead of expanding them directly in inline bash scripts. - This prevents potential shell injection vulnerabilities if inputs contain shell metacharacters.
1 parent 12ce31b commit c4ff355

4 files changed

Lines changed: 30 additions & 19 deletions

File tree

.github/workflows/release_create_rc.yaml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,12 @@ jobs:
4141
4242
- name: Attempt RC Tagging
4343
id: tagger
44-
run: |
45-
bazel run //tools/private/release -- \
46-
create-rc --issue ${{ inputs.issue }} --remote origin
4744
env:
4845
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
46+
ISSUE: ${{ inputs.issue }}
47+
run: |
48+
bazel run //tools/private/release -- \
49+
create-rc --issue "$ISSUE" --remote origin
4950
5051
call_release:
5152
needs: tag_rc

.github/workflows/release_prepare.yaml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,13 @@ jobs:
3939
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
4040
4141
- name: Run Release Preparation Pipeline
42-
run: |
43-
bazel run //tools/private/release -- \
44-
prepare ${{ inputs.issue && format('--issue={0}', inputs.issue) || '' }} --no-dry-run
4542
env:
4643
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
44+
ISSUE: ${{ inputs.issue }}
45+
run: |
46+
ARGS=()
47+
if [ -n "$ISSUE" ]; then
48+
ARGS+=("--issue=$ISSUE")
49+
fi
50+
bazel run //tools/private/release -- \
51+
prepare "${ARGS[@]}" --no-dry-run

.github/workflows/release_process_backports.yaml

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -55,19 +55,22 @@ jobs:
5555
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
5656
5757
- name: Process Pending Backports
58+
env:
59+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
60+
ADD_BACKPORTS: ${{ inputs.add_backports }}
61+
COMMENT_ID: ${{ inputs.comment_id }}
62+
ISSUE: ${{ inputs.issue }}
5863
run: |
5964
ARGS=()
60-
if [ -n "${{ inputs.add_backports }}" ]; then
61-
ARGS+=("--add=${{ inputs.add_backports }}")
65+
if [ -n "$ADD_BACKPORTS" ]; then
66+
ARGS+=("--add=$ADD_BACKPORTS")
6267
fi
63-
if [ -n "${{ inputs.comment_id }}" ]; then
64-
ARGS+=("--triggering-comment=${{ inputs.comment_id }}")
68+
if [ -n "$COMMENT_ID" ]; then
69+
ARGS+=("--triggering-comment=$COMMENT_ID")
6570
fi
6671
6772
bazel run //tools/private/release -- process-backports \
68-
--issue ${{ inputs.issue }} \
73+
--issue "$ISSUE" \
6974
--remote origin \
7075
--no-dry-run \
7176
"${ARGS[@]}"
72-
env:
73-
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/release_promote_rc.yaml

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,17 +42,19 @@ jobs:
4242
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
4343
4444
- name: Run Promote RC
45+
env:
46+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
47+
VERSION: ${{ inputs.version }}
48+
ISSUE: ${{ inputs.issue }}
4549
run: |
4650
ARGS=()
47-
if [ -n "${{ inputs.version }}" ]; then
48-
ARGS+=("${{ inputs.version }}")
51+
if [ -n "$VERSION" ]; then
52+
ARGS+=("$VERSION")
4953
fi
50-
if [ -n "${{ inputs.issue }}" ]; then
51-
ARGS+=("--issue" "${{ inputs.issue }}")
54+
if [ -n "$ISSUE" ]; then
55+
ARGS+=("--issue" "$ISSUE")
5256
fi
5357
ARGS+=("--remote" "origin")
5458
ARGS+=("--no-dry-run")
5559
5660
bazel run //tools/private/release -- promote-rc "${ARGS[@]}"
57-
env:
58-
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)