Skip to content

Commit 7ef4f08

Browse files
authored
Prevent command injection when creating release notes (#1419)
If a merged PR title contains invalid strings, it could allow for shell injection. It's best to address known problems promptly.
1 parent 729a7f0 commit 7ef4f08

File tree

2 files changed

+3
-6
lines changed

2 files changed

+3
-6
lines changed

.github/workflows/create-draft-release.yml

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,8 @@ jobs:
106106
.concat(`\n\n${footer}`);
107107
108108
console.log(`releaseNotes (modified): ${JSON.stringify(modifiedBody, null, 2)}`);
109-
core.setOutput("release_body", modifiedBody);
109+
const fs = require('fs');
110+
fs.writeFileSync('release-notes.txt', modifiedBody, { encoding: 'utf8' });
110111
111112
- name: Prepare Release Title
112113
id: title
@@ -118,10 +119,6 @@ jobs:
118119
SANITIZED_TITLE="$(printf '%s' "$RAW_TITLE" | sed 's/"/\\"/g')"
119120
echo "sanitized_title=$SANITIZED_TITLE" >> "$GITHUB_OUTPUT"
120121
121-
- name: Write Release Notes to File
122-
run: |
123-
echo "${{ steps.generate-release-notes.outputs.release_body }}" > release-notes.txt
124-
125122
- name: Create Draft Release
126123
run: |
127124
gh release create "${{ steps.calculate-version.outputs.new_version }}" \

.github/workflows/test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
- '20'
1919
- '20.12.2'
2020
- '22'
21-
- '24'
21+
- '24.9.0'
2222
fail-fast: false
2323

2424
name: Node.js ${{ matrix.node }}

0 commit comments

Comments
 (0)