You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Desktop: dsh-auth-* cookies accumulate on every launch and eventually overflow the request-header limit (0.2.1-rc.5)
#12013
The Desktop shell starts its Host with --port 0, so the port is random on every launch.
The session cookie is named dsh-auth- + sha256(authority), and the authority includes
that port. Each launch therefore mints a new, persistent cookie while the old ones are
never removed, so they accumulate in the 127.0.0.1 jar and are all sent on every request.
The Cookie: header grows ~228 bytes per launch until it exceeds Node's default maxHeaderSize (16384), after which requests fail with HPE_HEADER_OVERFLOW / HTTP 431 —
visible to users as "authentication crashes".
Environment
DeepSeek Harness Desktop 0.2.1-rc.5 (macOS), packages dsh-desktop-host, dsh-client-connection, dsh-host-webserver at the same version.
Reproduction
Cookies live in ~/Library/Application Support/@deepseek-ai/dsh-desktop/Cookies (SQLite).
SELECTcount(*) FROM cookies WHERE name LIKE'dsh-auth-%';
Launch the app, quit, relaunch, re-run the query: the count increases by one every
launch. After 13 launches over 5 days:
2. Cookie name embeds the port — dsh-client-connection/lib/index.js:
functioncookieName(authority){return"dsh-auth-"+encodeBase64Url(createHash("sha256").update(authority).digest());}functionrequestAudience(headers,secure){consturl=newURL(`${secure ? "https:" : "http:"}//${host}`);returnsecure ? url.origin : url.host;// <-- includes the port}
Unlike-named cookies never overwrite each other, so every port change adds a row.
Verified: sha256("127.0.0.1:50299") reproduces the exact name in the jar.
3. Nothing ever cleans them up — there is no cookies.remove() in the shell, and cleanStorage() only clears the per-account partition, not defaultSession:
4. Duplicates cannot be collapsed downstream — the shell forwards with headers.set("cookie", cookie) and withholds set-cookie from the renderer, while the
Host-side mergePlatformCookies() only de-duplicates the injected pair.
Impact
~71 launches (≈4 weeks at 3/day) reach 16384 bytes and every request then fails.
Proxies or CDNs with a lower header cap fail sooner.
Suggested fixes
Stop passing --port 0 (or default to a stable/configurable port). A fixed
authority gives a stable name, so relaunches overwrite instead of append.
Drop the authority from the cookie name — use a fixed name and validate the authority already present inside the signed payload.
Purge stale dsh-auth-* cookies on startup, or extend cleanStorage() to defaultSession.
Workaround (verified on 0.2.1-rc.5)
Pin the port via the profile patch layer — no app.asar changes, so code signing and
asar integrity validation stay intact. Append to ~/.dsh/profiles/desktop/cordis.patch.yml:
Result after one relaunch: rows 13 → 1, Cookie: header 2964 → 226 bytes, port
fixed at 3080. The single row's name matched the predicted sha256("127.0.0.1:3080") → dsh-auth-VPhEEcLKeqRDBoBalzN2Nm7CnfxKhLE00pKIDWxt1sw,
confirming that a fixed authority yields in-place overwrite.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Summary
The Desktop shell starts its Host with
--port 0, so the port is random on every launch.The session cookie is named
dsh-auth-+sha256(authority), and the authority includesthat port. Each launch therefore mints a new, persistent cookie while the old ones are
never removed, so they accumulate in the
127.0.0.1jar and are all sent on every request.The
Cookie:header grows ~228 bytes per launch until it exceeds Node's defaultmaxHeaderSize(16384), after which requests fail withHPE_HEADER_OVERFLOW/ HTTP 431 —visible to users as "authentication crashes".
Environment
DeepSeek Harness Desktop
0.2.1-rc.5(macOS), packagesdsh-desktop-host,dsh-client-connection,dsh-host-webserverat the same version.Reproduction
Cookies live in
~/Library/Application Support/@deepseek-ai/dsh-desktop/Cookies(SQLite).Launch the app, quit, relaunch, re-run the query: the count increases by one every
launch. After 13 launches over 5 days:
All rows:
host_key = 127.0.0.1,is_persistent = 1, 228 bytes each (52-char name +173-byte value) → 2964 bytes of
Cookie:header after 13 launches.Root cause
1. Hard-coded
--port 0—dsh-desktop-host/lib/index.js:2. Cookie name embeds the port —
dsh-client-connection/lib/index.js:Unlike-named cookies never overwrite each other, so every port change adds a row.
Verified:
sha256("127.0.0.1:50299")reproduces the exact name in the jar.3. Nothing ever cleans them up — there is no
cookies.remove()in the shell, andcleanStorage()only clears the per-account partition, notdefaultSession:4. Duplicates cannot be collapsed downstream — the shell forwards with
headers.set("cookie", cookie)and withholdsset-cookiefrom the renderer, while theHost-side
mergePlatformCookies()only de-duplicates the injected pair.Impact
~71 launches (≈4 weeks at 3/day) reach 16384 bytes and every request then fails.
Proxies or CDNs with a lower header cap fail sooner.
Suggested fixes
--port 0(or default to a stable/configurable port). A fixedauthority gives a stable name, so relaunches overwrite instead of append.
authorityalready present inside the signed payload.dsh-auth-*cookies on startup, or extendcleanStorage()todefaultSession.Workaround (verified on 0.2.1-rc.5)
Pin the port via the profile patch layer — no
app.asarchanges, so code signing andasar integrity validation stay intact. Append to
~/.dsh/profiles/desktop/cordis.patch.yml:Result after one relaunch: rows 13 → 1,
Cookie:header 2964 → 226 bytes, portfixed at
3080. The single row's name matched the predictedsha256("127.0.0.1:3080")→dsh-auth-VPhEEcLKeqRDBoBalzN2Nm7CnfxKhLE00pKIDWxt1sw,confirming that a fixed authority yields in-place overwrite.
All reactions