Add generated token auth to app-server WebSockets

This commit is contained in:
mikhail-oai
2026-06-30 10:02:18 -04:00
parent cfead68e5d
commit d46eb761b5
4 changed files with 395 additions and 103 deletions
+14
View File
@@ -34,6 +34,20 @@ When running with `--listen ws://IP:PORT`, the same listener also serves basic H
- `GET /healthz` returns `200 OK` when no `Origin` header is present.
- Any request carrying an `Origin` header is rejected with `403 Forbidden`.
By default, app-server uses query-token authentication: it generates a 256-bit connection token
and prints the complete connection URL to stderr, for example:
```text
ws://127.0.0.1:4500/?token=<generated-token>
```
By default, clients must provide that exact `token` query parameter during the websocket upgrade.
Treat the printed URL as a secret. Pass `--no-token-check` to accept clients that omit the token or
provide an incorrect token; app-server still prints the tokenized URL.
When `--ws-auth capability-token` or `--ws-auth signed-bearer-token` is configured, app-server
prints the token-free listen URL and requires `Authorization: Bearer <token>` during upgrade.
Websocket transport is currently experimental and unsupported. Do not rely on it for production workloads.
The unix socket transport is intended for local app-server control-plane clients. `codex app-server proxy`