Skip to content

Commit bf1cc8c

Browse files
fix: Prevent script injection in platform-check action (#5913)
Fixes ENG-7182 (parent: VULN-1389) Move input parameters from direct script interpolation to environment variables to prevent potential code injection attacks. This follows GitHub Actions security best practices by treating user input as untrusted and isolating it through environment variables. Changes: - Add env block with PLATFORM, SAMPLE_CHANGED, NEEDS_IOS, NEEDS_ANDROID, NEEDS_WEB - Remove ${{ inputs.* }} interpolations from script body - Update case statement to use environment variables References: - https://linear.app/getsentry/issue/VULN-1389 - https://linear.app/getsentry/issue/ENG-7182 - https://docs.github.com/en/actions/learn-github-actions/security-hardening-for-github-actions#understanding-the-risk-of-script-injections Co-authored-by: fix-it-felix-sentry[bot] <260785270+fix-it-felix-sentry[bot]@users.noreply.github.com> Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com>
1 parent cae4c90 commit bf1cc8c

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

.github/actions/platform-check/action.yml

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,13 @@ runs:
3232
- name: Check if platform is needed
3333
id: check
3434
shell: bash
35+
env:
36+
PLATFORM: ${{ inputs.platform }}
37+
SAMPLE_CHANGED: ${{ inputs.sample_changed }}
38+
NEEDS_IOS: ${{ inputs.needs_ios }}
39+
NEEDS_ANDROID: ${{ inputs.needs_android }}
40+
NEEDS_WEB: ${{ inputs.needs_web }}
3541
run: |
36-
PLATFORM="${{ inputs.platform }}"
37-
SAMPLE_CHANGED="${{ inputs.sample_changed }}"
38-
3942
if [[ "$SAMPLE_CHANGED" == "true" ]]; then
4043
echo "skip=false" >> "$GITHUB_OUTPUT"
4144
echo "Sample app changed — building/testing $PLATFORM."
@@ -44,9 +47,9 @@ runs:
4447
4548
# macOS uses the iOS change-detection flag
4649
case "$PLATFORM" in
47-
ios|macos) NEEDS="${{ inputs.needs_ios }}" ;;
48-
android) NEEDS="${{ inputs.needs_android }}" ;;
49-
web) NEEDS="${{ inputs.needs_web }}" ;;
50+
ios|macos) NEEDS="$NEEDS_IOS" ;;
51+
android) NEEDS="$NEEDS_ANDROID" ;;
52+
web) NEEDS="$NEEDS_WEB" ;;
5053
*)
5154
echo "::warning::Unknown platform '$PLATFORM' — not skipping."
5255
echo "skip=false" >> "$GITHUB_OUTPUT"

0 commit comments

Comments
 (0)