Preface¶
The core capability of DeepSeek Harness (DSH) lies in allowing agents to invoke external tools. Without safeguards, misuse or malicious behavior during tool invocation can directly compromise the system environment. DSH’s native tool approval typically offers only two modes: “popup inquiry” or “completely disabled.” The former interrupts workflows, while the latter renders protection meaningless.
dsh-warden aims to provide a third option: zero interruption during normal operation, triggering a low-cost review only for genuinely dangerous operations. By hooking into the tools/pre-execute hook, it intercepts and evaluates risks before tool execution.
What It Is¶
dsh-warden is a plugin for DeepSeek Harness, maintained by dingchenhui0618-arch and licensed under MIT.
It functions as an “adversarial review gate”: before a tool call is executed, a separate small model reviews the call to determine if it is dangerous, returning a command to either allow or block it. All judgment results are displayed in real-time in the Web GUI, and every decision is recorded in an audit log.
Core Features¶
Two-Layer Defense Mechanism¶
The plugin adopts a two-layer defense strategy. The second layer is triggered only if the first layer does not intercept, ensuring no additional latency for daily operations.
-
Layer 1 (Local Regex, Zero Latency)
Uses local regular expressions to match destructive commands and sensitive paths.- Destructive Commands: Include
rm -rf(any flag order),Remove-Item -Recurse,rmdir /s,format,mkfs,DROP TABLE/DROP DATABASE,git push --force,git reset --hard, etc. - Sensitive Path Writes:
.env,credential,id_rsa,.ssh,.git/,settings.*,cordis*.yml,AGENTS.md, and any files under$DSH_HOME.
- Destructive Commands: Include
-
Layer 2 (Model Call, On-Demand Trigger)
For calls that do not match Layer 1, the plugin sends “Tool Name + Risk Category + Full Parameters + Current Session Context” to a review model, which decides whether to block it.- Normal read/write operations (
read/grep/glob) do not enter this logic and incur no extra latency.
- Normal read/write operations (
Real-time Review and Auditing¶
- Web GUI: In the “Adversarial Review” tab of the conversation view, you can view real-time counters (Total Tool Calls, Count by Risk Category, Sent for Review, Allowed, Blocked, Exception Degradations) and details of the last 60 decisions (Time, Tool Name, Risk Category, Latency, Model, Reason).
- Audit Log: Every call sent for review appends a JSON line to
$DSH_HOME/warden-audit.l, containing time, tool, category, decision, reason, model, and latency. Normal calls not sent for review exist only in an in-memory ring buffer and are not persisted to disk.
Configurable Rules¶
Default rules are built into the plugin, adopting a strategy of “default allow, only block irreversible destruction.”
* Users can override default rules by editing the $DSH_HOME/adversary.md file.
* This file supports auto-reloading based on modification time. After modification, clicking the “Reload Rules” button on the panel takes effect without restarting DSH.
Installation and Activation¶
The plugin has been published to npm, supporting installation from npm or GitHub. After installation, restart DSH, and the “Adversarial Review” tab will appear in the conversation view.
dsh plugin --profile <your profile> add dsh-warden
If you need to install from source:
dsh plugin --profile <your profile> add github:dingchenhui0618-arch/dsh-warden
Caveats¶
- Rejects Inquiry Mode: The plugin never returns
ask. If the approval UI is unavailable or disabled, it defaults to denying the operation. Do not rely on it to provide interactive “Please confirm” popups. - Exception Fault Tolerance: The plugin does not block execution upon exceptions or errors. If the model is unavailable, parameters cannot be serialized, or any error occurs, the plugin allows the execution directly. Its design goal is “do nothing in the worst case,” rather than “locking the workflow due to plugin crashes.”
- Security Boundary: It is not a hard security boundary. Because it runs within the same process, malicious code or plugins could still potentially bypass it. It is primarily intended to reduce the probability of accidental misoperation.
- Classification Basis: Classification is based on “Tool Name + Parameter Pattern,” not the type reported by the tool itself.
Conclusion¶
By combining regex pre-checks with model reviews, dsh-warden provides granular control over tool calls for DSH. It does not interfere with normal read/write operations but offers fallback protection at the edge of danger. For users running DSH in production environments or with sensitive data, this is a security enhancement worth trying.