Skip to content

fix: keep invited collaborators from loosening your session's guardrails or approving your commands - #201615

Merged
jalehman merged 31 commits into
mainfrom
openclaw/nova-crab-2
Nov 21, 2026
Merged

jalehman merged 31 commits into
mainfrom
openclaw/nova-crab-2

Conversation

@jalehman

@jalehman jalehman commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

Related: #201526 (part D)

What Problem This Solves

When you invite someone into a session (a role with sessions.others: "invited" plus a session membership), they could change its permission mode to something looser than you set, for example from Ask me to Auto-review, and approve shell commands your own turns were waiting on. Inviting a collaborator could quietly remove the guardrails you chose.

User Impact

User impact: only invited collaborators are affected. For someone whose access to a session comes from an invitation:

  • Permission mode is tighten-only. They can tighten it but not loosen it or reset it to the default.
  • Approvals are their own. They can only see and resolve approvals raised by their own turns.

Everyone else keeps exactly the behavior on main: the session creator, admins, teammates whose role grants sessions.others view/suggest/write, unprofiled paired devices, non-admin iOS approvers and their pushes, sessionless and node approvals, history from deleted sessions, and older sessions with no recorded creator. These rules only ever add a restriction for invitees; they never replace an existing device, reviewer or custody check.

Why This Change Was Made

This is the scoped version chosen after an audit showed the earlier global version changed behavior for team roles, iOS approvers, unprofiled devices and sessionless approvals. Invited access is decided from the resolved Gateway profile role policy plus actual session membership (the profile role is the single authority since #201610), so it applies the same way whether the invitee arrives through OpenClaw ID, Cloudflare Access or a trusted proxy.

Permission-mode changes are checked once, by the shared session patch owner, so the single and bulk RPC, tool, create-adoption and reset paths follow the same rule. Approvals record which profile's turn raised them; a schema 41 migration (SQLite and PostgreSQL) adds the nullable requested_by_profile_id column with no backfill. Only invitees consult it.

Evidence

Compatibility matrix (written first, red on the previous head, now green): a real-Gateway matrix of 137 cells. Rows: creator, admin, team view/suggest/write, invited collaborator (with operator.write, and with operator.approvals), unprofiled non-admin device, non-admin iOS approver, sessionless/node approval, deleted-session history, legacy owner session with no creator. Columns: loosen mode, reset to default, tighten mode, list/get/resolve another person's approval, list/resolve own approval, push eligibility. 41 cells failed against the previous global head; all 137 pass now. Every non-invitee cell matches main.

Call sites: 30 production paths were classified (session permission authorization, patch/create/reset, approval lookup/list/get/wait/resolve, generic approval records, history, events, web and iOS push). Each either applies the invite-only deny filter or keeps main's check unchanged.

Local verification on this head:

  • Migration and conformance: 42 tests, including real PostgreSQL 17.12 and SQLite v40→v41.
  • Core approval 31, review regressions 25, repaired fixtures 20, workspace policy 18, live Gateway 3.
  • Production typecheck and all four Gateway test-type scopes; lifetime, test-lines and line-cap ratchets; database-worker ratchet 166→166.
  • Two independent reviews; the runtime findings from the first were fixed, the second found no P0–P2 issues.

Not certified locally (bounded runs timed out during compilation/teardown on this host), so CI is the authority for: the wider approval consumer sweep, the plugin-approval routing E2E, and the final typed-lint subset.

Test-line allocation: recorded in config/test-lines-allocations/201526-session-member-authority.txt for the real-Gateway matrix and approval boundary coverage; these are new security behaviors with no existing tests to extend.

Commands
node scripts/run-vitest.mjs \
  src/gateway/server.invite-scope-matrix.test.ts \
  src/gateway/server.session-member-authority.test.ts \
  src/gateway/server.sessions.create.workspace-policy.test.ts \
  --maxWorkers=1

Plus the approval, push, persistence, migration (SQLite and PostgreSQL) and generated-schema suites.

CI on the final head (d2ed75fa, run 44819517110): landed with these failures, none caused by this PR:

  • checks-node-changed-compact-large-19: src/agents/mcp-config-mutation.test.ts (keep/replace custody) fails identically on main f6298a19.
  • checks-node-compact-small-5 and -12: runner apt setup failed (ondrej/php PPA label change) before any test.
  • android-access-native (4096, google_apis): emulator could not load the SDK devices.xml before any test.
  • checks-ui-e2e (2/4): skills and skill-settings asset-request bounds. ui/ is unchanged by this PR and the shard passed on the previous head.
  • ios-screenshots: testReleaseChatScreenshot. apps/ios/ is unchanged by this PR and the job passed on the previous head with the same Swift change.
  • Intersect shared OpenClawKit dead code (not required): flags two UI declarations this PR doesn't reference.

Proof limits: the packaged upgrade proof ran on c115c774, not the final head, and there is no live shipped-Gateway/real-model run.

🦞 Made with OpenClaw

@clawsweeper

clawsweeper Bot commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation gateway Gateway runtime scripts Repository scripts agents Agent runtime and tooling size: XL labels Nov 19, 2026
@github-actions

github-actions Bot commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

⚠️ Security sensitive changes

This maintainer PR changes sensitive security components.

No secops approval is required. This comment is informational because the PR author has Maintain or Admin access.

  • Current SHA: d2ed75fa46eaf256592a0e8e29e4491ec8d9f589
  • Maintainer: @jalehman
  • Repository role: admin

These security sensitive changes were made:

  • src/gateway/exec-approval-manager.types.ts: Controls sandbox containment or tool execution authority. Check filesystem and network isolation, approval scope, and command allowlists.
  • src/gateway/exec-approval-registration.ts: Controls sandbox containment or tool execution authority. Check filesystem and network isolation, approval scope, and command allowlists.
  • src/gateway/server-methods/exec-approval.ts: Controls sandbox containment or tool execution authority. Check filesystem and network isolation, approval scope, and command allowlists.
  • src/gateway/server-methods/sessions-patch-sandbox.runtime.ts: Controls sandbox containment or tool execution authority. Check filesystem and network isolation, approval scope, and command allowlists.
  • src/gateway/session-permission-authorization.ts: Controls Gateway authentication, pairing, or caller permissions. Check identity validation, scope checks, and revocation.
  • src/gateway/session-reset-authorization.ts: Controls Gateway authentication, pairing, or caller permissions. Check identity validation, scope checks, and revocation.
  • src/gateway/session-sharing-authorization.ts: Controls Gateway authentication, pairing, or caller permissions. Check identity validation, scope checks, and revocation.

Carefully review these changes before merging.

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 automation 🚨 May affect CI, automerge, proof capture, label sync, or maintainer automation. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Nov 19, 2026
@clawsweeper

clawsweeper Bot commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

Restricts invited collaborators to tightening session permissions and accessing approvals raised by their own profile.

Example: Alice is invited to Morgan's guarded session and has operator.write and operator.approvals.

  • Before: Alice can switch the session to workspace mode and resolve Morgan's unbound approval.
  • After: Both actions are refused; Alice can tighten the mode and review her own approvals subject to existing reviewer checks.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) The source and compatibility evidence support the repair, with behavioral confidence limited to Gateway harness coverage and current CI shards that have not completed validation.
Proof confidence 🦐 gold shrimp (3/6) This maintainer-authored PR is outside the contributor proof gate; its behavior evidence is in-process Gateway coverage, while the packaged CLI upgrade demonstrates retained data, and the inspected screenshots belong to the broader participation PR.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: Inviting a collaborator can let them loosen a session's guardrails or approve another person's commands.
Reason: The maintainer-authored direction explicitly limits the repair to invitation-derived access and preserves other role and device behavior.

Merge readiness

✅ Ready for maintainer review

Keep open: this maintainer-authored PR addresses an invitation-authority gap still present on main, and review found no definite introduced bug.

Priority: P2
Reviewed head: d2ed75fa46eaf256592a0e8e29e4491ec8d9f589

Before merge

None.

Findings

None.

Tests

  • Missing end-to-end proof: Permission-denial and cross-profile approval behavior is demonstrated by Gateway test suites rather than an independently operated shipped Gateway with real model turns.
Agent review details

How this fits together

The Gateway combines authenticated profile roles, session membership, and approval requester records to authorize session mutations, approval RPCs, events, and notifications.

flowchart TD
  A[Authenticated caller] --> B[Profile role and session membership]
  B --> C[Session permission owner]
  B --> D[Approval access owner]
  E[Admitted turn identity] --> F[Approval requester storage]
  F --> D
  C --> G[Session mutation]
  D --> H[RPC events and notifications]
Loading

Technical review

Best possible solution:

Keep the invite-only restriction in the shared permission and approval owners, retaining existing reviewer checks and nullable historical attribution.

Do we have a high-confidence way to reproduce the issue?

Main's approval owner filters session readability without checking which profile raised an approval, and the supplied Gateway regressions exercise the corresponding permission and approval paths; no target code was run during this review.

Is this the best way to solve the issue?

The change addresses the authority decision through existing shared owners and persists the otherwise unavailable initiating profile without inventing historical identities.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against c2e7b54ab6f5.

Provenance checked

  • Approval session visibility keeps the original intent (4c5ba03: Apply canonical session-membership visibility to approval lookups and prevent session-derived disclosure.)
  • Profile-based role authority keeps the original intent (fa6f9f8: Use the Gateway profile role consistently across OpenClaw ID and other sign-in transports.)
  • Historical SQLite catalogs keeps the original intent (1930535: Keep installed updater readers able to resolve historical schema fingerprints across in-place build swaps.)

Testing

Proof path: shipped entry point.

Security

None.

Evidence

What I checked:

Likely related people:

  • Josh Lehman: Raw commit fa6f9f8 adds src/gateway/operator-role-policy.ts:340 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: fa6f9f8fc946; files: src/gateway/operator-role-policy.ts)

PR surface

PR surface statistics unavailable: the file list is incomplete.

Preflight source

Source unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified.

Review metrics

Metric Value Why it matters
Stored-data change State schema 40→41; one nullable column operator_approvals.requested_by_profile_id retains trusted requester identity without backfilling historical rows.

Labels

Label changes:

  • add rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • remove rating: 🦪 silver shellfish: Current PR rating is rating: 🦐 gold shrimp, so this older rating label is no longer current.

Label justifications:

  • P2: The repair affects a limited multiplayer workflow involving invitation-only members with write or approval scopes.
  • merge-risk: 🚨 compatibility: Schema 41 makes older binaries refuse the upgraded database; the maintainer-authored direction documents backup-based rollback and supplies stable-upgrade preservation evidence.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Rating scale

6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

History

Review history (9 earlier review cycles; latest 8 shown)
  • reviewed 2026-11-19T07:45:30.596Z sha 56b2eb0 :: blocked before merge. :: none
  • reviewed 2026-11-19T07:54:16.825Z sha 56b2eb0 :: blocked before merge. :: [P2] [P2] Preserve profile authorization in the worker commit guard
  • reviewed 2026-11-19T08:41:01.385Z sha 921c65f :: blocked before merge. :: none
  • reviewed 2026-11-20T10:00:09.089Z sha a40b3c1 :: needs maintainer review before merge. :: none
  • reviewed 2026-11-20T10:23:33.826Z sha c115c77 :: blocked before merge. :: none
  • reviewed 2026-11-20T11:07:09.838Z sha 54195cf :: blocked before merge. :: none
  • reviewed 2026-11-20T15:50:49.437Z sha ee0367d :: needs maintainer review before merge. :: none
  • reviewed 2026-11-20T16:52:33.295Z sha 572bfc0 :: needs maintainer review before merge. :: none

Reviewed November 20, 2026, 4:29 PM ET / 21:29 UTC (Revision 10).

OpenClaw-Publication: 19bb00ba-605a-8569-9151-9f51248e5b70
@jalehman

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@jalehman

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. labels Nov 20, 2026
@jalehman
jalehman merged commit 2b5f1a8 into main Nov 21, 2026
247 of 256 checks passed
@jalehman
jalehman deleted the openclaw/nova-crab-2 branch November 21, 2026 01:48
@jalehman

Copy link
Copy Markdown
Contributor Author

Merged via explicitly authorized admin squash with attributed pre-existing CI failures.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 21, 2026
…ils or approving your commands (openclaw#201615)

* fix(gateway): fence shared-session permission and approval authority

* fix: keep shared collaborators from loosening your session's guardrails or approving your commands

OpenClaw-Publication: f9a4c13b-0902-8399-be8a-4d61e7cf36d3

* fix(gateway): preserve approval replay and align ownership fixtures

* Publish openclaw/nova-crab-2

OpenClaw-Publication: 8dd17d3d-5a1b-83fa-9003-8948b887e9f1

* fix(gateway): enforce profile boundary for legacy approval readers

* Publish openclaw/nova-crab-2

OpenClaw-Publication: 9980e439-8848-81ae-8354-84b5d835e157

* fix(gateway): preserve profile authority through approval commits

* Publish openclaw/nova-crab-2

OpenClaw-Publication: 7cf0b931-8265-821e-9078-285cf72c0512

* test(gateway): pin invite-scoped compatibility matrix

Real Gateway matrix is red before scope correction: 41 of 137 cells fail on c2ed2bc. Covers named roles, actual memberships, creator/admin, legacy unprofiled and iOS device authority, sessionless node approvals, and deleted-source history. Main source mutation denials for nonmember view/suggest approvers remain expected.

* fix(gateway): limit member safeguards to invited session access

* Publish openclaw/nova-crab-2

OpenClaw-Publication: 8c9daaa2-7c3f-8027-aeab-95470f726d0e

* fix(gateway): use session keys for permission authority

* Publish openclaw/nova-crab-2

OpenClaw-Publication: 5e4432dd-2a20-8681-b39f-b27a5d75e771

* fix(gateway): preserve reset lifecycle rejection ordering

* Publish openclaw/nova-crab-2

OpenClaw-Publication: e133d313-82c9-8ff8-b4c4-352e2179b909

* Publish openclaw/nova-crab-2

OpenClaw-Publication: dacc1d51-af59-8958-a2e1-67c848cb9e2b

* test(gateway): preserve lazy approval mock exports

* Publish openclaw/nova-crab-2

OpenClaw-Publication: 19bb00ba-605a-8569-9151-9f51248e5b70

* Publish openclaw/nova-crab-2

OpenClaw-Publication: 2a025e42-e7f9-87fe-bf53-52b659019b3b
scribe-dandelion-cult added a commit to karmaterminal/openclaw that referenced this pull request Nov 22, 2026
…9388 stage 4)

Absorbs openclaw/openclaw main 5a3e6b1
(473 commits past the absorbed 1129d4c, which is the merge-base) into
16541aa, so openclaw#129388's presentation can fast-forward. rerere was off for
the merge; nothing arrived pre-staged.

24 content conflicts:
- Generated, regenerated rather than hand-merged: config-baseline counts
  and sha256 (config:docs:gen; core 2667 + fork 17 = 2684), gateway
  predicates.js (gateway:validators:gen), and the four PostgreSQL state
  catalogs (db:postgres:gen).
- package.json schemaVersions: state 41 (upstream openclaw#201615) with the
  fork's agent 44 (continuation's recipient-authority step; upstream's
  agent ladder is still at 43).
- plugin-sdk-surface-report budgets: upstream's +2 (openclaw#203044) plus the
  fork's unchanged +11 / +4.
- subagent-registry-queries: upstream openclaw#203102 folded
  excludeSuspendedDelivery into excludeSettledDelivery; T1's
  unconditional suspended-unbound skip stays.
- subagent-registry-suspended-delivery: upstream openclaw#202732 restructured the
  discard into discardExpiredSubagentDelivery with the expiry notice in a
  finally block; T1's suspended-unbound outcome still notifies no session.
- agent-runner-result-accounting, update-command-service-command,
  session-reset-service, assistant-answer-text,
  state-port.postgres.test, vitest.database-worker-core-paths: both
  sides kept (imports, openclaw#201615 permission checks beside the reset
  retention, openclaw#203174's Responses-only signed selection with the fork's
  per-item answers, both port fixtures, both worker-path lists).
- update-cli tests (openclaw#200578 deleted the in-place Git runner): upstream's
  deletions win; the fork's compiler-flag argv matchers are carried onto
  upstream's rewritten checks.

Refs openclaw#129388

Co-Authored-By: Claude Opus 5.5 <[email protected]>
scribe-dandelion-cult added a commit to karmaterminal/openclaw that referenced this pull request Nov 22, 2026
Upstream openclaw#201615 (2b5f1a8) bumped the state schema to 41 and pinned
getOpenClawStatePredecessorSchema(40) to the sha256 of its own v40 schema
(fcbb0021…), so a v40 database stays recognized for the v41 step. The
fork's state schema also carries the continuation tables, so its v40
predecessor hashes differently, exactly as the file's other historical
hashes already do (the fork's comment beside them).

The invariant still holds for fork seats: the head's v40 predecessor is
byte-identical to the v40 schema the preceding build 16541aa shipped
(both e44990102d31…; upstream's pre-openclaw#201615 v40 is fcbb0021…). The pin
now names that hash. RED at e293165 (db:postgres:check's first step,
1 failed / 209), GREEN here (210/210).

Refs openclaw#129388

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling commands Command implementations docs Improvements or additions to documentation gateway Gateway runtime merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. scripts Repository scripts security-sensitive-changed size: XL status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant