Skip to content

Commit d067806

Browse files
Fix shell injection vulnerability in release workflow
Resolves command injection vulnerability by using environment variables instead of direct GitHub context interpolation in shell scripts. This prevents potential malicious code injection through user-controlled input in github.event_name and github.event.inputs.version. Changes: - Added env section with GH_EVENT_NAME and GH_INPUT_VERSION - Updated shell script to reference environment variables - Added proper quoting around variables Fixes: https://linear.app/getsentry/issue/ENG-6554 Parent: https://linear.app/getsentry/issue/VULN-1163 Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
1 parent 1240425 commit d067806

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

.github/workflows/release.yml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,14 +58,17 @@ jobs:
5858

5959
- name: Get version from tag or input
6060
id: get_version
61+
env:
62+
GH_EVENT_NAME: ${{ github.event_name }}
63+
GH_INPUT_VERSION: ${{ github.event.inputs.version }}
6164
run: |
62-
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
63-
VERSION="${{ github.event.inputs.version }}"
65+
if [ "$GH_EVENT_NAME" = "workflow_dispatch" ]; then
66+
VERSION="$GH_INPUT_VERSION"
6467
echo "VERSION=$VERSION" >> $GITHUB_OUTPUT
6568
echo "IS_TEST=true" >> $GITHUB_OUTPUT
6669
echo "📝 Test version: $VERSION"
6770
# Update package.json version for test releases only
68-
npm version $VERSION --no-git-tag-version
71+
npm version "$VERSION" --no-git-tag-version
6972
else
7073
VERSION=${GITHUB_REF#refs/tags/v}
7174
echo "VERSION=$VERSION" >> $GITHUB_OUTPUT

0 commit comments

Comments
 (0)