Repository navigation
Conversation
|
/gemini review |
There was a problem hiding this comment.
📋 Review Summary
This PR remediates zizmor/template-injection Code Scanning alerts in .github/actions/gradle-command-self-hosted-action/action.yml by passing action inputs through step environment variables (GRADLE_COMMAND, MAX_WORKERS, GRADLE_ARGUMENTS) instead of interpolating ${{ inputs.* }} directly into the run: script. It introduces a pure-Bash argument tokenizer (parse_gradle_args) to preserve quoting, escapes, line continuations, and $VAR / ${VAR} environment variable expansion without eval, command substitution, or globbing.
🔍 General Feedback
- The state-machine tokenizer cleanly handles single and double quotes, backslash escapes (both inside and outside double quotes, including
\$suppression), CRLF/LF line continuations, and variable lookups via${!var_name}. - Because
shell: bashin composite actions runs with-eo pipefailby default, returning non-zero on unterminated quotes properly aborts the step before invoking./gradlew.
💡 Tip: Comment /gemini review on this pull request to trigger a new Gemini code review.
|
Closing in favor of a path-scoped ignore in .github/zizmor.yml rather than maintaining a custom shell tokenizer in CI YAML. |
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 22:57 UTC):19PRs merged so far, with~15more 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 3
High-severity GitHub Code Scanning alerts (#130, #131, #132) forzizmor/template-injectionin.github/actions/gradle-command-self-hosted-action/action.yml:inputs.gradle-command,inputs.max-workers, andinputs.argumentsvia stepenv:(GRADLE_COMMAND,MAX_WORKERS,GRADLE_ARGUMENTS) instead of interpolating${{ inputs.* }}directly into therun:script.GRADLE_COMMANDandGRADLE_ARGUMENTSinto an explicit argument array (GRADLE_CMD_ARGS) preserving POSIX single/double quotes,\escapes and multi-line continuations, and$VAR/${VAR}environment variable lookups across all 516 workflow call sites—withouteval, command substitution, or shell globbing.Verification
zizmor --persona=pedantic .github/actions/gradle-command-self-hosted-action/action.yml(0findings)./gradlew :beam-test-gha:preCommit(BUILD SUCCESSFUL)argvharness across all 516.github/workflows/call sites (0mismatches) + adversarial shell-injection & unterminated-quote checksworkflow_dispatchruns on this PR branch:Java Tests(workflow_dispatchacrossubuntu-24.04,macos-latest, andwindows-latest, exercising backslash-escaped quotes[\"--runner=DirectRunner\",\"--tempRoot=./tmp\"]): https://github.com/apache/beam/actions/runs/45714534233 (SUCCESS)PreCommit Java Delta IO Direct(workflow_dispatchexercising multi-line\continuations +$JAVA_HOME_17_X64expansion): https://github.com/apache/beam/actions/runs/45714537270 (SUCCESS)PreCommit GHA(zizmor+:beam-test-gha:preCommit): https://github.com/apache/beam/actions/runs/45714325732 (SUCCESS)CodeQL Advanced: https://github.com/apache/beam/actions/runs/45714325301 (SUCCESS)