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

on:
push:
branches:
- '**'
pull_request:

permissions:
contents: read

jobs:
verify:
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Set up JDK 8
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: '8'
cache: maven
Comment on lines +17 to +25

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 | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "Unpinned action refs (should be empty):"
rg -nP '^\s*uses:\s*[^@\s]+@(?![0-9a-fA-F]{40}\b)' .github/workflows || true

echo
echo "Checkout steps for manual verification of persist-credentials:"
rg -nP '^\s*uses:\s*actions/checkout@' .github/workflows -A6 -B1 || true

Repository: UltiKits/UltiBackup

Length of output: 910


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "---- maven-ci.yml: checkout step ----"
awk 'NR>=1 && NR<=120 {print NR ":" $0}' .github/workflows/maven-ci.yml | sed -n '1,80p' >/tmp/maven_ci_head.txt
# print around checkout and with block
rg -n 'name: Checkout|uses: actions/checkout@|persist-credentials' .github/workflows/maven-ci.yml -n || true
echo
echo "---- maven-ci.yml: mvn invocations ----"
rg -n --fixed-string "mvn -B" .github/workflows/maven-ci.yml || true
echo
echo "---- maven-ci.yml: full steps (small file check) ----"
wc -l .github/workflows/maven-ci.yml
sed -n '1,220p' .github/workflows/maven-ci.yml

Repository: UltiKits/UltiBackup

Length of output: 1243


Pin GitHub Actions and harden checkout credentials (plus avoid duplicate Maven test runs)

  • .github/workflows/maven-ci.yml: actions/checkout@v4 and actions/setup-java@v4 are unpinned (use commit SHAs) and the checkout step is missing persist-credentials: false.
  • .github/workflows/maven-ci.yml: mvn -B test followed by mvn -B package will run tests twice (no -DskipTests/-Dmaven.test.skip is used); remove one step or skip tests for the package build.
  • .github/workflows/publish.yml: also contains unpinned actions/setup-java@v4 and actions/setup-node@v4.
🔒 Suggested hardening diff
       - name: Checkout
-        uses: actions/checkout@v4
+        uses: actions/checkout@<40-char-commit-sha>
+        with:
+          persist-credentials: false

       - name: Set up JDK 8
-        uses: actions/setup-java@v4
+        uses: actions/setup-java@<40-char-commit-sha>
🧰 Tools
🪛 zizmor (1.25.2)

[warning] 17-18: credential persistence through GitHub Actions artifacts (artipacked): does not set persist-credentials: false

(artipacked)


[error] 18-18: unpinned action reference (unpinned-uses): action is not pinned to a hash (required by blanket policy)

(unpinned-uses)


[error] 21-21: unpinned action reference (unpinned-uses): action is not pinned to a hash (required by blanket policy)

(unpinned-uses)

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/maven-ci.yml around lines 17 - 25, In
.github/workflows/maven-ci.yml pin the GitHub Actions used (replace
actions/checkout@v4 and actions/setup-java@v4 with specific commit SHAs) and add
persist-credentials: false to the Checkout step to harden credentials; also fix
the duplicate Maven test runs by either removing the mvn -B test step or adding
-DskipTests (or -Dmaven.test.skip) to the mvn -B package invocation so tests
aren’t executed twice; likewise pin actions/setup-java and actions/setup-node in
.github/workflows/publish.yml to specific commit SHAs.


- name: Run tests
run: mvn -B test

- name: Build package
run: mvn -B package
10 changes: 8 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -77,13 +77,19 @@
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<version>5.5.0</version>
<version>4.11.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-junit-jupiter</artifactId>
<version>5.5.0</version>
<version>4.11.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-inline</artifactId>
<version>4.11.0</version>
<scope>test</scope>
</dependency>
<dependency>
Expand Down
Loading