From 0431df92abbad020bdbede64dd89788489286fa9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20K=C3=BCffner?= <11882946+mkuf@users.noreply.github.com> Date: Mon, 23 Dec 2024 23:57:04 +0100 Subject: [PATCH] ci: add zizmor workflow (#183) * ci: add zizmor workflow w/ config * update workflows according to zizmor suggestions --- .../image-build-and-publish-push.yaml | 4 +++ .../image-build-and-publish-schedule.yaml | 2 ++ .github/workflows/image-build-review.yaml | 4 +++ .github/workflows/image-docs-publish.yaml | 4 +++ .github/workflows/pr-yamllint.yaml | 2 ++ .github/workflows/zizmor.yaml | 31 +++++++++++++++++++ zizmor.yml | 5 +++ 7 files changed, 52 insertions(+) create mode 100644 .github/workflows/zizmor.yaml create mode 100644 zizmor.yml diff --git a/.github/workflows/image-build-and-publish-push.yaml b/.github/workflows/image-build-and-publish-push.yaml index 43610a7..7e937ee 100644 --- a/.github/workflows/image-build-and-publish-push.yaml +++ b/.github/workflows/image-build-and-publish-push.yaml @@ -16,6 +16,8 @@ jobs: apps: ${{ steps.filter.outputs.changes }} steps: - uses: actions/checkout@v4 + with: + persist-credentials: false - uses: dorny/paths-filter@v3 id: filter with: @@ -39,6 +41,8 @@ jobs: steps: - name: "[prind] checkout" uses: actions/checkout@v4 + with: + persist-credentials: false - name: "[prind] set up build environment" uses: ./.github/actions/image-build-common - name: "[docker] login" diff --git a/.github/workflows/image-build-and-publish-schedule.yaml b/.github/workflows/image-build-and-publish-schedule.yaml index 574ad26..d5393ee 100644 --- a/.github/workflows/image-build-and-publish-schedule.yaml +++ b/.github/workflows/image-build-and-publish-schedule.yaml @@ -16,6 +16,8 @@ jobs: steps: - name: "[prind] checkout" uses: actions/checkout@v4 + with: + persist-credentials: false - name: "[prind] set up build environment" uses: ./.github/actions/image-build-common - name: "[docker] login" diff --git a/.github/workflows/image-build-review.yaml b/.github/workflows/image-build-review.yaml index 9b9112a..3e40e2c 100644 --- a/.github/workflows/image-build-review.yaml +++ b/.github/workflows/image-build-review.yaml @@ -16,6 +16,8 @@ jobs: apps: ${{ steps.filter.outputs.changes }} steps: - uses: actions/checkout@v4 + with: + persist-credentials: false - uses: dorny/paths-filter@v3 id: filter with: @@ -56,6 +58,8 @@ jobs: steps: - name: "[prind] checkout" uses: actions/checkout@v4 + with: + persist-credentials: false - name: "[prind] set up build environment" uses: ./.github/actions/image-build-common - name: "[prind] build" diff --git a/.github/workflows/image-docs-publish.yaml b/.github/workflows/image-docs-publish.yaml index 61d5f97..35efcef 100644 --- a/.github/workflows/image-docs-publish.yaml +++ b/.github/workflows/image-docs-publish.yaml @@ -17,6 +17,8 @@ jobs: apps: ${{ steps.filter.outputs.changes }} steps: - uses: actions/checkout@v4 + with: + persist-credentials: false - uses: dorny/paths-filter@v3 id: filter with: @@ -42,6 +44,8 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 + with: + persist-credentials: false - name: "Update Docker Hub Description" uses: peter-evans/dockerhub-description@v4 with: diff --git a/.github/workflows/pr-yamllint.yaml b/.github/workflows/pr-yamllint.yaml index d212cda..977bf2f 100644 --- a/.github/workflows/pr-yamllint.yaml +++ b/.github/workflows/pr-yamllint.yaml @@ -7,5 +7,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 + with: + persist-credentials: false - name: Run yamllint uses: reviewdog/action-yamllint@v1 diff --git a/.github/workflows/zizmor.yaml b/.github/workflows/zizmor.yaml new file mode 100644 index 0000000..da26efa --- /dev/null +++ b/.github/workflows/zizmor.yaml @@ -0,0 +1,31 @@ +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 + 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@v4 + - 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 diff --git a/zizmor.yml b/zizmor.yml new file mode 100644 index 0000000..7183857 --- /dev/null +++ b/zizmor.yml @@ -0,0 +1,5 @@ +rules: + template-injection: + ignore: + - image-build-and-publish-push.yaml:53:9 + - image-build-review.yaml:65:9