Repository navigation
cx-dgsp: retire the legacy bearer wire subprotocol - #21671
Conversation
The wire's `bearer.<token>` subprotocol put the token in a header that Workers invocation logs record. New expectations: - the API refuses a `bearer.` upgrade with 401 and x-cmux-wire-auth (backend/apps/api/test/wire-ticket.test.ts: 1 failed, 8 passed); - the TS client never sends `bearer.` when the ticket route answers 404 (clients/ts/cloud: 1 fail, 4 pass); - cmux-tui never retries a 401 with the token in a subprotocol (a_401_without_header_auth_is_final_and_sends_no_token_subprotocol). The other API tests now open sockets with the Authorization header. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Three test files sent `bearer.<token>, team.<id>`; they now send the token in the Authorization header like the rest. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The API no longer reads `bearer.<token>` from Sec-WebSocket-Protocol; it still strips it from the subprotocols forwarded to the owner object. Clients stop falling back to it: - cmux NEXT feed (CloudFeedSource) and cmux-tui send the token only in Authorization and treat any 401 as final; - the TS cloud client and the dashboard use a ticket or nothing. Each fallback fired on any 401 without x-cmux-wire-auth (or a 404 from the ticket route), so a response from something other than the API could pull the token into a logged header. Invocation logs stay off in staging and production until clients built before this change age out. Green: wire-ticket.test.ts 9 passed; clients/ts/cloud 5 pass; the socket test files rerun alone pass. cmux-tui's test runs hosted. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Receipt for
|
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configuration
You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Not verified: macOS jobs did not run: compile and app tests were skipped on CI passes on Written by |
|
The feat-cmux-next push run https://github.com/manaflow-ai/cmux/actions/runs/39138985914 at 09711a4 failed: cmux-next Release compile (Xcode 26). |
|
The feat-cmux-next push run https://github.com/manaflow-ai/cmux/actions/runs/39139053832 at 4b68fdc failed: cmux-next Release compile (Xcode 26). |
|
The feat-cmux-next push run https://github.com/manaflow-ai/cmux/actions/runs/39139500989 at 6e7ec42 failed: cmux-next Release compile (Xcode 26). |
|
The feat-cmux-next push run https://github.com/manaflow-ai/cmux/actions/runs/39141168383 at e30d059 failed: cmux-next Release compile (Xcode 26). |
Summary
The cmux Cloud API's wire socket still accepted a token in the
bearer.<token>subprotocol. Workers invocation logs record that header (cx-dgsp). Every client also fell back to it: the Swift feed and cmux-tui on any 401 withoutx-cmux-wire-auth, and the TS client and dashboard on a 404 from the ticket route. So a response from something other than the API could make a current client send its token in a logged header.This retires the path:
backend/apps/api/src/wire-ticket.ts): no longer readsbearer.. It still strips it from the subprotocols forwarded to the owner object, and the 401 still namesx-cmux-wire-auth.CloudFeedSource.swift) and cmux-tui (cloud_conversations_backend.rs): send the token only in Authorization. A 401 is final.wrangler.jsonc: invocation logs stay off in staging and production, because clients built before this change still sendbearer.<token>. The comment says to turn them on once those clients have aged out.The API tests that opened sockets with
bearer.now use the Authorization header.Compatibility: a client built before cx-dgsp's header auth (2026-10-11) can no longer open a wire socket until it updates. That covers cmux NEXT, cmux-tui daemons and any dashboard tab served before that date.
Testing
Red first (32b6f49):
backend/apps/api:vitest run test/wire-ticket.test.tsgives 1 failed, 8 passed.clients/ts/cloud:bun test testgives 1 fail, 4 pass.a_401_without_header_auth_is_final_and_sends_no_token_subprotocolfails.Green (6565913):
wire-ticket.test.ts: 9 passed.clients/ts/cloud: 5 pass.backend/apps/apisuite on Linux: 17 tests failed in one parallel run. 4 were socket tests in files my first rewrite missed; fixed in 90484ab. Every failing file passes when rerun alone.Bead: cx-dgsp.
Changelog
none
🤖 Generated with Claude Code
Need help on this PR? Tag
@codesmith-botwith what you need.Summary by cubic
Retires the legacy
bearer.<token>wire subprotocol. The API no longer authenticates wire sockets with it, and all clients stop falling back to it when the Authorization header path fails — a fallback that any 401 from any server could trigger, sending the token in a header Workers invocation logs record. The API still stripsbearer.subprotocols before forwarding to the owner object, and the 401 still namesx-cmux-wire-auth.Compatibility: clients built before header auth shipped (2026-10-11) can't open a wire socket until they update, and invocation logs stay off in staging and production until those clients age out.
Written for commit 6565913. Summary will update on new commits.