Skip to content
Merged
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
19 changes: 19 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: Tests

on:
push:
branches: ["main", "master"]
pull_request:

jobs:
test:
runs-on: ubuntu-latest
Comment on lines +8 to +10
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Add an explicit permissions block to restrict GITHUB_TOKEN scope.

Without a permissions declaration, this workflow inherits the repository's default token permissions, which may be write-all depending on org/repo settings. A test-only workflow needs at most contents: read.

🔒 Proposed fix: add least-privilege permissions
 jobs:
   test:
+    permissions:
+      contents: read
     runs-on: ubuntu-latest
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
jobs:
test:
runs-on: ubuntu-latest
jobs:
test:
permissions:
contents: read
runs-on: ubuntu-latest
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/workflows/tests.yml around lines 8 - 10, The workflow currently
lacks an explicit permissions block so GITHUB_TOKEN may inherit overly broad
repo defaults; add a top-level permissions declaration in the workflow (outside
the jobs block) that restricts GITHUB_TOKEN to least privilege for the test job
(for example set permissions: contents: read) to ensure the "test" job only gets
read access to repository contents.

steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '17'
- name: Run tests (Maven)
run: |
if [ -f mvnw ]; then chmod +x mvnw && ./mvnw -B test; else mvn -B test; fi
Loading