From c7d86a8f8591c5baa177e9f27fda0a19edf672d4 Mon Sep 17 00:00:00 2001 From: Claudio Pilotti Date: Wed, 29 Jul 2026 17:34:39 +0200 Subject: [PATCH] Check GitHub actions with zizmor (SEA-2065) --- .github/workflows/python-pr.yaml | 15 ++++++++---- .github/workflows/python-publish.yaml | 8 ++++--- .github/workflows/python-tox.yaml | 13 ++++++++--- .github/workflows/zizmor.yml | 33 +++++++++++++++++++++++++++ .pre-commit-config.yaml | 6 ++++- 5 files changed, 64 insertions(+), 11 deletions(-) create mode 100644 .github/workflows/zizmor.yml diff --git a/.github/workflows/python-pr.yaml b/.github/workflows/python-pr.yaml index 012be67..b9ed530 100644 --- a/.github/workflows/python-pr.yaml +++ b/.github/workflows/python-pr.yaml @@ -3,26 +3,33 @@ name: tests (pull_request) on: pull_request: +permissions: {} + jobs: build: runs-on: ubuntu-latest + permissions: + contents: read + strategy: matrix: python-version: ['3.10', '3.11', '3.12', '3.13', '3.14'] steps: - - uses: actions/checkout@v6 + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + persist-credentials: false - name: Install uv - uses: astral-sh/setup-uv@v7 + uses: astral-sh/setup-uv@c771a70e6277c0a99b617c7a806ffedaca235ff9 # v9.0.0 - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v6 + uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0 with: python-version: ${{ matrix.python-version }} - name: Install dependencies - run: uv pip install tox tox-gh tox-uv + run: uv pip install tox tox-gh tox-uv --system - name: Test with tox without uploading coverage run: tox diff --git a/.github/workflows/python-publish.yaml b/.github/workflows/python-publish.yaml index a0a3df5..894f540 100644 --- a/.github/workflows/python-publish.yaml +++ b/.github/workflows/python-publish.yaml @@ -16,10 +16,12 @@ jobs: id-token: write steps: - - uses: actions/checkout@v6 + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + persist-credentials: false - name: Set up Python - uses: actions/setup-python@v6 + uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0 with: python-version: "3.x" @@ -32,4 +34,4 @@ jobs: run: python -m build -s -w - name: Publish package distributions to PyPI - uses: pypa/gh-action-pypi-publish@release/v1 + uses: pypa/gh-action-pypi-publish@ba38be9e461d3875417946c167d0b5f3d385a247 # v1.14.1 diff --git a/.github/workflows/python-tox.yaml b/.github/workflows/python-tox.yaml index 8a5ffed..c15f609 100644 --- a/.github/workflows/python-tox.yaml +++ b/.github/workflows/python-tox.yaml @@ -3,15 +3,22 @@ name: tests on: push: +permissions: {} + jobs: build: runs-on: ubuntu-latest + permissions: + contents: read + strategy: matrix: python-version: ['3.10', '3.11', '3.12', '3.13', '3.14'] steps: - - uses: actions/checkout@v6 + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + persist-credentials: false - name: Get branch name (merge) if: github.event_name != 'pull_request' @@ -28,10 +35,10 @@ jobs: >> $GITHUB_ENV - name: Install uv - uses: astral-sh/setup-uv@v7 + uses: astral-sh/setup-uv@c771a70e6277c0a99b617c7a806ffedaca235ff9 # v9.0.0 - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v6 + uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0 with: python-version: ${{ matrix.python-version }} diff --git a/.github/workflows/zizmor.yml b/.github/workflows/zizmor.yml new file mode 100644 index 0000000..6d0b1ea --- /dev/null +++ b/.github/workflows/zizmor.yml @@ -0,0 +1,33 @@ +# https://docs.zizmor.sh/integrations/#github-actions +name: Zizmor (GitHub Actions Security) + +on: + push: + paths: + - '.github/workflows/**' + pull_request: + paths: + - '.github/workflows/**' + +permissions: {} + +concurrency: + group: zizmor-${{ github.ref }} + cancel-in-progress: true + +jobs: + zizmor: + runs-on: ubuntu-latest + permissions: + contents: read # Required for private repos + actions: read # Required for private repos + steps: + - name: Checkout repository + uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 + with: + persist-credentials: false + + - name: Run zizmor + uses: zizmorcore/zizmor-action@6599ee8b7a49aef6a770f63d261d214911a7ce02 # v0.6.0 + with: + advanced-security: false diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 1bb731b..f45c00a 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -39,4 +39,8 @@ repos: files: '^(src|tests)/.*\.py$' additional_dependencies: - pytest - - types-pytz \ No newline at end of file + - types-pytz + - repo: https://github.com/zizmorcore/zizmor-pre-commit + rev: v1.28.0 + hooks: + - id: zizmor