Skip to content

Commit 8cf7244

Browse files
committed
docs(auth): clarify websocket token transport, threat model, and hardening plan
1 parent 4651a5d commit 8cf7244

2 files changed

Lines changed: 31 additions & 2 deletions

File tree

engineering/warts-and-limits.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ This is a contained hack, explicitly documented, and should be replaced if upstr
7373

7474
These are deliberate compromises to preserve correctness and operability in real environments:
7575

76-
- WebSocket auth currently accepts query param token flow because browser/WebView socket APIs make header-based auth inconsistent in practice. We keep this bounded via explicit server checks and fail-closed behavior.
76+
- WebSocket auth currently accepts query param token flow because browser/WebView socket APIs make header-based auth inconsistent in practice. We keep this bounded via explicit server checks and fail-closed behavior, but treat it as transitional architecture.
7777
- Filesystem-facing sync paths are intentionally mixed:
7878
markdown ingest uses a dirty-set drain loop for backpressure-aware coalescing,
7979
while some blob paths keep quiet-window checks because partial attachment reads are costlier and noisier than text edits.
@@ -86,3 +86,4 @@ The standard is not "perfect abstraction." The standard is explicit correctness
8686
- No fully automatic HTTP bootstrap path for giant initial sync payloads yet.
8787
- No cryptographic prev-hash chain between journal segments yet (current model uses per-segment hash plus strict sequence validation).
8888
- No per-file sharded CRDT model yet (current design intentionally preserves monolithic cross-file transactional semantics).
89+
- WebSocket auth still supports query token transport; target state is explicit post-connect auth handshake plus short-lived session credentials.

engineering/zero-config-auth.md

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,35 @@ When deployed, the YAOS server boots into an "Unclaimed" state.
2121
- The server hashes the token (SHA-256) and stores only the hash inside a singleton Config Durable Object via an ACID transaction.
2222
- The setup route permanently locks itself.
2323

24-
For subsequent authentication, the plugin utilizes modern HTTP headers—specifically Authorization: Bearer \<token>—rather than leaking the shared token into query strings, browser history, or proxies.
24+
For subsequent authentication, the plugin uses `Authorization: Bearer <token>` for HTTP endpoints.
25+
26+
For WebSocket sync transport, YAOS currently includes the token as a query parameter for compatibility across browser/WebView socket APIs. This is an explicit, documented compromise for v1 and should be replaced by an explicit post-connect auth handshake in a future revision.
27+
28+
## Current transport model (v1)
29+
30+
- HTTP routes (`/vault/*`, setup helpers, snapshot APIs) authenticate with `Authorization: Bearer <token>`.
31+
- WebSocket sync (`/vault/sync/:room`) currently accepts a query token for compatibility with constrained mobile/webview environments.
32+
- All traffic is expected over HTTPS/WSS in normal deployment.
33+
34+
## Threat model notes (v1)
35+
36+
This compromise is acceptable for YAOS v1's current self-hosted model when:
37+
38+
- TLS is enabled end-to-end (HTTPS/WSS).
39+
- Server/operator logs are private and access-controlled.
40+
- The shared token is treated as a secret and rotated when exposed.
41+
42+
It is still not ideal because URL parameters can appear in application/server logs, browser debugging surfaces, and proxy instrumentation. For that reason, query-token auth should be treated as transitional rather than final architecture.
43+
44+
## Planned hardening (post-v1)
45+
46+
- Move WebSocket auth to an explicit post-connect handshake frame.
47+
- Prefer short-lived session credentials derived from the long-lived setup token.
48+
- Ensure auth material is redacted from traces and diagnostics by default.
49+
- Add an operator option to disable query-token WebSocket auth once clients support handshake auth.
50+
51+
For the broader list of accepted compromises and tracked debt, see
52+
`engineering/warts-and-limits.md`.
2553

2654
# The URI Protocol Handshake
2755

0 commit comments

Comments
 (0)