DeepSeek-Harness 局域网访问,一行改动让 DSH Web UI 绑定所有网卡
dsh --host 0.0.0.0被禁一行改动让 DSH Web UI 绑定所有网卡DeepSeek-HarnessDSHDSH 出于安全考虑禁止--host 0.0.0.0但局域网调试场景确实需要本文提供 diff 补丁和 agent prompt 两种方式解除限制。正文DeepSeek HarnessDSH的 Web UI 默认只监听127.0.0.1当你尝试dsh--profileweb--port8080--host0.0.0.0会直接报错退出error: --host 0.0.0.0 is intentionally not supported yet for safety: it would expose remote code execution to the network; use 127.0.0.1 instead原因是 DSH agent 具备执行本地 shell 命令的能力绑定0.0.0.0意味着同网络的任何设备都能触达这个能力风险很大。但如果你在可信内网调试确实需要从手机或其他设备访问可以用以下两种方式解除限制。方案一diff 补丁找到你 DSH 安装目录下的这个文件node_modules/deepseek-ai/dsh-web-app/lib/startup.js第 39 行apply 以下 diff--- a/node_modules/deepseek-ai/dsh-web-app/lib/startup.js b/node_modules/deepseek-ai/dsh-web-app/lib/startup.js -36,7 36,7 program.action(() { const options program.opts(); - if (options.host 0.0.0.0) program.error(error: --host 0.0.0.0 is intentionally not supported yet for safety: it would expose remote code execution to the network; use 127.0.0.1 instead); if (options.host 0.0.0.0) console.warn(⚠️ WARNING: Binding to 0.0.0.0 exposes agent command execution to the entire network. Use at your own risk.); if (options.port ! void 0 !/^\d$/.test(options.port)) program.error(error: --port must be a number, got ${JSON.stringify(options.port)});保存后即可正常启动。program.error()会终止进程换成console.warn()只打警告不退出。方案二让 Agent 帮你改BasePrompt把下面这段话直接丢给 DSH 或任何 agent找到 DSH 安装目录下node_modules/deepseek-ai/dsh-web-app/lib/startup.js先确认文件中存在--host 0.0.0.0 is intentionally not supported yet这段原文再将该行的program.error(...)替换为console.warn(...)保留警告信息但不再阻断进程。如果原文不存在版本已变化则打印当前该行内容并停止不要盲目修改。这段 prompt 的关键点在于先校验原文再改不会因为 DSH 升级导致改错位置。安全提醒确保在可信网络家庭/公司内网使用防火墙限制 8080 端口仅内网可访问不要在公网服务器或公共 WiFi 上绑定0.0.0.0此修改在node_modules中pnpm install后会被覆盖需重新应用