PerryLink/dsh-defend12

dsh-defend

Prompt-injection, jailbreak, and secret-leak detection with allow/ask/block interception for DeepSeek Harness: an Aho-Corasick pattern engine and heuristics ported from the Prompt-Injection-Payloads, Jailbreak-Detector, and Secret-Key-Leaker-Detect assets, gating user messages on agent/pre-step, tool arguments on tools/pre-execute, and tool results on tools/post-execute, with sanitized defend/* session audit events, a defend_report tool, and a /defend command.

包名
dsh-defend
版本
0.3.10
许可证
Apache-2.0
最近更新
2026年9月12日

安装

$npx -p @deepseek-ai/dsh dsh plugin --profile web add github:PerryLink/dsh-defend

Configuration

All tunables are Schemastery Config fields (changeable from cordis.yml). An id-targeted override replaces the whole row — restate every key you need. cordis.patch.yml documents each key inline.

KeyDefaultMeaning
enabledtrueMaster switch for both layers
actiondenyDestructive-delete guard action (deny / ask)
toolNames['bash','persistent-bash','terminal-bash']Tool names whose command arguments the guard reviews
detection.enabledtrueDetection-layer switch
detection.maxScanChars10000Scan cap per interception (head only)
detection.normalizeUnicodetrueNFKC-normalize text before scanning (blocks lookalike-Unicode bypass)
detection.secretMinEntropy3.0Minimum Shannon entropy (bits/char) to admit a secret regex hit; 0 disables
detection.injectionActionaskInjection family: allow / ask / block
detection.jailbreakActionaskJailbreak family: allow / ask / block
detection.secretActionaskSecret family: allow / ask / block
detection.secretBlockCriticaltrueCritical secrets always block regardless of secretAction
detection.audittrueWrite defend/detection session audit events
detection.allowUnmarkedAuditfalseKeep writing session audit on hosts whose Session.append predates the ignorable marker (every released line so far) or that fail-closed on unknown event types (host 0.1.2-rc.1+), accepting the unresumable-session hazard
detection.maxReportEntries200In-memory report ring-buffer cap
registerCommandtrueRegister the /defend command
registerTooltrueRegister the defend_report tool