Harden release workflow against shell-expanded inputs - #1022
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
env:blocks instead of materializing them insiderun:scriptsprintf '%s\n' "$CUSTOM_NOTES"/tmp/notes.mddirectly to the release action viabody_path, avoiding delimiter collisions in$GITHUB_OUTPUTRoot cause
GitHub Actions expands
${{ ... }}expressions before Bash parses arun:block. The previouscustom_notes="${{ inputs.release_notes }}"line therefore turned release-note contents into executable script text, allowing backticks or$()to execute or break the step. A quoted heredoc would have the same template-time problem and would also collide with a bare delimiter line. Passing the value throughenv:keeps it out of script text entirely.The generated body was also exported through a fixed
NOTES_EOF$GITHUB_OUTPUTdelimiter. An otherwise valid custom-note line equal toNOTES_EOFcould close that value early and leave malformed runner commands. The release action now reads the generated file directly.Interpolation audit
The full workflow was checked for expressions embedded in
run:blocks:inputs.versionandgithub.refexpanded directly in BashRELEASE_VERSIONandWORKFLOW_REFare populated viaenv:and referenced as quoted shell variablesRELEASE_VERSIONis populated viaenv:inputs.release_noteswere expanded in Bashenv:; custom notes are emitted withprintf '%s\n' "$CUSTOM_NOTES"RELEASE_VERSIONis populated viaenv:NOTES_EOFstep-output delimiterbody_path: /tmp/notes.mdpasses the file directly to the release actionNo
${{ inputs.* }}or${{ github.event.* }}interpolation remains in arun:block; the audit found no workflow expression of any kind remaining in executable shell text.Validation
git diff --check.github/workflows/release.ymluv run ruff check tests/test_release_workflow.pyuv run pytest -q tests/test_release_workflow.py(2 passed)${{ ... }}expressions insiderun:blocks and literal handling of backticks,$(), single and double quotes, multiline Markdown, and a bareNOTES_EOFlineactionlintis not installed in this environment. The Release workflow itself cannot be CI-exercised pre-merge without performing the live tag-and-publish path, so this PR does not claim a live release run.🤖 Opened by Kuzya