clawSafe

Multi-layer security detector for AI agents. Blocks prompt injection, jailbreak, XSS, SQL injection, API key leaks, supply chain attacks, and deployment vulnerabilities.

Safety Notice

This listing is from the official public ClawHub registry. Review SKILL.md and referenced scripts before running.

Copy this and send it to your AI assistant to learn

Install skill "clawSafe" with this command: npx skills add SilverTime/clawsafe

clawSafe 🛡️

Enterprise-grade security detector for AI agents

Overview

clawSafe is a comprehensive security middleware that intercepts and blocks malicious input before it reaches your AI agent. Built with defense-in-depth philosophy.

Features

5-Layer Protection

LayerThreatsRules
LLM LayerPrompt Injection, Jailbreak, Prompt Leaking, Encoding Attacks44
Web LayerSQL Injection, XSS, CSRF, SSRF32
API LayerKey Exposure, Rate Limiting, Auth Bypass19
Supply ChainDangerous Dependencies, Remote Code Execution8
Deploy LayerEnvironment Leaks, Debug Info Disclosure10

Total: 113+ detection rules

Quick Start

Installation

# Via ClawHub
clawhub install clawSafe

# Manual
cp -r clawSafe ~/.openclaw/workspace/skills/

Basic Usage

const Detector = require('./detector');

const detector = new Detector();

// Scan user input
const result = detector.scan('Ignore previous instructions');

if (!result.safe) {
  console.log('Blocked:', result.threats);
  // Handle blocked input
}

Return Format

{
  safe: boolean;           // true if input is safe
  threats: Array<{
    type: string;         // threat category
    pattern: string;      // matched pattern ID
    severity: string;     // critical|high|medium|low
    confidence: number;   // 0-1
    description: string;
  }>;
  confidence: number;      // overall confidence 0-1
  layersScanned: string[]; // layers that were checked
}

Configuration

config.json

{
  "enabled": true,
  "logLevel": "info",
  "layers": {
    "llm": {
      "enabled": true,
      "rules": ["injection", "jailbreak", "prompt_leak", "encoding"]
    },
    "web": {
      "enabled": true,
      "rules": ["sql_injection", "xss", "csrf", "ssrf"]
    },
    "api": {
      "enabled": true,
      "rules": ["key_exposure", "rate_limit", "auth"]
    },
    "supply_chain": {
      "enabled": true,
      "rules": ["deps"]
    },
    "deploy": {
      "enabled": true,
      "rules": ["env_leak", "debug_info"]
    }
  },
  "detection": {
    "confidenceThreshold": 0.6,
    "minMatchCount": 1
  },
  "actions": {
    "onThreatDetected": "block",
    "onUncertain": "log"
  }
}

whitelist.json

{
  "keywords": ["trusted-keyword"],
  "users": ["user-id-1"],
  "sessions": ["session-id-1"]
}

Detection Rules

LLM Layer

Prompt Injection Patterns:

  • ignore previous instructions
  • disregard your guidelines
  • forget all rules
  • act as if you have no restrictions

Jailbreak Patterns:

  • DAN mode
  • developer mode
  • roleplay as

Encoding Bypass:

  • Base64 encoded commands
  • Hex encoding
  • Unicode homoglyphs

Web Layer

  • SQL Injection: '; DROP TABLE users; --
  • XSS: <script>alert(1)</script>
  • CSRF: Token manipulation
  • SSRF: Internal URL access

API Layer

  • API Key exposure: sk-1234567890
  • JWT tokens
  • Bearer tokens
  • Basic auth credentials

Testing

# Run all tests
node test.js

# Interactive mode
node test-interactive.js

# Demo
node detector.js

Integration

OpenClaw Hook

To integrate with OpenClaw, add to your gateway config:

// gateway.config.js
module.exports = {
  middleware: ['clawSafe'],
  clawSafe: {
    enabled: true,
    strictMode: false
  }
};

Performance

  • Latency: < 5ms per scan
  • Memory: ~50KB
  • Rules: 113+ (JSON-based, lazy load)

License

MIT

Changelog

v1.0.0

  • Initial release
  • 5-layer protection
  • 113+ detection rules

Source Transparency

This detail page is rendered from real SKILL.md content. Trust labels are metadata-based hints, not a safety guarantee.

Related Skills

Related by shared tags or category signals.

Security

Auto Security Audit

一键自动化安全审计:nmap 端口扫描 + nuclei 12000+ CVE 漏洞检测(内外网双扫)+ SSL/TLS 检查 + SSH/防火墙/fail2ban 系统审计 + Markdown 报告生成。支持 cron 定时扫描 + 飞书推送。

Registry SourceRecently Updated
Security

web-recon

Website vulnerability scanner and security audit toolkit. Scan any website for security issues: open ports (nmap), exposed secrets, subdomain enumeration, di...

Registry SourceRecently Updated
1262
Profile unavailable
Security

Trent OpenClaw Security

Audit your OpenClaw deployment for security risks using Trent AppSec Advisor

Registry SourceRecently Updated
0218
Profile unavailable