mirror of
https://github.com/cozystack/cozystack.git
synced 2026-12-02 13:18:38 +09:00
A private copy of the repository, used to verify an embargoed security fix because GitHub runs no CI in an advisory's temporary fork, receives every workflow file with each sync. Without a repository guard, each sync and each cron tick there would build, publish, prune and cut releases with that copy's credentials. Pull request events stay allowed in the workflows that also check pull requests, since checking the fix is what the copy is for. Every job carries the guard rather than only the root jobs, because a job whose condition calls a status function runs even when the job it needs was skipped. A contract test holds new push and schedule workflows to the same rule. It reads 'on' in every form GitHub accepts, requires whatever follows the guard to be one parenthesized group, because && binds tighter than || and a trailing '|| (...)' would reopen the job, and fails on a workflow it cannot parse instead of leaving that workflow unchecked. Signed-off-by: Alexey Artamonov <aleksei.artamonov@aenix.io> Assisted-by: LLM
51 lines
1.5 KiB
YAML
51 lines
1.5 KiB
YAML
name: zizmor
|
|
|
|
# Tree-wide GitHub Actions security gate. Fails the PR when a workflow
|
|
# reintroduces an unpinned action or a missing/overly-broad permissions block
|
|
# (Scorecard's Pinned-Dependencies and Token-Permissions checks). The audit
|
|
# scope is pinned in .github/zizmor.yml; the same tool also runs on the PR diff
|
|
# via the pre-commit hook.
|
|
#
|
|
# Runs offline: the two gating audits are purely syntactic, so no GitHub token is
|
|
# needed and no data leaves the runner. Findings are surfaced in the job log and
|
|
# fail the step; the SARIF is intentionally NOT uploaded to code scanning, matching
|
|
# scorecard.yml — the public signal is the failing check, not a Security-tab alert.
|
|
|
|
on:
|
|
pull_request:
|
|
paths:
|
|
- '.github/workflows/**'
|
|
- '.github/zizmor.yml'
|
|
push:
|
|
branches: [main]
|
|
paths:
|
|
- '.github/workflows/**'
|
|
- '.github/zizmor.yml'
|
|
workflow_dispatch:
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
concurrency:
|
|
group: zizmor-${{ github.workflow }}-${{ github.ref }}
|
|
cancel-in-progress: true
|
|
|
|
jobs:
|
|
zizmor:
|
|
if: (github.event_name == 'pull_request' || github.repository == 'cozystack/cozystack')
|
|
name: Audit workflows
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
contents: read
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
with:
|
|
persist-credentials: false
|
|
|
|
- name: Install zizmor
|
|
run: pipx install zizmor==1.26.1
|
|
|
|
- name: Audit workflows
|
|
run: zizmor --offline .github/workflows/
|