Skip to content

Conversation

@strug
Copy link
Contributor

@strug strug commented Sep 3, 2025

No description provided.

@strug strug requested a review from a team as a code owner September 3, 2025 11:21
jobs:
build:
uses: valitydev/java-workflow/.github/workflows/maven-service-build.yml@v2
uses: valitydev/java-workflow/.github/workflows/maven-service-build.yml@v3

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 5 months ago

To fix the issue, explicitly set a permissions block at either the workflow or job level in .github/workflows/build.yml. Since the workflow only contains a single job, it makes sense to add the permissions block at the root level, so all jobs inherit it. The minimal starting point recommended by CodeQL is simply {} (no permissions), but you may want to set contents: read if, for example, your jobs need to check out code. Place the following block under the name: field and before the on: trigger:

permissions:
  contents: read

This lets the workflow access repository contents, which is usually required for build jobs. If you know that more or fewer permissions are needed, adjust accordingly. Only lines in .github/workflows/build.yml need to be changed.

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,4 +1,6 @@
 name: Maven Build Artifact
+permissions:
+  contents: read
 
 on:
   pull_request:
EOF
@@ -1,4 +1,6 @@
name: Maven Build Artifact
permissions:
contents: read

on:
pull_request:
Copilot is powered by AI and may make mistakes. Always verify output.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants