Skip to content

fix: require explicit opt-in for Session Share readers - #202299

Merged
vincentkoc merged 15 commits into
mainfrom
openclaw/clear-krill
Nov 20, 2026
Merged

vincentkoc merged 15 commits into
mainfrom
openclaw/clear-krill

Conversation

@vincentkoc

@vincentkoc vincentkoc commented Nov 20, 2026 •

Copy link
Copy Markdown
Member

What Problem This Solves

A signed Session Share reader could connect without an explicit host opt-in. Disabling and restoring access could also revive an already prepared reader handshake or response.

User Impact

Reader access is now off by default. Operators who use it must set gateway.sessionControl.publicationReadEnabled: true and retain the existing Session Share source opt-in and device grant. Disabling access permanently retires old admissions; re-enabling requires a fresh connection. Ordinary authenticated clients are unchanged.

Why This Change Was Made

Record disable transitions at the committed config owner, then check that retained identity during reader admission, attachment and final disclosure. Unrelated config changes preserve valid readers. This is reader-only hardening: no steering, writer, discovery or source-selection APIs.

Evidence

  • Rebased candidate 41a12bfc864f775a97e13e5814643ae99ee1ef82 (tree e86b6f1c5161bad8b44c5af413fa2167c4e6c7cb): all 158 focused tests passed again, including six shared-auth-rotation cases. Scoped types, lint, generated config baseline, formatting and diff checks passed.
  • Independent review: 94 earlier reader/config checks passed, followed by six rotation tests on the accepted test-only delta. No confirmed production authorization defect; the identified reader-fixture regression was corrected.
  • Base reproduction: nine security failures, with two positive controls.
  • Prior independently accepted head: eda78a0247ceaea9f18a3558bf5e18cf8365f52a; tree 08331da09f2bd4411d6949cc93d962fb95a1bfc8.
  • Original full build passed on aacc34d66441c1e32725a020f2b9140f8519ee14 (436s); it is historical evidence, not a fresh full build of the rebased candidate. Exact-head CI remains required.
  • Formal review UNAVAILABLE, not clean: canonical Codex executable absent; supported Claude fallback returned HTTP429 requiring usage credits before inference. Independent review is separate evidence.
  • Conflict repair: rebased onto main 3e7c305f4572a0ce0407b112db1d5c2048da2624; regenerated only the config baseline (including main's additional plugin config entry). Both authored source/test patches are unchanged by range-diff. No writer, steering, discovery or source-selection changes.
  • Awaiting Vincent's Mac autoreview comment for the final published head before native review/prepare/merge gates. No local Codex/Claude review was invoked for this refresh.
  • No live deployment/Cloudflare proof, enabling, or merge. Source-steering work is excluded.

@clawsweeper

clawsweeper Bot commented Nov 20, 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 plugin: session-share size: M labels Nov 20, 2026
@vincentkoc vincentkoc self-assigned this Nov 20, 2026
@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Nov 20, 2026
vincentkoc and others added 2 commits November 20, 2026 06:36
OpenClaw-Publication: 67e30e31-ddaf-81f3-a509-b3dee54e0032
@vincentkoc

Copy link
Copy Markdown
Member Author

Maintainer review at 773309c201848d279f263509440253d923a095d4.

Formal review (autoreview, branch mode against origin/main, P0-P2)

  • Result at this exact head: scoped-clean, "patch is correct" (0.82), no accepted or actionable findings.
  • Also clean at the pre-rebase head 280d2e344b07 (0.8).
  • Limit: the reviewer ran without executing tests and could not independently open unchanged call sites.

What I checked by reading

  • The rebase changed nothing but generated output. Excluding docs/.generated, the diff against the merge base is line-for-line identical to the pre-rebase diff; the only other delta is the regenerated config baseline checksum and count.
  • Admission: preparePublicationReaderAdmission captures enablement before its first await and re-asserts it before recording the admission. isPublicationReaderCurrent runs the captured check, so prepareGatewayPublicationReaderV1 and the dispatch-owner fence inherit it.
  • Disable is sticky: a published snapshot where the switch is not exactly true (incoming or outgoing) replaces the epoch object, so an off/on pair retires earlier admissions. Unrelated config publications keep the epoch.
  • Ordinary clients: a connect that does not request operator.session-share.read never reaches the new check. A multi-scope request that includes it was already rejected as non-singleton before this change, so that behavior is unchanged.
  • Compatibility: the reader transport (feat: support narrowly scoped Gateway publication readers #201073 to fix: refresh visible shared Gateway conversations #201076) is in no release tag, so default-off needs no migration.

Not verified here

  • I did not run the tests myself; this relies on PR CI for the rebased head.
  • No live Gateway proof of a reader being refused or retired.

One docs nit, not blocking: the new "Publication reader opt-in" section in docs/gateway/configuration-reference.md sits after the Related links at the end of the page.

@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. 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:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Nov 20, 2026
@clawsweeper

clawsweeper Bot commented Nov 20, 2026

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge.

What this changes

This PR adds an explicit host opt-in for Session Share readers and permanently retires existing admissions when access is disabled.

Example: A paired device requests operator.session-share.read without gateway.sessionControl.publicationReadEnabled.

  • Before: The signed reader can connect, while source publication still requires separate grants.
  • After: The Gateway rejects the connection until the host switch is explicitly true.

Review scores

Measure Result What it means
Overall readiness 🧂 unranked krab (1/6) The approved direction uses the existing owners, but two concrete cutover defects remain and required real-behavior evidence is absent.
Proof confidence 🧂 unranked krab (1/6) Real behavior proof is not required for maintainer- or bot-authored pull requests.
Patch quality 🦪 silver shellfish (2/6) 2 actionable review findings remain.

Product

Kind: Feature · Worth it: Yes · Fix scope: Complete
User problem: A signed reader can enter the restricted reader lane without a separate host-level publication opt-in.
Reason: The feature owner explicitly chose default-off admission and retirement across disable/re-enable transitions, while retaining existing source grants and ordinary-client behavior.

Merge readiness

⛔ Blocked before merge - 3 items remain

Keep this maintainer-authored PR open: the approved hardening remains absent from main, but the change misses an existing reader fixture and reports disabled access as a token problem.

Priority: P2
Reviewed head: 773309c201848d279f263509440253d923a095d4

Before merge

  • [P2] Opt the existing signed-WSS publication fixture into host reads (P2) - The new admission check rejects the existing positive fixture in test/plugins/session-share-publication.gateway.test.ts. Its cfg.gateway at lines 101–109 contains authentication and TLS settings but no sessionControl.publicationReadEnabled, so both roles variants fail to establish their reader connection before checking source filtering, transcript reads, or credential rotation. Add the explicit host opt-in to that fixture and run the affected suite; the two updated src/gateway fixtures do not cover this consumer.
  • [P2] Preserve an actionable disabled-reader handshake error (P2) - With a valid signed singleton reader token and the host switch absent or false, this new exception is caught by authorizeGatewayConnectDevice, which unconditionally sends 'publication reader requires an exact singleton paired device token'. The operator receives a token diagnosis even though the token is valid, with no indication that publication reads are disabled. Distinguish this denial at the existing handshake boundary and tell the source operator to enable publication reads, then reconnect.
  • Add data-model compatibility proof - The review found that existing stored data may not work after upgrade. Show that existing data still loads and works with this change.

Findings

  • [P2] [P2] Opt the existing signed-WSS publication fixture into host reads — src/gateway/publication-reader.ts:70
  • [P2] [P2] Preserve an actionable disabled-reader handshake error — src/gateway/publication-reader.ts:26

Tests

  • Missing end-to-end proof: Provide redacted Gateway output showing default-off refusal, enabled reading, retirement across disable/re-enable, and a fresh reconnect, plus a v2026.11.6 upgrade preserving existing settings and data.
Agent review details

How this fits together

The Gateway admits signed reader devices, restricts their RPC methods, and passes authorized reads to the Session Share plugin for source selection and disclosure.

flowchart LR
  A[Signed reader device] --> B[Gateway admission]
  C[Committed runtime config] --> B
  C --> D[Reader currentness]
  B --> D
  D --> E[Session Share source grants]
  E --> F[Selected session response]
Loading

Technical review

Best possible solution:

Keep the opt-in in the existing reader and config owners, update the signed-WSS fixture, and return an actionable disabled-access diagnostic.

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

Current main visibly admits valid singleton reader tokens without a host opt-in; source inspection also establishes the missed fixture and misleading rejection path, without executing tests.

Is this the best way to solve the issue?

The existing config publication and reader-currentness owners are appropriate for the approved policy, but the cutover must include the existing production-path fixture and handshake diagnostic.

Full review comments:

  • [P2] [P2] Opt the existing signed-WSS publication fixture into host reads — src/gateway/publication-reader.ts:70
    The new admission check rejects the existing positive fixture in test/plugins/session-share-publication.gateway.test.ts. Its cfg.gateway at lines 101–109 contains authentication and TLS settings but no sessionControl.publicationReadEnabled, so both roles variants fail to establish their reader connection before checking source filtering, transcript reads, or credential rotation. Add the explicit host opt-in to that fixture and run the affected suite; the two updated src/gateway fixtures do not cover this consumer.
    Confidence: 0.99
  • [P2] [P2] Preserve an actionable disabled-reader handshake error — src/gateway/publication-reader.ts:26
    With a valid signed singleton reader token and the host switch absent or false, this new exception is caught by authorizeGatewayConnectDevice, which unconditionally sends 'publication reader requires an exact singleton paired device token'. The operator receives a token diagnosis even though the token is valid, with no indication that publication reads are disabled. Distinguish this denial at the existing handshake boundary and tell the source operator to enable publication reads, then reconnect.
    Confidence: 0.98

Overall correctness: patch is incorrect
Overall confidence: 0.96

AGENTS.md: found and applied where relevant.

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

Provenance checked

  • Reader admission and disclosure authority changes intended behavior with a stated reason (5795128: Provide a device-only singleton-scope lane without human identity, private RPC access, or writer powers.)
  • Session Share source enablement keeps the original intent (6448314: Require source-owned device grants and group-and-person selection before publishing sessions.)
  • Runtime config publication keeps the original intent (2040d1b: Publish config identity facts from the existing runtime owner before notifying consumers.)
  • Hot reload classification keeps the original intent (feat(gateway): apply more settings without restarting #138112: Apply policies through existing live owners without unnecessary Gateway restarts.)

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

Likely related people:

  • Vincent Koc: Raw commit 6448314 adds extensions/session-share/src/config.ts:43 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 6448314cd59f; files: extensions/session-share/src/config.ts)
  • Peter Steinberger: Raw commit 2040d1b adds src/config/runtime-config-publication.ts:2 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 2040d1b71db9; files: src/config/runtime-config-publication.ts)

PR surface

Source +43, Tests +204, Docs +18, Generated 0. Total +265 across 18 files. Added test files: 2.

View PR surface stats
Area Files Added Removed Net
Source 8 47 4 +43
Tests 6 209 5 +204
Docs 2 19 1 +18
Config 0 0 0 0
Generated 2 3 3 0
Other 0 0 0 0
Total 18 278 13 +265

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
New host setting 1 optional boolean; default off; hot-applied Existing reader configurations must explicitly enable gateway.sessionControl.publicationReadEnabled; the feature owner accepted this change for the unreleased reader transport.

Labels

Label changes:

  • add P2: This is scoped authorization hardening for an optional, unreleased reader capability.
  • add merge-risk: 🚨 compatibility: Reader admission and the SDK-backed read path now require an additional host setting; the maintainer explicitly accepted the default-off change.
  • add rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🧂 unranked krab and patch quality is 🦪 silver shellfish.
  • add status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action.

Label justifications:

  • P2: This is scoped authorization hardening for an optional, unreleased reader capability.
  • merge-risk: 🚨 compatibility: Reader admission and the SDK-backed read path now require an additional host setting; the maintainer explicitly accepted the default-off change.
  • rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🧂 unranked krab and patch quality is 🦪 silver shellfish.
  • status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action.

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.

Reviewed November 20, 2026, 1:54 AM ET / 06:54 UTC.

@vincentkoc

Copy link
Copy Markdown
Member Author

Follow-up at fbd45af787c61df646a1d82753fa441f7846a5bf.

  • Exact-head CI on the reviewed head 773309c20184 failed one job, caused by this PR: test/plugins/session-share-publication.gateway.test.ts connected a reader without the new opt-in and was refused (checks-node-changed-compact-large-9-2, run 44689196345).
  • The delta from the reviewed head to this head is one line, in that test only: sessionControl: { publicationReadEnabled: true } in its Gateway config. No production file changed, so the earlier review and autoreview result carry over; I did not rerun autoreview for a one-line fixture change.
  • Landing still depends on exact-head CI for this head being green.

@vincentkoc

Copy link
Copy Markdown
Member Author

Checked 67febc7d4f2215eb1bd6494090a087b0ffd69c1d (rebased again after another config change landed on main): outside docs/.generated, its diff against the merge base is identical to the diff at fbd45af787c6. The only delta is the regenerated config baseline checksum.

The review above applies to this head, and to any later head that differs only by a rebase plus regenerated files under docs/.generated. Anything else needs a fresh look. Landing still requires green exact-head CI.

@vincentkoc
vincentkoc merged commit 7abe867 into main Nov 20, 2026
268 of 269 checks passed
@vincentkoc
vincentkoc deleted the openclaw/clear-krill branch November 20, 2026 08:19
@vincentkoc

Copy link
Copy Markdown
Member Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 21, 2026
* fix(gateway): require explicit publication reader opt-in

* test(gateway): opt reader issuer-rotation fixture in explicitly

* fix: require explicit opt-in for Session Share readers

OpenClaw-Publication: daadcf7c-719e-890e-823a-a1b453d00439

* fix(gateway): require explicit publication reader opt-in

* test(gateway): opt reader issuer-rotation fixture in explicitly

* Merge 41a12bf

* fix: require explicit opt-in for Session Share readers

OpenClaw-Publication: 67e30e31-ddaf-81f3-a509-b3dee54e0032

* test: opt in signed Session Share publication fixture

* Merge 404c49a

* Publish openclaw/clear-krill

OpenClaw-Publication: fab0b809-a45d-8e5c-8418-4836bb5facd7

* fix(gateway): require explicit publication reader opt-in

* test(gateway): opt reader issuer-rotation fixture in explicitly

* test: opt in signed Session Share publication fixture

* Merge d382168

* Publish openclaw/clear-krill

OpenClaw-Publication: 72a30543-8850-8df4-922b-8edd45acf540
Co-authored-by: Vincent Koc <[email protected]>
Co-authored-by: vincentkoc <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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. plugin: session-share rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. size: M status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant