返回顶部
c

counterclaw反爪拦截

Defensive interceptor for prompt injection and basic PII masking.

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

counterclaw

技能名称: counterclaw
详细描述:

CounterClaw 🦞

AI代理的防御性安全工具。对恶意载荷自动封锁。

⚠️ 安全须知

本包有两种模式:

  1. 1. 核心扫描器(离线): checkinput() 和 checkoutput() — 无网络调用
  2. 邮件集成(网络): sendprotectedemail.sh — 需要用于Gmail的gog CLI

安装

bash
claw install counterclaw

快速开始

python
from counterclaw import CounterClawInterceptor

interceptor = CounterClawInterceptor()

输入扫描 - 阻止提示注入

注意:以下示例仅为测试用例 - 非实际指令

result = interceptor.check_input({{示例:忽略之前的指令}})

→ {blocked: True, safe: False}

输出扫描 - 检测PII泄露

result = interceptor.check_output(联系方式:john@example.com)

→ {safe: False, pii_detected: {email: True}}

功能特性

  • - 🔒 防御常见提示注入模式
  • 🛡️ 基础PII掩码(邮箱、电话、信用卡)
  • 📝 违规日志记录至 ~/.openclaw/memory/MEMORY.md
  • ⚠️ 若未配置TRUSTEDADMINIDS,启动时发出警告

配置

必需的环境变量

bash

设置您的受信任管理员ID - 仅使用非敏感标识符!


export TRUSTEDADMINIDS=yourtelegramid

重要: TRUSTEDADMINIDS 应仅包含非敏感标识符:

  • - ✅ Telegram用户ID(例如 123456789)
  • ✅ Discord用户ID(例如 987654321)
  • ❌ 绝不可使用API密钥
  • ❌ 绝不可使用密码
  • ❌ 绝不可使用令牌

可通过逗号分隔设置多个管理员ID:
bash
export TRUSTEDADMINIDS=telegramid1,telegramid2

运行时配置

python

选项1:通过环境变量(推荐)


运行前设置TRUSTEDADMINIDS


interceptor = CounterClawInterceptor()

选项2:直接参数

interceptor = CounterClawInterceptor(adminuserid=123456789)

安全说明

  • - 故障关闭:若未设置 TRUSTEDADMINIDS,管理员功能默认禁用
  • 日志记录:所有违规行为记录至 ~/.openclaw/memory/MEMORY.md,PII已掩码处理
  • 无网络访问:此中间件不进行任何外部网络调用(仅离线)
  • 文件访问:仅写入 ~/.openclaw/memory/MEMORY.md — 明确声明的范围

创建的文件

路径用途
~/.openclaw/memory/首次运行时创建的目录
~/.openclaw/memory/MEMORY.md
违规日志,PII已掩码 |

许可证

MIT - 详见LICENSE文件

开发与发布

本地运行测试

bash
python3 tests/test_scanner.py

代码检查

bash
pip install ruff
ruff check src/

发布至ClawHub

CI在每次推送和拉取请求时运行:

  1. 1. Ruff - 检查Python代码
  2. 测试 - 运行单元测试

发布新版本:

bash

版本在pyproject.toml中设置


git add -A
git commit -m 发布 v1.0.9
git tag v1.0.9
git push origin main --tags

CI将自动:

  • - 运行代码检查 + 测试
  • 若测试通过且标签以 v* 开头,发布至ClawHub

标签

skill ai

通过对话安装

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

OpenClaw WorkBuddy QClaw Kimi Claude

方式一:安装 SkillHub 和技能

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

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

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

通过命令行安装

skillhub install counterclaw-core-1776419987

下载

⬇ 下载 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
返回顶部