Repository navigation
Replies: 2 comments
补充:根因实现与关键机理我在这台机器上的 DSH 安装包里定位到了 Host 侧的实现,可以补上两点排查线索。 实现位置: const COOKIE_PREFIX = "dsh-auth-";
function cookieName(authority) {
return COOKIE_PREFIX + encodeBase64Url(createHash("sha256").update(authority).digest());
}
function sessionCookie(name, value, expiresAt, maxAgeSeconds, secure) {
const attributes = `${name}=${value}; Max-Age=${maxAgeSeconds}; Path=/; Expires=${new Date(expiresAt).toUTCString()}; HttpOnly; SameSite=Strict`;
return secure ? `${attributes}; Secure` : attributes;
}
res.writeHead(303, {
"cache-control": "no-store",
"location": "./",
"set-cookie": sessionCookie(cookieName(authority), value, expiresAt, ...),
});配置项 cookieMaxAgeDays: z.natural().min(1).default(30)关键机理: 三件事叠加才导致无限累积:
桌面侧触发路径( 修复优先级建议
临时规避的另一个选项:把 |
[bug]
|
Uh oh!
There was an error while loading. Please reload this page.
[bug]
dsh desktop启动认证 cookie 无限累积,约六七十次启动后启动崩溃现象
dsh desktop启动后直接崩溃,日志报:cordis.patch.yml都无效(与插件无关)303 + Set-Cookie根因
dsh desktop每次启动给 host 分配随机端口,而认证 cookie 的名字由端口派生:于是每启动一次就多一个
dsh-auth-*cookie,且旧的不被回收。实测累积到 71 条,每条约 200+ 字节。请求头因此超过 Chromium 的 8KB 上限。
net.fetch跟随重定向时请求头被截断,当前端口对应的那条 cookie 没有发出去 → host 判定未认证 →401→ 启动流程抛Web authentication failed。这也解释了「10/24 能启动、10/26 不行」:它是逐次累积到阈值的,不是版本或配置问题。
影响
复现步骤
dsh desktop(每次端口不同)Network/Cookies:dsh-auth-*条目只增不减desktop welcome: Web authentication failed建议修复
任选其一即可解决:
dsh-auth),host 端口变化时用同名的Set-Cookie覆盖dsh-auth-*,只保留本次端口的那个Max-Age: 0在会话结束时清除,或设置较短过期时间Set-Cookie时复用同一 cookie 名(同名同 domain/path 会覆盖而不是新增)临时规避(用户侧)
退出
dsh desktop后,删除 cookie 库中所有dsh-auth-*条目(只删这一前缀,不动其它数据),再启动即可恢复。备注
Web authentication failed,没有任何「请求头过大 / cookie 过多」的提示,排查成本很高;如果能在启动阶段检测到dsh-auth-*数量异常并打出警告,会好很多All reactions