Repository navigation
Conversation
Reject a version that is not X.Y.Z before it is written to $GITHUB_OUTPUT, and send the dispatch payload with gh's --raw-field so a value starting with @ is never read as a file. Fixes generative-computing#1722 Assisted-by: Claude Signed-off-by: Alex Shuvalov <shuv.aleksandr@icloud.com>
planetf1
left a comment
There was a problem hiding this comment.
Verified both changes against the issue:
- Ran the regex in bash:
0.9.0and1.2.3are accepted;1.2.3rc1,v0.9.0,@/etc/passwd,1.2.3\nfoo=bar,1.2.3.4, empty and trailing-space values are all rejected. The newline injection and@-prefixed file paths from #1722 are both closed off before the value reaches$GITHUB_OUTPUTor the dispatch call. gh api --helpconfirms-F/--fieldis the typed flag that reads@<path>values from disk, while-f/--raw-fieldsends the literal string. Both values here are plain strings, so the payload mellea-contribs receives is unchanged.- zizmor reports no findings on the modified workflow.
The run steps use the default bash shell on ubuntu-latest, so [[ =~ ]] is fine.
markstur
left a comment
There was a problem hiding this comment.
See inline. The injection problem was fixed, but also introduced in the error handling.
| VERSION="${GITHUB_REF#refs/tags/v}" | ||
| fi | ||
| if [[ ! "${VERSION}" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then | ||
| echo "::error::Invalid version '${VERSION}'; expected X.Y.Z" |
There was a problem hiding this comment.
The new ::error:: message interpolates the raw unvalidated VERSION. A dispatch with a version input containing \n::stop-commands::t fails the regex (good) but the echo then emits the raw multi-line value, and the runner parses those lines as workflow commands. Same injection class the PR exists to close, relocated. Fix: echo a quoted/escaped form or just "Invalid version; expected X.Y.Z" without the value.
There was a problem hiding this comment.
@skritosss please take a look at the injection problem with the new error message
Pull Request
Issue
Fixes #1722
Description
The two changes proposed in #1722, applied to
.github/workflows/dispatch-to-contribs.yml:X.Y.Zwith an::error::before it is written to$GITHUB_OUTPUT, so a manualworkflow_dispatchinput with a newline cannot add step outputs.--raw-fieldinstead of--field, so a value starting with@is sent as text and never read as a file from the runner. Both values are plain strings, so the payload contributors receive is unchanged.Testing
The run steps use the default bash shell on
ubuntu-latest, so[[ =~ ]]works. I checked the regex in bash:0.9.0and1.2.3pass;1.2.3\nfoo=bar,@/etc/passwd,0.9.0rc1andv0.9.0are rejected. zizmor reports no findings on the file. The workflow itself only runs on a release, so I could not run it from a fork.Attribution
Adding a new component, requirement, sampling strategy, or tool?
If your PR adds or modifies one of the types below, check the matching box. A checklist of type-specific review items will be posted as a comment.
NOTE: Please ensure you have an issue that has been acknowledged by a core contributor and routed you to open a pull request against this repository. Otherwise, please open an issue before continuing with this pull request.