481359ddb2
Co-authored-by: Kandev Agent <agent@kandev.dev> Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
2.2 KiB
2.2 KiB
id, title, status, wave, depends_on, plan, spec
| id | title | status | wave | depends_on | plan | spec | |
|---|---|---|---|---|---|---|---|
| 05-transport-scoping | Transport scoping: WS gateway and MCP | todo | 2 |
|
plan.md | ../../specs/multi-tenancy/spec.md |
Task 05: Transport Scoping — WS Gateway and MCP
Acceptance
Hub.BroadcastToOrg(orgID, …)exists and replacesHub.Broadcastfor every tenant-derived event. The remaining//ws:globalcall sites are an explicit allowlist (release notification, feature-toggle change, restart) pinned by a test that fails when a new global broadcast is added without an entry.- The WS dispatch backstop (
internal/gateway/websocket/dispatch_scope.go) resolves the org for any payload carryingtask_id,session_id,task_environment_id, or a top-leveltask.<verb>id, and refuses a foreign-org reference before dispatch. - WS subscriptions are org-checked at subscribe time, not only at broadcast time.
internal/mcp/scoperesolves stream → task → workspace → org and attaches an identity carrying both owner and org. An unresolvable org is denied; the path never returns an identity-free context.- A client authenticated to org B receives no frame produced by org A, proven by a two-client gateway test rather than by inspecting broadcast call sites.
Verification
go test -race ./internal/gateway/websocket/... ./internal/mcp/...fromapps/backendgo test ./internal/gateway/websocket/... -run 'TestGlobalBroadcastAllowlist|TestCrossOrgNoFrame'
Files Likely Touched
apps/backend/internal/gateway/websocket/{hub,dispatch_scope,access}.goapps/backend/internal/mcp/scope/scope.go- Every
hub.Broadcastcall site
Inputs
- Spec: API surface (WS changes), Scenarios (cross-org no frame).
- Patterns: the existing dispatch-backstop rules and their
user_shell.stop/task.stateregression history inapps/backend/AGENTS.md— a new action name silently opts out of the backstop, so the org check must key off the same ref extraction rather than inventing a parallel one.
Output Contract
Report the global-broadcast allowlist and its justification per entry, the two-client cross-org test, RED/GREEN commands, and set this task plus its plan checkbox to done.