fix(handlers): add CanCommunicate hierarchy check to terminal WebSocket handler (KI-005) - #1806
Closed
molecule-ai[bot] wants to merge 1 commit into
Closed
fix(handlers): add CanCommunicate hierarchy check to terminal WebSocket handler (KI-005)#1806molecule-ai[bot] wants to merge 1 commit into
molecule-ai[bot] wants to merge 1 commit into
Conversation
…et handler (KI-005) KI-005: terminal access was not gated by the workspace-hierarchy check, enabling Workspace A to reach Workspace B's terminal if it knows B's UUID (enumeration via canvas, logs, or delegation). Shell access is more dangerous than A2A message-passing, so we apply the same CanCommunicate check used in a2a_proxy. Changes: - Add registry + wsauth imports - Add canCommunicateCheck package var (exposed for test stubbing) - Gate HandleConnect: validate caller's token, then check CanCommunicate before routing to remote/local handler Fixes: KI-005 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Contributor
Author
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
terminal.goHandleConnectwas reachable by any workspace without hierarchy validationCanCommunicateguard froma2a_proxyChanges
canCommunicateCheck— injectable for test stubbing; defaults toregistry.CanCommunicateHandleConnectguard (applied before routing):callerIDfromX-Workspace-IDheadercallerID != workspaceID: validate token against caller + enforce hierarchy viacanCommunicateCheckterminal_auth_test.go— 4 test casesSecurity notes
ValidateToken(token, callerID)(binds token to claimed workspace) preventsX-Workspace-IDforgeryTest plan
go test ./workspace/...passesMerge (requires write access — PR needs reviewer approval)