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 about 1 month ago

To fix the issue, explicitly declare a permissions block that limits the GITHUB_TOKEN to the least privileges needed for this workflow. Since the provided snippet only shows a build job that calls a reusable Maven build workflow and does not indicate any need for write access (no releases, tagging, issue updates, etc.), a safe default is read‑only access to repository contents. This aligns with GitHub’s recommended minimal starting point.

The best targeted fix is to add a permissions block at the job level under build: so that it applies specifically to this job. Concretely, in .github/workflows/build.yml, under jobs:, within the build: job (before the uses: line), add:

permissions:
  contents: read

This change preserves existing behavior for the job while ensuring the GITHUB_TOKEN cannot perform write operations on the repository contents from this workflow, unless the called reusable workflow further constrains it. No imports, methods, or additional definitions are required, as this is purely a YAML configuration change.

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
@@ -7,4 +7,6 @@
 
 jobs:
   build:
+    permissions:
+      contents: read
     uses: valitydev/java-workflow/.github/workflows/maven-service-build.yml@v4
EOF
@@ -7,4 +7,6 @@

jobs:
build:
permissions:
contents: read
uses: valitydev/java-workflow/.github/workflows/maven-service-build.yml@v4
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 @@ -12,7 +12,7 @@

jobs:
deploy:
uses: valitydev/java-workflow/.github/workflows/maven-service-deploy.yml@v3
uses: valitydev/java-workflow/.github/workflows/maven-service-deploy.yml@v4
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