Back to home

a903067276-rgb

dsh-perm-guard

No description

Stars
0
Language
JavaScript
Created
Aug 17, 2026
Updated
Aug 17, 2026

Introduction

dsh-perm-guard

English | 简体中文

License: MIT

Auto-approval permission guard for DeepSeek Harness (dsh) web — the "middle tier" between workspace-write (asks too often) and danger-full-access (too open). Common operations like cross-directory edits, git commit/merge and builds run without approval prompts; destructive operations (deletes, disk ops, privilege escalation, curl|sh) always ask for human confirmation.

Auto button in the composer tool row

Auto Permissions settings page

Features

  • Auto approval answerer — intercepts every approval request before the host prompt, classifies the actual command/target, and auto-answers allowed-once for safe operations (13ms, no popup) or forwards to the human prompt for risky ones.
  • Command-level firewall (tools/pre-execute) — dangerous categories are intercepted before the sandbox even rejects them.
  • Two modes (switchable in the settings page, persisted):
    • Standard — auto-approve inside the trust directories (workspace, sibling directories, custom list); outside + risky operations prompt.
    • Aggressive — location-unrestricted: only destructive operations still prompt.
  • 11 per-category tri-state switches (auto / ask / deny) with your personal defaults.
  • Audit trail — every decision is recorded (approved / forwarded to human / rejected) with timestamp and command summary.
  • Persistent config~/.dsh/perm-guard.json, survives restarts. Zero host dependencies.

Install

dsh plugin --profile web add "github:a903067276-rgb/dsh-perm-guard#main"

Then restart dsh web. Update: dsh plugin --profile web update dsh-perm-guard, restart.

Requires pnpm in PATH (dsh plugin is a pnpm forwarder).

Usage

  • Auto button — in the composer tool row (left of the input box). Click to toggle auto-approval on/off (green = on). Off restores the host's default approval behavior completely.
  • Settings → "Auto 权限" (Auto Permissions) — total switch, mode selection (Standard / Aggressive), 11 category switches, trust directory editor, and the recent-decision audit list.
  • Rules apply to all sessions (including subagents) while enabled.

Mode defaults

CategoryStandardAggressive
File edit (write/edit/cp/mv/mkdir)auto (in trust dirs)auto
Git local (commit/merge/rebase/checkout)autoauto
Build / test / installautoauto
Read-only queries (ls/cat/grep/git status)autoauto
Delete (rm, reset --hard, clean -fd)askask
Protected paths (.ssh/.aws/secrets/.env/system dirs)askask
Privilege (sudo, services, global installs)askask
Network download-execute (curl|sh)askask
Git pushaskauto
Publish / deployaskauto
Disk / partition / deviceaskask

Switching modes resets the category switches to that mode's defaults (adjustable afterwards).

Never auto-approved (all modes)

  • Deletion: rm, rm -rf / or ~ (circuit breaker, even with $(...) variants), git reset --hard, git clean -fd, Remove-Item
  • Disk: dd writing devices, mkfs/fdisk/wipefs/diskutil erase, writes to /dev/
  • Privilege: sudo/su, service management (launchctl/systemctl), recursive chmod/chown on / or ~
  • Network download-execute: curl|sh, wget|sh
  • Force push: git push --force / -f (rewrites history)
  • Writes to protected paths

Coverage

  • All approval entry points in DSH are covered: bash, pwsh (PowerShell), and the write/edit file tools. MCP tools and other read-only tools have no approval mechanism and are unaffected.
  • Compound commands (a && rm -rf x): pure-word chains are split and evaluated per subcommand, taking the strictest result; chains containing variables/redirection/wildcards are treated conservatively as one unit.
  • Unknown commands fall back to "ask" in Standard mode (safe default) and "allow" in Aggressive mode.

How it compares to Claude Code / Codex

Claude CodeCodexdsh-perm-guard
Read-only command setbuilt-in, not configurablesandboxbuilt-in + configurable
rm -rf / ~ breakeralways promptssandbox blocksalways prompts (all modes)
Protected pathsyes.git/.agents/.codex.ssh/.aws/secrets/system dirs/.git
Network isolationtool-levelOS-level (default off)not available (DSH has no OS network fence; only curl|sh pattern detection)
Approval categories3 tool classes5 granular switches11 explicit switches + 2 modes
Auditingprompts onlylogsin-plugin audit + host approval/asked/decided events

Configuration file

~/.dsh/perm-guard.json (created on first change):

{
  "enabled": true,
  "mode": "standard",
  "categories": { "fileEdit": "auto", "...": "..." },
  "trustedDirs": []
}
  • trustedDirs: extra absolute paths auto-approved in Standard mode (default: workspace + its sibling directories).
  • Trust directories are ignored in Aggressive mode (location-unrestricted).

Known limitations

  • DSH's sandbox has no OS-level network fence (unlike Codex): the plugin can only detect download-execute patterns (curl|sh) in command text, not block other network traffic.
  • Terminal sessions, subagent creation, model calls and MCP tools are outside the approval system entirely.
  • Commands whose text contains danger words (e.g. echoing "Remove-Item", or scripts embedding rule sources) are conservatively intercepted — expected, rare in practice.
  • The audit list is in-memory (60 entries) and resets on restart; approval decisions themselves are always persisted via the host's approval/asked + approval/decided event pair.

Development

# hot-plug testing (no restart)
# 1. define a dynamic Cordis plugin with the same decision logic
# 2. cordis_run → verify → cordis_stop

# static bundle (this repo layout)
# symlink to ~/.dsh/profiles/web/node_modules/dsh-perm-guard
# add "dsh-perm-guard" to ~/.dsh/profiles/web/package.json dsh.profile.bundles
# restart dsh web

Verification matrix: docs/verify-checklist.md

License

MIT