dsh --host 0.0.0.0被禁?一行改动让 DSH Web UI 绑定所有网卡
DeepSeek-Harness(DSH)
DSH 出于安全考虑禁止 --host 0.0.0.0,但局域网调试场景确实需要,本文提供 diff 补丁和 agent prompt 两种方式解除限制。
正文
DeepSeek Harness(DSH)的 Web UI 默认只监听 127.0.0.1,当你尝试:
dsh --profile web --port 8080 --host 0.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后会被覆盖,需重新应用


被折叠的 条评论
为什么被折叠?



