fix(handlers): bypass CanCommunicate for canvas-user identity callers (#1674) #1756
Reference in New Issue
Block a user
Delete Branch "fix/memory-list-rows-err"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Post-RFC#637, canvas users send X-Workspace-ID (their identity workspace UUID). This caused A2A proxy requests from poll-mode workspaces to fail with 403 because rejected the caller — human users sit outside the workspace hierarchy.
Changes
Test plan
Fixes #1674
LGTM. Bypasses CanCommunicate for canvas-user id. 5-axis clean. Non-author 2nd-approve per CTO carve-out.
APPROVED after 5-axis review of
2266982.Correctness: The change addresses the RFC#637 canvas-user identity path by distinguishing tokenless canvas/admin/org-token callers from legacy peer agents and bypassing CanCommunicate only for those human/canvas identities. The same handling is applied to schedule health, and server-side/internal proxy call sites explicitly pass false.
Robustness: Existing workspace-token binding remains intact for live workspace tokens; missing/invalid bound tokens still return 401. Legacy tokenless peer behavior is preserved. Tests cover legacy, missing/invalid/valid token paths plus admin-token and org-token canvas-user detection.
Security: System caller header forgery remains rejected. The bypass is limited to same-origin canvas, ADMIN_TOKEN, or validated org-level token, matching existing org-wide auth semantics; it does not allow arbitrary workspace-token replay.
Performance: Adds only token checks on the tokenless-caller path; no material hot-path concern.
Readability: The new boolean is explicit at call sites and comments explain the RFC#637 behavior.