Portal link: send the instance credential as Authorization: Bearer

Not ?token= in the tunnel URL, which access logs keep. The hub has to be
upgraded first; websockets>=14 for additional_headers on the asyncio client.

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 09:41:44 +02:00
co-authored by Claude Opus 5.5
parent 5eeeb08be4
commit 25706fedff
5 changed files with 45 additions and 5 deletions
+5 -2
View File
@@ -191,9 +191,12 @@ class CloudConnector:
import websockets
attached = False
url = f"{config.ws_url}?token={config.token}"
# A header rather than `?token=`, since a URL ends up in access logs.
# A hub from before the header reads only the query: upgrade the hub
# before its instances.
async with websockets.connect(
url,
config.ws_url,
additional_headers={"Authorization": f"Bearer {config.token}"},
max_size=MAX_WS_MESSAGE,
ping_interval=PING_INTERVAL_S,
ping_timeout=PING_TIMEOUT_S,