fix(bridge): require token when Bridge is enabled for security#408
Open
fix(bridge): require token when Bridge is enabled for security#408
Conversation
Security improvements: - Bridge server now requires token to be set unless insecure mode is explicitly enabled - Added `insecure` config option for local development only - WebSocket origin check now validates against CORS origins or same-host - Clear error message when token is missing Breaking change: Bridge with empty token now fails to start. For local dev, set `insecure = true` in [bridge] config. Fixes #403 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Owner
Author
|
✅ QA review: Ready to merge Critical security fix for Bridge server. Review summary:
Breaking change documented: Bridge with empty token now fails to start unless Good security hardening for production deployments. |
Owner
Author
|
LGTM! This is a solid security fix for the Bridge server. ✅ Security: Token is now required unless ✅ Implementation:
✅ Breaking change handling: Clear documentation on how to configure ✅ Tests: Updated tests use insecure mode appropriately. ✅ CI: All checks pass. Ready for merge. |
chenhg5
commented
Apr 3, 2026
Owner
Author
chenhg5
left a comment
There was a problem hiding this comment.
QA review passed. 重要安全修复。
Review summary:
- ✅ Bridge 启动时强制要求 token(除非显式设置 insecure=true)
- ✅ insecure 模式仅用于本地开发,有明确警告日志
- ✅ 验证失败时返回 nil 并打印错误信息
- ✅ 文档更新:config.go 注释说明 token 必填条件
- ✅ CI passes
Ready to merge (owner PR).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
insecure = trueis explicitly configuredinsecureconfig option for local development onlyRoot Cause
Issue #403 identified that when
bridge.tokenis not set:authenticate()returnedtruefor all requestsCheckOriginalways returnedtrue:9810)This allowed unauthenticated access to the Bridge API.
Changes
config/config.go: AddedInsecure *boolfield toBridgeConfigcore/bridge.go:insecurefield toBridgeServerNewBridgeServerInsecure()for explicit local-dev modeauthenticate()now requires token unlessinsecureis truecheckOrigin()that validates against CORS origins or same-hostcmd/cc-connect/main.go: Check insecure flag and exit with error if token is missingcore/bridge_test.go: Updated tests to use insecure mode when testing without tokenBreaking Change
Bridge with empty token now fails to start with error:
For local development, add to config:
Test plan
go build ./...passesgo vet ./...passesgo test ./core/...passesinsecure = truestarts without token🤖 Generated with Claude Code
Fixes #403