快速代码安全审查 · 保守风险评估
简介
轻量级代码安全扫描工具,快速识别危险模式、硬编码凭据与风险权限,提供保守的风险评估与建议
原始描述
Security review workflow for OpenClaw skills and other small code folders. Use when auditing a skill before publishing or installing it, checking for dangero...
通过你的 Agent 添加
安装目录:security-scan/(目录名取自 SKILL.md 的 frontmatter name,不是 URL 里的 slug)。
点「快速安装」复制一段指令贴给你的 Agent:它会先下载到 /tmp、把文件清单和校验值给你看,你确认之后才解压安装。不会一步装完、也不改系统其它位置。
或者手动安装
包是「根级 SKILL.md + 作者附带的文件」,解压到上面的 <slug>/ 目录即可;
目录名不用换,也不要把包直接解压到 skills 根目录。
技能申请的权限由作者决定:装之前先看清单里有没有脚本、它会读写什么。
技能正文
name: security-scan
description: >
Rapid security scanning workflow for code changes. Activates a focused security sweep.
Activate when: security scan, scan for vulnerabilities, check for secrets,
security check, run security audit, check deps.
argument-hint: "[path or scope to scan — defaults to recent git changes]"
Security Scan
Rapid security sweep for code changes. Faster than a full /review — focused on security only.
When to Use
- Before committing code that touches auth, user input, data storage, or external APIs
- After adding new dependencies
- Quick pre-PR security gate
Scan Protocol
Step 1: Determine Scope
# Default: scan recent changes
git diff --name-only HEAD~1
# Or use provided path
Step 2: Secrets Scan
Step 1: Determine Scope
# Default: scan recent changes
git diff --name-only HEAD~1
# Or use provided path
# Scan for common secret patterns
grep -rn --include="*.{ts,js,py,go,rs,java,cs,yaml,json,env,sh,toml}" \
-e "sk-[A-Za-z0-9]\{32,\}" \
-e "ghp_[A-Za-z0-9]\{36\}" \
-e "AKIA[0-9A-Z]\{16\}" \
-e "api.key\s*=\s*['\"][^'\"]\{8,\}" \
-e "password\s*=\s*['\"][^'\"]\{4,\}" \
-e "secret\s*=\s*['\"][^'\"]\{8,\}" \
.
# Check .env is in .gitignore
cat .gitignore | grep -E "\.env$|\.env\."
CRITICAL: Any match in committed code = immediate blocker.
Step 3: Dependency Audit
Run language-appropriate audit:
# Node.js
npm audit --audit-level=high
# Python
pip-audit # or: safety check
# Rust
cargo audit
# Go
govulncheck ./...
# Java/Maven
mvn dependency-check:check
Report: Count of critical/high severity CVEs and their package names.
Step 4: Input Validation Spot-Check
For changed files that handle user input (API endpoints, form handlers, CLI args):
- Is input validated/sanitized before use?
- Are SQL queries parameterized (no string concatenation)?
- Is HTML output escaped before rendering?
- Are file paths sanitized (no
../traversal)?
Step 5: Auth/Authz Quick Check
For changed files touching auth:
- Is authentication checked BEFORE authorization?
- Are authorization checks on EVERY relevant endpoint?
- Are JWT tokens validated (algorithm + signature + expiry)?
- Are session cookies
HttpOnly; Secure; SameSite=Strict?
Output Format
## Security Scan Report
**Scope:** [files scanned]
**Date:** [timestamp]
### Secrets
- [ ] No hardcoded secrets found
- ⚠ Found: [file:line — description]
### Dependencies
- Critical CVEs: X
- High CVEs: Y
- Packages: [list if any]
### Input Validation
- [ ] User inputs sanitized in changed files
- ⚠ Risk: [file:line — description]
### Auth
- [ ] Auth/authz checks present on relevant routes
- ⚠ Risk: [file:line — description]
### Verdict
CLEAN / NEEDS ATTENTION / BLOCKER
### Next Steps
- [Action items with file:line references]
Severity Quick Reference
Finding
Severity
Action
Hardcoded secret in committed file
CRITICAL
Rotate key + remove from history
Critical CVE in direct dependency
HIGH
Update package immediately
SQL injection risk
CRITICAL
Parameterize query before PR
Missing auth check on endpoint
HIGH
Add before PR
High CVE in transitive dependency
MEDIUM
Track in backlog
HTTP instead of HTTPS
MEDIUM
Enforce HTTPS redirect
See Also
@security-reviewer — comprehensive OWASP Top 10 security review
/review — full code review including security
/coding-standards — baseline code quality rules
## Security Scan Report
**Scope:** [files scanned]
**Date:** [timestamp]
### Secrets
- [ ] No hardcoded secrets found
- ⚠ Found: [file:line — description]
### Dependencies
- Critical CVEs: X
- High CVEs: Y
- Packages: [list if any]
### Input Validation
- [ ] User inputs sanitized in changed files
- ⚠ Risk: [file:line — description]
### Auth
- [ ] Auth/authz checks present on relevant routes
- ⚠ Risk: [file:line — description]
### Verdict
CLEAN / NEEDS ATTENTION / BLOCKER
### Next Steps
- [Action items with file:line references]
| Finding | Severity | Action |
|---|---|---|
| Hardcoded secret in committed file | CRITICAL | Rotate key + remove from history |
| Critical CVE in direct dependency | HIGH | Update package immediately |
| SQL injection risk | CRITICAL | Parameterize query before PR |
| Missing auth check on endpoint | HIGH | Add before PR |
| High CVE in transitive dependency | MEDIUM | Track in backlog |
| HTTP instead of HTTPS | MEDIUM | Enforce HTTPS redirect |
See Also
@security-reviewer — comprehensive OWASP Top 10 security review
/review — full code review including security
/coding-standards — baseline code quality rules
@security-reviewer — comprehensive OWASP Top 10 security review/review — full code review including security/coding-standards — baseline code quality rules