返回目录
安全与治理 插件

dsh-approval-memory

TMrazbw/dsh-approval-memory

自动同意请求 / DAM for DeepSeek Harness: approval memory, command-risk preview, and scoped auto-approval for read-only classes.

Stars
0
Forks
0
Issues
0
更新
18 天前

PROJECT TOPICS

项目标签

INSTALL REFERENCE

安装参考

未验证
dsh plugin --profile web add github:TMrazbw/dsh-approval-memory

该命令指向仓库当前默认分支;尚无绑定当前 commit 的完整验证结果。

PROJECT README

README

dsh-approval-memory(DAM)

A profile-level Host + Client plugin for DeepSeek Harness (DSH) that records approval requests, groups them into request classes, shows counts and possible risk, and lets the user auto-approve selected read-only classes.

  • DAM = DSH Approval Memory
  • Version: 0.3.2
  • No DSH core changes
  • No custom session event types
  • One-shot grants only: auto-approval still returns allowed-once

Features

  • Collects approval/asked / approval/decided from every session in the current profile.
  • Groups requests into stable classes such as plugin_manager:list_bundles and bash:sandbox:danger-full-access.
  • Shows request name, operation, count, risk, and last seen time; statistics are sorted by observed frequency, with the main table showing the auto-approved count.
  • Irreversible-action tags for display/audit only: force-push, deploy, data-delete, send-message; they never affect auto-approval.
  • Per-class switch for low-risk read-only classes.
  • Path trust, scoped to the current conversation and cleared on restart:
    • non-sensitive read requests are auto-approved;
    • sensitive paths stay manual, then a once-approved exact path is trusted for that session;
    • a manual write/edit approval trusts exactly that file for that session;
    • no parent/directory inheritance, no shell trust.
  • One collapsible no auto-approval (statistics only) section with two groups:
    • other observed classes that cannot be toggled (command preview, risk tags, targets, cwd);
    • permanent blacklist (read-only counts, no switch, no rule creation).
  • Repeated-rejection hint for the latest command hash, queried from retained audit events (no fixed 30-day window; the retained window may be shorter).
  • Approximate auto-approval outcomes (ok / error / no-result) from tool/result events.
  • Audit log of auto-approved requests.
  • Sidebar panel, /dam-ui command, and the open_dam_ui agent tool for natural-language opening.
  • Panel loads when opened; manual refresh is available.
  • Horizontal and vertical scrolling for long tables.

Install from GitHub

In a DSH Web session, install this repository as a profile bundle:

plugin_manager
  action: install_bundle
  target: https://github.com/TMrazbw/dsh-approval-memory

Or with the DSH CLI:

dsh plugin --profile <profile> add https://github.com/TMrazbw/dsh-approval-memory

The installation action requires approval and may need a DSH restart depending on the profile's HMR setup.

The plugin targets the public DSH 0.2.x plugin/event APIs. It was verified against DSH 0.2.1-rc.2. API changes in other DSH versions may require adjustments.

Usage

After installation:

  • Open 自动同意请求 from the left sidebar, or type /dam-ui.
  • Say “我要看 DAM 的界面” / “open the DAM UI”; the agent can call open_dam_ui.
  • The panel shows only request classes that actually occurred and can be auto-approved.
  • Classes that cannot be auto-approved (blacklist, medium/high/unknown risk) are counted but are not listed in the toggle table; the blacklist has its own read-only section.
  • Use the switch to enable or disable auto-approval for a low-risk read-only class.
  • 关闭全部自动同意 disables every known rule; it does not close the panel.
  • 返回对话 closes the panel and returns to the conversation.

Command names are lowercase; the typed command is /dam-ui, while the menu label is DAM-UI.

Default auto-approval

V1 enables these low-risk read-only classes by default:

  • plugin_manager:list_plugins
  • plugin_manager:list_bundles
  • plugin_manager:list_version_exemptions
  • plugin_manager:inspect (if the installed DSH exposes it)

Everything else is conservative:

Class Behavior
plugin_manager:set_plugin / set_bundle displayed, switch disabled (medium risk)
plugin_manager:install_bundle / remove_bundle statistics only
plugin_manager:set_version_exemption blacklisted, never auto-approved
bash / pwsh sandbox escalation statistics only
write / edit sandbox escalation statistics only
bash / pwsh / write / edit full access blacklisted
unknown / MCP / PTC statistics only

Risk labels are static inferences, not a security guarantee.

Scope

  • Applies to all sessions in the current DSH profile where the plugin is installed.
  • Subagent sessions are counted; auto-approval is disabled for subagents by default.
  • Other DSH profiles, other processes, and requests made before installation are not covered.
  • Data is stored under %DSH_HOME%/approval-memory by default:
    • classes.json
    • rules.json
    • events.jsonl
    • _plugin.log

Optional plugin config:

Field Default Meaning
dataRoot %DSH_HOME%/approval-memory data directory
maxEvents 5000 retained audit events
maxExamples 3 examples retained per class
includeSubagents false allow auto-approval in subagent sessions

Environment override: DSH_APPROVAL_MEMORY_ROOT.

Security boundaries

  • Auto-approval is a user-enabled rule, not an inferred “the user surely agrees” judgment.
  • Repeating a request does not automatically create a rule.
  • A request class with any rejection can be reviewed; V1 never treats repetition as consent.
  • The blacklist is code-owned and cannot be removed through the UI/API.
  • The open_dam_ui tool only opens the panel; it never changes rules.
  • The panel uses authenticated connection.fetch routes:
    • GET /api/approval-memory.snapshot
    • POST /api/approval-memory.mutate (setRule / closeAll)

Development

node --test --test-isolation=none

Current test suite: 136 tests, covering classification, extraction, redaction, storage, Host runtime, data bridge, Client registration, command-risk parsing, path trust, result tracking, and integration flows.

index.js            Host entry
client.js           Client entry: panel, sidebar, /dam-ui, open_dam_ui tool view
lib/
  classes.js        request class catalog
  blacklist.js      permanent deny list
  extract.js        callId/tool-call, command/cwd, and reason extraction
  format.js         counts, time, redaction
  store.js          file-backed persistence (v2 risk metadata)
  host.js           approval runtime
  open-tool.js      plain ToolDefinition for open_dam_ui
  bridge.js         authenticated snapshot/mutate routes
  command-risk.js   pure command-risk heuristics (recorded and displayed)
  path-trust.js     session path normalization and sensitive-path checks
test/               136 Node tests
locale/             en / zh display metadata

No build step is required. The plugin uses only public DSH events/services and the browser module loader.

License

MIT. See LICENSE.

CLASSIFICATION EVIDENCE

分类依据

项目类型插件
功能分类安全与治理
规则置信度高

系统优先读取 GitHub Topics,再与站内分类词典和词根规则比对。当前命中: security。