XiaoYuOvO/dsh-llm-injection-filter
XiaoYuOvO★ 0JavaScript最后同步: 2026-08-18
DSH LLM response-stream injection filter: hard-block rare Unicode scripts (Track A) + score-based disposal of control chars / protocol markers / script mixing / spam keywords (Track B) on the llm/stream waterfall. Install: dsh plugin --profile web add github:XiaoYuOvO/dsh-llm-injection-filter
README 摘要
dsh-llm-injection-filter DeepSeek Harness 的 LLM 响应流注入过滤器 :在模型流式响应进入 agent 之前,实时检测疑似提示词注入 / 污染内容并处置。挂载于 llm/stream waterfall,对所有适配器生效,不改动任何运行时源码。 背景动机(真实安全事件) 一个 coding agent 会话( gpt-5.6-terra / openai / OpenAI Responses API)中,模型在生成 edit 工具的 new string 参数时,于正常代码之后无缝接续输出了一段注入式载荷并被逐字写入源码、进入 Git 历史。污染样本: 特征:协议控制标记( assistant to= 、 / 、 、 ] (只替换字符串值内部,保持 JSON 引号/结构不变;逐 delta 与 block-end 权威内容同步改写); - reject :block-end 把命中 tool-call 的 block.arguments 改写为 {"$rejected":"dsh-injection-filter","reason":" "} (缺必需字段 → 工具 schema 校验失败 → INVALID ARGS 返回模型,模型可自我纠正);text 命中替换为 [FILTERED: ] ;reasoning 只 audit。 - 轨道 A 与 B 独立、同时生效;A 命中时不做 strip/reject,直接中断。 配置 审计日志 每次命中输出一行结构化日志( console.error ): rule ∈ HARD BLOCK CTRL PROTO SCRIPT KW ;只提取标量, sample 截断 ≤ maxSampleLen 。 中断时详细记录(RECORD) 轨道 A 命中、需要中断 agent loop 时 ,除上述紧凑审计行外,额外输出一条结构化 RECORD 行,包含 出现问题的请求身份 与 相应载荷的详细信息 (取证用): - block.kind ∈ text tool-call-arguments reasoning ;tool-call 场景额外携带 index/callId/toolName/accumulatedArguments (拦截瞬间的完整载荷,含命中 delta 本身)。 - 载荷详情按 recordMaxLen 截断( deltaLength / accumulatedLength 保留完整长度);只提取标量/有界文本,不触碰 options.messages 等大型 live 对象;不落盘,随插件 fiber 输出到结构化日志通道。 已知取舍(文档化) - 默认允许集合不含日文(假名)/韩文(谚文)/俄文(西里尔)等 ,含这些脚本的合法输出也会被硬阻断。这是刻意设…
在 GitHub 查看完整 README →分类
DeepSeek Harness: Everything is a Plugin.
★ 183,476
amruthpillai/reactive-resumeA one-of-a-kind resume builder that keeps your privacy in mind. Completely secure, customizable, portable, open-source and free forever. Try it out today!
★ 41,499
anywhere-labs/deepseek-harness-desktop为 DeepSeek Harness (DSH) 插件生态打造的现代化桌面端解决方案。万物皆「插件」,桌面本身也是「插件」。
★ 18,022