Skip to content

ci(security): add Zizmor GitHub Actions workflow scanner - #55

Merged
dhc-tech merged 3 commits into
mainfrom
feat/zizmor-security-scan
Aug 25, 2026
Merged

ci(security): add Zizmor GitHub Actions workflow scanner#55
dhc-tech merged 3 commits into
mainfrom
feat/zizmor-security-scan

Conversation

@dhc-tech

@dhc-tech dhc-tech commented Aug 25, 2026

Copy link
Copy Markdown
Owner

Integrate Zizmor security scanner for static analysis of GitHub Actions workflows with SARIF reporting to GitHub Security & Quality dashboard.

Summary by Sourcery

Add automated security scanning for GitHub Actions workflows with Zizmor and GitHub Code Scanning integration.

Enhancements:

  • Add automated Zizmor security auditing for GitHub Actions workflows, including weekly and workflow-change scans with findings surfaced through GitHub Code Scanning.

CI:

  • Add a dedicated GitHub Actions workflow to run Zizmor and upload SARIF results to the Security & Quality dashboard.

@dhc-tech dhc-tech added the autosubmit Automatically merges PR when CI passes and review is approved label Aug 25, 2026
@sourcery-ai

sourcery-ai Bot commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

Reviewer's Guide

Introduces a least-privilege, pinned GitHub Actions workflow that runs Zizmor against repository workflows on relevant changes and weekly, then uploads SARIF results to GitHub Security & Quality via Code Scanning.

Sequence diagram for the Zizmor workflow security scan

sequenceDiagram
    participant Trigger as Workflow trigger
    participant Actions as GitHub Actions
    participant Checkout as actions/checkout
    participant Zizmor as zizmor-action
    participant CodeScanning as GitHub Code Scanning

    Trigger->>Actions: Start zizmor workflow
    Actions->>Checkout: Checkout repository
    Checkout-->>Actions: Workflow files available
    Actions->>Zizmor: Run zizmor security audit
    Zizmor-->>Actions: Write results.sarif
    Actions->>CodeScanning: upload-sarif(results.sarif)
    CodeScanning-->>Actions: Publish findings to Security & Quality
Loading

File-Level Changes

Change Details Files
Add a dedicated GitHub Actions workflow to scan workflow definitions with Zizmor and publish SARIF findings to GitHub Code Scanning.
  • Trigger scans for workflow changes on main, pull requests targeting main, and a weekly scheduled run.
  • Run the pinned Zizmor action with read-only checkout and request only the security-events permission needed for reporting.
  • Generate a SARIF report and upload it under a dedicated zizmor Code Scanning category.
.github/workflows/zizmor.yml

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@github-actions github-actions Bot added size:S Small diff (<=100 lines changed) type:ci CI configuration status:needs-review Awaiting review or checks infra: workflows status:ci-failed A required check is failing and removed status:needs-review Awaiting review or checks labels Aug 25, 2026

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've found 2 issues

Prompt for AI Agents
Please address the comments from this code review:

## Individual Comments

### Comment 1
<location path=".github/workflows/zizmor.yml" line_range="42" />
<code_context>
+      - name: Run zizmor security audit
+        uses: woodruffw/zizmor-action@a87be7b233a0b8106f3634ea576ca22ebc29ffc1 # v1.4.1
+        with:
+          args: --format sarif .
+        env:
+          GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
</code_context>
<issue_to_address>
**issue (bug_risk):** When Zizmor finds a policy violation, the audit step exits nonzero and GitHub skips the subsequent `upload-sarif` step because it has the default `success()` condition, so the SARIF findings are not uploaded to Code Scanning.

**Triggers:** When the scanned workflows contain at least one Zizmor finding.

**Suggested fix:** Add `if: ${{ always() }}` to the SARIF upload step so the report is uploaded even when the audit step reports findings.
</issue_to_address>

### Comment 2
<location path=".github/workflows/zizmor.yml" line_range="46" />
<code_context>
+    runs-on: ubuntu-latest
+    permissions:
+      contents: read
+      security-events: write
+    steps:
+      - name: Check out repository
</code_context>
<issue_to_address>
**issue (bug_risk):** When this workflow runs for a pull request from a fork, GitHub downgrades the `GITHUB_TOKEN` to read-only despite `security-events: write`, so `upload-sarif` cannot write the Code Scanning result and the workflow fails with a resource-access error.

**Triggers:** When an external contributor opens a pull request that changes a workflow file.

**Suggested fix:** Skip SARIF uploading for fork pull requests, or use a separately trusted `pull_request_target` workflow that does not execute untrusted checkout contents.

```suggestion
      - name: Upload SARIF report to Code Scanning
        if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.fork == false
```
</issue_to_address>

Sourcery assessment

Needs a human reviewer. 2 findings to address first, and the workflow adds a pinned third-party action that executes with repository-read and security-events-write permissions and uploads scan findings to GitHub Code Scanning. A faulty scanner or action could produce incorrect or stale security results, but reverting stops future runs and the persisted findings can be cleared or regenerated.

Blocking findings: .github/workflows/zizmor.yml:42, .github/workflows/zizmor.yml:46


Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Comment thread .github/workflows/zizmor.yml Outdated
Comment thread .github/workflows/zizmor.yml
@github-actions github-actions Bot added status:changes-requested A reviewer requested changes and removed status:ci-failed A required check is failing labels Aug 25, 2026
@github-actions

Copy link
Copy Markdown
Contributor

@sourcery-ai review

@github-actions

Copy link
Copy Markdown
Contributor

@sourcery-ai review

@dhc-tech
dhc-tech enabled auto-merge (squash) August 25, 2026 05:27
@dhc-tech
dhc-tech merged commit 5135bea into main Aug 25, 2026
12 checks passed
@dhc-tech
dhc-tech deleted the feat/zizmor-security-scan branch August 25, 2026 05:27
@dhc-tech
dhc-tech restored the feat/zizmor-security-scan branch August 25, 2026 05:27
@dhc-tech
dhc-tech deleted the feat/zizmor-security-scan branch August 25, 2026 06:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

autosubmit Automatically merges PR when CI passes and review is approved infra: workflows size:S Small diff (<=100 lines changed) status:changes-requested A reviewer requested changes type:ci CI configuration

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants