Skip to content

Add Zizmor security workflow to enhance project security posture #199

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
Mar 15, 2025
2 changes: 2 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ jobs:
TEST_DJANGO_VERSION: ${{ matrix.django-version }}
steps:
- uses: actions/checkout@v4
with:
persist-credentials: false
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
id: sp
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ jobs:
RELEASE_VERSION: ${{ steps.set-package.outputs.release_version }}
steps:
- uses: actions/checkout@v4
with:
persist-credentials: false
- name: Set up Python
uses: actions/setup-python@v5
with:
Expand Down
24 changes: 24 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ jobs:
TEST_DJANGO_VERSION: ${{ matrix.django-version }}
steps:
- uses: actions/checkout@v4
with:
persist-credentials: false
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
id: sp
Expand Down Expand Up @@ -123,6 +125,8 @@ jobs:
TEST_DJANGO_VERSION: ${{ matrix.django-version }}
steps:
- uses: actions/checkout@v4
with:
persist-credentials: false
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
id: sp
Expand Down Expand Up @@ -180,6 +184,8 @@ jobs:

steps:
- uses: actions/checkout@v4
with:
persist-credentials: false
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
id: sp
Expand Down Expand Up @@ -257,6 +263,8 @@ jobs:

steps:
- uses: actions/checkout@v4
with:
persist-credentials: false
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
id: sp
Expand Down Expand Up @@ -314,6 +322,8 @@ jobs:

steps:
- uses: actions/checkout@v4
with:
persist-credentials: false
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
id: sp
Expand Down Expand Up @@ -374,6 +384,8 @@ jobs:

steps:
- uses: actions/checkout@v4
with:
persist-credentials: false
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
id: sp
Expand Down Expand Up @@ -437,6 +449,8 @@ jobs:

steps:
- uses: actions/checkout@v4
with:
persist-credentials: false
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
id: sp
Expand Down Expand Up @@ -506,6 +520,8 @@ jobs:

steps:
- uses: actions/checkout@v4
with:
persist-credentials: false
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
id: sp
Expand Down Expand Up @@ -565,6 +581,8 @@ jobs:

steps:
- uses: actions/checkout@v4
with:
persist-credentials: false
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
id: sp
Expand Down Expand Up @@ -632,6 +650,8 @@ jobs:

steps:
- uses: actions/checkout@v4
with:
persist-credentials: false
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
id: sp
Expand Down Expand Up @@ -700,6 +720,8 @@ jobs:

steps:
- uses: actions/checkout@v4
with:
persist-credentials: false
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
id: sp
Expand Down Expand Up @@ -771,6 +793,8 @@ jobs:
with:
detached: true
- uses: actions/checkout@v4
with:
persist-credentials: false
- uses: actions/setup-python@v5
id: sp
- name: Install uv
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/update_coc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ jobs:
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
persist-credentials: false

- name: Fetch CODE_OF_CONDUCT.md from django-commons
run: |
Expand Down
51 changes: 51 additions & 0 deletions .github/workflows/zizmor.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: Zizmor

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
schedule:
# Run weekly
- cron: '0 0 * * 0'
workflow_dispatch:

permissions:
contents: read

jobs:
zizmor-analysis:
name: Run Zizmor
runs-on: ubuntu-latest
permissions:
contents: read
security-events: write

steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
persist-credentials: false

- name: Set up Rust
uses: actions-rust-lang/setup-rust-toolchain@v1

- name: Install Zizmor
run: |
cargo install zizmor

- name: Run Zizmor analysis
run: |
zizmor --format sarif .github/workflows/ > results.sarif

- name: Upload analysis results
uses: actions/upload-artifact@v4
with:
name: zizmor-results
path: results.sarif
retention-days: 7

- name: Upload to code-scanning
uses: github/codeql-action/upload-sarif@v3
with:
sarif_file: results.sarif
1 change: 1 addition & 0 deletions SECURITY.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Security Policy

[![CodeQL](https://github.com/django-commons/django-typer/actions/workflows/github-code-scanning/codeql/badge.svg?branch=main)](https://github.com/django-commons/django-typer/actions/workflows/github-code-scanning/codeql?query=branch:main)
[![Zizmor](https://github.com/django-commons/django-typer/actions/workflows/zizmor.yml/badge.svg?branch=main)](https://woodruffw.github.io/zizmor)
[![OpenSSF Scorecard](https://api.securityscorecards.dev/projects/github.com/django-commons/django-typer/badge)](https://securityscorecards.dev/viewer/?uri=github.com/django-commons/django-typer)

## Supported Versions
Expand Down
Loading