用途 skill-safety-scanner 用于在发布任何 Agent Skill 之前,对其目录进行本地安全检查。它可以在正式提交发布前预览目录安全检查会发现的内容,帮助提前识别并修复安全问题,也可作为 CI/CD 流程的一部分使用。
主要能力 该扫描器检测以下内容:
密钥:硬编码的 API key、token、密码、私钥。
危险代码:eval()、exec()、命令注入、XSS 模式。
权限:所需的能力,例如文件系统、网络、子进程等。
使用方式 可以对指定目录运行扫描。示例指令为:Scan the skill at /path/to/my-skill for safety issues。
获取详细输出:
python3 safety_scan.py /path/to/my-skill --verbose
获取用于 CI 集成的 JSON 输出:
python3 safety_scan.py /path/to/my-skill --json
输出示例
Safety Scan Report Skill: my-skill Grade: B (85/100)
Scores: Secrets: 100/100 Dangerous Code: 70/100
Permissions Detected: - filesystem - network
Findings (1): [medium] Potential command injection File: scripts/main.py:42 Code: subprocess.run(cmd, shell=True)
Recommendation: Review the finding above before publishing.
示例 基础扫描:
User: Scan my skill at ./document-tools for safety issues Agent: Running safety scan on ./document-tools...
Grade: A (95/100)
No critical issues found.
发现密钥:
User: Check ./my-api-client for security issues Agent: Running safety scan...
Grade: F (0/100)
Findings:
[critical] Hardcoded API key detected
File: config.py:5
Code: API_KEY = "sk-ant-..."
You must remove this secret before publishing.
适用场景 在提交 Skill 进行发布之前。
预览目录安全检查将发现的内容。
尽早识别并修复安全问题。
作为 CI/CD 流程的一部分。
限制 不扫描依赖(需另行使用 npm audit / pip-audit)。
基于模式的检测可能产生误报。
无法检测所有安全问题(不能替代安全审查)。
仅扫描本地文件(不支持 GitHub URL)。
依赖 Python 3.9+。
无外部依赖(使用 Python 标准库)。