Repository navigation
ci(fast): read event values from env in the test-fast run scripts - #2042
Merged
Merged
Conversation
Four run scripts in test-fast expanded `${{ github.event_name }}`,
`${{ github.repository }}` and `${{ github.event.number }}` straight into
shell source, which CodeFactor reports as possible code injection. None
of these values can be set by a contributor, so nothing was exploitable,
but GitHub's hardening guide keeps expressions out of scripts.
The scripts now read the runner's default GITHUB_EVENT_NAME and
GITHUB_REPOSITORY variables, and a PR_NUMBER variable set in each step's
env from github.event.number. Behaviour is unchanged. No `${{ }}` is
left inside any run script in this workflow.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
What this changes
Four
run:scripts in the test-fast job expanded${{ github.event_name }},${{ github.repository }}and${{ github.event.number }}directly into shell source. CodeFactor reports that pattern as possible code injection. The affected steps are:None of those values can be set by a contributor, so nothing was exploitable. GitHub's hardening guide still recommends keeping expressions out of scripts, and this clears the whole file.
The scripts now read the runner's default
GITHUB_EVENT_NAMEandGITHUB_REPOSITORYvariables. The three steps that call the PR files API also setPR_NUMBERin theirenv:fromgithub.event.number. No${{ }}is left inside anyrun:script in this workflow; the expressions that remain are inenv:,with:,if:and the matrix, where they are never parsed as shell.#2036 fixes the same pattern in the install step it adds, so the two PRs touch different steps.
Verification
run:block finds no remaining${{.scripts/check_offline_audit.pyonly names the workflow file in its docstring.AI assistance
🤖 Generated with Claude Code