Skip to content

Commit 20eec1b

Browse files
committed
Fix release metadata shell injection
1 parent 0b90891 commit 20eec1b

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

‎.github/workflows/publish-package.yml‎

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,14 @@ jobs:
4040
shell: bash
4141
run: |
4242
notes="$(git log -1 --pretty=%B | sed '/^Co-authored-by:/d')"
43+
delimiter="RELEASE_NOTES_${RANDOM}_${RANDOM}_${RANDOM}"
44+
while [[ "$notes" == *"$delimiter"* ]]; do
45+
delimiter="RELEASE_NOTES_${RANDOM}_${RANDOM}_${RANDOM}"
46+
done
4347
{
44-
echo "PACKAGE_RELEASE_NOTES<<EOF"
48+
echo "PACKAGE_RELEASE_NOTES<<$delimiter"
4549
printf '%s\n' "$notes"
46-
echo "EOF"
50+
echo "$delimiter"
4751
} >> "$GITHUB_ENV"
4852
4953
- name: Setup .NET
@@ -131,4 +135,4 @@ jobs:
131135
run: |
132136
gh release create "v$BUILD_VERSION" \
133137
--title "v$BUILD_VERSION" \
134-
--notes "${{ env.PACKAGE_RELEASE_NOTES }}"
138+
--notes "$PACKAGE_RELEASE_NOTES"

0 commit comments

Comments
 (0)