360 Secure SkillHub
360 安全技能中心

GitHub Actions Permission Scope Audit

核心功能:读取GitHub Actions工作流YAML,检测过宽权限授予、无明确权限策略、高危触发事件等风险,按规则标记警告/严重风险。典型场景:CI流水线权限合规检查、权限最小化治理。输入为可选配置参数(如工作流路径、输出格式、风险阈值等),输出支持文本/JSON,可设置发现严重风险时使任务失败,作为合规门禁。

daniellummis
daniellummis
热度 50.69
最近更新 2026-05-11 17:29:33
分类:安全依赖:代码执行 / 读写文件应用场景:DevOps / 报告撰写 / 工作流

安装技能

复制下面的话术发给你的 Agent,它会通过 secure-skills 检索并安装该技能。

执行命令安装此 skill: npx secure-skills-cli add github-actions-permission-scope-audit
Metadata
name
github-actions-permission-scope-audit
description
Audit GitHub Actions workflow permission scope drift to enforce least-privilege token access.
version
1.0.0
metadata
{"openclaw":{"requires":{"bins":["bash","python3"]}}}

GitHub Actions Permission Scope Audit

Use this skill to detect over-broad GITHUB_TOKEN permissions and scope drift across GitHub Actions workflows.

What this skill does

  • Reads workflow YAML files
  • Detects explicit broad permission grants (write-all, contents: write, etc.)
  • Flags risky patterns like pull_request_target workflows with write permissions
  • Identifies workflows with no explicit permissions policy
  • Emits text or JSON for CI triage and policy gates

Inputs

Optional:

  • WORKFLOW_GLOB (default: .github/workflows/*.y*ml)
  • TOP_N (default: 20)
  • OUTPUT_FORMAT (text or json, default: text)
  • WARN_SCORE (default: 2)
  • CRITICAL_SCORE (default: 5)
  • FLAG_MISSING_PERMISSIONS (0 or 1, default: 1)
  • FLAG_WRITE_ALL (0 or 1, default: 1)
  • FLAG_WRITE_SCOPES (0 or 1, default: 1)
  • WORKFLOW_FILE_MATCH / WORKFLOW_FILE_EXCLUDE (regex, optional)
  • EVENT_MATCH / EVENT_EXCLUDE (regex, optional)
  • PERMISSION_MATCH / PERMISSION_EXCLUDE (regex, optional)
  • FAIL_ON_CRITICAL (0 or 1, default: 0)

Run

Text report:

WORKFLOW_GLOB='.github/workflows/*.yml' \
bash skills/github-actions-permission-scope-audit/scripts/permission-scope-audit.sh

JSON output + fail gate:

WORKFLOW_GLOB='.github/workflows/*.yml' \
OUTPUT_FORMAT=json \
FAIL_ON_CRITICAL=1 \
bash skills/github-actions-permission-scope-audit/scripts/permission-scope-audit.sh

Run against bundled fixtures:

WORKFLOW_GLOB='skills/github-actions-permission-scope-audit/fixtures/*.yml' \
bash skills/github-actions-permission-scope-audit/scripts/permission-scope-audit.sh

Output contract

  • Exit 0 in report mode (default)
  • Exit 1 when FAIL_ON_CRITICAL=1 and one or more workflows are critical
  • Text mode prints summary + ranked workflows
  • JSON mode prints summary + ranked workflows + critical workflows