From 8f92d5626348074e352d695d8b2bfe8a468ad99a Mon Sep 17 00:00:00 2001 From: Matt Robenolt Date: Tue, 12 May 2026 12:29:33 -0700 Subject: [PATCH] security: harden GitHub Actions workflows --- .github/workflows/ci.yml | 8 ++++++++ .github/workflows/codeql.yml | 2 ++ .github/workflows/licensing.yml | 3 +++ .github/workflows/publish.yml | 12 ++++++++---- 4 files changed, 21 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 725680e..b87179d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -9,8 +9,12 @@ on: jobs: lint: runs-on: ubuntu-latest + permissions: + contents: write steps: - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + with: + persist-credentials: false - uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0 - uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5 with: @@ -28,8 +32,12 @@ jobs: branch: ${{ github.head_ref }} test: runs-on: ubuntu-latest + permissions: + contents: read steps: - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + with: + persist-credentials: false - uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0 - uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5 with: diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index 24c450e..9278c25 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -23,6 +23,8 @@ jobs: steps: - name: Checkout repository uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + with: + persist-credentials: false - name: Initialize CodeQL uses: github/codeql-action/init@68bde559dea0fdcac2102bfdf6230c5f70eb485e # v4.35.4 diff --git a/.github/workflows/licensing.yml b/.github/workflows/licensing.yml index 5eb2056..60fd4c3 100644 --- a/.github/workflows/licensing.yml +++ b/.github/workflows/licensing.yml @@ -13,10 +13,13 @@ on: jobs: licensing: runs-on: ubuntu-latest + permissions: + contents: read steps: - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 with: fetch-depth: 0 + persist-credentials: false - run: sudo gem install license_finder -v 7.1 - run: npm install - run: license_finder diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index acf99de..4b7ac2d 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -14,14 +14,18 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 - - uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0 + with: + persist-credentials: false + - uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0 # zizmor: ignore[cache-poisoning] with: node-version: '24' registry-url: 'https://registry.npmjs.org' + cache: '' - run: npm ci - run: npm run build - run: npm test - run: npm publish --provenance --access public - - uses: softprops/action-gh-release@b4309332981a82ec1c5618f44dd2e27cc8bfbfda # v3.0.0 - with: - generate_release_notes: true + - run: gh release create "$TAG" --generate-notes + env: + GH_TOKEN: ${{ github.token }} + TAG: ${{ github.ref_name }}