diff --git a/.github/workflows/audit.yml b/.github/workflows/audit.yml index a8a904ac..b1654527 100644 --- a/.github/workflows/audit.yml +++ b/.github/workflows/audit.yml @@ -17,7 +17,11 @@ on: - cron: '20 6 * * 1' # weekly, Monday — catches newly-disclosed CVEs even with no code changes workflow_dispatch: -permissions: read-all +# Read the repository and nothing else. The SBOM and claims-guard jobs only +# check out code and upload a workflow artifact; the Scorecard job sets its +# own grants below. +permissions: + contents: read jobs: scorecard: diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4bff0bce..e8c79eba 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -9,6 +9,11 @@ on: branches: [main] pull_request: +# Read-only token. The job checks out the repository and fetches the base +# branch, and writes nothing back to GitHub. +permissions: + contents: read + concurrency: group: ci-${{ github.ref }} cancel-in-progress: true diff --git a/.github/workflows/cla.yml b/.github/workflows/cla.yml index 97d99466..7a076cbc 100644 --- a/.github/workflows/cla.yml +++ b/.github/workflows/cla.yml @@ -20,15 +20,26 @@ on: pull_request_target: types: [opened, closed, synchronize] +# Nothing at the top level beyond reading the repository. The grants the +# CLA job needs are on the job itself, below. permissions: - actions: write - contents: write - pull-requests: write - statuses: write + contents: read jobs: cla: runs-on: ubuntu-latest + # What contributor-assistant/github-action does with the workflow token: + # contents: write commits each new signature to + # signatures/version1/cla.json on main + # pull-requests: write posts and updates the CLA comment on the pull request + # actions: write re-runs the pull request's failed CLA run once + # everyone has signed + # It never calls the commit statuses API, so `statuses: write` is not + # granted; the CLA result is the job's own pass or fail. + permissions: + actions: write + contents: write + pull-requests: write steps: - name: CLA Assistant if: (github.event.comment.body == 'recheck' || github.event.comment.body == 'I have read the CLA Document and I hereby sign the CLA') || github.event_name == 'pull_request_target' diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml index 52beaf75..804c62b0 100644 --- a/.github/workflows/docker-publish.yml +++ b/.github/workflows/docker-publish.yml @@ -34,6 +34,12 @@ concurrency: group: docker-publish-${{ github.ref }} cancel-in-progress: true +# Read-only by default. Each job below asks for what it needs on top: build +# pushes to GHCR (packages: write), release creates the GitHub Release +# (contents: write). +permissions: + contents: read + env: REGISTRY: ghcr.io # Hardcoded lowercase — GHCR tags reject the repo's actual "Calnode/calnode" diff --git a/.github/workflows/ns8-module.yml b/.github/workflows/ns8-module.yml index 7879ae16..0f31b269 100644 --- a/.github/workflows/ns8-module.yml +++ b/.github/workflows/ns8-module.yml @@ -35,6 +35,11 @@ concurrency: group: ns8-module-publish cancel-in-progress: false +# Read-only by default. Only the build job writes, to push the module image +# to GHCR (packages: write), and it says so itself. +permissions: + contents: read + jobs: validate: runs-on: ubuntu-latest diff --git a/.github/workflows/test-module.yml b/.github/workflows/test-module.yml index a05cd5bf..5265d365 100644 --- a/.github/workflows/test-module.yml +++ b/.github/workflows/test-module.yml @@ -60,9 +60,16 @@ on: # types: [completed] # ...after setting the do_token secret. +# Read-only by default; the job below grants what the reusable workflow uses. +permissions: + contents: read + jobs: test: name: Run tests + # The called workflow checks out code (contents: read), sets a commit + # status for the run (statuses: write) and comments UI screenshots on the + # pull request (pull-requests: write). permissions: contents: read pull-requests: write