Skip to content

Commit ed884a5

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

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
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 }}" \

0 commit comments

Comments
 (0)