Repository avatar
Version Control
v1.0.0
active

gha-guard-actor

io.github.Zluowa/gha-guard-actor

Zero-LLM deterministic GitHub Actions workflow security & supply-chain auditor (SARIF 2.1.0).

Documentation

GHAGuard — GitHub Actions Security & Supply-Chain Auditor (v1.0.0)

Release CI Node.js SARIF 2.1.0 License: MIT

Zero-dependency deterministic CI/CD security gate for .github/workflows/*.yml — catches Pwn Requests (pull_request_target), script injection, unpinned third-party actions, overbroad GITHUB_TOKEN permissions, and hardcoded secrets in sub-second execution with SARIF 2.1.0 and PR Markdown scorecards.

Runs as a Zero-Install CLI, GitHub Action, and Apify Store PPE Actor (zluowa/ghaguard-workflow-auditor) built on pure node:24-alpine (128–256 MB RAM, zero headless browser, zero LLM hallucinations).


30-Second Quick Start (Zero npm install)

1. Audit any local repository in one command

# Scan .github/workflows/*.yml and print a Markdown security scorecard
npx --yes github:Zluowa/gha-guard-actor . --markdown

# Strict mode: also flag unpinned official actions/* & github/* as HIGH severity
npx --yes github:Zluowa/gha-guard-actor . --strict-official --markdown

# Emit SARIF 2.1.0 JSON for GitHub Code Scanning
npx --yes github:Zluowa/gha-guard-actor . --sarif > ghaguard.sarif

2. Drop-in GitHub Action (Dogfooded in this repository's CI)

name: GHAGuard Security Gate
on: [push, pull_request]

permissions:
  contents: read
  security-events: write

jobs:
  ghaguard:
    runs-on: ubuntu-latest
    timeout-minutes: 10
    steps:
      - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
      - uses: Zluowa/gha-guard-actor@v1.0.0
        with:
          target: '.'
          strict-official: 'true'
          sarif-file: 'ghaguard.sarif'
          fail-on-findings: 'true'

Real Scan Output Examples (Before vs. After Hardening)

Catching a Vulnerable PR Automation Workflow (exit 1)

## GHAGuard Security & Supply-Chain Report — FAIL

- **Target**: `.github/workflows/pr-bot.yml`
- **Security Score**: **0/100** (Grade **F**)
- **Findings**: 6 total (3 CRITICAL, 1 HIGH, 1 MEDIUM, 1 LOW)

| Severity | Rule | Location | Issue |
|---|---|---|---|
| **CRITICAL** | `GHA004` | `.github/workflows/pr-bot.yml:4` | Explicit "permissions: write-all" grants full read/write GITHUB_TOKEN privileges across all scopes. |
| **CRITICAL** | `GHA001` | `.github/workflows/pr-bot.yml:11` | Workflow triggers on pull_request_target and checks out untrusted PR head code, allowing arbitrary code execution with write GITHUB_TOKEN & repo secrets (Pwn Request). |
| **CRITICAL** | `GHA002` | `.github/workflows/pr-bot.yml:13` | Untrusted GitHub context "${{ github.event.pull_request.title }}" is interpolated directly inside a shell run: block, enabling command injection. |
| **HIGH** | `GHA003` | `.github/workflows/pr-bot.yml:12` | Third-party action "thirdparty/auto-label@main" is pinned to mutable ref "main" instead of a 40-char commit SHA. |
| **MEDIUM** | `GHA003` | `.github/workflows/pr-bot.yml:9` | Official action "actions/checkout@v4" is pinned to mutable ref "v4" instead of a 40-char commit SHA. |
| **LOW** | `GHA010` | `.github/workflows/pr-bot.yml:1` | No job declares "timeout-minutes:", inheriting GitHub Actions 360-minute (6h) default which risks runaway runner cost. |

Dogfood Self-Scan on This Repository (--strict-official, exit 0)

## GHAGuard Security & Supply-Chain Report — PASS

- **Target**: `.github/workflows/ci.yml`
- **Security Score**: **100/100** (Grade **A**)
- **Findings**: 0 total (0 CRITICAL, 0 HIGH, 0 MEDIUM, 0 LOW)

No supply-chain, injection, or permission issues detected.

10 Deterministic Supply-Chain & CI/CD Rules

RuleSeverityWhat It Catches
GHA001CRITICALpull_request_target + untrusted PR head checkout (head.sha, head.ref, refs/pull/.../merge) — Pwn Request RCE
GHA002CRITICALShell script injection via ${{ github.event.issue.title / pr.body / comment.body / head_ref }} directly in run:
GHA003HIGH / MEDIUMUnpinned third-party (and optionally official via --strict-official) Actions not pinned to a 40-char commit SHA
GHA004CRITICAL / HIGH / MEDIUMpermissions: write-all, multiple global write scopes, or missing explicit top-level permissions:
GHA005CRITICALHardcoded API keys, GitHub PATs, AWS keys, Stripe/Slack tokens, or URL credentials in workflow YAML
GHA006CRITICAL / HIGHUnverified `curl
GHA007HIGHself-hosted runner exposed to externally triggerable pull_request / issue_comment events
GHA008HIGHPrivileged workflow_run downloading untrusted artifacts or checking out workflow_run.head_sha
GHA009HIGHUntrusted event input redirected directly to GITHUB_ENV / GITHUB_PATH
GHA010MEDIUM / LOWUnpinned container / docker:// images (:latest or missing digest) and missing timeout-minutes

Apify Cloud Actor & Remote MCP (mcp.apify.com)

Public on Apify as zluowa/ghaguard-workflow-auditor (Pay-per-event, Limited permissions); the local CLI and GitHub Action remain free.

ActionPPE EventPrice (USD)Capabilities
(Platform Start)apify-actor-start$0.001Platform auto-billed start event unlocking the 5-second free compute window (never manually charged by actor code).
audit-workflow-bundle (Primary)workflow-bundle-audit$0.05Pass githubRepo: "owner/repo" for one-click live scanning of public .github/workflows/*.yml (up to 25 files, strict SSRF host pinning, $0 charge on 404/429), OR pass up to 100 offline workflow files -> 0–100 score, SARIF 2.1.0 & Markdown.
audit-workflowworkflow-security-audit$0.025Audits a single workflow YAML file -> 0–100 Security Score, Grade A–F, SARIF 2.1.0 & Markdown.
{
  "action": "audit-workflow-bundle",
  "githubRepo": "Zluowa/gha-guard-actor",
  "includeSarif": true,
  "includeMarkdown": true
}

Local Development & Verification

git clone https://github.com/Zluowa/gha-guard-actor.git
cd gha-guard-actor
npm test
node cli/ghaguard.mjs . --strict-official --markdown