DSH (DeepSeek Harness) restricts Agent execution permissions through a sandbox mechanism. When the sandbox intercepts a command and requests privilege escalation (e.g., to the danger-full-access level), manual approval is usually required. Manual approval is inefficient and precludes automated allowance based on command characteristics.
The dsh-approve-prefix plugin analyzes command line prefixes to automatically approve privilege escalation requests when specific conditions are met, while introducing a session-level “Night Mode” to manage approval flows.
Plugin Introduction¶
- Name:
dsh-approve-prefix - Author:
azazo1 - Category:
admin-security - Positioning: Automates the approval of DSH sandbox escalation requests via prefix matching.
This plugin addresses the issue where DSH escalation approval requests typically only contain toolName and reason without the raw command text. It inserts the command record at the very front of the approval waterfall, replacing the model’s uncertain judgment with deterministic rules (prefix matching).
Core Features¶
- Prefix Auto-approval: Automatically approves requests only when they originate from tools like
bashorpwsh, and the command is “exactly one simple command” (no pipes, redirects, or chaining operators) whose argv matches an allowed prefix. - Night Mode: Provides a session-level switch. When enabled, escalation requests that do not match allowed prefixes, as well as approval inquiries from other plugins (e.g., the first prompt from a Chrome plugin), are rejected directly without popping up cards.
- Command Filtering: Commands containing pipes (
|), chaining operators (;,&&), redirects (>,<), or command substitutions ($(...)) are always routed to manual approval. - Management Capabilities: Supports configuration of static prefixes, persistent prefixes, and session-level temporary prefixes. Allows management of temporary prefixes for the current session via the Session View Tab.
Installation and Activation¶
After installing the plugin, the host process (both Host and Client sides) must be restarted to take effect.
Web Installation¶
Install into the web profile:
dsh plugin --profile web add azazo1/dsh-approve-prefix
After installation, restart dsh web and refresh the browser page.
Dependencies¶
The plugin requires DeepSeek Harness engine version 0.2.0-rc.1 or higher.
Configuration¶
Configuration is located in the profile’s cordis.patch.yml. All fields have default values:
- insert:
- id: dsh-approve-prefix
name: dsh-approve-prefix
config:
prefixes: []
tools:
- bash
- pwsh
allowedEscalationModes:
- danger-full-access
| Field | Default Value | Description |
|---|---|---|
prefixes |
[] |
Static allowlist of prefixes. Defaults to empty. |
tools |
['bash', 'pwsh'] |
Tool names involved in logging and judgment. |
allowedEscalationModes |
['danger-full-access'] |
Escalation modes eligible for automatic approval. Defaults to danger-full-access only. |
nightBlockedTools |
['ask_user_question'] |
List of tool names to be directly rejected in Night Mode. |
nightExemptTools |
['exit_plan_mode'] |
Exceptions allowed even if they are in nightBlockedTools. |
nightCommand |
true |
Whether to register the /night command to toggle Night Mode. |
Typical Usage¶
The plugin judges based on “single simple commands.” In the following examples, assume the prefix gh api is configured:
- Auto-approved:
gh api user --jq .login
- Manual Approval (Contains pipe):
gh api user | jq .login
- Manual Approval (Contains chaining operator):
gh api user; rm -rf /tmp/x
- Manual Approval (Contains redirect):
gh api user > /tmp/out.json
Notes¶
- Restart to Apply: After modifying configuration or installing the plugin, the host process must be restarted for the settings to take effect.
- Night Mode Logic: When Night Mode is enabled, if the tool arguments contain
approved: truebut the command does not match an allowed prefix, the request will be rejected and not routed to manual review. - Meaning of Approved Field: The
approved: truefilled by the model in the schema is a self-check declaration used for conditional verification; it is not an approval request and does not change the Night status. - Session View Management: Changes to temporary prefixes and the Night switch in the session view must be saved by clicking “Apply” to be written into the Host memory.