Skip to content

Commit 6be6447

Browse files
committed
ci: mitigate script injection attack in test_weaver-pre-release.yaml
Fixes the script injection attack mentioned here: https://hackerone.com/reports/2471956 Signed-off-by: Sandeep Nishad <sandeep.nishad1@ibm.com>
1 parent 514dc68 commit 6be6447

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

.github/workflows/test_weaver-pre-release.yaml

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,11 @@ jobs:
2323

2424
- name: Ignore if not a release PR
2525
id: early
26+
env:
27+
TITLE: ${{ github.event.pull_request.title }}
2628
run : |
2729
status="skip"
28-
if echo "${{ github.event.pull_request.title }}" | grep -q "chore(release)"; then
30+
if echo ${TITLE} | grep -q "chore(release)"; then
2931
status="continue"
3032
fi
3133
echo "status=$status" >> $GITHUB_OUTPUT
@@ -39,10 +41,12 @@ jobs:
3941
- uses: actions/checkout@v4.1.1
4042

4143
- name: Get release verison from PR title
44+
env:
45+
TITLE: ${{ github.event.pull_request.title }}
4246
run: |
4347
# Assuming release PR follows pattern: chore(release): publish vA.B.C
4448
# Split PR title by space, and take 3rd word
45-
VERSION=$(echo "${{ github.event.pull_request.title }}" | cut -d ' ' -f 3)
49+
VERSION=$(echo "${TITLE}" | cut -d ' ' -f 3)
4650
# Strip "v" from version
4751
VERSION=$(echo $VERSION | sed -e 's/^v//')
4852
echo "VERSION=$VERSION" >> $GITHUB_ENV
@@ -146,10 +150,12 @@ jobs:
146150
- uses: actions/checkout@v4.1.1
147151

148152
- name: Get release verison from PR title
153+
env:
154+
TITLE: ${{ github.event.pull_request.title }}
149155
run: |
150156
# Assuming release PR follows pattern: chore(release): publish vA.B.C
151157
# Split PR title by space, and take 3rd word
152-
VERSION=$(echo "${{ github.event.pull_request.title }}" | cut -d ' ' -f 3)
158+
VERSION=$(echo "${TITLE}" | cut -d ' ' -f 3)
153159
# Strip "v" from version
154160
VERSION=$(echo $VERSION | sed -e 's/^v//')
155161
echo "VERSION=$VERSION" >> $GITHUB_ENV

0 commit comments

Comments
 (0)