| 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","vulnerability-scanner","code-analysis","dependency-checker","openclaw"] |
flaw0 - Zero Flaws Security Scanner
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) ๐ฏ
Installation
Install this skill via ClawHub:
npx clawhub@latest install flaw0
Or install globally via npm:
npm install -g flaw0
When to Use This Skill
Use flaw0 to ensure your OpenClaw code and dependencies are secure:
Before Installing Skills
flaw0 scan ~/.openclaw/skills/new-skill
During Development
flaw0 scan src/
flaw0 deps
Before Committing
flaw0 audit
Auditing OpenClaw Installation
flaw0 scan --target all
flaw0 scan --target skills
flaw0 scan --target plugins
flaw0 scan --target core
Usage
Basic Commands
Scan Code
flaw0 scan
flaw0 scan /path/to/code
flaw0 scan --model claude-opus-4-6
Check Dependencies
flaw0 deps
flaw0 deps --deep
Full Security Audit
flaw0 audit
flaw0 audit --output report.json
flaw0 audit --json
Scan OpenClaw Components
flaw0 scan --target core
flaw0 scan --target plugins
flaw0 scan --target skills
flaw0 scan --target all
What flaw0 Detects
Code Vulnerabilities (12+ Types)
-
Command Injection
exec() with unsanitized input
- Shell command construction with user input
-
Code Injection
eval() usage
Function() constructor with strings
-
SQL Injection
- String concatenation in SQL queries
- Unparameterized queries
-
Cross-Site Scripting (XSS)
innerHTML assignments
dangerouslySetInnerHTML usage
-
Path Traversal
- Unvalidated file path operations
readFile() with user input
-
Hardcoded Secrets
- API keys in source code
- Passwords and tokens
- AWS credentials
-
Weak Cryptography
- MD5 and SHA1 usage
- Weak hashing algorithms
-
Insecure Randomness
Math.random() for security operations
- Predictable token generation
-
Unsafe Deserialization
JSON.parse() without validation
- Unvalidated input parsing
-
Missing Authentication
- API endpoints without auth middleware
- Unprotected routes
Dependency Issues
- Known CVEs - Vulnerabilities from CVE database
- Outdated Packages - Packages with security updates available
- Malicious Packages - Known malware or suspicious packages
- Duplicate Dependencies - Bloated dependency trees
Understanding Results
Flaw Score
Results are reported with a flaw score - lower is better:
- flaw 0 ๐ฏ - Perfect! No issues detected
- flaw 1-3 ๐ก - Minor issues
- flaw 4-10 ๐ - Needs attention
- flaw 10+ ๐ด - Critical issues
Score Calculation
Each issue is weighted by severity:
- Critical: 3 points
- High: 2 points
- Medium: 1 point
- Low: 0.5 points
Total flaw score = sum of all weighted issues (rounded)
Example Output
Clean Code (flaw 0)
๐ flaw0 Security Scan Results
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
๐ Result: flaw 0
โ
Status: SECURE
โ No security issues detected!
โ All checks passed
Great job! ๐
Issues Found (flaw 12)
๐ 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
...
AI-Powered Analysis
flaw0 uses OpenClaw's AI models for intelligent code review:
Available Models
claude-sonnet-4-5 (default)
- Balanced speed and accuracy
- Best for most use cases
- Good false positive reduction
flaw0 scan --model claude-sonnet-4-5
claude-opus-4-6
- Most thorough analysis
- Deepest context understanding
- Slower but most accurate
flaw0 scan --model claude-opus-4-6
claude-haiku-4-5
- Fastest scanning
- Good for quick checks
- Use in CI/CD for speed
flaw0 scan --model claude-haiku-4-5
AI Features
- Context-aware analysis - Understands code flow and context
- False positive reduction - Filters out non-issues
- Confidence scoring - Rates detection confidence
- Fix suggestions - Provides specific remediation steps
Configuration
Create Config File
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
}
Configuration Options
- severity.failOn - Exit with error on this severity level or higher
- severity.ignore - Skip these severity levels
- targets - What to scan (code, dependencies)
- exclude - File patterns to ignore
- model - AI model to use
- maxFlawScore - Maximum acceptable flaw score
CI/CD Integration
GitHub Actions
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"
Pre-commit Hook
#!/bin/bash
echo "๐ Running flaw0 scan..."
flaw0 scan
if [ $? -ne 0 ]; then
echo "โ Flaws detected! Commit blocked."
exit 1
fi
Examples
Scan Before Installing a Skill
git clone https://github.com/user/some-skill.git /tmp/some-skill
flaw0 scan /tmp/some-skill
Audit Your OpenClaw Skills
flaw0 scan --target skills
Check Dependencies After Install
npm install some-package
flaw0 deps
Full Project Audit
flaw0 audit --output security-report.json
cat security-report.json | jq '.flawScore'
API Usage
Use flaw0 programmatically in your own tools:
const Flaw0 = require('flaw0');
const scanner = new Flaw0({
target: './src',
model: 'claude-sonnet-4-5'
});
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}`);
});
}
How It Works
- Pattern Matching - Fast regex-based detection of common vulnerabilities
- AI Analysis - Claude AI reviews each issue in context
- False Positive Filtering - AI identifies and removes non-issues
- Dependency Checking - Integrates with npm audit and CVE databases
- Scoring - Calculates weighted flaw score
- Reporting - Generates detailed, actionable reports
Tips for Achieving flaw 0
- Fix Critical issues first - Biggest security impact
- Update dependencies - Resolve known CVEs quickly
- Use parameterized queries - Prevent SQL injection
- Validate all inputs - Stop injection attacks
- Use environment variables - No hardcoded secrets
- Apply security headers - Use helmet.js
- Implement authentication - Protect all endpoints
- Use strong crypto - SHA-256 or better
- Sanitize output - Prevent XSS
- Review AI suggestions - Learn from recommendations
Comparison with Other Tools
| Feature | flaw0 | npm audit | Snyk | ESLint Security |
|---|
| Dependency CVEs | โ
| โ
| โ
| โ |
| AI Code Analysis | โ
| โ | โ | โ |
| OpenClaw-specific | โ
| โ | โ | โ |
| Context-aware | โ
| โ | โ ๏ธ | โ ๏ธ |
| False positive reduction | โ
| โ | โ ๏ธ | โ |
| Fix suggestions | โ
| โ ๏ธ | โ
| โ ๏ธ |
Requirements
- Node.js: 14+
- API Key: Anthropic API key for AI analysis
- npm: For dependency checking
Setup API Key
export ANTHROPIC_API_KEY='your-api-key-here'
Get your API key from: https://console.anthropic.com/
Troubleshooting
"No API key found"
export ANTHROPIC_API_KEY='sk-...'
"npm audit failed"
Ensure you have a valid package.json:
npm init -y
npm install
Rate Limit Exceeded
If you hit API rate limits:
- Use haiku model:
--model haiku
- Scan smaller portions
- Wait and retry
Support
- Documentation: See USAGE.md for detailed guide
- Examples: Check examples/ directory
- Issues: Report at GitHub repository
- Demo: Run
./demo.sh for interactive demo
About
flaw0 helps the OpenClaw community achieve secure, vulnerability-free code.
- Built with OpenClaw/Claude AI
- Uses industry-standard security patterns
- Continuously updated with new vulnerabilities
- Open source under MIT license
Contributing
Contributions welcome! Areas for contribution:
- New vulnerability patterns
- Additional AI models
- Python/Go support
- Web dashboard
- Custom rule engine
License
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!