Prevent output injection in publish-release workflow - #18
Merged
alessandrobologna merged 1 commit intoMay 27, 2026
Conversation
There was a problem hiding this comment.
Pull request overview
This PR hardens the release publishing workflow against $GITHUB_OUTPUT injection from manually supplied release tags.
Changes:
- Rejects
release_tagvalues containing newline or carriage-return characters. - Replaces
echooutput writes for release ref outputs withprintfsingle-line assignments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
Motivation
publish-releaseworkflow wrote a user-controlledrelease_taginput directly to$GITHUB_OUTPUT, allowing newline-based output injection to overridecheckout_refandversionand cause releases to be built from unintended refs.workflow_dispatchrights cause the workflow to check out and publish code from an attacker-controlled ref while using the workflow's AWS publishing credentials.Description
release_tagvalues containing newline characters (\nor\r) in theResolve release refstep of.github/workflows/publish-release.ymlto block output injection.echo-based writes to$GITHUB_OUTPUTwithprintf-based writes fortag,version, andcheckout_refto ensure literal, single-line output assignments.Testing
sed -n '1,140p' .github/workflows/publish-release.ymlto verify the new newline validation and that theprintfwrites are present.nl -ba .github/workflows/publish-release.yml | sed -n '48,86p'to confirm theResolve release reflogic now rejects\n/\rand writes outputs withprintf.Codex Task