fix(ci): harden release.yml against shell injection in notes

The previous template inlined ${{ inputs.release_notes }} directly into
a double-quoted bash NOTES="..." assignment, so backticks (or $vars) in
the notes were evaluated by the shell as command substitution. Today's
0.11.30 release hit this — backticks in the ADR-107 release notes blew
up the heredoc and failed the workflow before tag creation.

Switch the templated values to env-var bindings (RELEASE_NAME,
RELEASE_VERSION, RELEASE_NOTES_INPUT) and assemble the markdown via
printf so the notes are treated as data, not code.
This commit is contained in:
Aaron Bockelie 2026-05-24 17:11:06 -05:00
parent 4fddaab955
commit 6358d31fdd

View file

@ -79,24 +79,21 @@ jobs:
if: steps.check_tag.outputs.exists == 'false'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
RELEASE_NAME: ${{ steps.version.outputs.name }}
RELEASE_VERSION: ${{ steps.version.outputs.version }}
# Bind via env to avoid shell interpretation of user-supplied notes
# (backticks, $vars, etc. in the notes must NOT be evaluated).
RELEASE_NOTES_INPUT: ${{ inputs.release_notes }}
run: |
NOTES="## ${{ steps.version.outputs.name }} ${{ steps.version.outputs.version }}
NOTES=$(printf '## %s %s\n\n%s\n\n### Installation via BRAT\n1. Install the BRAT plugin if you haven'\''t already\n2. Command palette → "BRAT: Add a beta plugin for testing"\n3. Enter: `aaronsb/obsidian-mcp-plugin`\n4. Enable the plugin in Community Plugins\n' "$RELEASE_NAME" "$RELEASE_VERSION" "$RELEASE_NOTES_INPUT")
${{ inputs.release_notes }}
### Installation via BRAT
1. Install the BRAT plugin if you haven't already
2. Command palette → \"BRAT: Add a beta plugin for testing\"
3. Enter: \`aaronsb/obsidian-mcp-plugin\`
4. Enable the plugin in Community Plugins"
gh release create "${{ steps.version.outputs.version }}" \
--title "${{ steps.version.outputs.name }} ${{ steps.version.outputs.version }}" \
gh release create "$RELEASE_VERSION" \
--title "$RELEASE_NAME $RELEASE_VERSION" \
--generate-notes \
--notes "$NOTES" \
--prerelease \
main.js \
manifest.json \
styles.css \
"obsidian-mcp-${{ steps.version.outputs.version }}.mcpb" \
"obsidian-mcp-$RELEASE_VERSION.mcpb" \
obsidian-mcp.mcpb