Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 6 additions & 12 deletions .github/workflows/create-tag-on-merge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,18 +80,12 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
PR_TITLE="${{ steps.should-deploy.outputs.pr-title }}"
RELEASE_NOTES="${{ steps.should-deploy.outputs.release-notes }}"
PR_NUMBER="${{ steps.should-deploy.outputs.pr-number }}"

# Create release notes with PR title, description, and link
cat > release_notes.md << EOF
## What's Changed

${PR_TITLE} in [#${PR_NUMBER}](https://github.com/${{ github.repository }}/pull/${PR_NUMBER})

${RELEASE_NOTES}
EOF
# Create release notes using printf to handle special characters safely
printf "## What's Changed\n\n%s in [#%s](https://github.com/${{ github.repository }}/pull/%s)\n\n%s\n" \
"${{ steps.should-deploy.outputs.pr-title }}" \
"${{ steps.should-deploy.outputs.pr-number }}" \
"${{ steps.should-deploy.outputs.pr-number }}" \
"${{ steps.should-deploy.outputs.release-notes }}" > release_notes.md
Comment on lines +83 to +88
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔒 Security - Shell Injection Risk: Either revert to the previous shell variable approach with proper quoting, or use printf with properly escaped arguments. Consider using shell parameter expansion with proper quoting like "${PR_TITLE@Q}" or a more robust templating approach.

Suggested change
# Create release notes using printf to handle special characters safely
printf "## What's Changed\n\n%s in [#%s](https://github.com/${{ github.repository }}/pull/%s)\n\n%s\n" \
"${{ steps.should-deploy.outputs.pr-title }}" \
"${{ steps.should-deploy.outputs.pr-number }}" \
"${{ steps.should-deploy.outputs.pr-number }}" \
"${{ steps.should-deploy.outputs.release-notes }}" > release_notes.md
# Create release notes using shell variables with proper quoting
PR_TITLE="${{ steps.should-deploy.outputs.pr-title }}"
PR_NUMBER="${{ steps.should-deploy.outputs.pr-number }}"
RELEASE_NOTES="${{ steps.should-deploy.outputs.release-notes }}"
printf "## What's Changed\n\n%s in [#%s](https://github.com/${{ github.repository }}/pull/%s)\n\n%s\n" \
"$PR_TITLE" \
"$PR_NUMBER" \
"$PR_NUMBER" \
"$RELEASE_NOTES" > release_notes.md


gh release create $NEW_TAG --notes-file release_notes.md
git checkout $NEW_TAG
Expand Down