From a63e9f61e0e5674f640852d3ccbacde5fce4577a Mon Sep 17 00:00:00 2001 From: Ilyes512 Date: Mon, 9 Nov 2026 12:54:21 +0100 Subject: [PATCH 1/2] Harden lint.yml, notify-slack-tag.yml and dependabot - lint.yml: contents: read, persist-credentials: false, actions pinned by commit SHA, actionlint pinned to the Taskfile's 1.7.12 (by digest), timeouts on every job, a zizmor job, and a check that no workflow references this repository by tag: that is how 3.0.1 shipped without its fix, and bake.yml needs no such reference. - notify-slack-tag.yml: the channel input is gone (an incoming webhook always posts to its own channel), the payload is built with jq so a tag name can't break it, runs-on defaults to ubuntu-24.04, and the Slack action is pinned by commit SHA. - dependabot: weekly, with every github-actions update grouped into one pull request and a seven-day cooldown. - Taskfile: a zizmor task at the same version as lint.yml. --- .github/dependabot.yml | 7 ++- .github/workflows/lint.yml | 37 ++++++++++- .github/workflows/notify-slack-tag.yml | 86 ++++++++++---------------- .github/zizmor.yml | 4 ++ Taskfile.dist.yml | 10 +++ 5 files changed, 86 insertions(+), 58 deletions(-) create mode 100644 .github/zizmor.yml diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 55cad01..8d18abc 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -6,4 +6,9 @@ updates: - package-ecosystem: "github-actions" directory: "/" schedule: - interval: "daily" + interval: "weekly" + cooldown: + default-days: 7 + groups: + github-actions: + patterns: ["*"] diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 74588fc..8b2403c 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -6,6 +6,9 @@ on: tags: ['*'] pull_request: +permissions: + contents: read + concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true @@ -15,22 +18,50 @@ jobs: actionlint: name: Linting runs-on: ubuntu-24.04 + timeout-minutes: 10 steps: - name: Checkout - uses: actions/checkout@v7 + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + persist-credentials: false - name: Register actionlint problem matcher run: echo "::add-matcher::.github/actionlint-matcher.json" + # Keep the version in step with ACTIONLINT_TAG_VERSION in Taskfile.dist.yml. - name: Run actionlint - uses: docker://rhysd/actionlint:latest + uses: docker://rhysd/actionlint:1.7.12@sha256:b1934ee5f1c509618f2508e6eb47ee0d3520686341fec936f3b79331f9315667 with: args: -color + - name: No references to this repository by tag + run: | + if grep -rnE 'uses:[[:space:]]*specsnl/github-actions/' .github/workflows; then + echo "::error::A workflow references this repository by tag. Use a local path, or add a check that the tag matches the release." + exit 1 + fi + + zizmor: + name: zizmor + runs-on: ubuntu-24.04 + timeout-minutes: 10 + steps: + - name: Checkout + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + persist-credentials: false + # Keep the version in step with ZIZMOR_VERSION in Taskfile.dist.yml. + - name: Run zizmor + uses: zizmorcore/zizmor-action@45d7276c9ca790aabd705e31ca99c6185c3e76dd # v0.8.1 + with: + version: 1.32.0 + advanced-security: false + annotations: true bake-tests: name: Bake tests runs-on: ubuntu-26.04 + timeout-minutes: 10 steps: - name: Checkout - uses: actions/checkout@v7 + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: persist-credentials: false - name: Run the specs.hcl fixture tests diff --git a/.github/workflows/notify-slack-tag.yml b/.github/workflows/notify-slack-tag.yml index dc70deb..9d35659 100644 --- a/.github/workflows/notify-slack-tag.yml +++ b/.github/workflows/notify-slack-tag.yml @@ -1,73 +1,51 @@ -name: Notify Slack on Tag +name: Notify Slack on tag on: workflow_call: inputs: runs-on: - description: Runner name i.e. default runner "ubuntu-24.04" + description: Runner name. type: string - required: true - channel: - description: Slack channel to notify i.e. "#releases" - type: string - default: "#releases" + default: ubuntu-24.04 secrets: slack-webhook-url: - description: Slack Incoming Webhook URL + description: Slack incoming webhook URL. The webhook decides the channel. required: true +permissions: {} + jobs: notify: - name: Slack Notification + name: Slack notification runs-on: ${{ inputs.runs-on }} + timeout-minutes: 5 steps: + - name: Build the payload + env: + TAG: ${{ github.ref_name }} + REPOSITORY: ${{ github.repository }} + REPOSITORY_URL: ${{ github.server_url }}/${{ github.repository }} + ACTOR: ${{ github.actor }} + run: | + jq -n --arg tag "$TAG" --arg repository "$REPOSITORY" --arg url "$REPOSITORY_URL" --arg actor "$ACTOR" '{ + text: "Tag `\($tag)` created in \($repository)", + blocks: [ + {type: "section", text: {type: "mrkdwn", text: "*New tag created*"}}, + {type: "section", fields: [ + {type: "mrkdwn", text: "*Tag:*\n`\($tag)`"}, + {type: "mrkdwn", text: "*Repository:*\n<\($url)|\($repository)>"}, + {type: "mrkdwn", text: "*Created by:*\n\($actor)"} + ]}, + {type: "actions", elements: [ + {type: "button", text: {type: "plain_text", text: "View Tag"}, url: "\($url)/releases/tag/\($tag | @uri)"} + ]} + ] + }' > "$RUNNER_TEMP/slack-payload.json" + - name: Send Slack notification - uses: slackapi/slack-github-action@v4 + uses: slackapi/slack-github-action@dcb1066f776dd043e64d0e8ba94ca15cc7e1875d # v4.0.0 with: webhook: ${{ secrets.slack-webhook-url }} webhook-type: incoming-webhook - payload: | - { - "channel": "${{ inputs.channel }}", - "text": "Tag `${{ github.ref_name }}` created in ${{ github.repository }}", - "blocks": [ - { - "type": "section", - "text": { - "type": "mrkdwn", - "text": "*New tag created*" - } - }, - { - "type": "section", - "fields": [ - { - "type": "mrkdwn", - "text": "*Tag:*\n`${{ github.ref_name }}`" - }, - { - "type": "mrkdwn", - "text": "*Repository:*\n<${{ github.server_url }}/${{ github.repository }}|${{ github.repository }}>" - }, - { - "type": "mrkdwn", - "text": "*Created by:*\n${{ github.actor }}" - } - ] - }, - { - "type": "actions", - "elements": [ - { - "type": "button", - "text": { - "type": "plain_text", - "text": "View Tag" - }, - "url": "${{ github.server_url }}/${{ github.repository }}/releases/tag/${{ github.ref_name }}" - } - ] - } - ] - } + payload-file-path: ${{ runner.temp }}/slack-payload.json diff --git a/.github/zizmor.yml b/.github/zizmor.yml new file mode 100644 index 0000000..9dc2d66 --- /dev/null +++ b/.github/zizmor.yml @@ -0,0 +1,4 @@ +rules: + # The "$/..." syntax this asks for isn't accepted by actionlint yet. + self-repository: + disable: true diff --git a/Taskfile.dist.yml b/Taskfile.dist.yml index 752cc1b..5559828 100644 --- a/Taskfile.dist.yml +++ b/Taskfile.dist.yml @@ -3,8 +3,10 @@ version: "3" silent: true vars: + # Keep these in step with lint.yml. ACTIONLINT_TAG_VERSION: "1.7.12" SHELLCHECK_TAG_VERSION: "v0.11.0" + ZIZMOR_VERSION: "1.32.0" tasks: lint: @@ -20,6 +22,14 @@ tasks: koalaman/shellcheck:{{.SHELLCHECK_TAG_VERSION}} bake/*/*.sh bake/test/*.sh + zizmor: + desc: Audit the GitHub Actions workflows using zizmor (online audits need GH_TOKEN) + cmd: docker run --rm + --env GH_TOKEN + --volume "{{.ROOT_DIR}}:/workdir" + --workdir /workdir + ghcr.io/zizmorcore/zizmor:{{.ZIZMOR_VERSION}} --no-progress . + test: desc: Run the bake/specs.hcl fixture tests and the plan tests cmds: From ac9b0ed45dd21b89886c92e8f34127596151acf2 Mon Sep 17 00:00:00 2001 From: Ilyes512 Date: Mon, 9 Nov 2026 13:30:37 +0100 Subject: [PATCH 2/2] Run lint.yml and notify-slack-tag.yml on ubuntu-26.04, and drop the zizmor config bake.yml's test now calls it with the $/ self-repository syntax, so the self-repository audit no longer needs to be disabled. --- .github/workflows/lint.yml | 4 ++-- .github/workflows/notify-slack-tag.yml | 2 +- .github/zizmor.yml | 4 ---- 3 files changed, 3 insertions(+), 7 deletions(-) delete mode 100644 .github/zizmor.yml diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 8b2403c..462db80 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -17,7 +17,7 @@ jobs: actionlint: name: Linting - runs-on: ubuntu-24.04 + runs-on: ubuntu-26.04 timeout-minutes: 10 steps: - name: Checkout @@ -40,7 +40,7 @@ jobs: zizmor: name: zizmor - runs-on: ubuntu-24.04 + runs-on: ubuntu-26.04 timeout-minutes: 10 steps: - name: Checkout diff --git a/.github/workflows/notify-slack-tag.yml b/.github/workflows/notify-slack-tag.yml index 9d35659..5374955 100644 --- a/.github/workflows/notify-slack-tag.yml +++ b/.github/workflows/notify-slack-tag.yml @@ -6,7 +6,7 @@ on: runs-on: description: Runner name. type: string - default: ubuntu-24.04 + default: ubuntu-26.04 secrets: slack-webhook-url: description: Slack incoming webhook URL. The webhook decides the channel. diff --git a/.github/zizmor.yml b/.github/zizmor.yml deleted file mode 100644 index 9dc2d66..0000000 --- a/.github/zizmor.yml +++ /dev/null @@ -1,4 +0,0 @@ -rules: - # The "$/..." syntax this asks for isn't accepted by actionlint yet. - self-repository: - disable: true