{"skill":{"slug":"firm-security-audit","displayName":"Firm Security Audit","summary":"Audit de sécurité proactif des déploiements OpenClaw. Détecte et remédie aux 4 gaps critiques/hauts identifiés dans openclaw/openclaw : SQL injection (C1), s...","description":"---\nname: firm-security-audit\nversion: 1.0.0\ndescription: >\n  Audit de sécurité proactif des déploiements OpenClaw.\n  Détecte et remédie aux 4 gaps critiques/hauts identifiés dans openclaw/openclaw :\n  SQL injection (C1), sandbox off par défaut (C2), session secret éphémère (C3),\n  absence de rate limiting (H8), et documentation sécurité incomplète (M10).\nauthor: romainsantoli-web\nlicense: MIT\nmetadata:\n  openclaw:\n    registry: ClawHub\n    requires:\n      - mcp-openclaw-extensions >= 2.0.0\ntags:\n  - security\n  - audit\n  - compliance\n  - hardening\n  - devops\n---\n\n# firm-security-audit\n\n> ⚠️ Contenu généré par IA — validation par un expert sécurité requise avant toute modification en production.\n\n## Purpose\n\nCe skill est la **porte de sécurité obligatoire** avant tout déploiement ou exposition\nréseau d'un Gateway OpenClaw. Il comble directement les gaps critiques identifiés dans\n`openclaw/openclaw` depuis l'extérieur du repo, sans modifier le code upstream.\n\n**Gaps couverts :**\n| Gap | Sévérité | Outil |\n|-----|----------|-------|\n| C1 — SQL injection `/api/metrics/database` | CRITICAL | `openclaw_security_scan` |\n| C2 — `sandbox.mode: off` par défaut | CRITICAL | `openclaw_sandbox_audit` |\n| C3 — Session secret régénéré au restart | HIGH | `openclaw_session_config_check` |\n| H8 — Absence de rate limiting sur WS Gateway | HIGH | `openclaw_rate_limit_check` |\n| M10 — Matrix E2EE status non documenté | MEDIUM | checklist documentaire |\n\n## Tools activés\n\n```\nopenclaw_security_scan         — détection SQL injection (C1)\nopenclaw_sandbox_audit         — vérification sandbox config (C2)\nopenclaw_session_config_check  — contrôle session secret persistance (C3)\nopenclaw_rate_limit_check      — vérification rate limiter (H8)\nfirm_export_slack_digest       — notification équipe si CRITICAL trouvé\n```\n\n## Séquence d'audit obligatoire\n\n**À exécuter avant chaque déploiement ou avant activation de Tailscale Funnel.**\n\n### Étape 1 — Sandbox audit (C2, priorité CRITIQUE)\n\n```json\n{\n  \"tool\": \"openclaw_sandbox_audit\",\n  \"args\": {\n    \"config_path\": \"/path/to/.openclaw/config.yaml\"\n  }\n}\n```\n**Attendu :** `severity: OK` avec `sandbox_mode: non-main` ou `all`\n**Si CRITICAL :** appliquer le fix_snippet fourni **avant de continuer**\n\n### Étape 2 — SQL injection scan (C1)\n\n```json\n{\n  \"tool\": \"openclaw_security_scan\",\n  \"args\": {\n    \"target_path\": \"/path/to/openclaw/src/api\",\n    \"endpoint\": \"/api/metrics/database\",\n    \"scan_depth\": 4\n  }\n}\n```\n**Attendu :** `critical_count: 0`, `high_count: 0`\n**Si CRITICAL ou HIGH :** appliquer `remediation_by_severity` avant déploiement\n\n### Étape 3 — Session secret check (C3)\n\n```json\n{\n  \"tool\": \"openclaw_session_config_check\",\n  \"args\": {\n    \"compose_file_path\": \"/path/to/docker-compose.yml\",\n    \"env_file_path\": \"/path/to/.env\"\n  }\n}\n```\n**Attendu :** `session_secret_found: true`\n**Si HIGH :** appliquer `fix_docker` ou `fix_env` fourni\n\n### Étape 4 — Rate limiting check (H8)\n\n```json\n{\n  \"tool\": \"openclaw_rate_limit_check\",\n  \"args\": {\n    \"gateway_config_path\": \"/path/to/.openclaw/config.yaml\",\n    \"check_funnel\": true\n  }\n}\n```\n**Attendu :** `rate_limiter_detected: true` OU `funnel_active: false`\n**Si CRITICAL (funnel actif sans rate limiter) :** appliquer `fix_nginx` ou `fix_caddy` **immédiatement**\n\n### Étape 5 — Alerte si CRITICAL (automatique)\n\nSi un des audits retourne `severity: CRITICAL`, dispatcher automatiquement via :\n```json\n{\n  \"tool\": \"firm_export_slack_digest\",\n  \"args\": {\n    \"objective\": \"Security audit — CRITICAL finding\",\n    \"content\": \"<résultats de l'audit>\",\n    \"channel\": \"#security-alerts\"\n  }\n}\n```\n\n## Checklist Matrix E2EE (M10)\n\nVérification documentaire manuelle (pas d'outil disponible — trop repo-spécifique) :\n- [ ] Le `CONTRIBUTING.md` OpenClaw mentionne-t-il le statut E2EE Matrix ?\n- [ ] Les utilisateurs Matrix privacy-sensitive sont-ils informés de l'absence d'E2EE ?\n- [ ] Un ADR (`firm_adr_generate`) documente-t-il la décision E2EE Matrix ?\n\n## Templates de remédiation rapide\n\n### C2 — Sandbox fix (ajout dans config.yaml)\n\n```yaml\nagents:\n  defaults:\n    sandbox:\n      mode: non-main   # ← activer isolation Docker pour sessions non-main\n  sessions:\n    main:\n      sandbox:\n        mode: off      # main conserve accès hôte (intentionnel)\n```\n\n### C3 — Session secret (docker-compose.yml)\n\n```yaml\nservices:\n  openclaw:\n    environment:\n      SESSION_SECRET: \"${SESSION_SECRET:?SESSION_SECRET env var required}\"\n# Générer : openssl rand -base64 48 > /etc/openclaw/session.secret\n```\n\n### H8 — Rate limiting Nginx\n\n```nginx\nlimit_req_zone $binary_remote_addr zone=openclaw:10m rate=30r/m;\nserver {\n    location /ws {\n        limit_req zone=openclaw burst=10 nodelay;\n        proxy_pass http://127.0.0.1:18789;\n        proxy_http_version 1.1;\n        proxy_set_header Upgrade $http_upgrade;\n        proxy_set_header Connection \"upgrade\";\n    }\n}\n```\n\n## Escalade\n\n| Résultat | Action |\n|----------|--------|\n| Tout OK | Déploiement autorisé — log de l'audit dans `docs/security-audits/` |\n| CRITICAL sandbox ou SQL | Bloquer le déploiement — fix obligatoire avant push |\n| CRITICAL rate limit + funnel | Désactiver Funnel et appliquer Nginx/Caddy immédiatement |\n| HIGH session secret | Appliquer fix + redémarrer le container avec le secret persistant |\n\n## Intégration CI/CD\n\nAjouter dans le workflow GitHub Actions :\n\n```yaml\n- name: Security audit (firm-security-audit)\n  run: |\n    # Depuis le CTO ou Engineering agent avant chaque deploy\n    openclaw skill run firm-security-audit \\\n      --config $OPENCLAW_CONFIG_PATH \\\n      --fail-on CRITICAL,HIGH\n```\n\n---\n*OpenClaw gaps : C1 (#29951 SQL injection), C2 (sandbox off), C3 (#29955 session secret), H8 (no rate limit)*\n\n---\n\n## 💎 Support\n\nSi ce skill vous est utile, vous pouvez soutenir le développement :\n\n**Dogecoin** : `DQBggqFNWsRNTPb6kkiwppnMo1Hm8edfWq`\n","tags":{"latest":"1.0.0"},"stats":{"comments":0,"downloads":609,"installsAllTime":23,"installsCurrent":1,"stars":0,"versions":1},"createdAt":1772323864875,"updatedAt":1778491674555},"latestVersion":{"version":"1.0.0","createdAt":1772323864875,"changelog":"firm-security-audit 1.0.0 — Initial release.\n\n- Provides proactive security auditing for OpenClaw deployments.\n- Detects and remediates four critical/high security gaps: SQL injection, sandbox off by default, non-persistent session secret, and missing rate limiting.\n- Includes step-by-step audit sequence with ready-to-use remediation templates.\n- Issues automatic Slack alerts for CRITICAL findings.\n- Requires manual checklist review for Matrix E2EE documentation gap.\n- Designed for mandatory execution before any deployment or public exposure.","license":null},"metadata":{"setup":[],"os":null,"systems":null},"owner":{"handle":"romainsantoli-web","userId":"s178fag1hxcgpz2z5084c6e6dx885d11","displayName":"romainsantoli-web","image":"https://avatars.githubusercontent.com/u/246739959?v=4"},"moderation":{"isSuspicious":false,"isMalwareBlocked":false,"verdict":"clean","reasonCodes":["review.llm_review"],"summary":"Review: review.llm_review","engineVersion":"v2.4.24","updatedAt":1779968133522}}