Skip to content

Pass inputs and outputs via env in setup-k8s-access - #41605

Open
derrickaw wants to merge 1 commit into
masterfrom
codescan/gha-setup-k8s-access-env
Open

derrickaw wants to merge 1 commit into
masterfrom
codescan/gha-setup-k8s-access-env

Conversation

@derrickaw

@derrickaw derrickaw commented Nov 24, 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-24 20:27 UTC): 8 PRs merged so far, with ~40 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 all 6 open zizmor/template-injection (High / error & Note, alerts #168–#173) findings in .github/actions/setup-k8s-access/action.yml:

  • Pass inputs.k8s_namespace, inputs.cluster_name, inputs.cluster_zone, inputs.remove_finalizer, and steps.replace_namespace.outputs.TEST_NAMESPACE via step-level env: variables instead of interpolating ${{ ... }} directly inside bash run: and with-post-step post: scripts.
  • Strip carriage returns/newlines with printf '%s' "${K8S_NAMESPACE}" | tr -d '\r\n' before writing TEST_NAMESPACE to $GITHUB_OUTPUT and quote all shell expansions.

Verification

  • Sample caller workflow (beam_PostCommit_Java_InfluxDbIO_IT.yml) on branch codescan/gha-setup-k8s-access-env: https://github.com/apache/beam/actions/runs/45298583844 (success across Set k8s access, Install InfluxDB, Run Java InfluxDbIO_IT, and Post Set k8s access namespace cleanup)
  • zizmor --config .github/zizmor.yml --persona=pedantic .github/actions/setup-k8s-access/action.yml (0 findings)
  • ./gradlew :beam-test-gha:preCommit and bash -n / sh -n across all run and post scripts

@derrickaw

Copy link
Copy Markdown
Collaborator Author

/gemini review

@github-actions github-actions Bot added the size/s S: 10-49 lines changed label Nov 24, 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 cleanly remediates the zizmor/template-injection findings in .github/actions/setup-k8s-access/action.yml by passing action inputs and step outputs through step-level env: blocks rather than interpolating ${{ ... }} expressions directly into shell scripts. Shell expansions are properly quoted and TEST_NAMESPACE is sanitized against newline characters before writing to $GITHUB_OUTPUT.

🔍 General Feedback

  • All step-level environment variables (including those used in the pytooling/actions/with-post-step post execution stage) are properly scoped and evaluated.
  • Quoting "${REMOVE_FINALIZER}" in kubectl patch aligns with all existing callers in the repository (which use the single-argument <type>/<name> format).

💡 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 24, 2026
@derrickaw derrickaw removed the ready-for-human Draft PR with all checks passing and all review comments resolved, ready for human review label Nov 25, 2026
@derrickaw
derrickaw marked this pull request as ready for review November 25, 2026 13:32
@github-actions

Copy link
Copy Markdown
Contributor

Assigning reviewers:

R: @chamikaramj added as fallback since no labels match configuration
Backup reviewer: tvalentyn (if the main reviewer is unresponsive, you can escalate to them by tagging their username)

Note: If you would like to opt out of this review, comment assign to next reviewer.

Available commands:

  • stop reviewer notifications - opt out of the automated review tooling
  • remind me after tests pass - tag the comment author after tests pass
  • waiting on author - shift the attention set back to the author (any comment or push by the author will return the attention set to the reviewers)

The PR bot will only process comments in the main thread (not review comments).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant