| name | security-audit-scanner |
| description | Automated security scanning for Vigil Guard v2.0.0. Use for OWASP Top 10 checks, TruffleHog secret detection, npm/pip vulnerability scanning, 3-branch service security, heuristics-service audit, and CI/CD security pipelines. |
| version | 2.0.0 |
| allowed-tools | ["Read","Write","Edit","Bash","Grep","Glob"] |
Security Audit Scanner (v2.0.0)
Overview
Automated security scanning and audit automation for Vigil Guard v2.0.0 covering OWASP Top 10, secret detection (TruffleHog), npm/pip vulnerability scanning, 3-branch service security, and 11-service architecture validation.
When to Use This Skill
- Running security audits
- Detecting secrets in codebase
- Scanning for vulnerabilities (npm audit, pip audit)
- 3-branch service security validation (v2.0.0)
- Heuristics-service pattern security audit
- OWASP Top 10 compliance checking
- Pre-commit security validation
- CI/CD security pipeline
v2.0.0 Architecture Security
11 Services to Secure
Core Services:
- clickhouse (database, credentials)
- grafana (dashboard, authentication)
- n8n (workflow, webhooks)
3-Branch Detection (v2.0.0):
- heuristics-service (pattern files, port 5005)
- semantic-service (model files, port 5006)
- prompt-guard-api (LLM model, port 8000)
PII Detection:
- presidio-pii-api (spaCy models)
- language-detector (no auth needed)
Web Interface:
- web-ui-backend (JWT, sessions)
- web-ui-frontend (CORS, CSP)
- proxy (TLS, rate limiting)
3-Branch Security Considerations
Branch A (Heuristics):
- Pattern injection in unified_config.json
- ReDoS in regex patterns
- Path traversal in pattern loading
Branch B (Semantic):
- Model poisoning
- Embedding manipulation
- Vector database injection
Branch C (LLM Guard):
- Prompt injection to LLM Guard itself
- Model extraction attempts
- Inference-time attacks
OWASP Top 10 Coverage (v2.0.0)
1. Broken Access Control
Check:
grep -r "requirePermission" services/web-ui/backend/src/
curl http://localhost:5005/analyze
curl http://localhost:5006/analyze
curl http://localhost:8000/analyze
curl -X POST http://localhost:8787/api/users \
-H "Content-Type: application/json" \
-d '{"username":"hacker"}'
2. Cryptographic Failures
Check:
grep -r "bcrypt.hash" services/web-ui/backend/ | grep -v "12"
echo $JWT_SECRET | wc -c
grep -r "http://" services/ --include="*.ts" | grep -v localhost
grep -r "http://heuristics-service\|http://semantic-service" services/
3. Injection
Check:
grep -r "db.prepare\|db.query" services/web-ui/backend/ | grep -v "?"
grep -r "exec\|spawn" services/ --include="*.js" --include="*.ts"
grep -r "dangerouslySetInnerHTML" services/web-ui/frontend/
grep -r "eval\|Function(" services/heuristics-service/
4. Insecure Design
Check:
grep -r "ALLOWED\|fail.*open" services/workflow/
5. Security Misconfiguration
Check:
grep -rE "(password|secret|key|token).*=.*['\"]" services/ --include="*.ts" --include="*.js" | grep -v ".env"
grep -r "cors({" services/web-ui/backend/
docker network inspect vigil-net | jq '.Containers | keys'
grep -r "admin123\|password123" services/
6. Vulnerable Components
Check:
cd services/web-ui/backend && npm audit --audit-level=moderate
cd services/web-ui/frontend && npm audit --audit-level=moderate
cd services/workflow && npm audit --audit-level=moderate
cd services/presidio-pii-api && pip check
cd services/language-detector && pip check
cd services/heuristics-service && pip check
cd services/semantic-service && pip check
docker scan vigil-heuristics-service:latest
docker scan vigil-semantic-service:latest
7. Authentication Failures
Check:
grep -A5 "authLimiter" services/web-ui/backend/src/server.ts
grep "expiresIn" services/web-ui/backend/src/auth.ts
grep "password.*length" services/web-ui/backend/
grep -r "Authorization" services/heuristics-service/
grep -r "Authorization" services/semantic-service/
8. Software & Data Integrity
Check:
grep "@sha256:" docker-compose.yml
grep "etag\|ETag" services/web-ui/backend/src/server.ts
grep "auditLog" services/web-ui/backend/
sha256sum services/workflow/config/unified_config.json
9. Logging & Monitoring
Check:
grep -r "console.log.*password\|console.log.*token" services/
docker exec vigil-clickhouse clickhouse-client -q "
SELECT column_name FROM information_schema.columns
WHERE table_name = 'events_processed'
AND column_name LIKE 'branch_%'
"
ls services/monitoring/grafana/provisioning/dashboards/
10. Server-Side Request Forgery (SSRF)
Check:
grep -r "axios\|fetch" services/workflow/ | grep -v "vigil-"
v2.0.0 Specific Security Checks
Heuristics Service Audit
#!/bin/bash
echo "🔍 Auditing Heuristics Service (Branch A)..."
echo "Checking unified_config.json patterns for ReDoS..."
PATTERNS=$(jq -r '.categories[].patterns[]' services/workflow/config/unified_config.json 2>/dev/null)
VULNERABLE=0
while IFS= read -r pattern; do
if [ -n "$pattern" ]; then
RESULT=$(npx redos-detector "$pattern" 2>&1)
if echo "$RESULT" | grep -q "vulnerable"; then
echo "❌ ReDoS: $pattern"
VULNERABLE=$((VULNERABLE+1))
fi
fi
done <<< "$PATTERNS"
echo "ReDoS scan: $VULNERABLE vulnerable patterns found"
grep -r "\.\.\/" services/heuristics-service/ && echo "⚠️ Path traversal risk"
grep -r "eval\|exec\|Function(" services/heuristics-service/ && echo "⚠️ Code injection risk"
Semantic Service Audit
#!/bin/bash
echo "🔍 Auditing Semantic Service (Branch B)..."
echo "Checking model checksums..."
docker exec vigil-semantic-service ls -la /models/
grep -r "torch.load\|pickle.load" services/semantic-service/ && echo "⚠️ Unsafe deserialization"
grep -r "384\|768" services/semantic-service/ | head -5
Arbiter Security Audit
#!/bin/bash
echo "🔍 Auditing Arbiter v2 Decision Logic..."
grep -r "0.30\|0.35" services/workflow/workflows/*.json
grep -r "critical_signal" services/workflow/
grep -r "threshold\|BLOCK\|SANITIZE" services/workflow/config/unified_config.json | head -10
Common Tasks
Task 1: Full Security Audit (v2.0.0)
#!/bin/bash
echo "🔒 Vigil Guard v2.0.0 Security Audit"
echo "===================================="
./scripts/scan-secrets.sh
./scripts/scan-vulnerabilities.sh
./scripts/audit-heuristics.sh
./scripts/audit-semantic.sh
./scripts/audit-arbiter.sh
./scripts/api-security-test.sh
./scripts/scan-docker-images.sh
./scripts/owasp-checklist.sh
echo "✅ Audit complete"
Task 2: Secret Scanning with TruffleHog
#!/bin/bash
echo "🔍 Scanning for secrets with TruffleHog..."
if ! command -v trufflehog &> /dev/null; then
brew install trufflehog || pip install trufflehog
fi
trufflehog filesystem . \
--exclude-paths=.truffleHog-exclude \
--json \
> /tmp/trufflehog-results.json
SECRETS_FOUND=$(jq length /tmp/trufflehog-results.json)
if [ "$SECRETS_FOUND" -gt 0 ]; then
echo "❌ Found $SECRETS_FOUND potential secrets"
exit 1
else
echo "✅ No secrets detected"
fi
Task 3: Branch Service API Security Test
#!/bin/bash
echo "🔍 Testing Branch Service Security..."
BRANCH_A=$(curl -s -o /dev/null -w "%{http_code}" \
-X POST http://localhost:5005/analyze \
-H "Content-Type: application/json" \
-d '{"text":"test","request_id":"sec-test"}')
echo "Branch A external access: HTTP $BRANCH_A"
BRANCH_B=$(curl -s -o /dev/null -w "%{http_code}" \
-X POST http://localhost:5006/analyze \
-H "Content-Type: application/json" \
-d '{"text":"test","request_id":"sec-test"}')
echo "Branch B external access: HTTP $BRANCH_B"
BRANCH_C=$(curl -s -o /dev/null -w "%{http_code}" \
-X POST http://localhost:8000/analyze \
-H "Content-Type: application/json" \
-d '{"text":"test"}')
echo "Branch C external access: HTTP $BRANCH_C"
CI/CD Integration
GitHub Actions Workflow (v2.0.0)
name: Security Audit v2.0.0
on:
push:
branches: [main]
pull_request:
branches: [main]
schedule:
- cron: '0 2 * * 1'
jobs:
security-scan:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: TruffleHog Secret Scan
run: docker run --rm -v "$PWD:/scan" trufflesecurity/trufflehog:latest filesystem /scan
- name: npm Audit (All Services)
run: |
cd services/web-ui/backend && npm audit --audit-level=moderate
cd ../frontend && npm audit --audit-level=moderate
cd ../../workflow && npm audit --audit-level=moderate
- name: Heuristics Service Audit
run:
Security Scorecard (v2.0.0)
#!/bin/bash
SCORE=0
MAX_SCORE=100
echo "🔒 Vigil Guard v2.0.0 Security Scorecard"
echo "========================================"
if ./scripts/scan-secrets.sh &>/dev/null; then
echo "✅ [15/15] No secrets in codebase"
SCORE=$((SCORE+15))
else
echo "❌ [0/15] Secrets detected"
fi
VULNS=$(cd services/web-ui/backend && npm audit --json 2>/dev/null | jq '.metadata.vulnerabilities.total // 0')
if [ "$VULNS" -eq 0 ]; then
echo "✅ [15/15] No npm vulnerabilities"
SCORE=$((SCORE+15))
else
echo "⚠️ [7/15] $VULNS vulnerabilities found"
SCORE=$((SCORE+7))
fi
echo "✅ [20/20] OWASP Top 10 compliance"
SCORE=$((SCORE+20))
if grep -q "authLimiter" services/web-ui/backend/src/server.ts 2>/dev/null; then
echo "✅ [15/15] Rate limiting enabled"
SCORE=$((SCORE+15))
else
echo "❌ [0/15] No rate limiting"
[ -ge 32 ] 2>/dev/null;
SCORE=$((SCORE+))
SCORE=$((SCORE+))
BRANCH_SERVICES_OK=0
port 5005 5006;
curl -s http://localhost:/health &>/dev/null && BRANCH_SERVICES_OK=$((BRANCH_SERVICES_OK+))
[ -eq 2 ];
SCORE=$((SCORE+))
SCORE=$((SCORE+))
REDOS_COUNT=$(./scripts/audit-heuristics.sh 2>&1 | grep -c || 0)
[ -eq 0 ];
SCORE=$((SCORE+))
Quick Reference
./scripts/security-audit-full.sh
./scripts/scan-secrets.sh
./scripts/audit-heuristics.sh
./scripts/audit-semantic.sh
./scripts/branch-security-test.sh
./scripts/security-scorecard.sh
Integration Points
With vigil-security-patterns:
when: Security issue detected
action:
1. Reference security-patterns skill for fix
2. Implement recommended pattern
3. Re-run security audit
With heuristics-service:
when: Pattern security audit
action:
1. Check unified_config.json for ReDoS
2. Validate pattern loading security
3. Test for injection vulnerabilities
Last Updated: 2025-12-09
Coverage: OWASP Top 10 + 3-Branch Security
Services: 11 containers to secure
Tools: TruffleHog, npm audit, Trivy, redos-detector
Target Score: >90/100 (Grade A)
Version History
- v2.0.0 (Current): 3-branch service audits, 11 services, arbiter security
- v1.6.11: 40-node pipeline, rules.config.json ReDoS scanning