Skip to content

Add read-only permissions and self-repo actions in local_env_tests.yml - #41631

Merged
derrickaw merged 1 commit into
masterfrom
codescan/gha-local-env-tests-permissions
Nov 24, 2026
Merged

derrickaw merged 1 commit into
masterfrom
codescan/gha-local-env-tests-permissions

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 suppressing alerts or masking underlying defects
  • Relevant unit tests, linters, and CI checks have been verified

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 7 open Code Scanning findings (CodeQL actions/missing-workflow-permissions, zizmor/excessive-permissions, and zizmor/self-repository — alerts #25, #28, #1577–#1579, #3136, #3511) in .github/workflows/local_env_tests.yml:

  • Add explicit top-level permissions: contents: read so neither run_local_env_install_ubuntu nor run_local_env_install_mac inherits default repository write scopes.
  • Switch both setup-environment-action references from ./.github/... to GitHub's $/... self-repository syntax.

Verification

  • Sample workflow_dispatch run of local_env_tests.yml on branch codescan/gha-local-env-tests-permissions: https://github.com/apache/beam/actions/runs/45438816723 (success across both Ubuntu run local environment shell script and Mac run local environment shell script)
  • ./gradlew :beam-test-gha:preCommit, zizmor, and CodeQL

@derrickaw

Copy link
Copy Markdown
Collaborator Author

/gemini review

@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 hardens .github/workflows/local_env_tests.yml by adding top-level permissions: contents: read and updating local composite action references to use the $/... self-repository syntax. The changes are minimal, consistent with other workflow hardening updates in the repository, and do not impact workflow functionality.

🔍 General Feedback

  • Both run_local_env_install_ubuntu and run_local_env_install_mac only check out the repository, set up toolchains/caches, and run local setup verification scripts, so contents: read is sufficient under the principle of least privilege.

💡 Tip: Comment /gemini review on this pull request to trigger a new Gemini code review.

@github-actions github-actions Bot added build size/xs XS: <10 lines changed labels Nov 24, 2026
@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 24, 2026
@derrickaw
derrickaw marked this pull request as ready for review November 24, 2026 19:16
@github-actions

Copy link
Copy Markdown
Contributor

Assigning reviewers:

R: @damccorm for label build.
Backup reviewer: Amar3tto (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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants