Repository navigation
ci: pass workflow inputs through env in bump-gitstream-core [skip ci] - #605
Conversation
Pass inputs.version, inputs.reviewer and inputs.description to the
run scripts through step-level env variables, and read the values
already stored in GITHUB_ENV as shell variables instead of ${{ env.* }}
expressions.
LINSEC-2148
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
There was a problem hiding this comment.
Orca Security Scan Summary
| Status | Check | Issues by priority | |
|---|---|---|---|
| Infrastructure as Code | View in Orca | ||
| OSS Licenses | View in Orca | ||
| SAST | View in Orca | ||
| Secrets | View in Orca | ||
| Vulnerabilities | View in Orca |
There was a problem hiding this comment.
✨ PR Review
The PR moves workflow inputs from inline ${{ }} expressions into env:, which removes direct script injection in the run: bodies. However, the values are still written unvalidated into $GITHUB_ENV and into an unquoted argument list, so injection paths remain.
2 issues detected:
🔒 Security - Unvalidated, potentially multi-line input is appended to the `$GITHUB_ENV` file, allowing environment variable injection. 🛠️
Details: INPUT_VERSION is written straight into $GITHUB_ENV with echo. A multi-line version value (for example 1.0.0\nNODE_OPTIONS=--require ./x.js or LD_PRELOAD=...) adds arbitrary environment variables to every later step. Those steps include npm install, npm run all and the step that uses CI_USER_GIT_TOKEN. The PR description presents this as hardening, yet this path to code execution in later steps is still open.
File: .github/workflows/bump-gitstream-core.yml (47-48)
🛠️ A suggested code correction is included in the review comments.
🔒 Security - User-controlled input is embedded in an env var that is later word-split into command-line arguments, without validation.
Details: REVIEWER is stored as --reviewer $REVIEWER in $GITHUB_ENV with no validation. It is later expanded unquoted as $REVIEWER_ARG in gh pr create. A reviewer value containing spaces or newlines adds extra gh flags, such as --base, --head or --body, or breaks the env file. A newline in the value can also inject extra env vars via $GITHUB_ENV.
File: .github/workflows/bump-gitstream-core.yml (59-61)
Generated by LinearB AI and added by gitStream.
AI-generated content may contain inaccuracies. Please verify before using.
💡 Tip: You can customize your AI Review using Guidelines Learn how
| echo "VERSION=$INPUT_VERSION" >> "$GITHUB_ENV" | ||
| echo "BRANCH_NAME=bump-gitstream-core-to-$INPUT_VERSION" >> "$GITHUB_ENV" |
There was a problem hiding this comment.
🔒 Security - GITHUB_ENV injection via input: Validate INPUT_VERSION against a strict semver regex and fail before writing to $GITHUB_ENV. Alternatively, skip $GITHUB_ENV for these values and pass them via step-level env: from inputs.version.
| echo "VERSION=$INPUT_VERSION" >> "$GITHUB_ENV" | |
| echo "BRANCH_NAME=bump-gitstream-core-to-$INPUT_VERSION" >> "$GITHUB_ENV" | |
| if [[ ! "$INPUT_VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+(-[0-9A-Za-z.-]+)?(\+[0-9A-Za-z.-]+)?$ ]]; then | |
| echo "::error::Invalid version: must be a valid semver string" | |
| exit 1 | |
| fi | |
| echo "VERSION=$INPUT_VERSION" >> "$GITHUB_ENV" | |
| echo "BRANCH_NAME=bump-gitstream-core-to-$INPUT_VERSION" >> "$GITHUB_ENV" |
Is this review accurate? Use 👍 or 👎 to rate it
If you want to tell us more, use /gs feedback e.g. /gs feedback this review doesn't make sense, I disagree, and it keeps repeating over and over
There was a problem hiding this comment.
🟢 Approved
No active review issues are recorded for the workflow input-handling changes.
No open issues 🎉
What changed in this PR
This PR hardens the gitstream-core dependency bump workflow by passing inputs through environment variables rather than interpolating them directly into shell scripts, while preserving behavior for normal inputs.
Changes:
- Passes version, reviewer, and description inputs through step-level environment variables.
- Uses shell variables in npm, Git, and PR creation commands, with updated quoting for package, branch, and title arguments.
| File | Description |
|---|---|
.github/workflows/bump-gitstream-core.yml |
Replaces direct input interpolation with environment-variable access in shell commands. |
Review effort: Balanced
What
In
bump-gitstream-core.yml, workflow inputs and values derived from them were written intorun:scripts with${{ }}expressions. This PR passes them throughenv:and reads them as regular shell variables, in line with GitHub's hardening guidance for Actions.No behaviour change for normal inputs. Only
.github/workflows/bump-gitstream-core.ymlis touched.Changes
inputs.version,inputs.reviewerandinputs.descriptionare passed through step-levelenv:(INPUT_VERSION,REVIEWER,PR_DESCRIPTION).${{ env.VERSION }},${{ env.BRANCH_NAME }},${{ env.REVIEWER_ARG }}and${{ env.LABEL_ARG }}insiderun:are replaced with$VERSION,$BRANCH_NAME,$REVIEWER_ARGand$LABEL_ARG. They were already environment variables (set through$GITHUB_ENV).gh pr create --titleargument moves from single to double quotes (backticks escaped) so$VERSIONexpands.Step names and the
Output PR URLstep are unchanged.Recommendation (not in this PR): validate the input format
This PR is kept to the minimal change. As a follow-up, I recommend adding a format check in the first steps, so the workflow fails early when a value is not in the format we expect, instead of carrying it into
$GITHUB_ENV, the branch name and thegh pr createarguments:Why it is worth adding:
VERSIONandBRANCH_NAMEare written to$GITHUB_ENVone per line, so the value should be a single line with version characters only.$REVIEWER_ARGis expanded unquoted on purpose (it holds--reviewer <name>), so the reviewer should be a single word.The patterns above are a suggestion; adjust them if pre-release versions or team reviewers (
org/team) need a different format.Testing
Not executed: the workflow only runs on
workflow_dispatchand opens a real bump PR. Suggested check before merge: run "Bump gitstream-core" from this branch with the currentgitstream-coreversion and close the PR it opens.Ticket: LINSEC-2148
🤖 Generated with Claude Code
✨ PR Description
Purpose: Enhance security and stability in
bump-gitstream-core.ymlby passing workflow inputs via environment variables.Main changes:
${{ inputs }}and${{ env }}expansion in shell scripts with environment variablesCreate PRstep to usePR_DESCRIPTIONenv var for description filegit pushandgh pr createto use shell variables for argumentsGenerated by LinearB AI and added by gitStream.
AI-generated content may contain inaccuracies. Please verify before using.
💡 Tip: You can customize your AI Description using Guidelines Learn how