The DeepSeek Harness plugin ecosystem allows for customizable behavior, but if the sandbox configuration is permissive, an agent can still execute dangerous operations. dsh-approval-gate intercepts actions before tool execution by registering tools.guard. It routes commands it cannot fully inspect to DSH’s native approval workflow and blocks recognized dangerous operations.
Plugin Introduction¶
This is a DeepSeek Harness native command-approval plugin maintained by GooDAnDReaY. It is an MIT-licensed open-source tool that provides security interception for bash commands and file-writing tools.
Installation and Activation¶
Install the plugin via the npm registry. After installation, ensure the gate remains enabled in the corresponding profile.
dsh plugin --profile web add @goodandready/dsh-approval-gate@0.1.3
Core Functionality¶
The plugin registers tools.guard to reject calls before tool bodies run. Its core capabilities include:
- Command Preprocessing and Blocking: Uses
lib/bands.jsfor fast two-band pre-filtering (Band 0 hard block, Band 1 safety check). For known dangerous operations (e.g.,rm -rf,DROP TABLE), it directly returns a block string. - Uncertain Command Routing: Routes commands that cannot be fully inspected (such as unclosed quotes, pipes, heredocs) to the DSH native approval flow.
- File-Write Protection: Classifies file-writing tools (e.g.,
write,edit,str_replace) by path rather than regex text to prevent writing to sensitive files (e.g.,.env,id_rsa,/etc/shadow). - Environment and Credential Protection: Prevents environment variable leaks, procfs reads, and key dumps via
lib/inspect-env.js. Redacts sensitive information in audit messages vialib/redact.js. - Circuit-Breaker Mechanism: Prevents infinite agent retry loops caused by security blocks via
lib/breaker.js.
Configuration¶
The plugin supports configuration through cordis.patch.yml. Available fields include:
| Field | Type | Default | Description |
|---|---|---|---|
toolName |
string | bash |
Specify the command parameter of the tool to inspect |
fileWriteTools |
string[] | write, edit, Write, Edit, str_replace, apply_patch |
File-writing tools classified by path |
Example configuration:
- insert:
- id: dsh-approval-gate
name: @goodandready/dsh-approval-gate
config:
toolName: bash
fileWriteTools:
- write
- edit
- Write
- Edit
- str_replace
- apply_patch
Typical Usage¶
The plugin classifies command behaviors as follows:
- Blocked:
rm -rf /tmp/x,sudo rm -r ...: Blocked.chmod/chownmodifying.env/id_rsa: Blocked.mysql << EOF DROP TABLE...: Blocked.curl ... \| python3: Blocked.bash -c "rm -rf /tmp/x": Blocked (nested shell).kill/pkill/killallas the main command: Blocked.
- Requests Approval:
source script.sh,. script.sh: Requests approval.- Commands with unclosed quotes,
$IFS,$(...), or heredoc<<: Requests approval.
Caveats and Use Cases¶
- Not a full parser: It is not a complete bash parser. Unknown or incomplete syntax will request approval. If approval is unavailable or set to
approval=never, DSH will reject the call. - File-scan limitation: For script files created earlier and executed later, the plugin will not open and scan the file (it only checks the execution command itself).
- Not a system sandbox: It only intercepts DSH tool calls.
cronandsystemdnever pass throughtools.guard. - Permission requirements: The plugin runs with the current dsh process privileges. Review the source code and license before installation.
Conclusion¶
By pre-execution interception and routing uncertain commands, this plugin provides a lightweight command security layer for DSH.