Skip to main content

harnessguard

Static hardening linter for GitHub Actions workflows that run AI agents.

Agents in CI (Claude Code Action, Gemini CLI Action, Codex, Copilot agents and friends) read attacker-controlled text — issue bodies, PR titles, comments — while the runner holds secrets and write tokens. That combination is the new CI/CD supply-chain attack surface: a public comment becomes instructions the agent obeys.

harnessguard enforces Microsoft's Agents Rule of Two: an AI-powered workflow must never combine untrusted input, privileged access, and external communication. It runs as a static, deterministic check in pull requests — it never executes your workflows or your agents.

Why

Real incidents, all from 2026:

  • Comment and Control (April 2026) — hijacked Claude Code Security Review, Gemini CLI Action and Copilot Agent via PR titles / issue bodies; leaked ANTHROPIC_API_KEY, GEMINI_API_KEY and GITHUB_TOKEN through public comments.
  • Black Hat USA 2026 (August) — an unprivileged GitHub issue reached CI runner secrets in the vendors' own repositories; Gemini CLI Action got CVE-2026-12537 (CVSS 10.0).
  • MSRC — Claude Code Action's Read tool reached /proc/self/environ; fixed in 2.1.128.

Existing Actions linters (zizmor, actionlint, poutine…) are excellent but agent-blind: they don't model "this step is an LLM that will obey text."

Install

pip install harnessguard
# or from source
uv sync && uv run harnessguard --version

Usage

# scan the current repo (finds .github/workflows/)
harnessguard scan .

# fail CI on high and above, write SARIF for code scanning
harnessguard scan . --fail-on high --sarif harnessguard.sarif

# machine-readable output
harnessguard scan . --format json

# list rules
harnessguard rules list

Exit code is 1 when findings at or above --fail-on exist. --fail-on none reports without failing.

GitHub Action

name: harnessguard
on: [push, pull_request]

jobs:
  harnessguard:
    runs-on: ubuntu-latest
    permissions:
      contents: read
      security-events: write
    steps:
      - uses: actions/checkout@v4
      - uses: dtduc-git/harnessguard@main
        with:
          fail-on: high

Rules

Rule Severity What it catches
HG001 critical Agent step on untrusted events with secrets in scope
HG002 high Attacker-controlled event data interpolated into an agent step
HG003 high Agent step on untrusted events with write permissions
HG004 high Agent step in a pull_request_target workflow
HG005 medium Agent step with shell/network tool grants or egress commands

Findings map to the OWASP Top 10 for Agentic Applications (ASI01–ASI03). Rules are data — YAML in src/harnessguard/rules_data/ — and checks are small named functions in checks.py. Add your own with --rules-dir.

Design principles

  • Never executes anything. No workflow runs, no agent calls, no network.
  • Local-first. No account, no telemetry, no SaaS.
  • Deterministic. Same input → same findings; no LLM in the detection path.
  • Rules as data. Extend coverage without touching the engine.

Non-goals

  • Not a general-purpose Actions linter — use zizmor alongside it.
  • No runtime enforcement or proxy — that is a different (complementary) tool.
  • Not GitLab/Jenkins (yet).

References

  • Microsoft Security Blog — Securing CI/CD in an agentic world (Agents Rule of Two), June 2026
  • CSA — Comment and Control: GitHub AI Agents as Credential Exfiltrators, April 2026
  • OWASP — Top 10 for Agentic Applications 2026

License

Apache-2.0

Release files for harnessguard 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for harnessguard 0.1.0
File Size Uploaded
harnessguard-0.1.0.tar.gz 38.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for harnessguard 0.1.0
File Interpreter ABI Platform
harnessguard-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 60.2 kB

Release files / harnessguard-0.1.0.tar.gz

Download URL harnessguard-0.1.0.tar.gz
Size 38.3 kB
Tags Source
SHA-256 checksum
How to use checksums
265b75baffd9a2ef6cd7ac73bde671c6ad0288e44575d2ba4f1e33041a78043d
BLAKE2b-256 checksum
How to use checksums
c8f4e1f5224cd533eca3fba99d84666c33fbd7db99c49d5c899e9a24394821a7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.12.13 {"installer":{"name":"uv","version":"0.12.13","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / harnessguard-0.1.0-py3-none-any.whl

Download URL harnessguard-0.1.0-py3-none-any.whl
Size 21.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5438fc4c4b74b9571db149effa11a88d1d44e112d43293b80f332115372704cc
BLAKE2b-256 checksum
How to use checksums
1d5591847af5feb1d7144076b5a7422f0811a301719741d04818b1f6d9d4b45f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.12.13 {"installer":{"name":"uv","version":"0.12.13","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release history Release notifications | RSS feed

0.6.4

2 release files

0.6.3

2 release files

0.6.2

2 release files

0.6.1

2 release files

0.6.0

2 release files

0.5.0

2 release files

0.4.1

2 release files

0.4.0

2 release files

0.3.0

2 release files

0.2.0

2 release files

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page