Skip to content

Add read-only permissions in go_tests.yml - #41660

Draft
derrickaw wants to merge 1 commit into
masterfrom
codescan/gha-go-tests-permissions
Draft

derrickaw wants to merge 1 commit into
masterfrom
codescan/gha-go-tests-permissions

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 02:49 UTC): 11 PRs merged so far, with ~37 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 2 open Code Scanning findings (CodeQL actions/missing-workflow-permissions and zizmor/excessive-permissions — alerts #23, #1559) in .github/workflows/go_tests.yml:

  • Add explicit top-level permissions: contents: read so the build job does not inherit default repository write scopes (codecov/codecov-action@v7 authenticates via CODECOV_TOKEN).

Verification

  • Live Go tests workflow run on this PR branch: https://github.com/apache/beam/actions/runs/45533691711 (success across Go unit tests, coverage upload, go fmt, go vet, and staticcheck)
  • zizmor --config .github/zizmor.yml .github/workflows/go_tests.yml (0 findings), ./gradlew :beam-test-gha:preCommit, and CodeQL

@derrickaw

Copy link
Copy Markdown
Collaborator Author

/gemini review

@github-actions github-actions Bot added build size/xs XS: <10 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 adds explicit top-level permissions: contents: read to .github/workflows/go_tests.yml to enforce least-privilege GITHUB_TOKEN permissions and resolve CodeQL/zizmor alerts.

🔍 General Feedback

  • The workflow steps (actions/checkout, .github/actions/setup-environment-action, codecov/codecov-action with CODECOV_TOKEN, and local Go test/lint commands) only require read access to repository contents. The change is minimal, accurate, and safe to merge.

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

@codecov

codecov Bot commented Nov 25, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 58.73%. Comparing base (09c5004) to head (c1f1a6c).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files
@@             Coverage Diff              @@
##             master   #41660      +/-   ##
============================================
- Coverage     58.73%   58.73%   -0.01%     
  Complexity     2315     2315              
============================================
  Files          1135     1135              
  Lines        170485   170485              
  Branches       1499     1499              
============================================
- Hits         100139   100135       -4     
+ Misses        67804    67803       -1     
- Partials       2542     2547       +5     
Flag Coverage Δ
go 29.21% <ø> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

build cleanup ready-for-human Draft PR with all checks passing and all review comments resolved, ready for human review size/xs XS: <10 lines changed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant