Skip to content

ci(fast): read event values from env in the test-fast run scripts - #2042

Merged
dgunning merged 1 commit into
mainfrom
ci/workflow-env-expressions
Nov 23, 2026
Merged

dgunning merged 1 commit into
mainfrom
ci/workflow-env-expressions

Conversation

@dgunning

Copy link
Copy Markdown
Owner

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:

  • the offline audit
  • the upgrade-guide check
  • Run fast tests
  • the section-boundary check

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_NAME and GITHUB_REPOSITORY variables. The three steps that call the PR files API also set PR_NUMBER in their env: from github.event.number. No ${{ }} is left inside any run: script in this workflow; the expressions that remain are in env:, 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

  • The YAML parses, and a scan of every run: block finds no remaining ${{.
  • This PR changes the workflow file, so its own run exercises all four steps on the pull-request path: the PR files API calls, the label lookup and the fast-test branch. The push path runs after merge.
  • No script or test reads these lines. scripts/check_offline_audit.py only names the workflow file in its docstring.

AI assistance

  • Assisted. Tool and model: Claude Code, Claude Opus 5.5

🤖 Generated with Claude Code

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>
@dgunning
dgunning merged commit 154a083 into main Nov 23, 2026
13 checks passed
@dgunning
dgunning deleted the ci/workflow-env-expressions branch November 23, 2026 18:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant