Skip to content

Scope GITHUB_TOKEN permissions across remaining workflows - #41671

Merged
derrickaw merged 1 commit into
masterfrom
codescan/gha-workflow-permissions-batch
Nov 25, 2026
Merged

derrickaw merged 1 commit into
masterfrom
codescan/gha-workflow-permissions-batch

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 15:26 UTC): 16 PRs merged so far, with ~21 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 51 remaining permission-only GitHub Code Scanning alerts (actions/missing-workflow-permissions (CodeQL) and zizmor/excessive-permissions) across 12 workflow files in .github/workflows/:

  • Read-only CI, Docker & metrics workflows (permissions: contents: read at workflow level):
    • .github/workflows/build_runner_image.yml (2 alerts: #3, #1460)
    • .github/workflows/build_wheels.yml (15 alerts: #5, #10, #12, #14, #16, #20, #22, #1464–#1467, #1469, #1471, #1900, #1901; branch_repo_nightly already declares job-level contents: write)
    • .github/workflows/playground_frontend_test.yml (2 alerts: #27, #1583)
    • .github/workflows/refresh_looker_metrics.yml (2 alerts: #97, #1799)
    • .github/workflows/reportGenerator.yml (2 alerts: #96, #1800)
    • .github/workflows/republish_released_docker_containers.yml (5 alerts: #3531–#3533, #3535, #3536)
    • .github/workflows/tour_of_beam_backend.yml (2 alerts: #36, #1739)
    • .github/workflows/tour_of_beam_backend_integration.yml (2 alerts: #39, #1745)
    • .github/workflows/tour_of_beam_frontend_test.yml (2 alerts: #37, #1748)
  • Release workflows with job-scoped elevated permissions:
    • .github/workflows/build_release_candidate.yml (15 alerts: #4, #6, #8, #9, #11, #18, #21, #1387, #1394, #1788–#1792, #3514): sets top-level permissions: contents: read and grants actions: read specifically to stage_python_artifacts (required by download_github_actions_artifacts.py to download wheel/sdist workflow artifacts via the GitHub Actions REST API; PR/release-upload jobs use inputs.REPO_TOKEN).
    • .github/workflows/git_tag_released_version.yml (1 alert: #1550): sets top-level permissions: {} and scopes contents: write to generate_tags.
    • .github/workflows/publish_github_release_notes.yml (1 alert: #1600): replaces permissions: read-all with top-level permissions: contents: read and scopes contents: write to publish_github_release_notes (which calls POST /repos/apache/beam/releases with GITHUB_TOKEN).

Verification

@derrickaw

Copy link
Copy Markdown
Collaborator Author

/gemini review

@github-actions github-actions Bot added build size/s S: 10-49 lines changed labels 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 properly scopes GITHUB_TOKEN permissions across 12 GitHub Actions workflows following the principle of least privilege. Read-only workflows are restricted to contents: read at the workflow level, and elevated permissions (actions: read for artifact downloads in build_release_candidate.yml and contents: write for tag/release creation in git_tag_released_version.yml and publish_github_release_notes.yml) are accurately scoped to the specific jobs that require them.

🔍 General Feedback

  • All workflow and job-level permission declarations match the actual token usage across steps, composite actions, and helper scripts.
  • No functional issues or regressions identified.

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

@derrickaw derrickaw added ready-for-human Draft PR with all checks passing and all review comments resolved, ready for human review and removed ready-for-human Draft PR with all checks passing and all review comments resolved, ready for human review labels Nov 25, 2026
@derrickaw
derrickaw marked this pull request as ready for review November 25, 2026 19:18
@github-actions

Copy link
Copy Markdown
Contributor

Assigning reviewers:

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

@derrickaw
derrickaw merged commit 36ff901 into master Nov 25, 2026
13 checks passed
@derrickaw
derrickaw deleted the codescan/gha-workflow-permissions-batch branch November 25, 2026 19:52
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