Skip to content

feat(acpremote): accept bearer token from WebSocket subprotocol - #74

Merged
fswair merged 1 commit into
mainfrom
fix/bearer-subprotocol
Oct 29, 2026
Merged

fswair merged 1 commit into
mainfrom
fix/bearer-subprotocol

Conversation

@fswair

@fswair fswair commented Oct 29, 2026

Copy link
Copy Markdown
Member

Browser WebSocket clients (e.g. acp-ui) cannot set Authorization, so they send bearer.<token> in Sec-WebSocket-Protocol alongside acp.v1.

  • is_bearer_authorized now accepts the Authorization header or a bearer.<token> subprotocol entry, compared with hmac.compare_digest.
  • Duplicated Sec-WebSocket-Protocol headers are treated as unauthorized instead of raising.
  • The server still only echoes acp.v1; the token is never reflected.
  • Docs updated; tests cover accept, bearer-only, wrong token, and no token.

Closes #73

Checked locally: ruff, ty, basedpyright, tests/acpremote (60 passed, auth.py 100%).

🤖 Generated with Claude Code

Browser clients cannot set Authorization on WebSocket handshakes, so they send
bearer.<token> next to acp.v1 in Sec-WebSocket-Protocol. The server now accepts
that token and still only echoes acp.v1.

Closes #73

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@codecov

codecov Bot commented Oct 29, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@fswair
fswair merged commit 64d6f4d into main Oct 29, 2026
56 checks passed
@fswair fswair mentioned this pull request Oct 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEATURE]: Accept bearer token via WebSocket subprotocol for browser clients

1 participant