Repository navigation
Description
- The version is not validated before being written to $GITHUB_OUTPUT
The "Resolve version" step writes the version straight to the step output file:
echo "version=${VERSION}" >> "$GITHUB_OUTPUT"
On a workflow_dispatch run, VERSION comes from free-text input. $GITHUB_OUTPUT treats every line as a separate key=value output, so a value with a newline (e.g. 1.2.3\nfoo=bar) would create extra step outputs. Nothing currently reads any output other than version, so this has no impact today. It is still unvalidated input going into a file the runner parses.
- gh api --field reads files when the value starts with @
The dispatch step uses --field (-F):
--field "client_payload[version]=${VERSION}"
-F is gh's typed flag. It turns true/false/null/numbers into JSON types, and if the value starts with @, gh reads the named file and sends its contents. A manual run with version @/some/path would send that file from the runner to mellea-contribs in the dispatch payload. A version is always a plain string, so -f/--raw-field is the correct flag.
Proposed change
- name: Resolve version
if: env.SKIP != 'true'
id: version
env:
INPUT_VERSION: ${{ github.event.inputs.version }}
run: |
if [ -n "${INPUT_VERSION}" ]; then
VERSION="${INPUT_VERSION}"
else
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"
exit 1
fi
echo "version=${VERSION}" >> "$GITHUB_OUTPUT"
echo "Dispatching mellea-released event to contribs with version=${VERSION}"
- name: Dispatch to mellea-contribs
if: env.SKIP != 'true'
env:
GH_TOKEN: ${{ steps.app-token.outputs.token }}
VERSION: ${{ steps.version.outputs.version }}
run: |
gh api repos/generative-computing/mellea-contribs/dispatches \
--method POST \
--raw-field event_type=mellea-released \
--raw-field "client_payload[version]=${VERSION}"
Notes:
- The workflow only dispatches for stable releases (pre-releases are skipped), so the regex accepts strict X.Y.Z. If manual recovery runs ever need pre-release or post-release versions (e.g. 1.2.3rc1, 1.2.3.post1), the pattern needs widening. The safety property is that it is anchored and contains no newlines, @, or quotes.
- Validation also catches mistakes in manual runs, like a leading v (v1.2.3) or trailing whitespace, before they reach contribs.
- Switching to --raw-field doesn't change the payload for valid versions. 1.2.3 was already sent as a string.
Acceptance criteria
- A manual run with an invalid version (e.g. v1.2.3, @foo, an empty string) fails at "Resolve version" with a clear error.
- A release with a stable tag vX.Y.Z still dispatches client_payload.version = "X.Y.Z" to mellea-contribs.
- zizmor stays clean on the workflow.
Activity
jakelorocco commentedon Oct 8, 2026
This is claude generated issue. I didn't have time validate everything / drive this through cicd. I think there might be other spots where these fixes could be cross-applied to other of our actions. It's a follow-up to #1717.
skritosss commentedon Oct 11, 2026
Can I take this one? The changes are ready and checked. I'll open a PR once you confirm.
jakelorocco commentedon Oct 12, 2026
Hi @skritosss, thanks for offering! Yes, we are happy to take a look at your PR / contribution. It might be a bit harder to work on this one since it involves github actions and you are an external contributor; but we'd still be happy to review and help merge any contributions.
fix(ci): validate the dispatched version and send it with --raw-field
fix(ci): validate the dispatched version and send it with --raw-field (…