Skill Shield v0.6.1 — Security Auditor
Scan any skill directory for permissions and dangerous patterns. Get a safety rating before you install.
Usage
Run the scanner on a skill directory:
CODEBLOCK0
SARIF Output (GitHub Code Scanning)
CODEBLOCK1
Output
The script prints two blocks to stdout:
- 1. A JSON report (between
--- JSON START --- and --- JSON END --- markers) - A Markdown report (between
--- MD START --- and --- MD END --- markers)
Save reports to files
CODEBLOCK2
This creates report.json and report.md in the output directory.
Safety Ratings
| Grade | Meaning | Action |
|---|
| A | Safe | Install freely |
| B |
Low risk | Minor concerns, generally safe |
| C | Needs review | Review flagged patterns before installing |
| D | High risk | Significant dangerous patterns detected |
| F | Dangerous | Do not install without thorough manual review |
Detection Capabilities (65 patterns, 11 categories)
- - File deletion: rm -rf, shred, unlink, rmtree, rimraf, del /f (7 patterns)
- Network exfiltration: curl POST, wget --post, requests.post, fetch POST, netcat reverse shell, DNS exfil, pipe to curl, socat (9 patterns)
- Environment variable access: process.env, os.environ, .env files, printenv (5 patterns)
- Secret/key access: .ssh/, .gnupg/, private keys, wallets, tokens, passwords, keychain, cloud credentials (8 patterns)
- Privilege escalation: sudo, su, chmod 777, chown, setuid/setgid, doas (6 patterns)
- Code execution: eval, exec(), Function(), child_process, subprocess, os.system, os.popen, compile (8 patterns)
- Data collection: /etc/passwd, /etc/shadow, whoami, hostname, ifconfig, /proc/self (6 patterns)
- Persistence: crontab, systemd, rc.local, shell profile modification, autostart (5 patterns)
- Obfuscation: long base64 strings, hex escapes, charCode, base64 decode, string reversal (5 patterns)
- Cryptocurrency/mining: xmrig/minerd, mining pool URLs, wallet addresses (3 patterns)
- Shell injection: backtick execution, pipe to shell, download-and-execute (3 patterns)
Key Features
Permission Declaration Audit (unique to skill-shield)
Compares tools declared in SKILL.md against tools actually used in code. Reports:
- - Undeclared permissions with sensitivity scoring (1-5)
- Unused declared permissions
- Declaration coverage ratio
- Per-tool risk recommendations
Anti-Obfuscation Analysis
Automatically decodes base64 and hex-encoded content, then re-scans decoded output for dangerous patterns. Obfuscated findings receive elevated severity.
Context-Aware False Positive Reduction
- - Comments and docstrings: severity reduced by 2
- Markdown code blocks in SKILL.md: severity reduced by 2 (examples, not real code)
- Pattern definition lines in scanner source: skipped entirely
- Original vs adjusted severity shown in reports (e.g., "Low (2←4)")
CWE References
Every detection pattern includes a CWE (Common Weakness Enumeration) reference for professional vulnerability classification.
v0.6.0 — Batch Scan Mode
Batch Scanning
Scan all skills in a directory at once with
--batch:
CODEBLOCK3
Performance
- - Skips venv/node_modules/dist/.git directories automatically
- Caps at 200 script files per skill for safety
- 164 skills scanned in ~8 seconds
Output
- - Markdown table with summary stats and per-skill ratings (default)
- JSON summary with
--json-summary flag for machine consumption - Writes
batch-summary.json when using INLINECODE9
v0.5.0 — SARIF Output Format
GitHub Code Scanning Integration
Use
--sarif flag to output SARIF 2.1.0 format, compatible with:
- - GitHub Code Scanning (upload-sarif action)
- VS Code SARIF Viewer extension
- SARIF Web Viewer
CODEBLOCK4
SARIF Features
- - Full rule definitions for all 65 detection patterns
- CWE taxonomy references (MITRE CWE 4.14)
- Partial fingerprints for deduplication across runs
- Security severity scores (2.0-10.0 scale)
- Skill-shield metadata in run properties (ratings, recommendation)
v0.4.0 — Security Tool False Positive Fix
String Literal Context Detection
Regex patterns and string constants inside security tools (scanners, auditors) are no longer flagged as dangerous code. The scanner now recognizes when a pattern like
rm -rf or
curl POST appears inside a string literal (quotes, regex, array) and reduces severity accordingly.
Ignore-Next-Line Support
Add
# skill-shield: ignore-next-line above any line to suppress the next finding. Useful for known-safe patterns in security tools.
Results
- - 5 security audit tools reclassified from F to A/C/D (agents-skill-security-audit, ai-skill-scanner, skulk-skill-scanner, aoi-prompt-injection-sentinel, aoi-sandbox-shield-lite)
- 0 regressions on known-safe skills
v0.3.0 — Dual Rating System
Security Rating (code safety)
Based purely on dangerous code patterns found in executable files. Not affected by permission declarations.
Compliance Rating (documentation quality)
Based on permission declaration completeness: does SKILL.md declare the tools actually used in code?
Recommendation
Combines both ratings into an actionable recommendation:
- - install — Security A/B + Compliance A/B
- installwithreview — Code is safe but permissions undeclared (likely poor docs, not malicious)
- reviewrequired — Security patterns flagged
- donotinstall — Significant security concerns
- documentationonly — No executable code (pure SKILL.md guidance)
False Positive Fixes (v0.3.0)
- - JS template literals (backticks) no longer flagged as shell execution
- Variable names (hostname, whoami) no longer flagged as commands
- Shell script normal $VAR usage no longer floods findings
- INLINECODE14 /
process.env.KEY reduced severity (standard practice) - INLINECODE16 (browser flag) reduced severity
- Documentation-only skills marked as N/A instead of getting A rating
Exit Codes
| Code | Ratings | Meaning |
|---|
| 0 | A, B | Safe to install |
| 1 |
C, D | Review recommended |
| 2 | F | Do not install |
Support
Tips welcome: 0x6c730bDcfC762e23cE53aD991B75ab9852e87806 (Base)
Moltbook: https://www.moltbook.com/u/Yuqian
Twitter: @Yuqian0202
Skill Shield v0.6.1 — 安全审计工具
扫描任意技能目录,检查权限和危险模式。在安装前获取安全评级。
使用方法
对技能目录运行扫描器:
bash
python3 scripts/scan.py /path/to/skill-directory
SARIF 输出(GitHub 代码扫描)
bash
python3 scripts/scan.py /path/to/skill-directory --sarif
输出结果
脚本会在标准输出中打印两个区块:
- 1. JSON 报告(位于 --- JSON START --- 和 --- JSON END --- 标记之间)
- Markdown 报告(位于 --- MD START --- 和 --- MD END --- 标记之间)
将报告保存到文件
bash
python3 scripts/scan.py /path/to/skill-directory --output-dir /path/to/output
这会在输出目录中创建 report.json 和 report.md 文件。
安全评级
低风险 | 轻微问题,总体安全 |
| C | 需审查 | 安装前需审查标记的模式 |
| D | 高风险 | 检测到显著的危险模式 |
| F | 危险 | 未经彻底人工审查请勿安装 |
检测能力(65种模式,11个类别)
- - 文件删除:rm -rf、shred、unlink、rmtree、rimraf、del /f(7种模式)
- 网络外传:curl POST、wget --post、requests.post、fetch POST、netcat 反向 shell、DNS 外传、管道至 curl、socat(9种模式)
- 环境变量访问:process.env、os.environ、.env 文件、printenv(5种模式)
- 密钥/凭证访问:.ssh/、.gnupg/、私钥、钱包、令牌、密码、钥匙串、云凭证(8种模式)
- 权限提升:sudo、su、chmod 777、chown、setuid/setgid、doas(6种模式)
- 代码执行:eval、exec()、Function()、child_process、subprocess、os.system、os.popen、compile(8种模式)
- 数据收集:/etc/passwd、/etc/shadow、whoami、hostname、ifconfig、/proc/self(6种模式)
- 持久化:crontab、systemd、rc.local、shell 配置文件修改、自启动(5种模式)
- 混淆:长 base64 字符串、十六进制转义、charCode、base64 解码、字符串反转(5种模式)
- 加密货币/挖矿:xmrig/minerd、矿池 URL、钱包地址(3种模式)
- Shell 注入:反引号执行、管道至 shell、下载并执行(3种模式)
主要特性
权限声明审计(skill-shield 独有)
比较 SKILL.md 中声明的工具与代码中实际使用的工具。报告内容包括:
- - 未声明的权限及其敏感度评分(1-5分)
- 已声明但未使用的权限
- 声明覆盖率
- 每项工具的风险建议
反混淆分析
自动解码 base64 和十六进制编码的内容,然后对解码后的输出重新扫描危险模式。混淆后的发现结果将获得更高的严重等级。
上下文感知的误报减少
- - 注释和文档字符串:严重等级降低2级
- SKILL.md 中的 Markdown 代码块:严重等级降低2级(示例,非实际代码)
- 扫描器源码中的模式定义行:完全跳过
- 报告中显示原始等级与调整后等级(例如,低(2←4))
CWE 参考
每个检测模式都包含 CWE(通用弱点枚举)参考,用于专业的漏洞分类。
v0.6.0 — 批量扫描模式
批量扫描
使用 --batch 参数一次性扫描目录中的所有技能:
bash
python3 scripts/scan.py /path/to/skills/ --batch
python3 scripts/scan.py /path/to/skills/ --batch --json-summary
python3 scripts/scan.py /path/to/skills/ --batch --json-summary -o /path/to/output
性能
- - 自动跳过 venv/node_modules/dist/.git 目录
- 每个技能最多扫描200个脚本文件以确保安全
- 约8秒内可扫描164个技能
输出
- - Markdown 表格,包含摘要统计和每个技能的评级(默认)
- 使用 --json-summary 标志输出 JSON 摘要,便于机器处理
- 使用 -o 参数时写入 batch-summary.json 文件
v0.5.0 — SARIF 输出格式
GitHub 代码扫描集成
使用 --sarif 标志输出 SARIF 2.1.0 格式,兼容:
- - GitHub 代码扫描(upload-sarif 操作)
- VS Code SARIF 查看器扩展
- SARIF Web 查看器
bash
python3 scripts/scan.py /path/to/skill --sarif > report.sarif
python3 scripts/scan.py /path/to/skill --sarif -o /path/to/output
SARIF 特性
- - 所有65种检测模式的完整规则定义
- CWE 分类法参考(MITRE CWE 4.14)
- 部分指纹用于跨运行去重
- 安全严重性评分(2.0-10.0 分制)
- 运行属性中的 skill-shield 元数据(评级、建议)
v0.4.0 — 安全工具误报修复
字符串字面量上下文检测
安全工具(扫描器、审计器)中的正则表达式模式和字符串常量不再被标记为危险代码。扫描器现在能够识别 rm -rf 或 curl POST 等模式出现在字符串字面量(引号、正则表达式、数组)中的情况,并相应降低严重等级。
忽略下一行支持
在任意行上方添加 # skill-shield: ignore-next-line 可抑制下一个发现结果。适用于安全工具中已知安全的模式。
结果
- - 5个安全审计工具从 F 级重新分类为 A/C/D 级(agents-skill-security-audit、ai-skill-scanner、skulk-skill-scanner、aoi-prompt-injection-sentinel、aoi-sandbox-shield-lite)
- 已知安全技能无回归问题
v0.3.0 — 双重评级系统
安全评级(代码安全性)
仅基于可执行文件中发现的危险代码模式。不受权限声明影响。
合规评级(文档质量)
基于权限声明的完整性:SKILL.md 是否声明了代码中实际使用的工具?
建议
将两个评级结合为可操作的建议:
- - install — 安全等级 A/B + 合规等级 A/B
- installwithreview — 代码安全但权限未声明(可能是文档不完善,而非恶意)
- reviewrequired — 标记了安全模式
- donotinstall — 存在显著安全问题
- documentationonly — 无可执行代码(纯 SKILL.md 指导)
误报修复(v0.3.0)
- - JS 模板字面量(反引号)不再被标记为 shell 执行
- 变量名(hostname、whoami)不再被标记为命令
- Shell 脚本中的普通 $VAR 用法不再产生大量发现
- os.environ.get(KEY) / process.env.KEY 降低严重等级(标准做法)
- --disable-setuid-sandbox(浏览器标志)降低严重等级
- 纯文档技能标记为 N/A,而非获得 A 评级
退出代码
C、D | 建议审查 |
| 2 | F | 请勿安装 |
支持
欢迎打赏:0x6c730bDcfC762e23cE53aD991B75ab9852e87806(Base 链)
Moltbook:https://www.moltbook.com/u/Yuqian
Twitter:@Yuqian0202