api-relay-audit
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.
PROJECT TOPICS
INSTALL REFERENCE
dsh plugin --profile web add github:Wonjader/dsh-permission-workspace-write-plus
该命令指向仓库当前默认分支;尚无绑定当前 commit 的完整验证结果。
PROJECT README
⚠️ 本项目按“现状”提供,不承诺长期持续性维护,使用前请自行评估风险。
完全插件化的 Workspace Write Plus 权限预设 + 合并版跨平台睡眠守护。 当前版本 1.2.2。
.dsh/profiles 插件/配置写入 + .dsh/skills 写入| 维度 | 权限 |
|---|---|
| 工具调用 | 完整(所有 tool) |
| 工作区(会话 workspace 根目录) | 读写 |
| 平台临时区 | 读写 |
| 工作区外配置类文件(且工作区内无同名对应) | 写 |
.dsh/profiles(插件安装与 profile 配置) |
写 |
用户 DSH skills 目录(<DSH_HOME>/skills) |
写 |
用户 DSH 主目录(<DSH_HOME>,兼容旧行为,可独立关闭) |
写 |
| 系统睡眠/关机指令(shutdown / powercfg / systemctl suspend 等) | 允许(宿主执行) |
| 睡眠守护:agent turn 执行期间保持系统不睡眠 | 默认开启 |
| 工作区外其他文件 | 拒绝写 |
| 升级/越界重试 | 需审批(approval: ask) |
lib/fs.js):继承 LocalFileSystem,标准 workspace-write fence
完全兼容;plus 会话额外放行配置类文件、.dsh/profiles、.dsh/skills、
.dsh 主目录。每个附加类别有独立 settings 开关。lib/shell.js):Windows 继承 PwshLocalExecutor,
Linux/macOS 继承 LocalBashExecutor;plus 会话中系统命令白名单走宿主执行。lib/sleep-guard.js):监听 session/event 的
turn/start / turn/end,引用计数。Windows 通过常驻 PowerShell 调用
SetThreadExecutionState,Linux 用 systemd-inhibit,macOS 用
caffeinate。WSL 中额外通过 interop 启动 Windows PowerShell 常驻进程,
让 Windows 主机在 WSL 的 dsh 执行任务时同样不睡眠。lib/client.js):权限图标 + 权限中文名
(“工作区内修改+”)+ 设置中独立的
Workspace Write Plus 设置栏(与通用设置同级)。插件 bundle patch 是纯 insert 的包根行(cordis.patch.yml),可以被
dshmarket 热挂载。fs/shell 两行仍在 profile patch 中。
- id: fs-sandbox
disabled: true
- id: pwsh-sandbox
disabled: true
- insert:
- id: fs-workspace-plus-config
name: dsh-permission-workspace-write-plus/fs
- id: shell-workspace-plus-config
name: dsh-permission-workspace-write-plus/shell
- id: fs-sandbox
disabled: true
- id: bash-sandbox
disabled: true
- insert:
- id: fs-workspace-plus-config
name: dsh-permission-workspace-write-plus/fs
- id: shell-workspace-plus-config
name: dsh-permission-workspace-write-plus/shell
包根行由插件 dsh.bundle.patch 提供:
- insert:
- id: dsh-permission-workspace-write-plus
name: dsh-permission-workspace-write-plus
禁用插件时
disabled行与insert行必须成对处理,否则核心 fs/pwsh 或 fs/bash 服务缺失会导致 DSH 无法启动。
dsh plugin --profile web add github:Wonjader/dsh-permission-workspace-write-plus
插件注册 workspace-write-plus 命名空间;设置页中会渲染独立一栏的开关组
(lib/client.js),也可直接写 settings.yaml:
| 键 | 含义 | 默认 |
|---|---|---|
enabled |
总开关:关闭后所有附加放行与睡眠守护失效 | true |
allowConfigFiles |
工作区外配置类文件写入 | true |
allowSkills |
<DSH_HOME>/skills 目录写入 |
true |
allowProfiles |
<DSH_HOME>/profiles 目录写入(插件/profile 配置) |
true |
allowDshHome |
<DSH_HOME> 整目录写入(兼容旧行为) |
true |
allowSystemCommands |
系统睡眠/关机指令宿主执行 | true |
allowSleepGuard |
任务执行期间保持系统不睡眠 | true |
settings.yaml 示例:
workspace-write-plus:
enabled: true
allowConfigFiles: true
allowSkills: true
allowProfiles: true
allowDshHome: true
allowSystemCommands: true
allowSleepGuard: true
| 环境 | 实现 |
|---|---|
| Windows | 常驻 PowerShell + SetThreadExecutionState(ES_CONTINUOUS\|ES_SYSTEM_REQUIRED) |
| Linux | systemd-inhibit --what=sleep |
| macOS | caffeinate -i |
| WSL | Linux 侧尽量使用 systemd-inhibit;同时通过 /mnt/c/.../powershell.exe 持有 Windows 主机唤醒锁 |
turn 开始 hold、turn 结束 release;多会话并发时引用计数,最后一个 turn 结束后释放;插件卸载/停用时自动释放。
特别说明:当Windows的Modern Standby被触发时,WSL会被暂停,sleep guard功能无法避免这一机制。
aria-label)、对话区权限下拉、通用设置权限下拉、/permission 快捷选择列表,以及设置侧栏的插件分栏标题与总开关文案。name(profile patch)与图标逻辑均不变:通用设置权限下拉仍保持无图标,其他位置图标不动。aria-label 上就地改写,不改核心、零核心改动,也不干扰 React 的渲染状态。document.body 的,之前只判断了 [role="dialog"] 祖先,导致 Workspace Write Plus 仍被注入图标。现在同时识别 portal 菜单并跳过,保持与系统自带权限项一致。allowWriteDirs 设置:可在 Workspace Write Plus 设置页中添加任意数量的绝对目录,这些目录会加入额外可写白名单,不再局限于预设的配置目录、.dsh/profiles、.dsh/skills、.dsh 主目录。enabled 关闭时所有自定义目录同样失效。connection.api.settings 迁移到 ctx.settingsScope 服务;插件优先使用 ctx.settingsScope.bind({ namespace }),旧版回退到 connection.api.settings,修复新版下设置页缺少 Workspace Write Plus 一栏的问题。@deepseek-ai/dsh-settings 已移除 installSettingsSection / settingsNamespace 命名导出。插件改为运行时特性检测:旧版使用 installSettingsSection(...),新版使用 ctx.settings.installSection(...),避免 ESM 静态链接失败导致 DSH 无法启动。dshmarket 升级到 1.45.1,以兼容新版 settings 服务 API。.dsh/profiles / .dsh/skills 写入、系统睡眠/关机命令宿主执行、跨平台睡眠守护(Windows/Linux/macOS/WSL)。本插件目标仓库:
dsh plugin --profile web add github:Wonjader/dsh-permission-workspace-write-plus
本项目接受外部贡献,但作者无义务审查或合并。提交即视为按APL授权。
本作品包含AI生成内容,按“现状”提供,不附带任何担保。使用或分发所产生的一切后果由接收者自行承担。
本作品使用 无著公共许可证(Asanga Public License, APL)v1.0 授权。
Copyright © 2026 Wonjader(GitHub、gitee、AtomGit:@wonjader)
详见 LICENSE.md 文件。
CLASSIFICATION EVIDENCE
系统优先读取 GitHub Topics,再与站内分类词典和词根规则比对。当前命中: deepseek-harness-permission、sleep-guard。