GHAGuard — GitHub Actions Supply-Chain Security Auditor について
GHAGuardは、CI保守担当者やリポジトリのセキュリティチーム向けの、GitHub Actionsワークフロー監査ツールです。ワークフロー注入、過剰な権限、未固定のAction、秘密情報を検出し、SARIFとMarkdownのレポートを生成できます。
主な機能
- 01プルリクエスト処理のリスク検出
- 02スクリプト注入と秘密情報の検出
- 03Actionの固定と権限の確認
- 04コンテナとランナーの露出監査
- 05SARIF・Markdownレポートの出力
活用シーン
- 01CIでワークフロー変更を検査
- 02リポジトリのサプライチェーンリスク確認
- 03コードスキャン用SARIF結果の作成
MCP 対応
`mcp.apify.com`を介したリモートMCPとして利用できます。READMEにはMCPツールや出力の詳細は記載されていません。
設定
リモートサーバーはインストール不要です。クライアントを選んで設定をコピーするか、ワンクリックで導入できます。
https://mcp.apify.com/?actors=zluowa~ghaguard-workflow-auditorclaude mcp add --transport http zluowa-gha-guard-actor https://mcp.apify.com/?actors=zluowa~ghaguard-workflow-auditor{"mcpServers":{"zluowa-gha-guard-actor":{"type":"http","url":"https://mcp.apify.com/?actors=zluowa~ghaguard-workflow-auditor"}}}Cursor で開く{"servers":{"zluowa-gha-guard-actor":{"type":"http","url":"https://mcp.apify.com/?actors=zluowa~ghaguard-workflow-auditor"}}}VS Code で開く{"mcpServers":{"zluowa-gha-guard-actor":{"type":"http","url":"https://mcp.apify.com/?actors=zluowa~ghaguard-workflow-auditor"}}}{"mcpServers":{"zluowa-gha-guard-actor":{"serverUrl":"https://mcp.apify.com/?actors=zluowa~ghaguard-workflow-auditor"}}}コマンドはターミナルで実行し、JSON は各クライアントの MCP 設定に貼り付けて再起動します。認可が必要なサーバーは初回接続時にログインを求めます。
ツール
詳細
GHAGuard — GitHub Actions セキュリティ&サプライチェーン監査ツール(v1.0.0)
.github/workflows/*.yml 向けの、依存関係ゼロで決定論的に動作する CI/CD セキュリティゲート — Pwn Request(pull_request_target)、スクリプトインジェクション、バージョンが固定されていないサードパーティ製アクション、過剰な GITHUB_TOKEN 権限、ハードコードされたシークレットを、1 秒未満で検出し、SARIF 2.1.0 および PR Markdown のスコアカードを出力します。
純粋な
node:24-alpineを基盤とする、インストール不要の CLI、GitHub Action、**Apify Store PPE Actor(zluowa/ghaguard-workflow-auditor)**として実行できます(RAM は128–256 MB、ヘッドレスブラウザー不要、LLM の幻覚も発生しません)。
30 秒で始める(npm install 不要)
1. 任意のローカルリポジトリを 1 つのコマンドで監査
# 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. すぐに使える GitHub Action(このリポジトリの 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/[email protected]
with:
target: '.'
strict-official: 'true'
sarif-file: 'ghaguard.sarif'
fail-on-findings: 'true'
実際のスキャン出力例(強化前と強化後)
脆弱な PR 自動化ワークフローの検出(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. |
このリポジトリ自体のスキャン(--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.
サプライチェーンと CI/CD に関する決定論的な 10 個のルール
| ルール | 重大度 | 検出対象 |
|---|---|---|
GHA001 | CRITICAL | pull_request_target と信頼されていない PR ヘッドのチェックアウト(head.sha、head.ref、refs/pull/.../merge)の組み合わせ — Pwn Request による RCE |
GHA002 | CRITICAL | ${{ github.event.issue.title / pr.body / comment.body / head_ref }} を run: に直接記述することによるシェルスクリプトインジェクション |
GHA003 | HIGH / MEDIUM | 40 文字のコミット SHA でバージョンが固定されていないサードパーティ製(および --strict-official を指定した場合は公式)Actions |
GHA004 | CRITICAL / HIGH / MEDIUM | permissions: write-all、複数のグローバルな書き込みスコープ、またはトップレベルの明示的な permissions: の欠落 |
GHA005 | CRITICAL | ワークフロー YAML 内のハードコードされた API キー、GitHub PAT、AWS キー、Stripe/Slack トークン、URL 認証情報 |
GHA006 | CRITICAL / HIGH | 検証されていない `curl |
GHA007 | HIGH | 外部からトリガー可能な pull_request/issue_comment イベントにさらされた self-hosted ランナー |
GHA008 | HIGH | 信頼されていないアーティファクトをダウンロードする、または workflow_run.head_sha をチェックアウトする、特権を持つ workflow_run |
GHA009 | HIGH | 信頼されていないイベント入力の GITHUB_ENV/GITHUB_PATH への直接リダイレクト |
GHA010 | MEDIUM / LOW | バージョンが固定されていないコンテナー/docker:// イメージ(:latest またはダイジェストの欠落)と timeout-minutes の欠落 |
Apify Cloud Actor & Remote MCP (mcp.apify.com)
Apify で zluowa/ghaguard-workflow-auditor として公開されています(イベントごとの従量課金、権限は限定的)。ローカル CLI と GitHub Action は引き続き無料です。
| アクション | PPE イベント | 価格(USD) | 機能 |
|---|---|---|---|
| (プラットフォーム起動) | apify-actor-start | $0.001 | 5 秒間の無料コンピューティング時間を有効にする、プラットフォームによる自動課金の起動イベントです(アクターのコードから手動で課金されることはありません)。 |
audit-workflow-bundle (メイン) | workflow-bundle-audit | $0.05 | githubRepo: "owner/repo" を渡すと、公開されている .github/workflows/*.yml をワンクリックでライブスキャンします(最大 25 ファイル、SSRF のホストを厳密に固定、404/429 の場合は課金なし)。または、オフラインのワークフローファイルを最大 100 個渡すと、0~100 のスコア、SARIF 2.1.0、Markdown を出力します。 |
audit-workflow | workflow-security-audit | $0.025 | 単一のワークフロー YAML ファイルを監査し、0~100 のセキュリティスコア、A~F のグレード、SARIF 2.1.0、Markdown を出力します。 |
{
"action": "audit-workflow-bundle",
"githubRepo": "Zluowa/gha-guard-actor",
"includeSarif": true,
"includeMarkdown": true
}
ローカル開発と検証
git clone https://github.com/Zluowa/gha-guard-actor.git
cd gha-guard-actor
npm test
node cli/ghaguard.mjs . --strict-official --markdown
コメント
AI アプリケーションが外部のツールやデータソースに統一的な方法で接続するためのオープンなプロトコルです。クライアントはモデルとの対話を担い、MCP サーバーはツール・リソース・プロンプトテンプレートを提供します。標準メッセージでやり取りするため、1 つのサーバーを複数のクライアントで再利用できます。