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
+7 -2
View File
@@ -156,8 +156,13 @@ class Agent:
backoff = min(MAX_BACKOFF_S, backoff * 2)
async def _session(self) -> None:
url = f"{self.args.url}?token={self.args.token}"
async with websockets.connect(url, max_size=None, ping_interval=20) as socket:
# A header rather than the query string, which access logs keep.
async with websockets.connect(
self.args.url,
additional_headers={"Authorization": f"Bearer {self.args.token}"},
max_size=None,
ping_interval=20,
) as socket:
await socket.send(
json.dumps(
{