fix(deepseek): only exchange a banner for the spawned loopback port

The launch URL comes from the child's output but fetching it is a request
made by the Codeman server, so a banner naming another host or another
local service could aim it. Require 127.0.0.1 and the port just spawned
before the exchange runs, and mark the server as unusable for reuse if
the check fails.
This commit is contained in:
ArizeSky committed 2026-11-16 16:10:10 +08:00
1 parent b1bcd1e3af
commit 7f729ee87b
4 files changed
+92 -6

No files matched your search

+7 -5
View File
@@ -300,11 +300,13 @@ authority it was minted for, so a repointed or stale tab cannot carry it
elsewhere. The reader scans every `dsh web:` line (dsh prints diagnostics such as
`dsh web: loading profiles` under the same prefix before the banner) and only
complete lines, so a banner split across two output chunks is waited for rather
than parsed truncated. A dsh without the gate prints a token-less banner and
keeps working unchanged. If a token is printed but the exchange still fails, the
server keeps running (its page serves, just 401) and is marked unusable for
reuse: the next start request stops and respawns it, which is the "restart `dsh
web`" the warning asks the user to perform.
than parsed truncated. Before the token URL is fetched it must name `127.0.0.1`
on the port the supervisor just spawned, so a banner cannot aim the server-side
request at another host or local service. A dsh without the gate prints a
token-less banner and keeps working unchanged. If a token is printed but the
exchange still fails, the server keeps running (its page serves, just 401) and is
marked unusable for reuse: the next start request stops and respawns it, which is
the "restart `dsh web`" the warning asks the user to perform.
The cookie is also bound to a person, not to a URL. `managed` is accepted from the
client on `POST/PATCH /api/webviews` and `GET /api/deepseek/web` publishes the live