Repository navigation
Add read-only permissions and self-repo actions in java_tests.yml - #41626
Conversation
|
/gemini review |
There was a problem hiding this comment.
📋 Review Summary
This PR hardens .github/workflows/java_tests.yml by adding top-level permissions: contents: read and migrating local composite action references from workspace-relative (./.github/...) to GitHub's self-repository ($/.github/...) syntax. The changes are minimal, accurate, and resolve the targeted CodeQL and zizmor code scanning findings without affecting test execution.
🔍 General Feedback
contents: readis sufficient for all steps in bothjava_unit_testsandjava_wordcount_direct_runner(actions/checkout, environment setup, Gradle execution, andactions/upload-artifact).- All local composite action invocations in the workflow have been consistently updated to use the
$/self-repository prefix.
💡 Tip: Comment /gemini review on this pull request to trigger a new Gemini code review.
|
Assigning reviewers: R: @Amar3tto for label build. Note: If you would like to opt out of this review, comment Available commands:
The PR bot will only process comments in the main thread (not review comments). |
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:
CodeQL/zizmor) onmasterwithout altering intended public API or workflow semanticsIf 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 11 open Code Scanning findings (
CodeQLactions/missing-workflow-permissions,zizmor/excessive-permissions, andzizmor/self-repository— alerts#24,#26,#1565,#1567,#1930,#3130–#3132,#3134,#3135,#3158) in.github/workflows/java_tests.yml:permissions: contents: readso neitherjava_unit_testsnorjava_wordcount_direct_runnerinherits default repository write scopes (actions/upload-artifact@v7uses the Actions runtime token rather thanGITHUB_TOKEN).setup-environment-actionandgradle-command-self-hosted-action) from./.github/...to GitHub's$/...self-repository syntax.Verification
workflow_dispatchrun ofjava_tests.ymlon branchcodescan/gha-java-tests-permissions: https://github.com/apache/beam/actions/runs/45431447081 (successacross all 6 matrix jobs:Java Unit TestsandJava Wordcount Direct Runneronubuntu-24.04,macos-latest, andwindows-latest)./gradlew :beam-test-gha:preCommit,zizmor, andCodeQL