Skip to content

Workspaces phase 2h: what the third review of phase 2 found (#277) - #326

Merged
antiv merged 1 commit into
mainfrom
workspaces-2h
Nov 7, 2026
Merged

antiv merged 1 commit into
mainfrom
workspaces-2h

Conversation

@antiv

@antiv antiv commented Nov 7, 2026

Copy link
Copy Markdown
Owner

A third security review of phase 2 (cb8a218..cea25e2, 2a–2g together) found ten candidates. Checked against the code, nine needed a fix; this PR has them. None affects 1.6: each path was opened in phase 2.

Fixes

Finding Fix Test
google_drive, cv_tools, google_calendar, supabase_storage act with the installation's credentials (Google service account, one Supabase key and bucket), so a workspace admin could read the installation's Drive or another workspace's stored files Platform-only on save (SERVER_CREDENTIAL_TOOLS, the tool's value is the defining part, so another calendar_id is a change); refused at run time outside the default workspace in the tool factory (both runtimes) test_tools_on_the_server_s_credentials_are_platform_only
SSRF: alert webhooks (and Test), trigger callbacks, remote MCP servers and model_base_url could target 127.0.0.1:8001 (the unauthenticated agent server), metadata, the database New shared/utils/outbound.py: for a workspace other than the default one, a URL resolving to a private, loopback, link-local, reserved or multicast address is refused. Default workspace unchanged (local Ollama, MCP beside MATE). OUTBOUND_ALLOW_PRIVATE_NETWORK=true lifts it test_outbound_requests_of_a_workspace_stay_off_the_server_s_network
A2A ran the agent as A2A_USER_<contextId>, chosen by the client: another member's contextId continued their session, RBAC checked a made-up user, and every new id created a user and a membership For a non-admin, the proxy sets x-mate-a2a-user to the caller (and drops it from what clients send); CallerAsA2AUser on the agent server puts it in scope["user"], which ADK runs as. Admins and the MCP bridge keep ADK's id test_the_proxy_s_caller_is_the_user_the_agent_runs_as, TestProxy.test_a2a_runs_as_the_member…, …for_an_admin_keeps…
A multi-parent sub-agent instance (<agent>_<parent>) had no project_id, so may_run_code took it for a hardcoded agent The instance config carries project_id test_a_multi_parent_instance_runs_code_only_where_its_agent_may
LangGraph session events for a rating were read by session_id alone; a widget rating of another workspace's session put its exchange on this workspace's eval page SessionStore.get_events(session_id, app_name) test_events_are_found_by_agent_without_user
Spend with sub-agents followed parent_agents across workspaces _agent_tree stays in the agent's workspace (an agent with no project counts as the default one's) test_spend_with_sub_agents_keeps_to_the_agent_s_workspace
A Slack user carried over from 1.5 joined the default workspace, so an integration of another workspace refused them _carry_over_roles sets home_workspace_id to the agent's workspace test_a_slack_user_from_before_1_6_joins_the_agent_s_workspace
A PAT of a soft-deleted workspace kept working on /v1 and MCP _workspace_of_caller checks workspace_is_open, for a platform administrator's token too test_a_token_of_a_closed_workspace_stops_working
Test case create and update stored any version_id Checked with _require_in_workspace test_a_test_case_links_only_a_version_of_the_workspace

Each new test fails without its fix. Also fixed on the way: LangGraph's stdio MCP check now passes the agent's project to may_run_code, as ADK's does since 2f.

Not changed

  • Feedback without agent_name answers 400. This was decided in 2f. The Work Room, standalone chat and widget all send it; only an outside client posting to /dashboard/api/feedback without it is affected.

Known limit

outbound_refusal resolves the host when it checks, not when the request goes out. A name whose address changes in between (DNS rebinding) is not caught. docs/dev/auth-and-access.md says so.

Checks

  • Full suite: 1869 tests OK (1 skipped).
  • shared/test/test_client_contract.py unchanged: 12/12 OK.
  • python scripts/gen_docs.py --check OK. The reference is regenerated for OUTBOUND_ALLOW_PRIVATE_NETWORK, which is also in .env.example and the CLAUDE.md table.

Docs

  • Updated:
    • docs/dev/auth-and-access.md: server-credential tools, A2A identity, the new "Requests to the server's own network" section, outbound.py in covers.
    • docs/dev/a2a.md: who reaches /a2a/* and as whom. Its "admins only" was out of date since 2e.
    • docs/dev/trigger-engine.md, docs/dev/langgraph-runtime.md.
    • docs/user/agents.md, tools-and-mcp.md, alerts.md, triggers.md.
    • documents/design/2.0-plan.md: the 2h item; eight PRs.
  • Listed by gen_docs.py drift and still accurate:
    • docs/user/sessions-and-traces.md, slack.md, usage-and-audit.md: what users see is unchanged.
    • docs/dev/agent-runtime.md, alerts.md, architecture.md, code-executor.md, openai-api-and-mcp.md, openai-compatibility.md, template-format.md, tracing.md, writing-a-tool.md: none covers the lines changed.

Phase 2 closes after a fourth review over 2a–2h finds no cross-workspace path.

A third review of 2a-2g (cb8a218..cea25e2) found these:

- Google Drive, CV Tools, Google Calendar and Supabase Storage act with the
  installation's credentials, shared by every workspace: platform-only on
  save, and refused at run time outside the default workspace.
- Alert webhooks (and their Test), trigger HTTP callbacks, remote MCP
  servers on both runtimes and model_base_url no longer reach private,
  loopback or link-local addresses for a workspace other than the default
  one (shared/utils/outbound.py; OUTBOUND_ALLOW_PRIVATE_NETWORK lifts it).
- A2A through the proxy runs as the member: the proxy sets x-mate-a2a-user
  and the agent server makes it the A2A user, instead of ADK's
  A2A_USER_<contextId>, which let a client continue anyone's session.
- A multi-parent sub-agent instance carries its project_id, so
  may_run_code no longer takes it for a hardcoded agent.
- LangGraph events for a rating are found by session and agent.
- Spend with sub-agents follows parent_agents within the agent's workspace.
- A Slack user carried over from before 1.6 joins the agent's workspace.
- A personal access token of a closed workspace is refused.
- A test case links only a version of its workspace.
- LangGraph's stdio MCP check is judged by the agent's project, as on ADK.
@antiv
antiv merged commit 0a3a254 into main Nov 7, 2026
2 checks passed
@antiv
antiv deleted the workspaces-2h branch November 7, 2026 12:46
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.

1 participant