Awesome Go

zanadir

CategoryContinuous Integration
SubcategoryContinuous Integration
Stars188

Reports which security and quality checks a repository's CI is missing, and which cannot fail the build

About zanadir

This large README is shown as a plain-text preview. Read the full README at the source

<p align="center">
  <img src="https://github.com/user-attachments/assets/88b976b4-cc46-4706-a3e4-3cfa0e6877d5" alt="zanadir">
</p>

<p align="center">
  <a href="#coverage-score"><img src="https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/MustacheCase/zanadir/badges/zanadir-badge.json" alt="zanadir coverage"></a>
  <a href="https://pkg.go.dev/github.com/MustacheCase/zanadir"><img src="https://pkg.go.dev/badge/github.com/MustacheCase/zanadir.svg" alt="Go Reference"></a>
  <a href="https://codecov.io/gh/MustacheCase/zanadir"><img src="https://codecov.io/gh/MustacheCase/zanadir/branch/main/graph/badge.svg" alt="Test coverage"></a>
  <a href="https://github.com/MustacheCase/zanadir/releases/latest"><img src="https://img.shields.io/github/v/release/MustacheCase/zanadir" alt="Latest release"></a>
  <a href="LICENSE"><img src="https://img.shields.io/github/license/MustacheCase/zanadir" alt="License: MIT"></a>
  <a href="https://github.com/avelino/awesome-go#continuous-integration"><img src="https://awesome.re/mentioned-badge.svg" alt="Mentioned in Awesome Go"></a>
</p>

zanadir is an open-source CI/CD security tool. It reads a repository's
pipeline, from GitHub Actions to GitLab CI, and reports which security and
quality checks are missing, or wired so they cannot fail a build.

## What it answers

- **What is my pipeline missing?** Thirteen categories, from dependency
  scanning and secrets detection to SBOMs, workflow hardening and agent
  skill scanning, each
  checked against the tools that cover it, with suggestions that fit the
  repository's languages.
- **Does my CI actually block on security findings?** A scanner with
  `continue-on-error`, `|| true`, a push-only trigger or `allow_failure`, or
  one that only reports unless told to fail, like `trivy` without
  `--exit-code 1`, is present but cannot stop a merge. zanadir grades each
  control *enforcing*, *partial*, *advisory* or *unknown* rather than just
  covered; see [Effectiveness](#effectiveness).
- **Is that check required to merge?** With `--required-checks`, a control
  only counts as enforcing when branch protection or a ruleset requires it.
- **What do I add?** `zanadir fix` prints ready-to-paste CI configuration for
  the gaps, or writes a workflow with `--write`.

It reads GitHub Actions, GitLab CI, CircleCI, Bitbucket Pipelines, Azure
Pipelines and Jenkins, from a checkout (`--dir`) or straight from GitHub
(`--repo`), and reports as a table, JSON, SARIF or Markdown. To see it on a
public repository first, [scan it in your browser](https://mustachecase.github.io/scan/).
For how it maps to the OWASP Top 10 CI/CD Security Risks, and how it differs
from OpenSSF Scorecard, see [the mapping](https://mustachecase.github.io/owasp-cicd-top-10/)
and [the comparison](https://mustachecase.github.io/compare/openssf-scorecard/).

How common are these gaps? The [State of CI security 2026](https://mustachecase.github.io/state-of-ci/)
scanned 1,000 of the most-starred GitHub repositories: 511 declare no
dependency, secret or code scanning at all, and 1 in 6 of those that run a
scanner in CI have one that cannot fail the build.

```sh
zanadir scan --dir .
zanadir scan --repo github.com/owner/name --output json
zanadir fix --dir .
```

## Installation

Try it on any public repository without installing anything, in your
browser at [mustachecase.github.io/scan](https://mustachecase.github.io/scan/)
(zanadir runs there as WebAssembly, and the repository's files never leave
your browser), or with Docker:

```sh
docker run --rm mustachecase/zanadir scan --repo github.com/owner/name
```

To install it, download the archive for Linux, macOS or Windows (amd64 or
arm64) from the [latest release](https://github.com/MustacheCase/zanadir/releases/latest).
`checksums.txt` lists each archive's SHA-256, and every archive has a build
provenance attestation:

```sh
gh attestation verify zanadir_<version>_linux_amd64.tar.gz --repo MustacheCase/zanadir
```

Or with Homebrew (the tap is this repository) or Go:

```sh
brew tap --custom-remote MustacheCase/zanadir https://github.com/MustacheCase/zanadir.git
brew install mustachecase/zanadir/zanadir
go install github.com/MustacheCase/zanadir@latest
```

In GitHub Actions, use [zanadir-action](https://github.com/MustacheCase/zanadir-action).
This workflow reports on every pull request without failing it:

```yaml
# .github/workflows/zanadir.yml
name: zanadir
on: [pull_request]
permissions:
  contents: read
jobs:
  zanadir:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
        with:
          fetch-depth: 0
      - uses: mustachecase/[email protected]
        with:
          dir: .
```

When you are ready to gate, add `enforce: true` (fail on any uncovered
category), `fail-on` (only the categories you name) or `fail-on-weakened`. To
post the report as a pull request comment, see
[Posting the report to a pull request](#posting-the-report-to-a-pull-request).

## zanadir and OpenSSF Scorecard

[OpenSSF Scorecard](https://github.com/ossf/scorecard) and zanadir answer
different questions, and work well together.

| | OpenSSF Scorecard | zanadir |
| --- | --- | --- |
| Question | How healthy are this project's security practices? | Which CI controls are missing, and can the ones present fail a build? |
| Scope | 20 checks across the project: branch protection, code review, maintenance, pinned dependencies, token permissions, signed releases, known vulnerabilities, fuzzing and more | 13 categories of CI controls, each matched against the many tools that provide it |
| Reads | The forge's API: GitHub and GitLab repositories, recent pull requests and check runs | The CI configuration: six CI platforms, the Makefiles, Taskfiles, tox, composite actions and templates its jobs call |
| SAST, for example | Looks for CodeQL or SonarCloud; its docs note other tools may score low | Recognises Semgrep, CodeQL, gosec, Bandit, Brakeman, SonarQube and others, and grades whether each can fail the build |
| Result | A 0-10 score per check and overall | Covered or not per category, graded enforcing, partial, advisory or unknown, with fixes |

Use Scorecard for a project-wide security posture, and zanadir to find out
whether the CI you have would actually stop a bad change, and what to add.

## Using zanadir with AI coding agents

To have a coding agent check CI with zanadir before changing it, add this to
the repository's `AGENTS.md`, `CLAUDE.md` or equivalent:

```markdown
## CI changes

Before adding or changing CI configuration, run `zanadir scan --dir . --output json`
(install: https://github.com/MustacheCase/zanadir#installation). It lists the
missing CI controls and grades each present one: `enforcing` can fail a merge,
`partial`, `advisory` and `unknown` cannot or may not. Fix advisory controls before
adding tools, and use `zanadir fix --dir .` for configuration that fits this
repository. Re-run the scan to confirm the change.
```

### As an MCP server

`zanadir mcp` serves three read-only tools over the Model Context Protocol, so
any agent that speaks MCP can grade CI, and check agent skills, before and
after changing them:

- `scan` returns the JSON report: the score, uncovered categories with
  suggested tools, and weakened controls with their verdicts;
- `fix` returns ready-to-paste configuration for the gaps, and writes nothing;
- `skills` returns [`zanadir skills`](#zanadir-skills)' JSON: the skills found
  and their problems.

Each takes `dir` (a local checkout, by default the current directory) or
`repo` (`github.com/owner/name[@ref]`, read without cloning); `scan` and
`fix` also take `excludedCategories`.

An agent can be steered by what it reads, so the server keeps its tools to
what you started it with. A `dir` must be inside `--dir` (by default the
directory the server starts in); a relative one is read from there. `repo`
fetches are anonymous, so they reach public repositories only, unless you
start the server with `--repo-token` to let them use `GITHUB_TOKEN` or
`GH_TOKEN`.

```sh
claude mcp add zanadir -- zanadir mcp
```

It is listed in the [MCP Registry](https://registry.modelcontextprotocol.io/v0/servers?search=zanadir)
as `io.github.MustacheCase/zanadir`, where it runs from the Docker image with
your repository mounted read-only. For other clients, such as Cursor, VS Code
or Windsurf:

```json
{
  "mcpServers": {
    "zanadir": { "command": "zanadir", "args": ["mcp"] }
  }
}
```

### As a Claude Code plugin

In Claude Code, the zanadir plugin brings both: the MCP server, and a skill
that scans, reads your CI configuration, recommends fixes in priority order,
and edits files only after you choose. The server runs the installed
`zanadir` if it is 0.18.0 or later, and otherwise the Docker image.

```
/plugin marketplace add MustacheCase/zanadir
/plugin install zanadir@mustachecase
```

Then ask Claude Code to review or harden your CI, or run `/zanadir:improve-ci`.

[`llms.txt`](llms.txt) summarises zanadir for agents that read the repository, and is
served at [mustachecase.github.io/llms.txt](https://mustachecase.github.io/llms.txt)
for those that look at a site's root.

## Features

- ๐Ÿ“‚ **Scan**: Analyze the repository for CI/CD enhancement suggestions, including security services and best practices.
- ๐Ÿ” **CI Analysis**: Grades whether each control can actually fail a build, not only whether it is present.
- ๐Ÿ› ๏ธ **Fix**: Prints, or writes as a workflow, CI configuration for the categories a scan reports as missing.
- ๐Ÿš€ **Open Source**: Contributions are welcome to enhance Zanadir's capabilities!

## Supported CI Actions

Zanadir currently supports:

- GitHub Actions
- CircleCI
- GitLab
- Bitbucket Pipelines
- Azure Pipelines
- Jenkins

Future work will include support for:

- Tekton

## Categories We Suggest

Zanadir analyzes repositories in the following categories. The name in bold is
the exact value to pass to `--excluded-categories` (matching is
case-insensitive):

- ๐Ÿ›ก๏ธ **SCA**: Software Composition Analysis
- ๐Ÿ” **Secrets Detection**: Secrets Management
- ๐Ÿ“œ **License Compliance**: License Compliance
- ๐Ÿ› ๏ธ **End Of Life**: End-of-Life Software Packages
- ๐Ÿ“Š **Coverage**: Test Coverage
- ๐Ÿ“Š **Performance Testing**: Test Performance and Reliability
- ๐Ÿง‘โ€๐Ÿ’ป **Linter**: Code Linting
- ๐Ÿงช **Unit Tests**: Automated Unit Testing
- ๐Ÿ”Ž **SAST**: Static Application Security Testing
- ๐Ÿ—๏ธ **IaC Security**: Infrastructure-as-Code Misconfiguration Scanning
- ๐Ÿ”— **Supply Chain**: SBOM Generation, Signing and Provenance
- ๐Ÿงฑ **Workflow Security**: Hardening of the pipeline definition itself
- ๐Ÿค– **Agent Skill Security**: Scanning agent skills (`SKILL.md`) for prompt injection and malicious code

## Usage Examples

### Basic Usage

Scan a repository for CI/CD improvement suggestions:

```sh
zanadir scan --dir /path/to/your/repo
```

Or scan a GitHub repository without cloning it:

```sh
zanadir scan --repo github.com/owner/name
zanadir scan --repo owner/[email protected]     # a branch, tag or commit
zanadir fix --repo owner/name
```

`--repo` lists the repository's files at one commit and downloads only the
ones zanadir reads (CI and build files, plus the start of JSON files for
infrastructure detection) into a temporary directory. Every other file is an
empty placeholder, since only its name matters. It then scans the directory
exactly as a checkout and removes it. That is a handful of GitHub API
requests per scan, however large the repository. The API also shows what no
file does: workflows GitHub has turned off, which then count for nothing;
code scanning's default setup, which counts as the CodeQL workflow it runs,
for the languages of its latest run; and Dependabot security updates enabled
in settings without a configuration file, which count as advisory SCA.
Dependabot's ecosystems are read from up to 100 recent runs in one additional
request, only when no Dependabot configuration exists. If the runs cannot be
read, Dependabot still counts with unknown ecosystems. A scan of a checkout
can't see these settings. A repository too large to list in one
request is downloaded as an archive instead. Public repositories need no
token; set `GITHUB_TOKEN` (or `GH_TOKEN`) to reach private ones or raise
GitHub's rate limit of 60 requests an hour without one. GitLab and Bitbucket
repositories still need a clone.

### Output Formats

Zanadir supports three output formats: table (default), JSON and SARIF.

#### Table Output (Default)

```sh
zanadir scan --dir . --output table
```

**Sample Output:**
```
Coverage 10/11 - 1 category needs attention:

|--------------------------------|--------------------------------|-------------------|
|            CATEGORY            |          DESCRIPTION           |  SUGGESTED TOOLS  |
|--------------------------------|--------------------------------|-------------------|
| Performance and Reliability    | Tools for load, stress and     | k6, JMeter,       |
| Testing Tools                  | reliability testing, to verify | Gatling, Apache   |
|                                | a system holds up under        | Bench, Artillery, |
|                                | expected and peak traffic.     | BlazeMeter        |
|--------------------------------|--------------------------------|-------------------|

10 categories are covered by:
  SCA                 Dependabot, govulncheck
  Secrets Detection   Gitleaks (advisory)
  Linter              golangci-lint
  Unit Tests          go test
  ...
```

The covered categories come last, each with the tools found for it. A tool
whose run cannot block a merge shows its grade (see
[Effectiveness](#effectiveness)). A rule that covers several
tools, such as the test command one, names the one it matched: `pytest`,
`go test` or `mvn`.

When nothing is missing, the scan says so rather than printing an empty table,
and lists what covers each category:

```
Coverage 11/11 - all categories are covered.

11 categories are covered by:
  ...
```

The headline is bold on an interactive terminal. Colour is omitted when the
output is piped or written with `--output-file`, and when `NO_COLOR` is set.

#### JSON Output

```sh
zanadir scan --dir . --output json
```

One object with the score, the CI systems whose configuration was found, the
uncovered categories and the tools that cover them, the covered categories whose tooling cannot fully protect the
repository, the categories left out of the score, and every covered category
with the tools found for it. Every list is an array, empty rather than `null`
when there is nothing in it.

```json
{
  "score": { "covered": 4, "total": 11 },
  "platforms": ["github"],
  "uncovered": [
    {
      "id": "Secrets Detection",
      "name": "Data Leakage & Secrets Detection",
      "description": "Tools that help detect sensitive information ...",
      "suggestions": [
        {
          "name": "Gitleaks",
          "repository": "https://github.com/gitleaks/gitleaks",
          "description": "..."
        }
      ]
    }
  ],
  "weakened": [
    { "category": "SCA", "verdict": "advisory", "location": ".github/dependabot.yml" }
  ],
  "notApplicable": ["IaC Security"],
  "covered": [
    {
      "category": "SCA",
      "verdict": "advisory",
      "tools": [
        { "name": "Dependabot", "verdict": "advisory", "locations": [".github/dependabot.yml"] }
      ]
    }
  ]
}
```

In `covered`, a category's `verdict` is its strongest tool's, and each tool
has its own with the files it runs in. Tools are listed strongest first.

`language` appears on a suggested tool only when it is specific to one
language, and `location` on a weakened category only when it points inside
the repository. Before 0.10.0, `--output json` printed only the bare array that
is now `uncovered`, with capitalised keys.

#### SARIF Output

```sh
zanadir scan --dir . --output sarif
```

SARIF is the standard interchange format for static analysis results. Emitting
it lets uncovered categories show up in GitHub's Security tab, and in any other
SARIF-consuming platform, alongside your other scanners.

Each uncovered category becomes one SARIF rule and one result at `warning`
level, with the suggested tools listed in the result's help text. Results are
anchored at a CI configuration file โ€” the place the missing tool would be
added. A missing control is not a defect on a particular line, but every SARIF
consumer expects a location, and GitHub code scanning rejects a report whose
results have none.

#### Markdown Output

```sh
zanadir scan --dir . --output markdown
```

Markdown is the format for putting a scan in front of people rather than in a
file. Tools link to their repositories, and the report opens with a hidden
marker so a workflow can update the comment it posted last time instead of
adding a new one on every push.

**Sample Output:**
```markdown
<!-- zanadir-report -->
### zanadir

Coverage 10/11 - 1 category needs attention:

| Category | Description | Suggested tools |
| --- | --- | --- |
| Performance and Reliability Testing Tools | Tools for load, stress and reliability testing. | [k6](https://github.com/grafana/k6), [JMeter](https://github.com/apache/jmeter) |
```

When nothing is missing the table is omitted, leaving a single line.

#### Writing the report to a file

Use `--output-file` to write the report to a path instead of stdout. This works
with every format, and is the reliable way to produce a machine-readable report:
redirecting stdout captures the debug log as well, so `--output sarif --debug >
report.sarif` yields a file that is not valid JSON.

```sh
zanadir scan --dir . --output sarif --output-file zanadir.sarif
```

To publish the report from a GitHub Actions workflow:

```yaml
- name: Run zanadir
  run: zanadir scan --dir . --output sarif --output-file zanadir.sarif

- name: Upload SARIF
  uses: github/codeql-action/upload-sarif@v3
  with:
    sarif_file: zanadir.sarif
```

Uncovered categories then appear in the repository's **Security** tab alongside
your other scanners.

### Posting the report to a pull request

SARIF puts uncovered categories in the **Security** tab, which people visit
occasionally. A pull request comment is where they already are.

```yaml
permissions:
  contents: read
  pull-requests: write

steps:
  - name: Run zanadir
    run: zanadir scan --dir . --output markdown --output-file zanadir.md

  - name: Post the report
    run: gh pr comment "$NUMBER" --body-file zanadir.md --edit-last --create-if-none
    env:
      GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
      NUMBER: ${{ github.event.pull_request.number }}
```

`--edit-last` keeps one comment up to date instead of adding one per push. It
matches on the last comment by the same user, so if something else comments as
`github-actions` too, match the marker instead:

```yaml
  - name: Find the previous report
    uses: peter-evans/find-comment@v4
    id: previous
    with:
      issue-number: ${{ github.event.pull_request.number }}
      body-includes: "<!-- zanadir-report -->"

  - name: Post the report
    uses: peter-evans/create-or-update-comment@v5
    with:
      comment-id: ${{ steps.previous.outputs.comment-id }}
      issue-number: ${{ github.event.pull_request.number }}
      body-path: zanadir.md
      edit-mode: replace
```

A pull request from a fork gets a read-only token, so the comment step cannot
post. Guard it with
`if: github.event.pull_request.head.repo.full_name == github.repository`
rather than reaching for `pull_request_target`, which would run your workflow
with write access to a fork's code.

## Coverage Score

Every scan is summarised as a coverage score: the categories that apply to the
repository, minus the ones still uncovered.

Three rules keep the number honest:

- **Excluded categories leave the denominator.** A repository is not marked
  down for a category it has declared irrelevant with `--excluded-categories`.
- **So do categories with nothing to scan.** A repository with no Terraform,

Frequently Asked Questions

What is zanadir?

zanadir is a Continuous Integration library for the Go programming language. Reports which security and quality checks a repository's CI is missing, and which cannot fail the build

How do I install zanadir?

Install zanadir with the Go module system using `go get MustacheCase/zanadir`. Check the repository for the current installation instructions.

What category does zanadir belong to?

zanadir is listed under Continuous Integration, specifically Continuous Integration.

โ† Back to Continuous Integration