# GHAGuard Workflow Auditor (`zluowa/ghaguard-workflow-auditor`) Actor

- **URL**: https://apify.com/zluowa/ghaguard-workflow-auditor.md
- **Developed by:** [Shengyang Xie](https://apify.com/zluowa) (community)
- **Features:** Limited permissions
- **Stats:** 1 total users, 0 monthly users, 0.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $50.00 / 1,000 workflow bundle audits

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

Learn more: https://docs.apify.com/actors/store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## GHAGuard — GitHub Actions Security & Supply-Chain Auditor (SARIF 2.1.0)

Zero-dependency deterministic CI/CD security gate for **`.github/workflows/*.yml`** files. Built on pure **Node.js 24 Alpine** (no headless browser, no LLM calls, `128–256 MB` RAM, sub-second execution) with **Limited permissions** for automatic discovery on **`mcp.apify.com`**.

### 10 Deterministic Supply-Chain & CI/CD Rules

| Rule | Severity | What It Catches |
|---|---|---|
| `GHA001` | CRITICAL | `pull_request_target` + untrusted PR head checkout (Pwn Request RCE) |
| `GHA002` | CRITICAL | Shell script injection via `${{ github.event.issue.title / pr.body / comment.body / head_ref }}` directly in `run:` |
| `GHA003` | HIGH / MEDIUM | Unpinned third-party (and optionally official) Actions not pinned to a 40-char commit SHA |
| `GHA004` | CRITICAL / HIGH / MEDIUM | `permissions: write-all`, multiple global write scopes, or missing explicit top-level `permissions:` |
| `GHA005` | CRITICAL | Hardcoded API keys, GitHub PATs, AWS keys, Stripe/Slack tokens, or URL credentials in workflow YAML |
| `GHA006` | CRITICAL / HIGH | Unverified `curl|sh` / `wget|bash` / `irm|iex` piped execution or direct `${{ secrets.* }}` leakage in commands |
| `GHA007` | HIGH | `self-hosted` runner exposed to externally triggerable `pull_request` / `issue_comment` events |
| `GHA008` | HIGH | Privileged `workflow_run` downloading untrusted artifacts or checking out `workflow_run.head_sha` |
| `GHA009` | HIGH | Untrusted event input redirected directly to `GITHUB_ENV` / `GITHUB_PATH` |
| `GHA010` | MEDIUM / LOW | Unpinned container / `docker://` images (`:latest` or missing digest) and missing `timeout-minutes` |

### Pay-Per-Event Pricing

| Action | PPE Event | Price (USD) | Capabilities |
|---|---|---:|---|
| *(Platform Start)* | `apify-actor-start` | `$0.001` | Platform 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.05` | Pass `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 -> unified 0–100 Security Score, Grade A–F, SARIF 2.1.0, and PR Markdown. |
| `audit-workflow` | `workflow-security-audit` | `$0.025` | Audits a single workflow YAML file -> 0–100 Security Score, Grade A–F, SARIF 2.1.0, and PR Markdown. |

*Recommended minimum spending cap (`minimalMaxTotalChargeUsd`): `$0.06`.*

### Example Input (One-Click Public GitHub Repo Scan)

```json
{
  "action": "audit-workflow-bundle",
  "githubRepo": "owner/repo",
  "includeSarif": true,
  "includeMarkdown": true
}
```

# Actor input Schema

## `action` (type: `string`):

Select 'audit-workflow' ($0.025, single YAML) or 'audit-workflow-bundle' ($0.05, supports one-click public githubRepo scan OR offline workflows array). Platform start event is $0.001 (5s free compute).

## `githubRepo` (type: `string`):

Optional for action='audit-workflow-bundle'. Public repo in 'owner/repo' or 'https://github.com/owner/repo' format (e.g. actions/checkout). Fetches up to 25 files from .github/workflows/\*.{yml,yaml} over GitHub API with strict SSRF host pinning; 404/429/empty repos NEVER incur a billing event.

## `githubRef` (type: `string`):

Optional branch, tag, or commit SHA when scanning via githubRepo (defaults to the repository's default branch).

## `fileName` (type: `string`):

Logical file path shown in findings and SARIF locations (e.g. .github/workflows/ci.yml).

## `workflowContent` (type: `string`):

Raw UTF-8 YAML content of a GitHub Actions workflow file (required for action='audit-workflow').

## `targetName` (type: `string`):

Logical repository or bundle name shown in unified bundle reports (for action='audit-workflow-bundle').

## `workflows` (type: `array`):

Offline array of { path, content } objects for action='audit-workflow-bundle' (1 to 100 workflow YAML files; alternative to githubRepo).

## `includeSarif` (type: `boolean`):

Attach a GitHub Code Scanning compatible SARIF 2.1.0 JSON report in the output.

## `includeMarkdown` (type: `boolean`):

Attach a ready-to-post GitHub Pull Request / Step Summary Markdown scorecard.

## `strictOfficialPinning` (type: `boolean`):

When true, elevates unpinned official actions/\* and github/\* tags from MEDIUM to HIGH severity.

## Actor input object example

```json
{
  "action": "audit-workflow",
  "fileName": ".github/workflows/ci.yml",
  "workflowContent": "name: CI\non:\n  push:\n    branches: [main]\npermissions:\n  contents: read\njobs:\n  test:\n    runs-on: ubuntu-latest\n    timeout-minutes: 10\n    steps:\n      - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11\n      - run: npm test\n",
  "includeSarif": true,
  "includeMarkdown": true,
  "strictOfficialPinning": false
}
```

# Actor output Schema

## `overview` (type: `string`):

No description

## `report` (type: `string`):

No description

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "action": "audit-workflow",
    "fileName": ".github/workflows/ci.yml",
    "workflowContent": `name: CI
on:
  push:
    branches: [main]
permissions:
  contents: read
jobs:
  test:
    runs-on: ubuntu-latest
    timeout-minutes: 10
    steps:
      - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
      - run: npm test`
};

// Run the Actor and wait for it to finish
const run = await client.actor("zluowa/ghaguard-workflow-auditor").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = {
    "action": "audit-workflow",
    "fileName": ".github/workflows/ci.yml",
    "workflowContent": """name: CI
on:
  push:
    branches: [main]
permissions:
  contents: read
jobs:
  test:
    runs-on: ubuntu-latest
    timeout-minutes: 10
    steps:
      - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
      - run: npm test
""",
}

# Run the Actor and wait for it to finish
run = client.actor("zluowa/ghaguard-workflow-auditor").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "action": "audit-workflow",
  "fileName": ".github/workflows/ci.yml",
  "workflowContent": "name: CI\\non:\\n  push:\\n    branches: [main]\\npermissions:\\n  contents: read\\njobs:\\n  test:\\n    runs-on: ubuntu-latest\\n    timeout-minutes: 10\\n    steps:\\n      - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11\\n      - run: npm test\\n"
}' |
apify call zluowa/ghaguard-workflow-auditor --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,zluowa/ghaguard-workflow-auditor"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/P4vQq3J6mEcQvF2qL/builds/IXrBTHueSQkYdaVPH/openapi.json
