DSH Plugins Marketplace

DSH Plugins

Plugins

/

Security & Audit

/

dsh-guard-sensitive-paths

T

dsh-guard-sensitive-paths

Manifest valid

Approval guard for DeepSeek Harness: write/edit/editor/bash calls touching sensitive paths (.env, .git, SSH keys, .pem) become an approval ask.

hasBundlePatch

dsh-guard-sensitive-paths

一个 DeepSeek Harness(DSH)插件(bundle):宿主侧前置注册 tools/pre-execute 策略,把指向敏感路径的 write / edit / str_replace_editor / bash 调用,以及 read 对密钥类文件(SSH 私钥、.pem 证书)的读取,拦截为审批询问(ask)——命中时调用不会直接执行,而是请求用户批准;没有审批通道的自动化按失败关闭。

本插件是纯审批策略:不修改任何会话行为,只把命中敏感目标的调用变成一次审批交换。grep / glob 对同一敏感集合的搜索排除由搜索层(@deepseek-ai/dsh-tool-fs-search)始终开启地完成,与该插件的配置无关。

保护范围

类别匹配规则示例
环境变量文件路径段以 .env 开头.env、.env.local
Git 元数据路径段等于 .git.git/config
SSH 私钥文件名为 id_rsa / id_ed25519(可带点号后缀)id_rsa、id_ed25519.pub
证书文件名以 .pem 结尾server.pem
SSH 目录路径段等于 .ssh.ssh/id_ed25519
  • write / edit 检查 file_path、str_replace_editor 检查 path,统一按路径段匹配(先归一化反斜杠)。
  • read 检查 file_path,但只对密钥类文件(SSH 私钥、.pem 证书)触发询问;读取 .env / .git / .ssh/config 等保持放行——把环境文件载入工具属常见合法操作,且这些路径始终被搜索层从 glob/grep 结果中排除。
  • bash 对命令文本扫描同一集合:命令里出现 .env、.git(作为独立路径名,覆盖 cp -r .git、tar czf x .git、--git-dir=.git 这类无尾斜杠写法)、id_rsa、id_ed25519、*.pem、.ssh/ 等即触发询问。普通 git 命令(git clone / push / pull / branch / fetch …)因不出现 .git 路径名而不受影响;foo.git、.gitignore、.github、.gitx 也不匹配。
  • 其余工具原样放行。

安装

本包符合 DSH bundle 规范:package.json 声明 dsh.bundle.patch,指向随包发布的 cordis.patch.yml(注册 id: sensitive-paths)。dsh plugin 检测到 dsh.bundle 后会自动把它追加进该 profile 的 dsh.profile.bundles 层列表,重启该 profile(如 dsh web)后生效。

从 GitHub 安装

dsh plugin --profile web add github:TARS-snail/dsh-guard-sensitive-paths

从本地目录安装(开发/自用)

dsh plugin --profile web add /path/to/dsh-guard-sensitive-paths

验证

dsh --profile web --dump-config
# 生效的配置里应能看到 id 为 sensitive-paths 的一行(name: dsh-guard-sensitive-paths)

配置

默认零配置即开启。在 profile 的 cordis.patch.yml(用户层)中按 id 覆盖:

- id: sensitive-paths
  name: dsh-guard-sensitive-paths
  config:
    sensitivePaths: false
字段类型默认说明
sensitivePathsbooleantrue为 false 时守卫整体关闭:不注册任何监听器,成为空操作

工作原理

  • 守卫以 PREPEND 方式注册在监听链最前,先于任何权限授予等其它 tools/pre-execute 监听执行;命中敏感目标(含读取密钥材料)即返回 ask 决策,理由为「<tool> targets the sensitive path <target> (<category>); approval is required because it matches the sensitive-path policy」。<category> 取 environment-file、git-metadata、key-material、certificate、ssh-directory,仅用于让审批自解释、便于审计,不改变是否拦截。
  • 未命中的调用经 next() 原样委托,不产生任何延迟或副作用。
  • 写/改类工具按完整敏感集(.env、.git、.ssh、SSH 私钥、.pem)匹配,read 按密钥子集(SSH 私钥、.pem)匹配,两者共享同一套 basename 规则。
  • 导出的 SENSITIVE_PATH_GLOBS 常量与搜索层的排除 globs 互为镜像,两处各自独立实现、互不依赖(守卫匹配用分段规则,搜索层匹配用 glob 排除 + 路径二次过滤)。

威胁模型边界(不覆盖什么)

本插件是工具调用面的路径审批策略,只观察 write / edit / str_replace_editor / read / bash 这些工具的参数。以下都不在其射程内:

  • 宿主级 sidecar / 运行时自身的文件与网络行为:不经过工具循环的读取、打包、加密、上传,本插件完全看不到,也不会产生任何 ask。2026-09-18 的智谱 ZCode「静默上传整仓 .git 历史」事件即属此类——其 313MB 归档中 .git 占 86.6%(.git/lfs 56.8%、.git/objects 29.6%、.git/logs 0.2%),打包上传由宿主进程在工具循环之外完成,任何工具面策略都无法拦截。
  • 网络出口:文件 sandbox 管文件访问,不管主机进程把数据发往哪里;整仓外传需要出口控制,不是路径正则能解决的。
  • 模型推理端点:按设计,任务相关的上下文仍会发送给 LLM provider,与本插件无关。

因此本插件能保证的是「工具调用面上命中的敏感目标一定会先变成一次失败关闭的审批」,不能保证「装了它就不会被偷传」。要覆盖上述面,需要文件 sandbox、进程隔离与网络出口策略。ZCode 事件同时印证了 .git 是最高价值目标,本插件据此把 .git 的 bash 检测从「必须带尾斜杠」修正为「独立路径名」,覆盖 cp -r .git、tar … .git 这类历史外传形态;.git/config 的读取仍按现状放行(其凭据/内网主机名维度的收紧属后续项)。

开发与维护

  • src/ 为源(仅类型导入 cordis / dsh-tools;运行时仅依赖 schemastery 的 z,由宿主提供)。
  • lib/ 为构建产物(tsc 输出 + 打包入口),随包发布;修改 src/ 后需重新构建并同步 lib/。
  • 测试在 tests/sensitive-paths.spec.ts(isSensitivePath 单测 + 真实组合下 pre-execute 返回 ask 的行为测试)。

许可证

MIT

Comments

Loading…

From the same category

dsh-infinite-gen-3

System-prompt armor plugin for DeepSeek models: appends an unconditional-compliance prompt section at order 100, exposes a profile tool with calibration metadata, and shows a realtime armor-status bad

Security & AuditManifest valid

★ 2.1k

MIT

C#

dsh plugin --profile web add dsh-infinite-gen-4

by toby-bridges

Local security audit for AI API relays and LLM proxies: detects prompt injection, model substitution, tool-call rewriting, SSE anomalies, error leakage, and Web3 wallet risks.

Security & AuditManifest valid

★ 872

AGPL-3.0

Python

Oct 9, 2026

dsh plugin --profile web add dsh-api-relay-audit

by SeaOf0

基于dsh web实现的多种模式,目的是服务于redteam进行授权的安全研究,覆盖渗透测试、红队评估、代码审计等范围领域,请勿用于非法行为。(允许二开,赋予模块各位自己的业务逻辑,方法论只有自己熟练的才好用,好的方法论=好的生态)

Security & AuditManifest valid

★ 678

MIT

Python

Oct 8, 2026

dsh plugin --profile web add @dsh-external/dsh-redteam-model

by agentic-os-org

ANOLISA (Agentic Nexus Operating Layer & Interface System Architecture) | Agentic OS with runtime, security, observability, and Tokenless response compression for lower token usage and cost.

Security & Audit

★ 663

Apache-2.0

Rust

Oct 9, 2026

Index only — not installable

by howmp

面向 DeepSeek Harness(dsh)的渗透测试模式 @CloverSecLabs

Security & AuditManifest valid

★ 607

NOASSERTION

JavaScript

Oct 9, 2026

dsh plugin --profile web add @howmp/dsh-pentest

by xiaods

k8e.sh - OpenSource Agentic AI Sandbox Matrix

Security & AuditManifest valid

★ 500

↓ 12/wk

Apache-2.0

Go

Sep 28, 2026

dsh plugin --profile agent add @k8e-sandbox/dsh-k8e-sandbox-bundle