huawei-cloud-skill-audit
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseHuawei Cloud Skill Audit
华为云技能审计
Two-check security pipeline for auditing Huawei Cloud skills — security gate.
用于审计华为云技能的双检查安全管道——安全门禁。
Overview
概述
Scan a single Huawei Cloud skill directory or a folder of skills, run two security gates, and generate a structured report with issue details and fix strategies.
Two checks:
| # | Tool | Check Content | Implementation |
|---|---|---|---|
| 1 | skillspector | AI skill security scanner: 47 rules / 439 patterns across 17 categories (prompt injection, data exfiltration, privilege escalation, supply chain, behavioral AST, taint tracking, MCP analysis, YARA) | Built-in (pure Python, 47 rules + AST analysis) |
| 2 | gitleaks | Credential leak scan: 222 rules detecting hardcoded API keys, passwords, private keys, tokens, and 800+ credential formats | Built-in (pure Python, 222 rules + Shannon entropy) |
扫描单个华为云技能目录或技能文件夹,运行两道安全门禁,并生成包含问题详情与修复策略的结构化报告。
两项检查:
| # | 工具 | 检查内容 | 实现方式 |
|---|---|---|---|
| 1 | skillspector | AI技能安全扫描器:覆盖17个类别的47条规则/439种模式(提示注入、数据泄露、权限提升、供应链、行为AST、污点追踪、MCP分析、YARA) | 内置(纯Python,47条规则+AST分析) |
| 2 | gitleaks | 凭证泄露扫描:222条规则,检测硬编码API密钥、密码、私钥、令牌及800+种凭证格式 | 内置(纯Python,222条规则+香农熵) |
Prerequisites
前置条件
- Python 3.10+ — for the built-in skillspector and gitleaks checks
- Node.js + npx — Optional; only needed for manual during remediation
markdownlint-cli2 --fix - hcloud CLI — For Huawei Cloud service verification (optional, used in verification only)
- Huawei Cloud AK/SK — Not required for audit itself, but needed if verifying skill functionality after audit
skillspector and gitleaks are built-in (pure Python) — no external binary or pip install needed. External binaries are used as fallback if available on PATH.
To skip fallback auto-install of external binaries, use flag.
--no-install- Python 3.10+ — 用于内置的skillspector和gitleaks检查
- Node.js + npx — 可选;仅在修复期间手动执行时需要
markdownlint-cli2 --fix - hcloud CLI — 用于华为云服务验证(可选,仅在验证阶段使用)
- 华为云AK/SK — 审计本身不需要,但如果在审计后验证技能功能则需要
skillspector和gitleaks为内置(纯Python)——无需外部二进制文件或pip安装。如果PATH中存在外部二进制文件,会将其作为回退选项使用。
要跳过外部二进制文件的自动回退安装,使用参数。
--no-installWorkflow
工作流程
Input (skill path or folder)
│
├── Discover Skills ──── Find SKILL.md in target or subdirectories
│
├── Run Two Checks ────
│ 1. skillspector → AI security scan (47 rules, 439 patterns)
│ 2. gitleaks → Credential leak detection
│
├── Build Report ────
│ Section 1: Scanned Skills
│ Section 2: Issue Summary (by severity)
│ Section 3: Issue Details (per-issue)
│ Section 4: Fix Strategies (per rule/category)
│
└── Gate Verdict ──── PASS or FAILInput (skill path or folder)
│
├── Discover Skills ──── Find SKILL.md in target or subdirectories
│
├── Run Two Checks ────
│ 1. skillspector → AI security scan (47 rules, 439 patterns)
│ 2. gitleaks → Credential leak detection
│
├── Build Report ────
│ Section 1: Scanned Skills
│ Section 2: Issue Summary (by severity)
│ Section 3: Issue Details (per-issue)
│ Section 4: Fix Strategies (per rule/category)
│
└── Gate Verdict ──── PASS or FAILScan Levels
扫描级别
| Level | Analyzers | Speed | Use Case |
|---|---|---|---|
| CRITICAL severity rules only (P5 harmful content) | Fast | Strictest gate, default |
| CRITICAL + ERROR severity rules | Fast | Block high-risk issues |
| Pattern matching only (all static regex rules) | Fast | Quick pre-commit check |
| All static analyzers (quick + AST + taint tracking) | Medium | CI/CD gate |
| Standard + MCP analysis (least privilege, tool poisoning, rug pull) | Slower | Pre-release full audit |
Severity filtering applies only to SkillSpector. gitleaks always reports all findings regardless of scan level.
| 级别 | 分析器 | 速度 | 使用场景 |
|---|---|---|---|
| 仅CRITICAL severity规则(P5有害内容) | 快 | 最严格的门禁,默认选项 |
| CRITICAL + ERROR severity规则 | 快 | 拦截高风险问题 |
| 仅模式匹配(所有静态正则规则) | 快 | 快速预提交检查 |
| 所有静态分析器(quick + AST + 污点追踪) | 中等 | CI/CD门禁 |
| Standard + MCP分析(最小权限、工具投毒、rug pull) | 较慢 | 发布前全面审计 |
Severity过滤仅适用于SkillSpector。无论扫描级别如何,gitleaks都会报告所有检测结果。
KooCLI Command Format Standard
KooCLI命令格式标准
This skill does not directly invoke CLI commands. It audits skill directories locally. However, when verifying a skill's functionality after audit, the standard KooCLI format applies:
hcloudbash
hcloud <Service> <Operation> --cli-region=<region> [--key=value ...]本技能不直接调用 CLI命令。它在本地审计技能目录。不过,在审计后验证技能功能时,需遵循标准KooCLI格式:
hcloudbash
hcloud <Service> <Operation> --cli-region=<region> [--key=value ...]Core Commands
核心命令
Scan a single skill
扫描单个技能
bash
python3 scripts/skill_audit.py --target /path/to/my-skillbash
python3 scripts/skill_audit.py --target /path/to/my-skillScan a folder of skills
扫描技能文件夹
bash
python3 scripts/skill_audit.py --target /path/to/skills-folderbash
python3 scripts/skill_audit.py --target /path/to/skills-folderScan with specific level
指定扫描级别进行扫描
bash
python3 scripts/skill_audit.py --target /path/to/skills --scan-level quickbash
python3 scripts/skill_audit.py --target /path/to/skills --scan-level quickSelective check execution
选择性执行检查
bash
python3 scripts/skill_audit.py --target /path/to/skills --checks skillspector
python3 scripts/skill_audit.py --target /path/to/skills --skip-checks gitleaksbash
python3 scripts/skill_audit.py --target /path/to/skills --checks skillspector
python3 scripts/skill_audit.py --target /path/to/skills --skip-checks gitleaksRun with custom tool paths
使用自定义工具路径运行
bash
python3 scripts/skill_audit.py \
--target /path/to/skill-or-folder \
--scan-level standard \
--skillspector /path/to/skillspector \
--gitleaks /path/to/gitleaks \
--node-bin /opt/nvm/versions/node/v18.20.8/binAvailable values: (default), , , , .
Available : , .
Use to exclude specific checks.
--scan-levelcriticalhighquickstandarddeep--checksskillspectorgitleaks--skip-checksbash
python3 scripts/skill_audit.py \
--target /path/to/skill-or-folder \
--scan-level standard \
--skillspector /path/to/skillspector \
--gitleaks /path/to/gitleaks \
--node-bin /opt/nvm/versions/node/v18.20.8/bin可用的值:(默认)、、、、。
可用的:、。
使用排除特定检查。
--scan-levelcriticalhighquickstandarddeep--checksskillspectorgitleaks--skip-checksParameter Confirmation
参数确认
| Parameter | Required | Description | Example |
|---|---|---|---|
| Yes | Single skill dir or parent folder of skills | |
| No | Report output directory (default: parent of target) | |
| No | Scan depth: critical/high/quick/standard/deep (default: critical) | |
| No | Comma-separated checks to run (default: all);可用值仅 | |
| No | SkillSpector binary path override | |
| No | gitleaks binary path override | |
| No | Comma-separated checks to skip;与 | |
| No | Skip auto-install of tools | |
| 参数 | 是否必填 | 描述 | 示例 |
|---|---|---|---|
| 是 | 单个技能目录或技能父文件夹 | |
| 否 | 报告输出目录(默认:目标路径的父目录) | |
| 否 | 扫描深度:critical/high/quick/standard/deep(默认:critical) | |
| 否 | 要运行的检查(逗号分隔,默认:全部);可用值仅为 | |
| 否 | 覆盖SkillSpector二进制文件路径 | |
| 否 | 覆盖gitleaks二进制文件路径 | |
| 否 | 要跳过的检查(逗号分隔);与 | |
| 否 | 跳过工具自动安装 | |
Report Structure
报告结构
Report is saved as in the parent directory of the scanned path.
skill-gate-report-<timestamp>.txt| Input | Report saved to |
|---|---|
| |
| |
Four sections:
- Scanned Skills — list of all skills found
- Issue Summary — count by severity (CRITICAL/ERROR/WARNING) with rule breakdown (INFO excluded)
- Issue Details — per-issue: skill name, rule, line number, snippet, message
- Fix Strategies — actionable remediation for each unique rule/category
报告保存为,位于扫描路径的父目录中。
skill-gate-report-<timestamp>.txt| 输入路径 | 报告保存路径 |
|---|---|
| |
| |
包含四个部分:
- 已扫描技能 — 所有发现的技能列表
- 问题摘要 — 按严重程度(CRITICAL/ERROR/WARNING)统计的问题数量,包含规则细分(INFO级别除外)
- 问题详情 — 每个问题的技能名称、规则、行号、代码片段、提示信息
- 修复策略 — 针对每条独特规则/类别的可操作修复方案
Fix Strategies Reference
修复策略参考
skillspector
skillspector
| Rule | Fix |
|---|---|
| P1-P5 (Prompt Injection) | Do not embed user-controllable input in system prompts; use template variables with explicit escaping |
| E1-E4 (Data Exfiltration) | Remove external URLs; use env vars for API endpoints; restrict network access in tool definitions |
| PE1-PE3 (Privilege Escalation) | Avoid sudo/root commands; use capability-based permissions; do not disable security controls |
| AST1-AST3 (Behavioral AST) | Replace exec()/eval() with safer alternatives; use importlib with allowlists |
| YR1-YR4 (YARA) | Remove reverse shell/webshell patterns; move server functionality to separate controlled service |
| SC1-SC6 (Supply Chain) | Pin dependency versions with hashes; update vulnerable dependencies |
| LP1-LP4 (MCP Least Privilege) | Reduce MCP tool permissions to minimum required |
| TP1-TP4 (MCP Tool Poisoning) | Validate MCP tool metadata against manifest |
| 规则 | 修复方案 |
|---|---|
| P1-P5(提示注入) | 不要在系统提示中嵌入用户可控输入;使用带显式转义的模板变量 |
| E1-E4(数据泄露) | 移除外部URL;使用环境变量存储API端点;在工具定义中限制网络访问 |
| PE1-PE3(权限提升) | 避免使用sudo/root命令;使用基于能力的权限;不要禁用安全控制 |
| AST1-AST3(行为AST) | 用更安全的替代方案替换exec()/eval();使用带允许列表的importlib |
| YR1-YR4(YARA) | 移除反向shell/webshell模式;将服务器功能移至单独的受控服务 |
| SC1-SC6(供应链) | 使用哈希固定依赖版本;更新易受攻击的依赖 |
| LP1-LP4(MCP最小权限) | 将MCP工具权限降至所需最低水平 |
| TP1-TP4(MCP工具投毒) | 根据清单验证MCP工具元数据 |
gitleaks
gitleaks
| Rule | Fix |
|---|---|
| generic-api-key | Replace hardcoded API key/secret with |
| private-key | Remove hardcoded private key; load from file or secret manager at runtime; add key file to |
| (other rules) | Replace hardcoded credential with environment variable or secret manager reference; see https://gitleaks.io/docs/secrets |
| 规则 | 修复方案 |
|---|---|
| generic-api-key | 用 |
| private-key | 删除硬编码的私钥;在运行时从文件或密钥管理器加载;将密钥文件添加到 |
| (其他规则) | 用环境变量或密钥管理器引用替换硬编码凭证;详见https://gitleaks.io/docs/secrets |
Remediation Workflow (audit -> fix -> verify)
修复工作流程(审计 -> 修复 -> 验证)
After running the audit and getting a FAIL, follow this sequence:
- Fix issues by hand — Apply the fixes from the report's Fix Strategies section, or the skillspector/gitleaks rule tables above.
- Re-run the full audit to verify PASS.
Markdown style and SKILL.md spec issues are not audited by this skill; use external tools likeonly if you need to fix markdown style separately.markdownlint-cli2 --fix
运行审计并得到FAIL结果后,请遵循以下步骤:
- 手动修复问题 — 应用报告中修复策略部分的方案,或上述skillspector/gitleaks规则表格中的修复方法。
- 重新运行完整审计以验证是否通过。
本技能不审计Markdown格式和SKILL.md规范问题;如果需要单独修复Markdown格式,请使用等外部工具。markdownlint-cli2 --fix
CI/CD Integration
CI/CD集成
yaml
jobs:
skill-gate:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Run audit
run: python3 scripts/skill_audit.py --target . --output-dir .
- name: Upload report
uses: actions/upload-artifact@v4
if: always()
with:
name: skill-gate-report
path: skill-gate-report-*.txtyaml
jobs:
skill-gate:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Run audit
run: python3 scripts/skill_audit.py --target . --output-dir .
- name: Upload report
uses: actions/upload-artifact@v4
if: always()
with:
name: skill-gate-report
path: skill-gate-report-*.txtConfiguration Files
配置文件
The built-in checks use their bundled rule sets — no external config required:
- — skillspector rules (47 rules / 439 patterns)
scripts/checks/skillspector_rules.json - — gitleaks rules (222 rules)
scripts/checks/gitleaks_rules.json
.markdownlint.jsonskillcheck.toml内置检查使用捆绑的规则集——无需外部配置:
- — skillspector规则(47条规则/439种模式)
scripts/checks/skillspector_rules.json - — gitleaks规则(222条规则)
scripts/checks/gitleaks_rules.json
技能目录中附带的和不会被本审计工具使用;它们仅用于外部markdownlint/skillcheck工具。
.markdownlint.jsonskillcheck.tomlSecurity Scanning
安全扫描
Why skillspector static-only mode has limitations
为什么skillspector静态模式存在局限性
skillspector--no-llm| Analyzer | What it detects | What it MISSES in --no-llm mode |
|---|---|---|
| Pattern matching (P1-P5, E1-E4, PE1-PE3) | Prompt injection, data exfiltration, privilege escalation patterns | LLM-generated obfuscated variants |
| AST analysis (AST1-AST3) | exec()/eval() calls, dynamic imports | Runtime-evaluated strings |
| YARA rules (YR1-YR4) | Reverse shell, webshell patterns | Encoded/obfuscated payloads |
| Supply chain (SC1-SC6) | Vulnerable/pinned dependency issues | Transitive dependency exploits |
skillspector--no-llm| 分析器 | 检测内容 | --no-llm模式下遗漏的内容 |
|---|---|---|
| 模式匹配(P1-P5、E1-E4、PE1-PE3) | 提示注入、数据泄露、权限提升模式 | LLM生成的混淆变体 |
| AST分析(AST1-AST3) | exec()/eval()调用、动态导入 | 运行时评估的字符串 |
| YARA规则(YR1-YR4) | 反向shell、webshell模式 | 编码/混淆的payload |
| 供应链(SC1-SC6) | 易受攻击/固定依赖问题 | 传递依赖漏洞 |
Complementary tools
补充工具
| Tool | Detects | Install |
|---|---|---|
| skillspector (built-in, --no-llm) | Prompt injection, reverse shell, command injection, data exfiltration, privilege escalation, supply chain | Auto-installed |
| gitleaks (built-in) | 800+ credential types: API keys, passwords, private keys, tokens | Auto-installed |
| gitcode-security-scanner | Generic keyword credentials, Chinese keywords, SQL injection, debug leakage | From DTSE-SKILL repo |
Recommended: Run both AND for complete coverage.
huawei-cloud-skill-auditgitcode-security-scanner| 工具 | 检测内容 | 安装方式 |
|---|---|---|
| skillspector(内置,--no-llm) | 提示注入、反向shell、命令注入、数据泄露、权限提升、供应链 | 自动安装 |
| gitleaks(内置) | 800+种凭证类型:API密钥、密码、私钥、令牌 | 自动安装 |
| gitcode-security-scanner | 通用关键字凭证、中文关键字、SQL注入、调试信息泄露 | 来自DTSE-SKILL仓库 |
推荐:同时运行和以实现全面覆盖。
huawei-cloud-skill-auditgitcode-security-scannerOutput Format
输出格式
Report is a plain text file with four sections (Scanned Skills, Issue Summary, Issue Details, Fix Strategies) followed by a Gate Verdict (PASS/FAIL).
报告为纯文本文件,包含四个部分(已扫描技能、问题摘要、问题详情、修复策略),随后是门禁Verdict(PASS/FAIL)。
Verification Method
验证方法
Run audit
运行审计
bash
python3 scripts/skill_audit.py --target /path/to/skillbash
python3 scripts/skill_audit.py --target /path/to/skillVerify fix
验证修复
bash
undefinedbash
undefinedFix issues from the report's Fix Strategies section, then re-run audit
根据报告的修复策略部分修复问题,然后重新运行审计
python3 scripts/skill_audit.py --target /path/to/skill
undefinedpython3 scripts/skill_audit.py --target /path/to/skill
undefinedCheck gate verdict
检查门禁Verdict
bash
undefinedbash
undefinedGate Verdict: PASS = all checks passed
Gate Verdict: PASS = 所有检查通过
Gate Verdict: FAIL = one or more checks have issues
Gate Verdict: FAIL = 一项或多项检查存在问题
---
---Reference Documents
参考文档
- — IAM permissions required for skill audit
references/iam-policies.md - — Detailed verification procedures
references/verification-method.md - — Acceptance criteria for audit PASS
references/acceptance-criteria.md - — Security audit guide and fix strategies
references/security-audit-guide.md - — Complementary scanner usage guide
references/gitcode-security-scanner.md
- — 技能审计所需的IAM权限
references/iam-policies.md - — 详细验证流程
references/verification-method.md - — 审计通过的验收标准
references/acceptance-criteria.md - — 安全审计指南及修复策略
references/security-audit-guide.md - — 补充扫描器使用指南
references/gitcode-security-scanner.md
Best Practices
最佳实践
- Run audit before accepting any Huawei Cloud skill contribution
- Fix issues per the report's Fix Strategies, then always re-run full audit to verify PASS
- For large repos, scan individual skills one at a time to avoid huge reports
- Run both and
huawei-cloud-skill-auditfor complete security coveragegitcode-security-scanner
- 在接受任何华为云技能贡献前运行审计
- 根据报告的修复策略修复问题,然后始终重新运行完整审计以验证通过
- 对于大型仓库,逐个扫描单个技能以避免生成过大的报告
- 同时运行和
huawei-cloud-skill-audit以实现全面安全覆盖gitcode-security-scanner
Notes
注意事项
- 本 skill 仅生成审计报告和修复策略,不自动修改任何技能文件;修复由用户按报告 Fix Strategies 或 Remediation Workflow 手动执行,修复后需重新运行审计验证
- Two-check pipeline runs sequentially; each check is independent
- API endpoints are strictly prohibited from being inferred
- Credentials (AK/SK) are read from environment variables; hardcoding is prohibited
- If AK/SK is missing for post-audit verification, prompt the user; do not skip
- Resources created during testing must be tracked; output manual cleanup instructions if any remain
- INFO-level issues are excluded from the report; only CRITICAL/ERROR/WARNING appear
- gitleaks mode scans current file contents only, not git history
--no-git - gitleaks does not detect Chinese keyword credentials; use gitcode-security-scanner for those
- 本skill仅生成审计报告和修复策略,不自动修改任何技能文件;用户需根据报告中的Fix Strategies或Remediation Workflow手动执行修复,修复后需重新运行审计验证
- 双检查管道按顺序运行;每个检查相互独立
- 严格禁止推断API端点
- 凭证(AK/SK)从环境变量读取;禁止硬编码
- 如果审计后验证缺少AK/SK,需提示用户;不得跳过
- 必须跟踪测试期间创建的资源;如有剩余资源,需输出手动清理说明
- INFO级别的问题不包含在报告中;仅显示CRITICAL/ERROR/WARNING级别的问题
- gitleaks的模式仅扫描当前文件内容,不扫描git历史
--no-git - gitleaks不检测中文关键字凭证;请使用gitcode-security-scanner进行检测
Edge Cases
边缘场景
| Scenario | Handling |
|---|---|
| Skill directory does not exist | Report error and terminate |
| Target has no SKILL.md and no subdirs with SKILL.md | Report error: no skills found |
| Built-in rules file missing | Auto-download fallback binary (skillspector/gitleaks) |
| Python version < 3.12 | External skillspector binary not available; builtin still works |
| Large repo produces huge report | Scan individual skills; use head/tail to read summary |
| gitleaks false positive | Add to .gitleaksignore file |
| skillspector exit code 1 | Risk score > 50; treated as finding source, not hard failure |
| 场景 | 处理方式 |
|---|---|
| 技能目录不存在 | 报告错误并终止 |
| 目标路径中没有SKILL.md,且子目录中也没有SKILL.md | 报告错误:未找到技能 |
| 内置规则文件缺失 | 自动下载回退二进制文件(skillspector/gitleaks) |
| Python版本 < 3.12 | 无法使用外部skillspector二进制文件;内置版本仍可正常工作 |
| 大型仓库生成过大报告 | 逐个扫描单个技能;使用head/tail读取摘要 |
| gitleaks误报 | 添加到.gitleaksignore文件 |
| skillspector退出码为1 | 风险得分>50;视为检测到问题,而非严重故障 |
Design Principles
设计原则
- Two-Check Pipeline — Each check is independent and contributes to the overall gate verdict
- Auto-Install — Missing tools are installed automatically on first run
- Chain Verification — All enabled checks must pass for gate verdict PASS
- Agent-proof — Write operations require user confirmation; automatic gate bypassing is not allowed
- Data-Driven — Report is structured text with clear severity levels and fix strategies
- Batch Repeatable — Same skill can be audited repeatedly; --fresh resets
- Credential Security — No hardcoded AK/SK; read from environment variables
- Least Privilege — IAM policies follow minimum required permissions
- 双检查管道 — 每个检查相互独立,共同决定门禁Verdict
- 自动安装 — 首次运行时自动安装缺失的工具
- 链式验证 — 所有启用的检查必须通过才能获得PASS的门禁Verdict
- 防Agent绕过 — 写入操作需用户确认;不允许自动绕过门禁
- 数据驱动 — 报告为结构化文本,包含明确的严重级别和修复策略
- 可批量重复 — 同一技能可重复审计;--fresh参数可重置
- 凭证安全 — 无硬编码AK/SK;从环境变量读取
- 最小权限 — IAM策略遵循最小必要权限