Skip to content

Commit d6cec1a

Browse files
Fix security warning for github.head_ref in bundle-size workflow
Move github.head_ref from inline script interpolation to an environment variable to prevent potential command injection attacks from malicious branch names containing shell metacharacters. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 716f3b2 commit d6cec1a

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

.github/workflows/bundle-size.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,10 @@ jobs:
2121

2222
- name: Check if branch should skip size check
2323
id: skip-check
24+
env:
25+
BRANCH: ${{ github.head_ref }}
2426
run: |
2527
SKIP_FILE=".bundle-size-skip-branch"
26-
BRANCH="${{ github.head_ref }}"
2728
SKIP_BRANCH=$(grep -v '^[[:space:]]*#' "$SKIP_FILE" 2>/dev/null | grep -v '^[[:space:]]*$' | tr -d '[:space:]' || echo "")
2829
if [ "$SKIP_BRANCH" = "$BRANCH" ]; then
2930
echo "skip=true" >> $GITHUB_OUTPUT

0 commit comments

Comments
 (0)