From d4a2b9f03891ee43ae62b0e7b916835e4bd9989c Mon Sep 17 00:00:00 2001 From: JoaoVitorPinheiro Date: Thu, 5 Nov 2026 09:12:00 -0400 Subject: [PATCH] ci: pin actions to SHAs and least-privilege token Pin every action to a commit SHA, default workflows to read-only contents, stop persisting checkout credentials, and add a Dependabot cooldown. --- .github/dependabot.yml | 8 ++++++++ .github/workflows/test-template.yml | 8 ++++++-- template/.github/dependabot.yml | 4 ++++ template/.github/workflows/ci.yml.jinja | 9 +++++++-- 4 files changed, 25 insertions(+), 4 deletions(-) create mode 100644 .github/dependabot.yml diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..9cbb9b7 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,8 @@ +version: 2 +updates: + - package-ecosystem: github-actions + directory: / + schedule: + interval: weekly + cooldown: + default-days: 7 diff --git a/.github/workflows/test-template.yml b/.github/workflows/test-template.yml index 737b1f9..fdfb39a 100644 --- a/.github/workflows/test-template.yml +++ b/.github/workflows/test-template.yml @@ -5,6 +5,9 @@ on: branches: [main] pull_request: +permissions: + contents: read + jobs: test: runs-on: ${{ matrix.os }} @@ -13,10 +16,11 @@ jobs: matrix: os: [ubuntu-latest, macos-latest, windows-latest] steps: - - uses: actions/checkout@v7 + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: + persist-credentials: false fetch-depth: 0 - - uses: astral-sh/setup-uv@v10.3.0 + - uses: astral-sh/setup-uv@1c37ad07a6a961277cf70c0d37d6f313000f5884 # v10.3.0 - name: Configure git identity for copier run: | git config --global user.name ci diff --git a/template/.github/dependabot.yml b/template/.github/dependabot.yml index db10189..8738fb5 100644 --- a/template/.github/dependabot.yml +++ b/template/.github/dependabot.yml @@ -4,6 +4,8 @@ updates: directory: / schedule: interval: weekly + cooldown: + default-days: 7 groups: dev-dependencies: dependency-type: development @@ -11,3 +13,5 @@ updates: directory: / schedule: interval: weekly + cooldown: + default-days: 7 diff --git a/template/.github/workflows/ci.yml.jinja b/template/.github/workflows/ci.yml.jinja index 73b5f22..e8dde52 100644 --- a/template/.github/workflows/ci.yml.jinja +++ b/template/.github/workflows/ci.yml.jinja @@ -5,6 +5,9 @@ on: branches: [main] pull_request: +permissions: + contents: read + concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true @@ -17,9 +20,11 @@ jobs: matrix: os: [ubuntu-latest, macos-latest, windows-latest] steps: - - uses: actions/checkout@v7 + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + persist-credentials: false - - uses: astral-sh/setup-uv@v10.3.0 + - uses: astral-sh/setup-uv@1c37ad07a6a961277cf70c0d37d6f313000f5884 # v10.3.0 with: enable-cache: true