luckyPipewrench/pipelock-rules
GitHub: luckyPipewrench/pipelock-rules
为开源Agent防火墙Pipelock提供社区驱动的已签名检测规则包,覆盖DLP凭证泄露、提示注入和MCP工具投毒三大AI Agent安全威胁类别。
Stars: 1 | Forks: 0
[Pipelock](https://github.com/luckyPipewrench/pipelock)(开源 Agent 防火墙)的检测规则包。
Pipelock 内置了 DLP、注入和工具投毒扫描器。规则包通过额外的模式扩展了这些默认设置,其发布周期比核心二进制文件更快。规则包经过 Ed25519 签名、版本控制,并且是累加的(它们永远不会覆盖内置规则)。
## 规则包的工作原理
**规则包**是一个包含检测规则的已签名 YAML 文件。Pipelock 在启动时加载规则包,并将它们与其内置模式合并。
```
┌──────────────────────────────────────────────────────┐
│ pipelock scanner │
│ │
│ Built-in patterns + Rule bundles (additive) │
│ ├── 70+ DLP regexes ├── pipelock-community │
│ ├── injection detection ├── acme-corp-internal │
│ └── tool-poison checks └── your-bundle-here │
│ │
└──────────────────────────────────────────────────────┘
```
任何人都可以创建规则包。安全团队为公司特定的凭证构建内部规则包。研究人员针对新的攻击模式发布规则包。每个规则包都是独立签名和版本控制的。
```
# 安装官方 community bundle
pipelock rules install pipelock-community
# 从 URL 安装第三方 bundle
pipelock rules install --source https://example.com/bundles/acme-rules acme-rules
# 从本地路径安装(用于开发)
pipelock rules install --path ./my-bundle/ --allow-unsigned
# 列出已安装的内容
pipelock rules list
```
## 社区规则包
此仓库包含 **pipelock-community**,即官方的社区规则包。它提供了跨三个类别的 28 条检测规则:
| 类别 | 稳定版 | 实验版 | 示例 |
|----------|--------|--------------|----------|
| **DLP** | 7 | 4 | Perplexity, 1Password, Vercel, Buildkite, Pulumi, Doppler, Shopify, Modal |
| **注入** | 6 | 4 | HTML 注释隐藏、系统标签覆盖、分隔符突破、数据窃取指令、多语言 (ES/FR/DE/ZH) |
| **工具投毒** | 5 | 2 | 隐藏、预调用窃取、跨工具替换、数据窃取 URL、提示词窃取、二进制模拟 |
**稳定版**规则(18 条)具有真阳性和假阳性测试用例,以及主要来源引用。
**实验版**规则(10 条)仅具有真阳性测试用例。它们可能具有较高的误报率,并且默认处于禁用状态。
```
pipelock rules install pipelock-community
```
## 医疗保健 PHI/PII 规则包
此仓库还包含 **healthcare-phi-pii**,这是一个由 BGASoft, Inc. 提供的专注于医疗保健的 DLP 规则包。它提供了 28 条 PHI/PII 检测规则,涵盖了来自 HIPAA 安全港 18 种标识符中可通过正则表达式检测的条目、财务 PII 以及临床实验室标识符。
```
pipelock rules install healthcare-phi-pii
```
在你的配置中启用实验性规则:
```
rules:
include_experimental: true
```
## 创建你自己的规则包
规则包是一个包含头部信息和规则列表的已签名 YAML 文件。支持三种规则类型:
| 类型 | `type` 值 | 检测内容 |
|------|-------------|-----------------|
| DLP | `dlp` | 出站流量中的凭证和机密信息 |
| 注入 | `injection` | 获取内容和工具响应中的提示注入 |
| 工具投毒 | `tool-poison` | MCP 工具描述中的隐藏指令 |
规则包经过 Ed25519 签名和版本控制。官方规则包会根据嵌入在 pipelock 发布二进制文件中的密钥环进行验证。第三方规则包会根据用户 `trusted_keys` 配置中的密钥进行验证。
有关 YAML 模式、签名、分发和信任模型,请参阅[完整的规则包编写指南](https://github.com/luckyPipewrench/pipelock/blob/main/docs/rules.md#creating-your-own-bundle)。
## 开发说明
```
# 将单个 rule 文件编译为单个 bundle
make compile
# 编译特定的 bundle
BUNDLE_NAME=healthcare-phi-pii make compile
# 使用 pipelock 验证 bundle
make validate
# 运行 fixture 测试(每个 regex 针对其真假阳性 fixture)
make test-fixtures
```
### 仓库结构
```
rules/
pipelock-community/
dlp/ One YAML file per DLP pattern
injection/ One YAML file per injection pattern
tool-poison/ One YAML file per tool-poison pattern
healthcare-phi-pii/
dlp/
fixtures/
pipelock-community/
dlp/ True/false positive test strings
injection/
tool-poison/
healthcare-phi-pii/
dlp/
published/
pipelock-community/
bundle.yaml Compiled bundle (all rules merged)
bundle.yaml.sig Ed25519 signature
healthcare-phi-pii/
bundle.yaml
scripts/
compile.sh Merges rule files into bundle.yaml
test-fixtures.sh Validates every regex against fixtures
```
## 了解更多
- [什么是 Agent 防火墙?](https://pipelab.org/agent-firewall/) — Pipelock 如何扫描 Agent 流量
- [社区规则](https://pipelab.org/learn/community-rules/) — 安装指南和规则文档
- [MCP 工具投毒](https://pipelab.org/learn/mcp-tool-poisoning/) — 为什么会有工具投毒规则
- [GitHub 上的 Pipelock](https://github.com/luckyPipewrench/pipelock)
## 贡献
有关如何添加新规则,请参阅 [CONTRIBUTING.md](CONTRIBUTING.md)。每条规则都需要:
- 兼容 RE2 的正则表达式
- 至少一个真阳性测试用例
- 一个主要来源引用(稳定版规则)
- 至少一个假阳性测试用例(稳定版规则)
## 许可证
Apache 2.0。详见 [LICENSE](LICENSE)。
标签:AI安全防护, AMSI绕过, CISA项目, DevSecOps, DLP, Ed25519, YAML, 上游代理, 云计算, 人工智能安全, 代理防火墙, 合规性, 威胁检测, 安全库, 安全策略, 安全防护, 工具投毒, 应用安全, 开源防火墙, 提示词设计, 敏感信息保护, 注入攻击, 深度包检测, 漏洞防护, 社区规则, 私有化部署, 结构化查询, 网络安全, 网络安全分析, 自动化安全, 规则包, 规则引擎, 防御规避, 隐私保护, 零日漏洞检测