Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@

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

Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {}

Copilot Autofix

AI 25 days ago

In general, the fix is to add an explicit permissions block that limits the GITHUB_TOKEN to the minimal access required. For simple build workflows that only need to read code and (optionally) read packages, a common baseline is contents: read and possibly packages: read. Since we cannot see any other actions in this job (it only reuses a Maven build workflow), and to avoid accidentally breaking behavior that might rely on write permissions (for example, if the reusable workflow publishes build summaries, comments on PRs, or uploads artifacts needing specific scopes), the safest minimal change is to add a root‑level permissions block with read‑only repo contents. This documents the intended restriction and prevents inheriting unnecessarily broad defaults.

Concretely, in .github/workflows/build.yml, add a permissions section at the top level, between name: and on: (or directly under name:) to apply to all jobs in this workflow. The block should be:

permissions:
  contents: read

This sets the default GITHUB_TOKEN permissions for all jobs (including the reusable build job) to read‑only access to repository contents, which is usually sufficient for a Maven build. No imports or additional definitions are needed, as this is pure YAML configuration for GitHub Actions.

Suggested changeset 1
.github/workflows/build.yml

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -1,5 +1,8 @@
 name: Maven Build Artifact
 
+permissions:
+  contents: read
+
 on:
   pull_request:
     branches:
EOF
@@ -1,5 +1,8 @@
name: Maven Build Artifact

permissions:
contents: read

on:
pull_request:
branches:
Copilot is powered by AI and may make mistakes. Always verify output.
2 changes: 1 addition & 1 deletion .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@

jobs:
build-and-deploy:
uses: valitydev/java-workflow/.github/workflows/maven-service-deploy.yml@v3
uses: valitydev/java-workflow/.github/workflows/maven-service-deploy.yml@v4
with:
ignore-coverage: true
secrets:
github-token: ${{ secrets.GITHUB_TOKEN }}
mm-webhook-url: ${{ secrets.MATTERMOST_WEBHOOK_URL }}

Check warning

Code scanning / CodeQL

Workflow does not contain permissions Medium

Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {}
Loading