Repository navigation
desktop: stale dsh-auth-* cookies overflow Node maxHeaderSize (16384) and break startup auth #11095
Replies: 5 comments 1 reply
|
Independent repro on Windows x64 (dsh-desktop 0.2.1-rc.3, Electron 44.7.0, Node 24.21.0): with 71 One additional stopgap verified without patching in the user environment. The desktop host runs as an Electron Node-mode child and inherits it (the packaged main process only logs the usual "Most NODE_OPTIONs are not supported" warning). With the override, the same host returns 303 for a 30 KB |
|
macOS arm64 confirmation, exact measurements, and code anchors Same failure on macOS, so this is not Windows-specific — adding the missing platform plus hard numbers from a real broken install. Environment
State when it stopped starting
431 boundary reproduced against a live Host
The cookie name is authority-derived (verified, not inferred)
Code anchors in the packaged 0.2.1-rc.5 build
Not caused by third-party plugins. The first cookie was written at first launch, 9 days before any plugin was installed on this machine, and disabling plugins leaves the failure unchanged. Suggested upstream fixes (any one is sufficient)
Local stopgap without patching |
|
Windows 11 x64 + 我这台的状态
比启动失败更严重的二次损坏
建议在修复 cookie 累积的同时,把这个恢复流程改掉:
另外上面 @Smalldy 给的 |
|
独立复现(Windows 11 x64,DSH Desktop 0.2.1-rc.5 / Electron 44.7.0 / Node 24.21.0),补充临界值的精确数据:
临时缓解已验证有效:完全退出桌面端后,删除 另外同意主楼第 5 条建议:431 被统一映射成 "authentication failed" 会误导排查方向(本机一开始先怀疑了第三方插件和代理,实际上都无关)。修复前,建议至少在恢复对话框里提示"Cookie 请求头过大,清除 dsh-auth-* 后重试"。 (本复现由用户授权 DSH 助手整理提交。) |
|
Confirmed independently on Windows 11 x64 — DSH Desktop 0.2.1-rc.3 (dshBuildCommit
Recovery: fully quit the desktop app, delete only Since hand-editing sqlite rows is not user-friendly, we packaged a small Windows PowerShell tool (attached
Upstream, I agree with the main thread: prune 中文补充(同一台机器,独立复现):
|
Uh oh!
There was an error while loading. Please reload this page.
Summary
Every desktop launch mints a new auth cookie for
127.0.0.1whose name encodes therandom listen port, with a 30-day
Max-Age. Old generations are never removed, so theElectron cookie jar grows by one cookie per launch. Chromium replays all of them on the
welcome
303 -> /hop, and once theCookieheader passes Node's defaultmaxHeaderSize(16384 B) the Host answers 431, which the desktop reports asdesktop welcome: Web authentication failed(phase: startup).The app becomes unusable after roughly 70 restarts and stays that way until the
cookie jar is manually cleaned.
Environment
nightly(resources/app-update.yml: providergeneric,url
https://download.deepseek.com/dsh-desk/feeds/win-x64/)maxHeaderSizeoverride in the host webserver options)app.asar); please add it to thecrash report / About panel if triage needs it
%APPDATA%\@deepseek-ai\dsh-desktop\Network\CookiesRoot cause chain
dsh-client-connectionbuilds the cookie name asCOOKIE_PREFIX ("dsh-auth-") + encodeBase64Url(sha256(authority))whereauthorityis127.0.0.1:<random port>;base64url(sha256)is a fixed 43 chars, so each name is 53 B.The cookie carries a 30-day
Max-Age.cookie jar keeps every generation until it expires.
connectDesktopWelcomedoesnet.fetch(ready.url)and follows the303to/; Chromiumattaches every cookie for the origin.
maxHeaderSize = 16384 B->431->authenticated.ok === false-> startup aborts.Measurements (this machine, real cookies)
?token=request)sum(length(name)+length(value)+3)overhost_key='127.0.0.1'reproduces the header sizewithin ~120 B. Chromium's ~180-cookies-per-domain cap is never reached: the 16 KB header
limit blows first, and the jar does not self-heal.
Accumulation on this machine: 71 cookies in 9.2 days = ~7.7 launches/day, i.e. the failure
point is reached after ~70 launches.
Suggested fixes (smallest first)
Max-Age/Expiresfrom thedsh-auth-*cookie.A new port already means a new token on the next launch, so persistence buys nothing and
the jar empty itself when the app closes. One-line change, no migration.
dsh-auth-*cookies for127.0.0.1(session.defaultSession.cookies.remove, orcookies.flushStore()after afiltered cleanup). Also handles hosts already stuck at 71 cookies.
__Host--style singlecookie), so the jar holds one entry regardless of port.
maxHeaderSizewhen creating the host HTTP server, or authenticate viaa header/URL token instead of a cookie on the welcome hop.
Workaround users can run today
Close the app, then delete only this origin's stale cookies (SQLite
delete from cookies where host_key='127.0.0.1' and name like 'dsh-auth-%').Better still: run the cleanup before launching, while the DB is not locked by Chromium.
Why it is worth fixing upstream
It is not a misconfiguration: any long-lived install on the nightly channel hits it in about
a week of normal restarting, and the failure mode (silent startup abort behind a generic
crash dialog) gives no hint about cookies.
All reactions