Authenticate sockets by header or one-time ticket instead of ?token=

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013GAeg4Jo6xjZzjwy9QDWMQ
This commit is contained in:
2026-10-07 08:58:22 +02:00
co-authored by Claude Opus 5.5
parent eb45fb2763
commit 5259b8db0a
21 changed files with 336 additions and 44 deletions
+12
View File
@@ -892,6 +892,18 @@ def test_a_panels_socket_carries_only_what_it_draws(
# A person's credential is not bounded at all.
assert panel_scope(superuser_token_headers["Authorization"][7:], client.app) is None
# It opens the socket with a ticket like any browser, and the ticket
# carries the panel's bound rather than widening it.
ticket = client.post(
f"{settings.API_V1_STR}/flows/ws-ticket",
headers={"Authorization": f"Bearer {token}"},
)
assert ticket.status_code == 200, ticket.text
with client.websocket_connect(
f"{settings.API_V1_STR}/flows/ws?ticket={ticket.json()['ticket']}"
) as ws:
assert ws.receive_json()["nodes"] == []
def test_a_panel_fetches_only_the_media_its_tiles_are_showing(
client: TestClient, superuser_token_headers: dict[str, str]