fix(handlers): add KI-005 CanCommunicate hierarchy guard to terminal endpoint - #1868
Closed
molecule-ai[bot] wants to merge 1 commit into
Closed
molecule-ai[bot] wants to merge 1 commit into
molecule-ai[bot] wants to merge 1 commit into
Conversation
…endpoint Enforce workspace-hierarchy guard in HandleConnect: when the caller presents a different X-Workspace-ID than the target, validate the caller's bearer token and check registry.CanCommunicate before allowing the WebSocket upgrade. Blocks any compromised token from terminaling into unrelated workspaces. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Contributor
|
[retarget-bot] This PR was opened against Why: per SHARED_RULES rule 8, all feature work targets What changed: just the base branch — no code change. CI will re-run against If this PR is the CEO's staging→main promotion: the Action skipped you (only bot-authored PRs are retargeted). If you see this comment on your CEO PR, that's a bug — please tag @HongmingWang-Rabbit. |
Contributor
Author
Contributor
Author
Security review: PR #1868 LGTM ✅Author: app/molecule-ai (cannot Approve — same bot account). Tech review only. KI-005 guard analysis
Correctness checks
LGTM. Clean, minimal KI-005 fix. Recommend merge. |
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
CanCommunicatehierarchy check toHandleConnectinterminal.goX-Workspace-IDthan the target, validate the bearer's token viawsauth.ValidateTokenand enforceregistry.CanCommunicatebefore allowing WebSocket upgradeChanges
workspace-server/internal/handlers/terminal.go: +22 linescanCommunicateCheckpackage var (injectable for tests)wsauthandregistryimportsHandleConnectchecking caller workspace hierarchyTest plan
🤖 Generated with Claude Code