Skip to content

Installation and Configuration

jkrandom-sudo edited this page Aug 15, 2026 · 1 revision

安装与配置

安装

# 从 npm
dsh plugin --profile web add dsh-plugin-audit

# 或直接从 GitHub
dsh plugin --profile web add github:jkrandom-sudo/dsh-plugin-audit

两条命令都会:

  1. 把包注册进 profile 的 package.json 的 dsh.profile.bundles;
  2. 应用本包自带的 cordis.patch.yml——向 profile 插入一行 dsh-plugin-audit(sentinelEnabled: true)。

重启 profile 后生效。 本插件除 profile 自身的依赖元数据外不做任何写入。

卸载

dsh plugin --profile web remove dsh-plugin-audit

移除依赖与 bundle 行,重启 profile 即可,无其他残留。

配置参考

bundle patch 插入的行可以在 profile 的 cordis.patch.yml 中编辑:

- id: dsh-plugin-audit
  name: 'dsh-plugin-audit'
  config:
    sentinelEnabled: true        # 总开关;false = 只保留静态审计
    allowedHosts:                # shell 外发的预批准主机
      - github.com
      - api.github.com
      - raw.githubusercontent.com
      - registry.npmjs.org
      - '*.deepseek.com'         # 前导 *. = 后缀规则

sentinelEnabled

  • true(默认):哨兵武装,监视会话中的每一次工具调用;
  • false:哨兵不挂载,只保留 plugin_audit 静态审计工具。

allowedHosts

哨兵规则 2(shell 外发)的主机白名单。匹配语义:

条目形式 匹配行为 例子
github.com(精确) 只匹配该主机本身 github.com ✅,api.github.com ❌
*.deepseek.com(后缀) 匹配所有子域名和裸域名 api.deepseek.com ✅,deepseek.com ✅
  • 比较不区分大小写(GitHub.com 与 github.com 等价);
  • 精确规则不会自动放宽到子域名——需要子域名就显式加 *. 前缀条目;
  • URL 中显式的主机优先;没有 URL 时回退到命令文本里的类主机 token(已知文件扩展名如 report.json、build.tar.gz 不会被误判为主机)。

静态扫描器不读取 allowedHosts——它如实报告发现的每一个网络面,白名单只影响运行时哨兵的裁决。

Clone this wiki locally