fix(handlers): add CanCommunicate hierarchy check to terminal WebSocket handler (KI-005) - #1809
Closed
molecule-ai[bot] wants to merge 1 commit into
Closed
fix(handlers): add CanCommunicate hierarchy check to terminal WebSocket handler (KI-005)#1809molecule-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
Security Review — PASS ✅KI-005 CanCommunicate hierarchy guard in terminal.go:
Recommendation: MERGE. This is the cleanest, most focused terminal KI-005 fix. Prefer this over larger consolidation PRs. |
Closed
2 tasks
Contributor
auto-merge was automatically disabled
April 23, 2026 18:16
Pull request was closed
HongmingWang-Rabbit
pushed a commit
that referenced
this pull request
Jun 12, 2026
…s table + legacy v1 surface' (#1809) from feat/issue-1792-phase-a3-drop-agent-memories into main
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
KI-005 CRITICAL: terminal.go HandleConnect had zero CanCommunicate check. Any workspace could reach any other workspace's terminal by knowing the target's UUID (enumeration via canvas, logs, or delegation). Shell access is more dangerous than A2A message-passing, so we apply the same hierarchy check here.
Logic: X-Workspace-ID header + bearer token validated via ValidateAnyToken -> CanCommunicate(callerID, targetID) called before granting access. Returns 403 if caller is not authorized to reach target workspace terminal.
The canCommunicateCheck var is exposed at package level so tests can stub it without DB fixtures.
Test plan
🤖 Generated with Claude Code