Update valitydev/java-workflow action to v4#39
Conversation
| jobs: | ||
| build: | ||
| uses: valitydev/java-workflow/.github/workflows/maven-service-build.yml@v3 | ||
| uses: valitydev/java-workflow/.github/workflows/maven-service-build.yml@v4 |
Check warning
Code scanning / CodeQL
Workflow does not contain permissions Medium
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix
AI about 1 month ago
In general terms, the fix is to explicitly define a permissions section for the workflow (globally) or for the build job so that the GITHUB_TOKEN is limited to the minimum necessary scopes, instead of inheriting potentially broad repository defaults. For a typical Maven build that only needs to fetch source and dependencies, contents: read is an appropriate minimal starting point.
The best targeted fix without changing existing functionality is to add a permissions block to the build job in .github/workflows/build.yml. Since this job simply calls a reusable workflow, and we have no evidence it requires write access, we will set contents: read at the job level. This ensures that, regardless of org/repo defaults, the token available to this job and passed to the reusable workflow remains read-only for repository contents. Concretely, in .github/workflows/build.yml, under jobs:, within the build: job and at the same indentation level as uses:, insert:
permissions:
contents: readNo additional methods, imports, or definitions are needed; this is purely a YAML configuration change inside the existing workflow file.
| @@ -7,4 +7,6 @@ | ||
|
|
||
| jobs: | ||
| build: | ||
| permissions: | ||
| contents: read | ||
| uses: valitydev/java-workflow/.github/workflows/maven-service-build.yml@v4 |
This PR contains the following updates:
v3→v4Release Notes
valitydev/java-workflow (valitydev/java-workflow)
v4Compare Source
Configuration
📅 Schedule: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).
🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.
♻ Rebasing: Whenever PR is behind base branch, or you tick the rebase/retry checkbox.
🔕 Ignore: Close this PR and you won't be reminded about this update again.
This PR was generated by Mend Renovate. View the repository job log.