协作头脑风暴
brainstorming
在实现前澄清需求、探索设计选择,并形成清晰的开发方向。
flaw0【开发与工程】Security and vulnerability scanner for OpenClaw code, plugins, skills, and Node.js dependencies. Powered by OpenClaw AI models.
独立 GitHub 快照 · 自动分类 · 以原作者文档为准
name: flaw0 description: Security and vulnerability scanner for OpenClaw code, plugins, skills, and Node.js dependencies. Powered by OpenClaw AI models. version: 1.0.0 author: Tom homepage: https://github.com/yourusername/flaw0 license: MIT metadata: openclaw: emoji: "🔍" category: "security" tags:
Security and vulnerability scanner for OpenClaw ecosystems. Analyzes source code, plugins, skills, and Node.js dependencies to detect potential security flaws.
Goal: Achieve flaw 0 (zero flaws detected) 🎯
Install this skill via ClawHub:
npx clawhub@latest install flaw0
Or install globally via npm:
npm install -g flaw0
Use flaw0 to ensure your OpenClaw code and dependencies are secure:
# Check a skill before installing
flaw0 scan ~/.openclaw/skills/new-skill
# Scan your code as you develop
flaw0 scan src/
# Check dependencies
flaw0 deps
# Full security audit
flaw0 audit
# Scan all OpenClaw components
flaw0 scan --target all
# Check specific components
flaw0 scan --target skills
flaw0 scan --target plugins
flaw0 scan --target core
# Scan current directory
flaw0 scan
# Scan specific directory
flaw0 scan /path/to/code
# Use specific AI model
flaw0 scan --model claude-opus-4-6
# Quick dependency scan
flaw0 deps
# Deep scan (entire dependency tree)
flaw0 deps --deep
# Comprehensive scan (code + dependencies)
flaw0 audit
# Save report to file
flaw0 audit --output report.json
# JSON output for CI/CD
flaw0 audit --json
# Scan OpenClaw core
flaw0 scan --target core
# Scan all plugins
flaw0 scan --target plugins
# Scan all skills
flaw0 scan --target skills
# Scan everything
flaw0 scan --target all
Command Injection
exec() with unsanitized inputCode Injection
eval() usageFunction() constructor with stringsSQL Injection
Cross-Site Scripting (XSS)
innerHTML assignmentsdangerouslySetInnerHTML usagePath Traversal
readFile() with user inputHardcoded Secrets
Weak Cryptography
Insecure Randomness
Math.random() for security operationsUnsafe Deserialization
JSON.parse() without validationMissing Authentication
Results are reported with a flaw score - lower is better:
Each issue is weighted by severity:
Total flaw score = sum of all weighted issues (rounded)
🔍 flaw0 Security Scan Results
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
📊 Result: flaw 0
✅ Status: SECURE
✓ No security issues detected!
✓ All checks passed
Great job! 🎉
🔍 flaw0 Security Scan Results
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
📊 Result: flaw 12
⚠️ Status: ISSUES FOUND
Code Flaws: 5
├─ 🔴 Critical: 2
├─ 🟠 High: 1
├─ 🟡 Medium: 2
└─ ⚪ Low: 0
Dependency Flaws: 7
├─ 🔴 Critical CVEs: 3
├─ 🟠 High CVEs: 2
├─ 🟡 Medium: 2
└─ ⚪ Low: 0
Detailed Report:
─────────────────────────────────
1. [CRITICAL] Command Injection
Location: src/executor.js:78
Code: `exec(\`ls ${userInput}\`)`
Description: Unsanitized exec() call
→ Fix: Use execFile() or validate input
🤖 AI Confidence: high
💡 AI Suggestion: Replace exec() with execFile()
and validate input against whitelist
2. [HIGH] Hardcoded API Key
Location: config/api.js:5
Code: `const API_KEY = "sk-1234..."`
Description: API key exposed in source code
→ Fix: Use process.env.API_KEY
3. [CRITICAL] CVE-2024-12345 in lodash@4.17.19
Package: lodash@4.17.19
Description: Prototype pollution vulnerability
→ Fix: npm install lodash@4.17.21
...
flaw0 uses OpenClaw's AI models for intelligent code review:
flaw0 scan --model claude-sonnet-4-5
flaw0 scan --model claude-opus-4-6
flaw0 scan --model claude-haiku-4-5
flaw0 init
This creates .flaw0rc.json:
{
"severity": {
"failOn": "high",
"ignore": ["low"]
},
"targets": {
"code": true,
"dependencies": true,
"devDependencies": false
},
"exclude": [
"node_modules/**",
"test/**",
"*.test.js"
],
"model": "claude-sonnet-4-5",
"maxFlawScore": 0
}
name: Security Scan
on: [push, pull_request]
jobs:
flaw0:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
- name: Install flaw0
run: npm install -g flaw0
- name: Run security scan
env:
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
run: flaw0 audit
- name: Check flaw score
run: |
SCORE=$(flaw0 audit --json | jq '.flawScore')
if [ "$SCORE" -gt 0 ]; then
echo "❌ Flaws detected: flaw $SCORE"
exit 1
fi
echo "✅ No flaws: flaw 0"
#!/bin/bash
echo "🔍 Running flaw0 scan..."
flaw0 scan
if [ $? -ne 0 ]; then
echo "❌ Flaws detected! Commit blocked."
exit 1
fi
# Download a skill to review
git clone https://github.com/user/some-skill.git /tmp/some-skill
# Scan it
flaw0 scan /tmp/some-skill
# If flaw 0, safe to install
# If flaw > 0, review issues first
# Scan all installed skills
flaw0 scan --target skills
# Example output:
# ✓ clawdex - flaw 0
# ✓ database-helper - flaw 0
# ⚠ crypto-bot - flaw 3
# ✓ git-assistant - flaw 0
# Overall: flaw 3
# After installing new packages
npm install some-package
# Check for vulnerabilities
flaw0 deps
# Comprehensive security check
flaw0 audit --output security-report.json
# Review the report
cat security-report.json | jq '.flawScore'
Use flaw0 programmatically in your own tools:
const Flaw0 = require('flaw0');
const scanner = new Flaw0({
target: './src',
model: 'claude-sonnet-4-5'
});
// Run full scan
const results = await scanner.scan();
console.log(`Flaw Score: ${results.flawScore}`);
if (results.flawScore === 0) {
console.log('✅ No flaws detected!');
} else {
results.codeFlaws.forEach(flaw => {
console.log(`[${flaw.severity}] ${flaw.name}`);
console.log(` Location: ${flaw.file}:${flaw.line}`);
console.log(` Fix: ${flaw.fix}`);
});
}
| Feature | flaw0 | npm audit | Snyk | ESLint Security |
|---|---|---|---|---|
| Dependency CVEs | ✅ | ✅ | ✅ | ❌ |
| AI Code Analysis | ✅ | ❌ | ❌ | ❌ |
| OpenClaw-specific | ✅ | ❌ | ❌ | ❌ |
| Context-aware | ✅ | ❌ | ⚠️ | ⚠️ |
| False positive reduction | ✅ | ❌ | ⚠️ | ❌ |
| Fix suggestions | ✅ | ⚠️ | ✅ | ⚠️ |
export ANTHROPIC_API_KEY='your-api-key-here'
Get your API key from: https://console.anthropic.com/
export ANTHROPIC_API_KEY='sk-...'
# Or add to ~/.bashrc or ~/.zshrc
Ensure you have a valid package.json:
npm init -y
npm install
If you hit API rate limits:
--model haiku./demo.sh for interactive demoflaw0 helps the OpenClaw community achieve secure, vulnerability-free code.
Contributions welcome! Areas for contribution:
MIT License - see LICENSE file
Goal: flaw 0 for everyone! 🎯
Remember: Security is not a one-time check. Run flaw0 regularly to maintain flaw 0 status!