Skip to content

Commit 31cfbbf

Browse files
authored
Merge pull request #1578 from jetstreamapp/fix/ci-command-vulnerability
fix: avoid interpolation in ci commands
2 parents 79a4012 + b0a8e24 commit 31cfbbf

File tree

1 file changed

+14
-6
lines changed

1 file changed

+14
-6
lines changed

.github/workflows/release.yml

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -73,12 +73,17 @@ jobs:
7373

7474
steps:
7575
- name: Validate inputs
76+
env:
77+
REF_NAME: ${{ github.ref_name }}
78+
RELEASE_WEB: ${{ inputs.release_web }}
79+
RELEASE_WEB_EXTENSION: ${{ inputs.release_web_extension }}
80+
RELEASE_DESKTOP: ${{ inputs.release_desktop }}
7681
run: |
77-
if [[ "${{ github.ref_name }}" != "main" ]]; then
78-
echo "Error: This workflow can only be run on the main branch. Current branch: ${{ github.ref_name }}"
82+
if [[ "$REF_NAME" != "main" ]]; then
83+
echo "Error: This workflow can only be run on the main branch. Current branch: $REF_NAME"
7984
exit 1
8085
fi
81-
if [[ "${{ inputs.release_web }}" != "true" && "${{ inputs.release_web_extension }}" != "true" && "${{ inputs.release_desktop }}" != "true" ]]; then
86+
if [[ "$RELEASE_WEB" != "true" && "$RELEASE_WEB_EXTENSION" != "true" && "$RELEASE_DESKTOP" != "true" ]]; then
8287
echo "Error: At least one of release_web, release_web_extension, or release_desktop must be true."
8388
exit 1
8489
fi
@@ -125,9 +130,10 @@ jobs:
125130
- name: Release Web
126131
if: ${{ inputs.release_web }}
127132
id: release_web
128-
run: npx release-it ${{ inputs.bump }} --ci --config .release-it.json
129133
env:
130134
GITHUB_TOKEN: ${{ secrets.GH_RELEASE_TOKEN }}
135+
BUMP: ${{ inputs.bump }}
136+
run: npx release-it "$BUMP" --ci --config .release-it.json
131137

132138
- name: Debug dirty working dir
133139
if: failure() && steps.release_web.outcome == 'failure'
@@ -158,13 +164,14 @@ jobs:
158164
# NOTE: Each application has its own tag format - so it is safe to have release-it run multiple times
159165
- name: Release Web Extension
160166
if: ${{ inputs.release_web_extension }}
161-
run: npx release-it ${{ inputs.bump }} --ci --config .release-it-web-ext.json
162167
env:
163168
GITHUB_TOKEN: ${{ secrets.GH_RELEASE_TOKEN }}
169+
BUMP: ${{ inputs.bump }}
164170
WEB_EXTENSION_ID_CHROME: ${{ secrets.WEB_EXTENSION_ID_CHROME }}
165171
GOOGLE_WEB_EXT_PUBLISH_CLIENT_ID: ${{ secrets.GOOGLE_WEB_EXT_PUBLISH_CLIENT_ID }}
166172
GOOGLE_WEB_EXT_PUBLISH_CLIENT_SECRET: ${{ secrets.GOOGLE_WEB_EXT_PUBLISH_CLIENT_SECRET }}
167173
GOOGLE_WEB_EXT_PUBLISH_REFRESH_TOKEN: ${{ secrets.GOOGLE_WEB_EXT_PUBLISH_REFRESH_TOKEN }}
174+
run: npx release-it "$BUMP" --ci --config .release-it-web-ext.json
168175

169176
- name: Upload web extension zips
170177
if: ${{ inputs.release_web_extension }}
@@ -178,6 +185,7 @@ jobs:
178185
# NOTE: Each application has its own tag format - so it is safe to have release-it run multiple times
179186
- name: Release Desktop
180187
if: ${{ inputs.release_desktop }}
181-
run: npx release-it ${{ inputs.bump }} --ci --config .release-it-desktop.json
182188
env:
183189
GITHUB_TOKEN: ${{ secrets.GH_RELEASE_TOKEN }}
190+
BUMP: ${{ inputs.bump }}
191+
run: npx release-it "$BUMP" --ci --config .release-it-desktop.json

0 commit comments

Comments
 (0)