diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml index b0ddf4c..d707a23 100644 --- a/.github/workflows/maven.yml +++ b/.github/workflows/maven.yml @@ -9,11 +9,9 @@ on: pull_request: branches: ["master"] workflow_dispatch: +# Least privilege by default; jobs opt into more only where they need it. permissions: - contents: write - packages: write - id-token: write - security-events: write + contents: read jobs: ci-test: @@ -81,6 +79,10 @@ jobs: runs-on: ubuntu-latest needs: ci-test timeout-minutes: 20 + # Only this job touches GHCR (login + image push), so it is the only one granted packages:write. + permissions: + contents: read + packages: write # 🚨 only run if this workflow was triggered by a tag push (release) # workflow_dispatch reruns skip the build and re-converge the box against :latest. if: startsWith(github.ref, 'refs/tags/')