Skip to content

Gateway: authorize session mutations by operator scope, not client identity #110930

Description

@steipete

Problem

Gateway session mutation authorization has two independent gates:

  1. the method registry and dynamic scope resolver authorize the negotiated
    operator scopes; then
  2. a session-handler guard rejects clients classified as WebChat by client ID
    or mode, regardless of those approved scopes.

The only identity exception is openclaw-control-ui. That makes a
client-reported product label part of authorization and encourages third-party clients
to impersonate Control UI. PinchChat added a configurable client ID for this
workaround in
e8fe332.

Options

A. Authorize session mutations by negotiated scopes

Remove the WebChat identity guard. Keep the existing method policy:

  • operator.write for lower-risk mutations such as organizational patch fields,
    checkpoint branch, and fork;
  • operator.admin for destructive or high-risk mutations such as unrestricted
    delete, compact, restore, rewind, branch switching, dispatch, and reclaim;
  • parameter-aware dynamic scope checks for patch and delete.

B. Keep the identity policy

Document a client ID/mode policy matrix and return a structured policy error.
This preserves the restriction but keeps authorization dependent on a
client-reported product identity.

Decision

Choose Option A. Negotiated scopes are the authorization contract. Client ID and
mode remain product/connection metadata, not a second session mutation ACL.

This does not change connection admission, device pairing, scope approval, or
gateway.controlUi.dangerouslyDisableDeviceAuth. No protocol or config surface
changes.

Acceptance

  • Read-only WebChat clients receive the normal structured missing-scope errors.
  • Admin-scoped WebChat clients can perform authorized session mutations without
    using the Control UI client ID.
  • Every formerly identity-blocked mutation remains classified in the central
    method scope registry.
  • Operator-scope docs and the changelog describe the contract.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P1High-priority user-facing bug, regression, or broken workflow.bug:behaviorIncorrect behavior without a crashclawsweeper:linked-pr-openClawSweeper found an open linked pull request for this issue.clawsweeper:needs-live-reproClawSweeper needs live local, crabbox, or manual validation to confirm this issue.clawsweeper:needs-security-reviewClawSweeper marked this issue as needing security-sensitive review.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.impact:securitySecurity boundary, credential, authz, sandbox, or sensitive-data risk.issue-rating: 🐚 platinum hermitGood issue quality with a plausible reproduction path needing some confirmation.maintainerMaintainer-authored PR

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions