Skip to content

Commit b5a64a3

Browse files
authored
fix(ci): prevent code injection in cleanup-prerelease workflow (#174)
Move github.event.pull_request.head.ref from direct shell interpolation to environment variable to prevent script injection attacks via malicious branch names. Fixes https://github.com/groupsky/ya-modbus/security/code-scanning/10
1 parent 2e85d97 commit b5a64a3

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

.github/workflows/cleanup-prerelease.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,11 +93,13 @@ jobs:
9393

9494
- name: Summary
9595
if: always()
96+
env:
97+
PR_BRANCH: ${{ github.event.pull_request.head.ref }}
9698
run: |
9799
echo "## Pre-release Cleanup Summary" >> $GITHUB_STEP_SUMMARY
98100
echo "" >> $GITHUB_STEP_SUMMARY
99101
echo "- PR: #${{ github.event.pull_request.number }}" >> $GITHUB_STEP_SUMMARY
100-
echo "- Branch: ${{ github.event.pull_request.head.ref }}" >> $GITHUB_STEP_SUMMARY
102+
echo "- Branch: $PR_BRANCH" >> $GITHUB_STEP_SUMMARY
101103
echo "- Status: ${{ github.event.pull_request.merged && 'Merged' || 'Closed without merge' }}" >> $GITHUB_STEP_SUMMARY
102104
echo "" >> $GITHUB_STEP_SUMMARY
103105

0 commit comments

Comments
 (0)