Skip to content

Listener-scoped workspace authority (ADR 0237) #762

Closed

Description

@jhrozek

Parent: #437 — a network-exposed k8s deployment must not let an authenticated API caller select an arbitrary host/container filesystem root.

Problem

CreateSession (and the other session-creating paths) accepted a client-supplied workspace path, checked only for non-emptiness, then opened it as a real filesystem root. Authentication identified the caller; nothing authorized that principal to select a path. On a network-facing deployment that combines a remote caller with the server's ambient filesystem authority — an authenticated client could root a session at /, /etc, or a service-account secret mount and point the file tools + Bash at it. A loopback bind is not evidence the caller is local (a reverse proxy defeats that inference), so the policy must be a deployment/composition decision, not inferred from the request or the socket.

Design

ADR 0237 and the acceptance plan docs/acceptance/listener-scoped-workspace-authority.md. Workspace selection becomes a deployment policy: a loopback/embedded deployment stays client-selectable; a network-facing deployment is server-assigned (client filesystem workspaces are rejected before cleaning/comparison, and the operator-configured root is assigned). Server-assigned authority is enforced on every create/run-entry/rehydration/schedule-fire/adoption/environment-override path, with a lexical stored-root identity check.

Acceptance criteria

  • mecated derives client-selected vs server-assigned from API-listener topology, with an explicit --workspace-authority override; a network filesystem deployment without a configured root fails before listener startup.
  • Server-assigned deployments reject a non-empty client workspace with InvalidArgument before path cleaning, filesystem access, trust evaluation, or environment creation.
  • Persisted-session run entry, rehydration, scheduled-fire creation, legacy adoption, and environment overrides all enforce the deployment root; a stale off-root value fails closed.
  • mecatui rejects an explicit --workspace to a remote target locally, and sends no cwd by default.
  • mecak8s is file-less by default (no-FS), and serves an operator-mounted workspace root (e.g. a PVC) as a server-assigned filesystem deployment when --workspace is set.
  • task lint && task test green; task docs + task site:build clean.

Status

Implemented on branch acc/listener-scoped-workspace-authority (all gates green); pending PR + merge. Panel review during implementation surfaced the follow-ups below.

Related

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bug

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions