Repository navigation
Harden checkout credentials and env expansion in CI workflows - #41683
Conversation
|
/gemini review |
There was a problem hiding this comment.
📋 Review Summary
This PR hardens three GitHub Actions workflows by disabling credential persistence on actions/checkout@v7 and replacing direct ${{ ... }} expression interpolation in run: blocks with environment variables. The changes cleanly resolve the target zizmor/artipacked and zizmor/template-injection alerts without altering workflow semantics.
🔍 General Feedback
- Passing step outputs and context variables through
env:andjq --argincodeql.ymlandrun_rc_validation_go_wordcount.ymlfollows GitHub Actions security best practices. - Adding the non-empty prefix check (
[[ -n "${WORK_DIR}" && "${WORK_DIR}" == go-rc-test-* ]]) beforerm -rfin thealways()cleanup step ofrun_rc_validation_go_wordcount.ymlis a solid defensive improvement in case the setup step fails before setting the output.
💡 Tip: Comment /gemini review on this pull request to trigger a new Gemini code review.
|
Assigning reviewers: R: @damccorm for label build. Note: If you would like to opt out of this review, comment Available commands:
The PR bot will only process comments in the main thread (not review comments). |
Note: this PR was auto-generated by tooling. Before moving it out of draft, the author has done a full review of the PR, specifically evaluating it on the following criteria:
CodeQL/zizmor) onmasterwithout altering intended public API or workflow semanticsworkflow_dispatchruns (for workflow/action changes) have been verifiedInitiative Progress (as of
2026-11-25 20:43 UTC):18PRs merged so far, with~16more PRs needed to be merged to close out all actionable Code Scanning findings (with#41637disablingNote-levelzizmor/self-repositorywarnings).Code Scanning Remediation Context (End Goal, Scope & Impact)
apache/beam's actionableHighandMediumCode Scanning backlog (CodeQL+zizmor) down to zero.Note-levelzizmor/self-repositorywarnings (~89% of all open alerts) are handled via.github/zizmor.ymlconfig (Disable zizmor self-repository rule in .github/zizmor.yml #41637) rather than churning ~300 workflow files.ZipSlip) fixes in JavaZipFiles.unzipFile(Enforce canonical path prefix check in ZipFiles.unzipFile #41497) and Go xlangexpansionx(Enforce IsLocal and prefix check in expansionx validatePath #41589)High) fixes in shared CI composite actions (Pass inputs via env in build-push-docker-action #41515, Pass inputs and outputs via env in test-arguments-action #41592, Pass inputs and outputs via env in setup-k8s-access #41605) andpr-bot(Pass git argument arrays to @actions/exec in pr-bot updateReviewers #41524)GITHUB_TOKENscoping across CI and release workflows (Harden permissions and setup-node caching in typescript_tests.yml #41499, Scope write permissions to job in update_python_dependencies.yml #41516, Scope write permissions to jobs in cut_release_branch.yml #41522, Add read-only permissions and self-repo actions in python_tests.yml #41526, Add read-only permissions and self-repo actions in java_tests.yml #41626, Add read-only permissions and self-repo actions in local_env_tests.yml #41631) and dead-code removal (Remove unused dind-up-action composite action #41585)If you have concerns with the PR or with the underlying methodology used to generate this, please comment below - they will be addressed by the author not the tooling :)
Summary
Resolves all 12
Note-level GitHub Code Scanning alerts (zizmor/artipackedandzizmor/template-injection) across.github/workflows/beam_PreCommit_Java_Kafka_Streams_Runner.yml,.github/workflows/codeql.yml, and.github/workflows/run_rc_validation_go_wordcount.yml:.github/workflows/beam_PreCommit_Java_Kafka_Streams_Runner.yml(#3408): Setspersist-credentials: falseonactions/checkout@v7..github/workflows/codeql.yml(#1908, #1875–#1880): Setspersist-credentials: falseondetect-changesactions/checkout@v7and passessteps.filter.outputs.*/github.event_name/matrix.languageviaenv:instead of interpolating${{ ... }}directly insiderun:scripts..github/workflows/run_rc_validation_go_wordcount.yml(#1642–#1645): References workflowenv:variables (${RC_TAG},${CONTAINER_TAG}, etc.) directly inrun:scripts and passessteps.setup_go.outputs.work_dirvia stepenv:instead of${{ ... }}template expansion.Verification
zizmor --config .github/zizmor.ymlacross all 3 workflows (0findings)./gradlew :beam-test-gha:preCommit(BUILD SUCCESSFUL)CodeQL Advanced(pull_requestpath-filtered matrix): https://github.com/apache/beam/actions/runs/45691137298 (SUCCESS)CodeQL Advanced(workflow_dispatchfull 6-language matrix including Go manual build): https://github.com/apache/beam/actions/runs/45691144662 (SUCCESS)PreCommit Java Kafka Streams Runner(workflow_dispatch): https://github.com/apache/beam/actions/runs/45691139445 (SUCCESS)