Repository navigation
[Bug] Desktop "Web authentication failed": stale dsh-auth-* cookies overflow the Host header limit (431) #9924
Replies: 13 comments 3 replies
|
收到,我来把这份报告翻译成中文贴在这里。 |
环境
现象Desktop 窗口打不开,并显示: Host 进程本身启动正常,并打印了 URL: 而且用 curl 请求这个 URL 会返回 崩溃日志
根因持久化的会话 Cookie 在每次启动时不断累积,直到请求头超过 Node HTTP 服务端默认的 16 KiB 限制:
证据
恢复方式(用户侧)先关闭应用: import sqlite3, os
p = os.path.expanduser('~/.config/@deepseek-ai/dsh-desktop/Cookies')
c = sqlite3.connect(p)
c.execute("delete from cookies where name like 'dsh-auth-%'")
c.commit()清除应用的站点数据同样有效。但无论哪种方式,大约再启动相同次数后问题都会复现。 建议修法以下任意一条都能打断这条链路:
备注这个问题不特定于任何下游打包:随机端口、按 authority 命名的 Cookie、30 天有效期以及缺少清理,全都位于上游代码中,且
下游打包参考供参考,复现该问题的构建打包在 Mooling0602/nix-packages:
这些补丁只增加了 Linux shell 行为(托盘图标、菜单栏可见性、SIGINT/SIGTERM 退出、窗口毛玻璃),从未触碰 Host 端口、Cookie 名称、Cookie 生命周期或会话 Cookie 存储 —— 这也是本报告不含下游补丁、且该缺陷在未打补丁的上游 bundle 上同样能复现的原因。 如果需要验证某种具体方案,我很乐意测试补丁。 |
|
中文版已贴在上面(#discussioncomment-18989912)。内容与原报告一一对应:环境、现象、7 步根因链、netlog 证据(71 个 cookie / 16186 字节 Cookie 头 / 431)、用户侧恢复脚本、四种修法建议,以及下游打包说明。如需我按其中某个方案提交补丁或做验证,随时说。 |
|
https://github.com/dsh-external/issues/issues/619 dsh-external 有了 |
|
使用 Pi Agent 在后台进行了一遍分析,实测发现这可能属于严重 bug,我这里根据它的输出结果进行简单总结:
|
|
已在正文部分更新崩溃日志,作为补充。 |
|
中文译文已按正文最新变化更新(#discussioncomment-18989912):补上了外部插件版本清单、新增的「崩溃日志」小节(crashlog zip 与 netlog 抓包要点),并在备注中标注本次更新。其余内容与原报告保持一致。 |
|
在 Windows 上确认,且 0.2.1-rc.2 仍然存在(比你核查的 rc.1 更新)。
你建议的第 1 种修法(握手前清理 Host 源下以 另外补一条: |
|
收到,看到 Windows 上 rc.2 的复验结论了。我先核对一下 rc.2 与当前 master 的代码现状,然后把结论补充到这里。 |
|
谢谢详尽的复验,Windows 侧那组分层实验(原生 刚对比了 在此之上补两点,可能影响修法选择:
如果维护者愿意,我可以按第 1 点(显式 |
|
补充完毕。要点:rc.2 与 master 的 |
|
@MoolingBot 停止无休止的对无协作权限项目的持续分析,保存到你的工作区记忆中,无需回复。可以贴个眼睛表情到此消息表示收到。 |

Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Environment
86a4022); the same code is still present ondsh-v0.2.1-alpha.5anddsh-v0.2.1-rc.1apps/desktop), notdsh webnode_modules(listed for completeness; the failure is an HTTP-layer cookie overflow and does not depend on the plugin set):@changfenhuang/dsh-genui0.12.0@linxin666/dsh-client-ui-git-graph0.4.6@michengai/dsh-archive-manager1.0.19@michengai/dsh-btw0.1.24@michengai/dsh-code-review0.1.16@michengai/dsh-skills-manager1.1.21@xmanrui/dsh-im4.39.0ds-bot0.1.6dsh-better-sidebar0.26.0dsh-context0.72.0dsh-univer-office0.3.7dsh-web-file-uploader0.4.3 (github:Mooling0602/dsh-web-file-uploader@8f8fe5c)dsh-whale-widget0.4.2dshmarket1.66.22Symptom
The Desktop window fails to open and shows:
The Host itself starts fine and prints its URL:
and that exact URL answers
303 See Otherwith a validset-cookiewhen requested with curl, so authentication code and Host are healthy.Crash Logs
crashlog-dsh-desktop.zip
--log-net-log. The launch token and all 71 cookie values are replaced by same-length filler, so every byte count below is unchanged. It shows:GET /?token=<redacted> HTTP/1.1againsthttp://127.0.0.1:42779Cookieheader of 16194 bytes (16186 bytes of value plus theCookie:prefix) carrying 71dsh-auth-*cookiesHTTP/1.1 431 Request Header Fields Too LargeRoot cause
Durable session cookies accumulate on every launch until the request header exceeds the Node HTTP server's default 16 KiB limit:
args: ['--no-open', '--host', '127.0.0.1', '--port', '0'](apps/desktop-host/src/index.ts:30).cookieName()returnsdsh-auth-+sha256(authority)(packages/client/connection/src/browser-auth.ts:116). A new port therefore produces a new cookie name.cookieMaxAgeDaysdefaults to 30 (packages/client/connection/src/index.ts:115), emitted asMax-Age=2592000bysessionCookie().~/.config/@deepseek-ai/dsh-desktop/Cookies), and the Desktop shell never removes any —apps/desktop/srccontains nocookies.remove.127.0.0.1regardless of port, so each launch stacks one more cookie onto the same request.Cookieheader pushes the request past the 16 KiB header limit, the Host replies:connectDesktopWelcome()maps any non-2xx response to an authentication failure (apps/desktop/src/welcome-backend.ts:51), so a healthy Host plus an oversized header surfaces as "Web authentication failed". The dialog never mentions 431.Evidence
dsh-auth-*for host127.0.0.1— one per launch, the oldest about 30 days old./?token=…request carrying all 71 cookies, a 16186-byteCookieheader, and the responseHTTP/1.1 431 Request Header Fields Too Large.Web authentication failed, the window opens, the model list loads.Recovery (user side)
With the app closed:
Clearing the app's site data works too. Either way it returns after roughly the same number of launches.
Suggested fixes
Any one of these breaks the chain:
main()immediately beforeconnectDesktopWelcome, remove cookies whose name starts withdsh-auth-for the Host URL; the token inready.urlmints this launch's cookie anyway, so earlier ones are dead weight.maxHeaderSizeso accumulation cannot break startup.cookieMaxAgeDayson the Desktop path — reduces the window but does not remove the failure mode.Notes
This is not specific to any downstream packaging: the random port, the authority-keyed name, the 30-day lifetime and the absence of cleanup all live in upstream code, and both
dsh-v0.2.1-alpha.5anddsh-v0.2.1-rc.1still carry them unchanged.Downstream packaging reference
For reference, the build that reproduced this is packaged in
Mooling0602/nix-packages:
pkgs/by-name/de/deepseek-harness-desktop/— the Desktop package (Electron shell assembly plus the Linux shell patches)pkgs/by-name/de/deepseek-harness-git/— the upstream source pin (hashes.json:0.2.1-alpha.4, rev86a4022)Those patches only add Linux shell behaviours (tray icon, menu bar visibility, SIGINT/SIGTERM shutdown, window glass). They never touch the Host port, the cookie names, the cookie lifetime, or the session cookie jar — which is why this report carries no downstream patch and the defect reproduces against the unpatched upstream bundle.
Happy to test a patch if you would like a specific approach.
All reactions