diff options
| author | Jesse Vincent <jesse@primeradiant.com> | 2026-06-09 12:22:53 -0700 |
|---|---|---|
| committer | Drew Ritter <drew@primeradiant.com> | 2026-06-16 10:09:45 -0700 |
| commit | cb5bb885fd7cf00a1820f20d922df06ec02d4bed (patch) | |
| tree | 1ee49051bb411aec789f05625406eca1fa89e6bb /tests/brainstorm-server/package.json | |
| parent | 09b6b25e089fdb5d27c852a1a2d4b2816442b1c8 (diff) | |
feat(brainstorm-server): gate every endpoint behind a per-session key
The companion server is reachable by any local browser tab (default loopback
bind) and by any host that can route to it (remote --host bind). It served
screens, files, and accepted event-injecting WebSocket connections with no
authentication, so a malicious browser tab or a direct remote client could read
brainstorm content or inject events that the agent reads as the user's input
(prompt injection into a live session).
Generate a per-session secret token, carry it in the served URL as ?key=, and
mirror it into an HttpOnly SameSite=Strict per-port cookie on first load so
same-origin subresources and the WebSocket handshake authenticate automatically.
Every HTTP request and WebSocket upgrade now requires a valid key (query or
cookie, constant-time compared); unauthenticated requests get a friendly 403
explaining they need the full URL. A secret authenticates the client uniformly
across loopback, tunnel, and remote binds and defeats DNS rebinding, which a
Host/Origin allowlist cannot.
Also guard handleMessage against a null JSON payload that crashed the process.
Tests: new auth.test.js (13 cases) covering the key on /, /files/*, and WS plus
cookie bootstrap and the null-payload guard; server.test.js threads the key;
ws-protocol.test.js + auth.test.js wired into npm test.
Closes #1014
Refs #1110, #1553, #1504
Diffstat (limited to 'tests/brainstorm-server/package.json')
| -rw-r--r-- | tests/brainstorm-server/package.json | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/tests/brainstorm-server/package.json b/tests/brainstorm-server/package.json index 52ff3ae..70bf525 100644 --- a/tests/brainstorm-server/package.json +++ b/tests/brainstorm-server/package.json @@ -2,7 +2,7 @@ "name": "brainstorm-server-tests", "version": "1.0.0", "scripts": { - "test": "node ws-protocol.test.js && node helper.test.js && node server.test.js && node lifecycle.test.js && bash stop-server.test.sh" + "test": "node ws-protocol.test.js && node helper.test.js && node auth.test.js && node server.test.js && node lifecycle.test.js && bash stop-server.test.sh" }, "dependencies": { "ws": "^8.19.0" |
