Repository navigation
Harden release workflow input handling against shell injection - #24
Conversation
Co-authored-by: fupacat <595487+fupacat@users.noreply.github.com>
There was a problem hiding this comment.
🔵 Needs a closer look
It modifies a security-sensitive release/publish pipeline and only partially closes the injection surface, since the input-derived RELEASE_VERSION output is still interpolated directly into later run: blocks, warranting human review.
1 open finding
What changed in this PR
This PR hardens the Release & Distribute GitHub Actions workflow against shell/script injection (SonarCloud rule githubactions:S7630, issue #22). Previously, workflow_dispatch inputs (version, next_version) were interpolated directly into bash run: blocks via ${{ inputs.* }}, which allows untrusted input to be injected into the shell. The change routes those inputs through step-level env: variables and consumes them as shell variables instead, preserving behavior while removing the flagged pattern.
Changes:
- Added
INPUT_VERSIONenv var to the "Determine Release Version" step and reference${INPUT_VERSION}instead of${{ inputs.version }}. - Added
INPUT_NEXT_VERSIONenv var to the "Bump to Next SNAPSHOT Version" step and reference${INPUT_NEXT_VERSION}in themvnandgitcommands.
| File | Description |
|---|---|
| .github/workflows/release.yml | Passes workflow_dispatch inputs through step-level env: variables and consumes them as shell variables to avoid direct GitHub Actions template interpolation in run: blocks. |
🧠 Review effort: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Co-authored-by: fupacat <595487+fupacat@users.noreply.github.com>
Co-authored-by: fupacat <595487+fupacat@users.noreply.github.com>

The release workflow was interpolating workflow_dispatch inputs directly into shell commands, which violates the GitHub Actions security guidance for untrusted input in bash scripts. This is especially relevant for
versionandnext_version, which are used inmvnandgitcommands.Summary
inputs.versionandinputs.next_version.$INPUT_VERSION/$INPUT_NEXT_VERSIONinside the shell.Changes
INPUT_VERSIONin the “Determine Release Version” step and reference it instead of${{ inputs.version }}.INPUT_NEXT_VERSIONin the “Bump to Next SNAPSHOT Version” step and reference it instead of${{ inputs.next_version }}in the Maven and git commands.Example