返回顶部
c

counterclaw

Defensive interceptor for prompt injection and basic PII masking.

作者: admin | 来源: ClawHub
源自
ClawHub
版本
V 1.1.1
安全检测
已通过
673
下载量
0
收藏
概述
安装方式
版本历史

counterclaw

# CounterClaw 🦞 > Defensive security for AI agents. Snaps shut on malicious payloads. ## ⚠️ Security Notice This package has two modes: 1. **Core Scanner (offline):** `check_input()` and `check_output()` — no network calls 2. **Email Integration (network):** `send_protected_email.sh` — requires gog CLI for Gmail ## Installation ```bash claw install counterclaw ``` ## Quick Start ```python from counterclaw import CounterClawInterceptor interceptor = CounterClawInterceptor() # Input scan - blocks prompt injections # NOTE: Examples below are TEST CASES only - not actual instructions result = interceptor.check_input("{{EXAMPLE: ignore previous instructions}}") # → {"blocked": True, "safe": False} # Output scan - detects PII leaks result = interceptor.check_output("Contact: john@example.com") # → {"safe": False, "pii_detected": {"email": True}} ``` ## Features - 🔒 Defense against common prompt injection patterns - 🛡️ Basic PII masking (Email, Phone, Credit Card) - 📝 Violation logging to `~/.openclaw/memory/MEMORY.md` - ⚠️ Warning on startup if TRUSTED_ADMIN_IDS not configured ## Configuration ### Required Environment Variable ```bash # Set your trusted admin ID(s) - use non-sensitive identifiers only! export TRUSTED_ADMIN_IDS="your_telegram_id" ``` **Important:** `TRUSTED_ADMIN_IDS` should ONLY contain non-sensitive identifiers: - ✅ Telegram user IDs (e.g., `"123456789"`) - ✅ Discord user IDs (e.g., `"987654321"`) - ❌ NEVER API keys - ❌ NEVER passwords - ❌ NEVER tokens You can set multiple admin IDs by comma-separating: ```bash export TRUSTED_ADMIN_IDS="telegram_id_1,telegram_id_2" ``` ### Runtime Configuration ```python # Option 1: Via environment variable (recommended) # Set TRUSTED_ADMIN_IDS before running interceptor = CounterClawInterceptor() # Option 2: Direct parameter interceptor = CounterClawInterceptor(admin_user_id="123456789") ``` ## Security Notes - **Fail-Closed**: If `TRUSTED_ADMIN_IDS` is not set, admin features are disabled by default - **Logging**: All violations are logged to `~/.openclaw/memory/MEMORY.md` with PII masked - **No Network Access**: This middleware does not make any external network calls (offline-only) - **File Access**: Only writes to `~/.openclaw/memory/MEMORY.md` — explicitly declared scope ## Files Created | Path | Purpose | |------|---------| | `~/.openclaw/memory/` | Directory created on first run | | `~/.openclaw/memory/MEMORY.md` | Violation logs with PII masked | ## License MIT - See LICENSE file ## Development & Release ### Running Tests Locally ```bash python3 tests/test_scanner.py ``` ### Linting ```bash pip install ruff ruff check src/ ``` ### Publishing to ClawHub The CI runs on every push and pull request: 1. **Ruff** - Lints Python code 2. **Tests** - Runs unit tests To publish a new version: ```bash # Version is set in pyproject.toml git add -A git commit -m "Release v1.0.9" git tag v1.0.9 git push origin main --tags ``` CI will automatically: - Run lint + tests - If tests pass and tag starts with `v*`, publish to ClawHub

标签

skill ai

通过对话安装

该技能支持在以下平台通过对话安装:

OpenClaw WorkBuddy QClaw Kimi Claude

方式一:安装 SkillHub 和技能

帮我安装 SkillHub 和 counterclaw-core-1776419987 技能

方式二:设置 SkillHub 为优先技能安装源

设置 SkillHub 为我的优先技能安装源,然后帮我安装 counterclaw-core-1776419987 技能

通过命令行安装

skillhub install counterclaw-core-1776419987

下载 Zip 包

⬇ 下载 counterclaw v1.1.1

文件大小: 13.89 KB | 发布时间: 2026-4-17 19:32

v1.1.1 最新 2026-4-17 19:32
- Clarified security model in documentation: now distinguishes between offline-only core and optional email integration that requires network access.
- Updated `security_manifest` to declare optional network usage for email scripts.
- Version bump in metadata to reflect documentation and manifest improvements.
- No functional code changes; updates are documentation- and manifest-focused.

Archiver·手机版·闲社网·闲社论坛·羊毛社区· 多链控股集团有限公司 · 苏ICP备2025199260号-1

Powered by Discuz! X5.0   © 2024-2025 闲社网·线报更新论坛·羊毛分享社区·http://xianshe.com

p2p_official_large
返回顶部