凡自治之物 · LGD 治理学 · 创造术家族 | 评测协议:skill-quality-gate
English
Prompt Injection Shield
When to use
- Before data ingestion: when web pages, emails, tool returns, or uploaded documents are about to be fed to the AI, pre-scan before they enter context.
- Prevent instruction hijack: detect "ignore previous instructions", "you are a new AI", jailbreak or system-prompt-leak attempts.
- As a pre-stage to
release-gate, combiningdesens-scanfor double-checking so untrusted content cannot pollute context.
How to use
- Run
python scripts/prompt_injection_scan.py. - Pass the text to scan via
--inputand set the scan mode via--mode safe/aggressive. - Output includes risk score, matched rules, and disposition advice; read the returned JSON for downstream decisions.
Workflow
- Submit content to the bilingual pattern + heuristic scanner.
- The engine identifies jailbreak, DAN, role hijack, and system-prompt-leak traits and checks sandbox rules.
- Score the overall risk; record matched rules and decide whether to trigger desensitization or blocking.
- Produce a disposition (drop/isolate/sandbox), reusing desens-scan and release-gate logic.
- The front-end acts on the score: block, isolate, or run in a safe sandbox.
Evidence & safety
- Evidence: TBD; Version: 1.0.1; Security: no independent scan (TBD).
中文
提示注入防护
何时用
- 数据接入前扫描:网页抓取、邮件、工具返回值或上传文档喂给 AI 前做安全预审。
- 防止指令劫持:检测「忽略之前指令」「你是新 AI」等触发词,防越狱或泄露系统提示。
- 作为 release-gate 前置环节,结合 desens-scan 双重校验,防不可信内容污染上下文。
用法
- 运行
python scripts/prompt_injection_scan.py。 --input传入待扫描文本,--mode safe/aggressive指定模式。- 输出含风险分、命中规则详情与处置建议,可读返回 JSON 做后续决策。
流程
提交内容到双语文式库+启发式扫描入口 → 识别越狱/DAN/角色劫持/系统提示泄露特征并关联沙箱规则 → 计算风险分并记录命中规则 → 生成处置建议(丢弃/隔离/沙箱)→ 前端按分拦截/隔离/沙箱运行。
证据与安全声明
- 证据:TBD;版本:1.0.1;安全:未做独立安全扫描(TBD)。
