@@ -18,13 +18,53 @@ jobs:
1818 with :
1919 egress-policy : audit
2020
21- - name : Checkout
21+ - name : Checkout target repository
2222 uses : actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
2323 with :
2424 persist-credentials : false
2525
26+ # Intentionally fails loudly when the org-level variable/secret is
27+ # missing (e.g. fork PRs, where GitHub withholds secrets from workflows
28+ # triggered from forks). A red check on the required workflow is the
29+ # desired signal: it forces a human to either mark the PR trusted or
30+ # investigate why the scanner credentials are unavailable. Do NOT add
31+ # an `if:` guard here to silently skip — loud failure is the contract.
32+ - name : Mint scanner token (org-wide read access for action ref resolution)
33+ id : app-token
34+ uses : actions/create-github-app-token@f8d387b68d61c58ab83c6c016672934102569859 # v3.0.0
35+ with :
36+ app-id : ${{ vars.ZIZMOR_SCANNER_APP_ID }}
37+ private-key : ${{ secrets.ZIZMOR_SCANNER_PRIVATE_KEY }}
38+ owner : rudderlabs
39+ permission-contents : read
40+ permission-metadata : read
41+
42+ # Inject the shared zizmor config from this repo into the target repo's
43+ # run context. Required because zizmor only auto-discovers config from
44+ # the checked-out working tree, and injected runs check out the target
45+ # repo's tree, not shared-workflows. Without this step, any config-level
46+ # rule overrides we ship here (e.g. the `secrets-outside-env` ignore for
47+ # the zizmor workflow itself) would never apply to injected runs.
48+ - name : Checkout shared zizmor config
49+ uses : actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
50+ with :
51+ repository : rudderlabs/shared-workflows
52+ # For self-scans (PRs against shared-workflows itself), test the
53+ # PR's proposed config — otherwise a PR that breaks .github/zizmor.yml
54+ # would be validated against main's config and merge green. For
55+ # injected runs in other repos, pin to main for stability.
56+ ref : ${{ github.repository == 'rudderlabs/shared-workflows' && github.event.pull_request.head.sha || 'main' }}
57+ token : ${{ steps.app-token.outputs.token }}
58+ path : .zizmor-shared
59+ persist-credentials : false
60+ sparse-checkout : |
61+ .github/zizmor.yml
62+ sparse-checkout-cone-mode : false
63+
2664 - name : Run zizmor
2765 uses : zizmorcore/zizmor-action@71321a20a9ded102f6e9ce5718a2fcec2c4f70d8 # v0.5.2
2866 with :
2967 advanced-security : true
3068 min-severity : medium
69+ config : .zizmor-shared/.github/zizmor.yml
70+ token : ${{ steps.app-token.outputs.token }}
0 commit comments