Skip to main content
← Back to list
01Issue
FeatureIn ProgressSwamp CLIPublic
Assigneeszack

Relationships

#4912 A dashboard session cookie per path: a serve with a path in its address names and scopes its cookie for that path

Opened by zack · 11/19/2026

Issue 16 of the execution plan in design/surfaces/serve-workspaces.md. One PR. Depends on nothing unbuilt.

Problem

Serve's dashboard session cookie has one name, swamp-dashboard-session, and Path=/ (src/serve/dashboard_session_handler.ts). Under a serve host the root and every workspace answer on one browser origin, so each sign-in overwrites the last. A browser can hold a dashboard session for only one of them at a time.

Change

A serve with a path in its --address names its cookie for that path and scopes it to that path. The design section is Dashboard.

  • The name. A serve at <host address>/w/<name> sets a cookie whose name is derived from its address path, so two workspaces never share a name.
  • The scope. The cookie's Path is the address path. A browser sends it only with requests under that path.
  • The path comes from --address. It is never taken from a forwarding header.
  • Reading. Such a serve reads only its own cookie, on HTTP requests and on the WebSocket upgrade. It ignores a cookie named swamp-dashboard-session.
  • Expiring. Sign-out clears the cookie with the same name and Path.
  • A serve without a path in its address is unchanged. Same name, Path=/.
  • HttpOnly, SameSite=Strict and Secure stay as they are.

Decisions this issue makes

The PR states what it chose and updates the design doc.

  • How the name is derived. A cookie name cannot hold a slash. It must be the same on every start and differ for every path.
  • The root's cookie reaches every workspace. The root has no path, so its cookie keeps Path=/ and a browser sends it with every request under /w/ too. The workspace ignores it, but code in the workspace's serve can read the request. The expected answer is that the host's router removes every cookie but the workspace's own before it forwards a request under /w/ (src/serve/host/forwarding_headers.ts). If that is too large for this PR, it becomes its own issue, filed before this one ships.

Done when

  • A browser signed in to the root and to two workspaces holds three cookies, and each serve resolves its own session.
  • Signing out of one workspace leaves the other sessions working.
  • A cookie for /w/data is not sent to /w/data-2. A test checks the Path and the name of each.
  • A serve with a path in its address refuses a session presented under the plain cookie name.
  • A serve with no path sets the cookie it sets today, byte for byte.
  • The WebSocket upgrade resolves the session from the renamed cookie.
  • Tests run in-process. A test that authenticates through serve's HTTP routes as a fixed principal calls resetRateLimitState() first.

Out of scope

  • The dashboard page signing in under a workspace segment. The next issue in the plan.
  • The switcher.
  • A browser origin per workspace. The design lists a host name per workspace under Later.
02Bog Flow
✓OPEN✓TRIAGED◉IN PROGRESS○SHIPPED+ 1 MOREASSIGNED+ 5 MOREREVIEW+ 12 MORECODE_CONFORMANCE_REVIEW

In Progress

11/21/2026, 3:51:09 PM

Click a lifecycle step above to view its details.

03Sludge Pulse
zack assigned zack11/21/2026, 3:43:09 PM

Sign in to post a ripple.