Skip to content

Pass inputs via env in gradle-command-self-hosted-action - #41688

Closed
derrickaw wants to merge 1 commit into
masterfrom
codescan/gha-gradle-command-action-env
Closed

derrickaw wants to merge 1 commit into
masterfrom
codescan/gha-gradle-command-action-env

Conversation

@derrickaw

@derrickaw derrickaw commented Nov 25, 2026 •

Copy link
Copy Markdown
Collaborator

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:

  • The PR remediates confirmed, live Code Scanning finding(s) (CodeQL / zizmor) on master without altering intended public API or workflow semantics
  • The fix is minimal, idiomatic, and avoids masking underlying defects (false positives and noisy rules are dismissed or scoped via config rather than code churn)
  • Relevant unit tests, linters, Gemini review feedback, and live workflow_dispatch runs (for workflow/action changes) have been verified

Initiative Progress (as of 2026-11-25 22:57 UTC): 19 PRs merged so far, with ~15 more PRs needed to be merged to close out all actionable Code Scanning findings (with #41637 disabling Note-level zizmor/self-repository warnings).

Code Scanning Remediation Context (End Goal, Scope & Impact)

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) for zizmor/template-injection in .github/actions/gradle-command-self-hosted-action/action.yml:

  • Passes inputs.gradle-command, inputs.max-workers, and inputs.arguments via step env: (GRADLE_COMMAND, MAX_WORKERS, GRADLE_ARGUMENTS) instead of interpolating ${{ inputs.* }} directly into the run: script.
  • Tokenizes GRADLE_COMMAND and GRADLE_ARGUMENTS into 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—without eval, command substitution, or shell globbing.

Verification

@derrickaw

Copy link
Copy Markdown
Collaborator Author

/gemini review

@github-actions github-actions Bot added the size/m M: 50-249 lines changed label Nov 25, 2026

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📋 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: bash in composite actions runs with -eo pipefail by 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.

@derrickaw derrickaw added the ready-for-human Draft PR with all checks passing and all review comments resolved, ready for human review label Nov 25, 2026
@derrickaw

Copy link
Copy Markdown
Collaborator Author

Closing in favor of a path-scoped ignore in .github/zizmor.yml rather than maintaining a custom shell tokenizer in CI YAML.

@derrickaw derrickaw closed this Nov 26, 2026
@derrickaw
derrickaw deleted the codescan/gha-gradle-command-action-env branch November 26, 2026 00:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cleanup ready-for-human Draft PR with all checks passing and all review comments resolved, ready for human review size/m M: 50-249 lines changed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant