https://gitlab.synchro.net/main/sbbs/-/commit/d9f3abd619d4bdd8e0a6b8de
Modified Files:
exec/websocketservice.js
Log Message:
websocketservice.js: name the authenticated web session in the sidecar
The relay already drops a sidecar file beside each connection so the
target service can learn the client's real IP, which a service reading
a proxied socket cannot see for itself. It said where a client came
from and nothing about who they were, so every browser arrived at the
far end anonymous, and a service had no way to tell an authenticated
visitor from a passer-by.
The Cookie header is captured during the handshake, the session
resolved against data/user/####.web, and the user number written as a
second line of the sidecar. A dead or absent session is user zero,
which is the truthful answer rather than a refusal: what a service does
with an anonymous client is the service's decision, not the relay's.
THE ORDERING IS THE GUARANTEE, and it is why this is worth stating in
the code as well as here. The sidecar is written and closed before a
single byte is forwarded. So a target service that has been spoken to
and still finds no sidecar knows it is not talking to the relay at all,
and can treat that connection as a direct local one. Written after the
first byte, that inference would be a race, and the fallback for a
missing sidecar is exactly the trusting one.
An over-long handshake header line is now refused rather than
truncated. A line cut at the buffer size leaves its tail to be parsed
as the NEXT header, which in this file's case can walk a value into the
slot the user number is read from. Refusing is the only safe reading of
a line that did not fit.
-auth is new, and refuses any connection whose sidecar cannot be
written. Without it a failed write degrades to a connection with no
sidecar, which is precisely the shape the fallback above treats as
trusted and local -- a write error turning into an unauthenticated
client wearing a local client's clothes.
Backward compatible: without -auth the file keeps its old single-line
meaning to anything that only reads the first line, and the behaviour
of every existing caller is unchanged.
Co-Authored-By: Claude Opus 5 (1M context) <
noreply@anthropic.com>
---
þ Synchronet þ Vertrauen þ Home of Synchronet þ [vert/cvs/bbs].synchro.net