diff --git a/.github/workflows/ci-actions.yaml b/.github/workflows/ci-actions.yaml new file mode 100644 index 0000000..e31de0f --- /dev/null +++ b/.github/workflows/ci-actions.yaml @@ -0,0 +1,35 @@ +name: GitHub Actions Security Analysis + +on: + push: + branches: ["main"] + pull_request: + branches: ["**"] + +jobs: + zizmor: + name: zizmor latest via PyPI + runs-on: ubuntu-latest + permissions: + security-events: write + 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@v4 + + - name: Run zizmor + run: uvx zizmor --pedantic --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/.github/workflows/ci-chart.yaml b/.github/workflows/ci-chart.yaml index c980f4e..ecee46f 100644 --- a/.github/workflows/ci-chart.yaml +++ b/.github/workflows/ci-chart.yaml @@ -13,22 +13,23 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v4 + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 with: fetch-depth: 0 + persist-credentials: false - name: Set up Helm - uses: azure/setup-helm@v4.2.0 + uses: azure/setup-helm@fe7b79cd5ee1e45176fcad797de68ecaf3ca4814 # v4.2.0 with: version: v3.14.4 - - uses: actions/setup-python@v5 + - uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5 with: python-version: '3.x' check-latest: true - name: Set up chart-testing - uses: helm/chart-testing-action@v2.6.1 + uses: helm/chart-testing-action@e6669bcd63d7cb57cb4380c33043eebe5d111992 # v2.6.1 - name: Run chart-testing (list-changed) id: list-changed @@ -59,7 +60,7 @@ jobs: - name: Create kind cluster if: steps.list-changed.outputs.changed == 'true' - uses: helm/kind-action@v1.10.0 + uses: helm/kind-action@0025e74a8c7512023d06dc019c617aa3cf561fde # v1.10.0 - name: Prepare cluster for tests if: steps.list-changed.outputs.changed == 'true' diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index d8b291f..325df2e 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -108,7 +108,7 @@ jobs: egress-policy: audit - name: Checkout - uses: actions/checkout@v4 + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 with: submodules: recursive persist-credentials: false @@ -120,6 +120,8 @@ jobs: echo "short_sha=$(git rev-parse --short ${GITHUB_REF})" >> $GITHUB_OUTPUT echo "INFO: Normalizing repository name (lowercase)" echo "repository_owner=$(echo ${GITHUB_REPOSITORY_OWNER} | tr '[:upper:]' '[:lower:]')" >> $GITHUB_OUTPUT + PROTECT_WEBHOOK_CHART_VERSION_TAG=$(cat charts/protect-webhook/Chart.yaml | grep version: | cut -d " " -f 2) + echo "protect_webhook_chart_version_tag=${PROTECT_WEBHOOK_CHART_VERSION_TAG}" >> $GITHUB_OUTPUT env: GITHUB_REF: '${{ github.ref }}' GITHUB_REPOSITORY_OWNER: '${{ github.repository_owner }}' @@ -130,19 +132,22 @@ jobs: - name: Publish new helm chart for protect-webhook run: | echo ${{ secrets.GITHUB_TOKEN }} | helm registry login ghcr.io --username ${GITHUB_ACTOR} --password-stdin - PROTECT_WEBHOOK_CHART_VERSION_TAG=$(cat charts/protect-webhook/Chart.yaml | grep version: | cut -d " " -f 2) - echo "PROTECT_WEBHOOK_CHART_VERSION_TAG=${PROTECT_WEBHOOK_CHART_VERSION_TAG}" >> $GITHUB_ENV helm package charts/protect-webhook/ --version="${PROTECT_WEBHOOK_CHART_VERSION_TAG}" - helm push protect-webhook-"${PROTECT_WEBHOOK_CHART_VERSION_TAG}".tgz oci://ghcr.io/${{ steps.resolve_parameters.outputs.repository_owner }}/charts + helm push protect-webhook-"${PROTECT_WEBHOOK_CHART_VERSION_TAG}".tgz oci://ghcr.io/${GITHUB_REPOSITORY_OWNER}/charts env: GITHUB_ACTOR: '${{ github.actor }}' - GITHUB_REPOSITORY_OWNER: '${{ github.repository_owner }}' + GITHUB_REPOSITORY_OWNER: '${{ steps.resolve_parameters.outputs.repository_owner }}' + PROTECT_WEBHOOK_CHART_VERSION_TAG: '${{ steps.resolve_parameters.outputs.protect_webhook_chart_version_tag }}' - name: Job summary run: | echo "New helm chart for protect-webhook published successfully!" >> $GITHUB_STEP_SUMMARY echo "" >> $GITHUB_STEP_SUMMARY echo "**Parameters:**" >> $GITHUB_STEP_SUMMARY - echo "- Ref: ${{ steps.resolve_parameters.outputs.resolved_ref }}" >> $GITHUB_STEP_SUMMARY - echo "- Short SHA: ${{ steps.resolve_parameters.outputs.short_sha }}" >> $GITHUB_STEP_SUMMARY - echo "- protect-webhook Chart version: ${{ env.PROTECT_WEBHOOK_CHART_VERSION_TAG }}" >> $GITHUB_STEP_SUMMARY + echo "- Ref: ${RESOLVED_REF}" >> $GITHUB_STEP_SUMMARY + echo "- Short SHA: ${SHORT_SHA}" >> $GITHUB_STEP_SUMMARY + echo "- protect-webhook Chart version: ${PROTECT_WEBHOOK_CHART_VERSION_TAG}" >> $GITHUB_STEP_SUMMARY + env: + RESOLVED_REF: '${{ steps.resolve_parameters.outputs.resolved_ref }}' + SHORT_SHA: '${{ steps.resolve_parameters.outputs.short_sha }}' + PROTECT_WEBHOOK_CHART_VERSION_TAG: '${{ steps.resolve_parameters.outputs.protect_webhook_chart_version_tag }}'