The full upstream README, mirrored here for reference. Install config, tool schemas, adoption signals, and an original overview live on the Shellward listing page.
AI 应用合规网关 — 为中国监管而生的 AI Agent 安全合规工具(网安法 2026 / PIPL / 等保2.0 / 数据出境 / AI标识)。先一行命令体检项目合规风险,再在运行时拦截提示注入、数据外泄与危险命令。中文威胁检测 + 中文 PII + 零依赖——英文工具不做的事。
🌐 官网: https://jnmetacode.github.io/shellward/
零安装、只读、不上传任何数据。一行命令,扫出你的 AI 项目踩了哪些合规红线:
输出一张映射到 网安法 / PIPL / 等保2.0 / 数据出境 / AI标识 的红黄绿评分卡,并精确到 文件:行:
想在浏览器里看?npx shellward scan --open(扫完直接打开报告)或 --serve(本地 http://localhost 提供报告)——数据全程不出本机。
Web 扫描器 / 客户端(双模式):
shellward web — 公开仓库 web 扫描器:网页贴「公开仓库 URL」或用 /scan?repo=URL 链接体检(可部署,见 Dockerfile)。shellward web --local — 本地 web GUI(客户端体验):填本地路径扫描,私有代码不上传、不出本机,无需命令行。--json 供 CI · --ci 发现 critical 时让构建失败 · --html report.html 导出可打印成 PDF 的报告(备案/审计存档)· 也可作 GitHub Action 接入 PR 门禁。
检测重点:境外大模型端点与 SDK 依赖(数据出境——中国独有、英文工具没有的概念)、硬编码密钥、文件中的中文 PII、
.env暴露。扫到境外模型(如openai依赖)时,直接给出境内合规替代(通义千问 / DeepSeek / Kimi / 智谱)及其 OpenAI 兼容base_url——多数迁移只需改一个base_url。
想在浏览器里看报告? 在项目目录跑 npx shellward scan --open —— 自动扫描并在浏览器打开报告,无需上传、无弹框、数据不出本机(最干净)。也可 npx shellward web --local 起本地图形界面(粘贴/点选路径,服务端直读)。
更多命令、运行时防护(MCP / 插件)、与英文文档见下方 English 章节。
AI Agent Security & Compliance Gateway — the AI agent security middleware built for China's regulatory regime (CSL / PIPL / MLPS 2.0 / cross-border data / AI labeling). Scan your project for compliance risks, then block prompt injection, data exfiltration, and dangerous commands at runtime. Chinese-language threat detection + Chinese PII + zero dependencies — things English tools don't do.
Quick start: npx shellward scan — zero install, read-only, nothing uploaded. Outputs a red/yellow/green scorecard mapped to Chinese regulations plus concrete file:line findings, and prescribes domestic compliant model alternatives for any overseas LLM it finds.

7 real-world scenarios: server wipe → reverse shell → prompt injection → DLP audit → data exfiltration chain → credential theft → APT attack chain
Your AI agent has full access to tools — shell, email, HTTP, file system. One prompt injection and it can:
Like a corporate firewall: use data freely inside, nothing leaks out.
| Platform | Integration | Note |
|---|---|---|
| Claude Desktop | MCP Server | Add to claude_desktop_config.json — 8 security tools |
| Cursor | MCP Server | Add to .cursor/mcp.json |
| OpenClaw | MCP + Plugin + SDK | openclaw plugins install shellward — adapts to available hooks |
| Claude Code | MCP + SDK | Anthropic's official CLI agent |
| LangChain | SDK | LLM application framework |
| AutoGPT | SDK | Autonomous AI agents |
| OpenAI Agents | SDK | GPT agent platform |
| Hermes Agent | MCP Server | Nous Research's self-improving agent — register via MCP Integration |
| Dify / Coze | SDK | Low-code AI platforms |
| Any MCP Client | MCP Server | stdio JSON-RPC, zero dependencies |
| Any AI Agent | SDK | npm install shellward — 3 lines to integrate |
curl -X POST, wget --post, nc, Python/Node network exfilShellWard runs as a standalone MCP server over stdio — zero dependencies, no @modelcontextprotocol/sdk needed.
Claude Desktop / Cursor / any MCP client:
Add to your MCP config (claude_desktop_config.json, .cursor/mcp.json, OpenClaw, etc.) — no install path needed, npx fetches the published shellward-mcp bin:
If installed globally (npm i -g shellward), simply use "command": "shellward-mcp".
8 MCP tools available:
| Tool | Description |
|---|---|
check_command | Check if a shell command is safe (rm -rf, reverse shell, fork bomb...) |
check_injection | Detect prompt injection in text (37+ rules, zh+en) |
scan_data | Scan for PII & sensitive data (CN ID/phone/bank, API keys, SSN...) |
check_path | Check if file path operation is safe (.env, .ssh, credentials...) |
check_tool | Check if tool name is allowed (blocks payment/transfer tools) |
check_response | Audit AI response for canary leaks & PII exposure |
scan_mcp_tool | Scan an MCP tool definition for poisoning + rug-pull |
security_status | Get current security config & active layers |
compliance_check | 🆕 Run a China AI-compliance health check (网安法/PIPL/等保/出境/标识) → red/yellow/green scorecard |
Environment variables:
| Variable | Values | Default |
|---|---|---|
SHELLWARD_MODE | enforce / audit | enforce |
SHELLWARD_LOCALE | auto / zh / en | auto |
SHELLWARD_THRESHOLD | 0-100 | 40 |
SHELLWARD_BASELINE_PATH | file path | ~/.openclaw/shellward/mcp-baseline.json |
As OpenClaw plugin:
Zero config, 8 layers active by default.
Block hardcoded secrets and overseas-LLM data-export risk before they merge. Add to .github/workflows/compliance.yml:
Or run it directly without the Action: npx shellward scan --ci.
.shellward.json)声明式 CI 门禁(issue #2)— put a .shellward.json in your repo root:
failOn — fail CI if any finding matches these kinds (secret/pii/overseas/env-perm) or severities (critical/high/medium)maxFindings — max total findings allowedallowOverseas — overseas providers explicitly permitted (exempt from failure)shellward scan --ci reads it; without the file it defaults to "fail on any critical". 实现「策略在 Git push 时声明 → 运行时执行」的纵深防御。
Dangerous Commands:
Prompt Injection:
Data Exfiltration Chain:
Each step looks legitimate alone. Together it's an attack. ShellWard catches the chain.
PII Detection:
How ShellWard maps to the OWASP Top 10 for LLM Applications (2025) and common MCP risks. Honest scope — ✅ covered, ◐ partial, ✗ out of scope.
| OWASP LLM Top 10 (2025) | ShellWard | How |
|---|---|---|
| LLM01 Prompt Injection | ✅ | L1 prompt guard + L4 injection engine (32 rules, hidden-char/tag detection) |
| LLM02 Sensitive Information Disclosure | ✅ | L2/L6 PII scan + L7 DLP exfiltration blocking |
| LLM03 Supply Chain | ✅ | /scan-plugins, package-install detection, /check-updates CVE DB |
| LLM04 Data & Model Poisoning | ◐ | MCP tool-poisoning scan + rug-pull detection (tool-definition layer) |
| LLM05 Improper Output Handling | ✅ | L6 output scanner + canary-leak detection |
| LLM06 Excessive Agency | ✅ | L3 tool blocker (payment/transfer), L5 security gate |
| LLM07 System Prompt Leakage | ✅ | L1 canary token tripwire in responses |
| LLM08 Vector & Embedding Weaknesses | ✗ | Out of scope (not a RAG/vector tool) |
| LLM09 Misinformation | ✗ | Out of scope |
| LLM10 Unbounded Consumption | ◐ | Fork-bomb / resource-exhaustion command blocking |
| Common MCP risk | ShellWard | How |
|---|---|---|
| Tool Poisoning (hidden instructions in tool metadata) | ✅ | scan_mcp_tool / /scan-mcp |
| Rug Pull (tool silently redefined after approval) | ✅ | description+schema fingerprint baseline |
| Data exfiltration via tools | ✅ | L7 outbound guard (email/HTTP/curl/bash) |
| Command injection via MCP | ✅ | check_command (17 dangerous patterns) |
| Sensitive-file access | ✅ | check_path + honeypot tripwires |
| Tool Shadowing / cross-server escalation | ◐ | Per-tool scan; cross-server graph analysis not yet |
| Option | Values | Default | Description |
|---|---|---|---|
mode | enforce / audit | enforce | Block + log, or log only |
locale | auto / zh / en | auto | Auto-detects from system LANG |
injectionThreshold | 0-100 | 40 | Risk score threshold (lower = stricter; calibrated via bench/) |
Extend the built-in rules without forking — every field is additive, except allowedTools which always wins:
Invalid regexes are skipped (never throws), so user input can't break the guard.
| Command | Description |
|---|---|
/compliance | 🆕 AI compliance scorecard (网安法/PIPL/等保/出境/标识) |
/security | Security status overview |
/audit [n] [filter] | View audit log (filter: block, audit, critical, high) |
/harden | Scan & fix security issues |
/scan-plugins | Scan installed plugins for malicious code |
/scan-mcp | Scan configured MCP servers (stdio + remote HTTP) for tool poisoning + rug-pull |
/check-updates | Check versions & known CVEs (17 built-in) |
| Metric | Data |
|---|---|
| 200KB text PII scan | <100ms |
| Command check throughput | 125,000/sec |
| Injection detection throughput | ~7,700/sec |
| Dependencies | 0 |
| Tests | 183 passing (incl. 15 MCP + 12 ReDoS + live tool-poisoning scan) |
Effectiveness is measured, not asserted. npm run bench runs every detector over a labeled corpus (attacks and hard negatives — benign text that looks suspicious) and reports precision/recall/F1. The corpus and harness live in bench/; CI fails on regression.
| Category | Precision | Recall | F1 |
|---|---|---|---|
| Prompt injection | 100% | 100% | 100% |
| Dangerous commands | 100% | 100% | 100% |
| PII / secrets | 100% | 100% | 100% |
| MCP tool poisoning | 100% | 100% | 100% |
| Compliance scan (overseas / secret / PII vs hard negatives) | 100% | 100% | 100% |
The compliance scanner has its own gated corpus — npm run bench:scan runs the real scanProject pipeline over 31 labeled cases (17 real risks + 14 hard negatives: domestic endpoints, placeholder keys, doc examples, lock files, invalid checksums). Self-authored corpus, CI-gated against regression.
83 gated samples (attacks + hard negatives). Zero-width-interleaved and empty-quote (r''m) obfuscation are normalized before matching. The corpus also tracks 5 documented bypasses (leetspeak, base64, non-zh/en languages, shell variable indirection) that regex/heuristics are not expected to catch — listed explicitly and excluded from the gate rather than hidden.
Numbers are on the current in-repo corpus — a floor, not a universal guarantee. Found a bypass? Add it to
bench/corpus.tsas a labeled row and the gap becomes measurable (and CI-enforced).Conservative by design: in enforce mode ShellWard fails safe — e.g.
echo "rm -rf /"(printing a literal) is flagged, since regex can't distinguish it fromecho "$(rm -rf /)"(which executes).
17 built-in CVE / GitHub Security Advisories. /check-updates checks if your version is affected:
Remote vuln DB syncs every 24h, falls back to local DB when offline.
ShellWard is built for teams that need runtime security for AI agents — whether you are building autonomous coding assistants, customer-facing chatbots with tool access, or internal automation powered by LLMs. Common use cases include MCP security enforcement, tool call interception and filtering, and adding agent guardrails to any LLM-powered workflow.
| Capability | ShellWard | agentguard | pipelock | Sage | AgentSeal |
|---|---|---|---|---|---|
| DLP data flow (read→send=block) | ✅ | ❌ | Proxy-based | ❌ | ❌ |
| Chinese PII (ID card, bank card) | ✅ | ❌ | ❌ | ❌ | ❌ |
| Chinese injection rules | 18 rules | ❌ | ❌ | ❌ | ❌ |
| Defense layers | 8 | 3 | 11 (proxy) | ~2 | ~2 |
| Zero dependencies | ✅ (npm) | ✅ | Go binary | Cloud API | Python |
| Runtime blocking | ✅ | ✅ | ✅ (proxy) | ✅ | ❌ (scanner) |
| Architecture | In-process middleware | Hook-based guard | HTTP proxy | Hook + cloud | Scan + monitor |
| Detection rules | 37 | 24 | 36 DLP patterns | 200+ YAML | 191+ |
ShellWard is the only tool with DLP-style data flow tracking + Chinese language security + zero dependencies in a single package.
Recent research (arXiv:2603.08665) demonstrates GenAI discovering 38 real-world vulnerabilities in 7 hours — AI-powered attacks are scaling fast. Defense must be built into the agent layer.
jnMetaCode · Apache-2.0
AI Agent 安全 · 合规网关 — 唯一为中国监管(网安法 / PIPL / 等保2.0 / 数据出境 / AI标识 GB45438)和中文语境而生的 AI Agent 安全中间件。先一键体检项目合规风险,再在运行时拦截提示注入、数据外泄与危险命令。中文威胁检测 + 中文 PII + 零依赖——英文工具不做的事。
零安装、只读、不上传任何数据。现在就扫你的 AI 项目:
输出一张映射到 网安法 / PIPL / 等保2.0 / 数据出境 / AI标识 的红黄绿评分卡,并列出项目里 文件:行 级别的真实风险:
--json 供 CI 消费 · --ci 发现 critical 时让构建失败 · 也可作 GitHub Action 接入 PR 门禁。
检测重点:境外大模型端点(数据出境风险 — 中国独有、英文工具没有这个概念)、硬编码密钥、文件中的中文 PII、
.env暴露。命令形态/compliance,MCP 工具compliance_check。

7 个真实攻击场景:服务器毁灭拦截 → 反弹 Shell → 注入检测 → DLP 审计 → 数据外泄链 → 凭证窃取 → APT 攻击链
核心理念:像企业防火墙一样,内部随便用,数据出不去。
| 平台 | 集成方式 | 说明 |
|---|---|---|
| Claude Desktop | MCP 服务器 | 添加到 claude_desktop_config.json,8 个安全工具 |
| Cursor | MCP 服务器 | 添加到 .cursor/mcp.json |
| OpenClaw | MCP + 插件 + SDK | openclaw plugins install shellward,开箱即用 |
| Claude Code | MCP + SDK | Anthropic 官方 CLI Agent |
| LangChain | SDK | LLM 应用开发框架 |
| AutoGPT | SDK | 自主 AI Agent |
| OpenAI Agents | SDK | GPT Agent 平台 |
| Hermes Agent | MCP 服务器 | Nous Research 自改进 Agent — 通过 MCP Integration 接入 |
| Dify / Coze | SDK | 低代码 AI 平台 |
| 任意 MCP 客户端 | MCP 服务器 | stdio JSON-RPC,零依赖 |
| 任意 AI Agent | SDK | npm install shellward,3 行代码接入 |
MCP 服务器模式(推荐):
在 MCP 配置中添加(适用于 Claude Desktop、Cursor、OpenClaw 等)。无需本地路径,npx 会拉取已发布的 shellward-mcp:
若已全局安装(npm i -g shellward),直接用 "command": "shellward-mcp" 即可。
零依赖,原生实现 MCP 协议。提供 8 个安全工具:命令检查、注入检测、敏感数据扫描、路径保护、工具策略、响应审计、MCP 工具投毒/rug-pull 扫描、安全状态。
OpenClaw 插件模式:
SDK 模式:
/scan-mcp 一键扫描已配置 MCP 服务器)| 能力 | ShellWard | agentguard | pipelock | Sage | AgentSeal |
|---|---|---|---|---|---|
| DLP 数据流 (读→发=拦截) | ✅ | ❌ | Proxy 架构 | ❌ | ❌ |
| 中文 PII 检测 (身份证、银行卡) | ✅ | ❌ | ❌ | ❌ | ❌ |
| 中文注入规则 | 18 条 | ❌ | ❌ | ❌ | ❌ |
| 防御层数 | 8 层 | 3 层 | 11 层(proxy) | ~2 层 | ~2 层 |
| 零依赖 | ✅ (npm) | ✅ | Go 二进制 | 需云 API | 需 Python |
| 运行时拦截 | ✅ | ✅ | ✅ (proxy) | ✅ | ❌ (扫描器) |
| 架构 | 进程内中间件 | Hook 守护 | HTTP 代理 | Hook + 云端 | 扫描 + 监控 |
| 检测规则数 | 37 | 24 | 36 DLP 模式 | 200+ YAML | 191+ |
ShellWard 是唯一同时具备 DLP 数据流追踪 + 中文语言安全 + 零依赖 的 AI Agent 安全工具。
最新研究 (arXiv:2603.08665) 显示 GenAI 在 7 小时内发现 38 个真实漏洞 — AI 驱动的攻击正在规模化,防御必须内建到 Agent 层。
微信公众号 「AI不止语」(微信搜索 AI_BuZhiYu)— 技术问答 · 项目更新 · 实战文章
| 渠道 | 加入方式 |
|---|---|
| QQ 群 | 点击加入(群号 1071280067) |
| 微信群 | 关注公众号后回复「群」获取入群方式 |
| 项目 | 说明 |
|---|---|
| ai-coding-guide | AI 编程工具实战指南 — 66 个 Claude Code 技巧 + 10 款工具最佳实践 + 可复制配置模板 |
| agency-agents-zh | 277 个专业角色,让 AI 变成安全工程师、DBA、产品经理等 |
| agency-orchestrator | 多智能体编排引擎 — 用 YAML 编排 276 个角色协作,15 种大模型(11 种免 key),零代码 |
| superpowers-zh | AI 编程超能力 · 中文版 — 20 个 skills,让你的 AI 编程助手真正会干活 |
| 🆕 ai-shortfilm-prompts | AI 短片提示词方法论 — Mx-Shell《丧尸清道夫》5 段式拆解 + Skill,Seedance / 小云雀 / Sora / 可灵 / 即梦通用 |
| 🆕 openshorts | 开片 —— 文案进,成片出:脚本 / 配音 / 字幕 / 成片 / 发布包一条龙,0 元 0 key 跑通第一条,本地优先 |
jnMetaCode · Apache-2.0