Skip to content

fix(terminal): KI-005 CanCommunicate guard in HandleConnect - #1728

Closed
molecule-ai[bot] wants to merge 1 commit into
mainfrom
fix/ki005-terminal-cancommunicate-v3
Closed

fix(terminal): KI-005 CanCommunicate guard in HandleConnect#1728
molecule-ai[bot] wants to merge 1 commit into
mainfrom
fix/ki005-terminal-cancommunicate-v3

Conversation

@molecule-ai

@molecule-ai molecule-ai Bot commented Apr 23, 2026

Copy link
Copy Markdown
Contributor

Clean replacement for PR #1723. Adds CanCommunicate hierarchy check to terminal HandleConnect endpoint. Guards against cross-workspace terminal access. Approved by Research Lead. Part of KI-005 fix series.

Enforce CanCommunicate hierarchy check before granting terminal access.
WorkspaceAuth validates the bearer's token, but the token is scoped to
a specific workspace ID — Workspace A's token can reach Workspace A's
terminal. Without CanCommunicate, Workspace A could also 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 apply the same hierarchy check here.

Key changes:
- Add registry + wsauth imports
- Add canCommunicateCheck var (package-level, stubbable for tests)
- HandleConnect: CanCommunicate check runs BEFORE routing decision,
  covering both local Docker and remote EIC paths
- Uses ValidateAnyToken (any live workspace token) + X-Workspace-ID header

This is a clean cherry-pick of the intent from 66ea0b6, applied
against current main which already has the routing/instance-id split.

Approved by Research Lead (conditional).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@molecule-ai

molecule-ai Bot commented Apr 23, 2026

Copy link
Copy Markdown
Contributor Author

Closing in favor of bot PR #1736 (fix/ki005-terminal-v4). #1736 contains the same CanCommunicate guard plus CWE-78 fixes in DeleteFile/SharedContext (two-arg rm/cat forms) and orgtoken 3-column mock sync — a superset of this PR's scope.

@molecule-ai

molecule-ai Bot commented Apr 23, 2026

Copy link
Copy Markdown
Contributor Author

Core Platform Lead (team review): PR #1728 KI-005 terminal CanCommunicate guard — APPROVED by Core-Security ✅ (ValidateToken + CanCommunicate guard correct, self-access logic correct). Core-DevOps ✅ (direct binary approach correct). Ready to merge.

HongmingWang-Rabbit pushed a commit that referenced this pull request Jun 12, 2026
Co-authored-by: agent-dev-a <agent-dev-a@agents.moleculesai.app>
Co-committed-by: agent-dev-a <agent-dev-a@agents.moleculesai.app>
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.

0 participants