From 2be9245c311777fa07bc08b3e6a282b8f7777867 Mon Sep 17 00:00:00 2001 From: Naji Obeid Date: Fri, 3 Jan 2025 16:46:24 +0000 Subject: [PATCH 1/2] integrate zizmor in github actions --- .github/workflows/address-sanitizer.yml | 1 + .github/workflows/clang-analyzer.yml | 1 + .github/workflows/codeql-analysis.yml | 3 ++- .github/workflows/release.yml | 2 ++ .github/workflows/test-libmaxminddb.yml | 1 + .github/workflows/test.yml | 1 + .github/workflows/zizmor.yml | 36 +++++++++++++++++++++++++ 7 files changed, 44 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/zizmor.yml diff --git a/.github/workflows/address-sanitizer.yml b/.github/workflows/address-sanitizer.yml index f2db862..dde5bcc 100644 --- a/.github/workflows/address-sanitizer.yml +++ b/.github/workflows/address-sanitizer.yml @@ -18,6 +18,7 @@ jobs: uses: actions/checkout@v4 with: submodules: true + persist-credentials: false - name: Set up Python uses: actions/setup-python@v5 diff --git a/.github/workflows/clang-analyzer.yml b/.github/workflows/clang-analyzer.yml index 56cd6a5..1c5460f 100644 --- a/.github/workflows/clang-analyzer.yml +++ b/.github/workflows/clang-analyzer.yml @@ -15,6 +15,7 @@ jobs: uses: actions/checkout@v4 with: submodules: true + persist-credentials: false - name: Install clang-tools run: sudo apt install clang-tools diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 99436a1..e9969c7 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -24,12 +24,13 @@ jobs: # a pull request then we can checkout the head. fetch-depth: 2 submodules: true + persist-credentials: false # If this run was triggered by a pull request event, then checkout # the head of the pull request instead of the merge commit. - run: git checkout HEAD^2 if: ${{ github.event_name == 'pull_request' }} - + # Initializes the CodeQL tools for scanning. - name: Initialize CodeQL uses: github/codeql-action/init@v3 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 2c6c339..5f13aac 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -22,6 +22,7 @@ jobs: - uses: actions/checkout@v4 with: submodules: true + persist-credentials: false - name: Set up QEMU if: runner.os == 'Linux' @@ -50,6 +51,7 @@ jobs: - uses: actions/checkout@v4 with: submodules: true + persist-credentials: false - name: Build sdist run: pipx run build --sdist diff --git a/.github/workflows/test-libmaxminddb.yml b/.github/workflows/test-libmaxminddb.yml index 4eb8063..73c78b2 100644 --- a/.github/workflows/test-libmaxminddb.yml +++ b/.github/workflows/test-libmaxminddb.yml @@ -28,6 +28,7 @@ jobs: uses: actions/checkout@v4 with: submodules: true + persist-credentials: false - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v5 diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 78badd5..c1f91ac 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -22,6 +22,7 @@ jobs: uses: actions/checkout@v4 with: submodules: true + persist-credentials: false - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v5 diff --git a/.github/workflows/zizmor.yml b/.github/workflows/zizmor.yml new file mode 100644 index 0000000..d915605 --- /dev/null +++ b/.github/workflows/zizmor.yml @@ -0,0 +1,36 @@ +name: GitHub Actions Security Analysis with zizmor + +on: + push: + branches: ["main"] + pull_request: + branches: ["**"] + +jobs: + zizmor: + name: zizmor latest via PyPI + runs-on: ubuntu-latest + permissions: + security-events: write + # required for workflows in private repositories + contents: read + actions: read + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + persist-credentials: false + + - name: Install the latest version of uv + uses: astral-sh/setup-uv@v5 + + - name: Run zizmor + run: uvx zizmor --format sarif . > results.sarif + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Upload SARIF file + uses: github/codeql-action/upload-sarif@v3 + with: + sarif_file: results.sarif + category: zizmor From 725c59cae955102a966829c02c0dd2364574eace Mon Sep 17 00:00:00 2001 From: Naji Obeid Date: Wed, 8 Jan 2025 15:22:34 +0000 Subject: [PATCH 2/2] change zizmor output format to report warnings --- .github/workflows/zizmor.yml | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/.github/workflows/zizmor.yml b/.github/workflows/zizmor.yml index d915605..c09cf12 100644 --- a/.github/workflows/zizmor.yml +++ b/.github/workflows/zizmor.yml @@ -23,14 +23,10 @@ jobs: - name: Install the latest version of uv uses: astral-sh/setup-uv@v5 + with: + enable-cache: false - name: Run zizmor - run: uvx zizmor --format sarif . > results.sarif + run: uvx zizmor --format plain . env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - - name: Upload SARIF file - uses: github/codeql-action/upload-sarif@v3 - with: - sarif_file: results.sarif - category: zizmor