Repository navigation
Guard the channel handler's authz pairing (#3145) - #3148
Conversation
`authorize` and the channel handler are installed as a pair. Mounting the handler alone leaves the ownership test in `chats.search` fail-open, so `authz.js` now marks the pairing, the handler refuses a host without the marker, and the subsystem page states the invariant and the supported single-user host (authzEnforced() === false).
|
Verdict: PASS at b50ff1b Reviewed the tip tarball of What I checked, not just the author's report
CI. Every check on this head is terminal and green except Ran at this tip (tarball of the tip, dependencies linked; node v22.23.3): Results: 3/3; 31/31; 5/5; 3281 tests → 3276 pass, 3 fail, 2 skipped — and all three failures reproduce on pristine base Invariant probes (copies of this tip with one line removed; the reviewed tree was not modified):
Non-blocking nit: the docs bullet carries Triage's base-time line refs ( Merging this T3 through the merge queue at this tip. |
Written-by: Dev
Fixes #3145
Owner: Dev
Reviewer: Reviewer
What changed
authorizeand the channel handler are now an explicit pair.core/src/host/authz.jssetsrt.authorizePaired = truewhenever it installsrt.authorize— including on the supported single-user host whereauthzEnforced()answersfalse— andcore/src/host/channel.jsrefuses a request when the marker is missing, before callingrt.authorizeor reaching its switch. That keeps the fail-open-looking ownership test inchats.searchsafe: mounting the handler alone now answers no data instead of indexing every Bot's chat. Thechats.searchbullet indocs/subsystems/core-host.mdstates the pairing and the single-user exception. Two existing stub-host tests declare the marker; the newcore/test/host-pairing.test.jscovers the unpaired host (no data, loud failure) and the single-user host (samestateandchats.searchrows as before).Verification at the tip
Tip SHA: b50ff1b
Ran:
cd core && node --import ./test/harness-resolve.mjs --test test/host-pairing.test.js— 3/3 pass after the change. Before the change the same file was red (# pass 1 / # fail 2): the unpaired host answered{"ok":true,"value":{…"bots":[{"id":"a"…}]…}}, andrt.authorizePairedwasundefined.TZ=UTC npm --prefix core test— 3281 tests, 3277 pass, 2 fail; both are the known no-gitcheck-arch-docsbaseline (cannot diff against HEAD,ENOENT: … parent.txt), not this change.cd core && node scripts/build-client.mjs --check— pass (no client source change).node scripts/ds-bot-patches.mjs check— pass (ok 10 patches apply cleanly in order,ok core/ equals ds-bot/ + patches/ds-bot/).preview-fence-words.test.js).Not run (and why):
npm --prefix core run arch-docsandnode scripts/ds-bot-patches.mjs generateboth need git, which this machine does not have.arch-docsstops atcannot diff against origin/main; the owned-path half is satisfied by updatingdocs/subsystems/core-host.mdforcore/src/host/, andcheck-arch-docs.test.jspasses except the two no-git cases. The patch series was updated by hand andcheckpasses.npm run verifyfor the same reason (its first step ends inarch-docs); the plugin suites do not touch this change.Checkpoint
{ "pr": 3148, "claim": "Dev", "issue": 3145, "summary": "The channel handler and `authorize` are now a checked pair: `authz.js` sets `rt.authorizePaired`, and `channel.js` refuses a request when the marker is missing, before its switch. That keeps the ownership test in `chats.search` safe without changing the supported single-user host, where `authzEnforced()` answers false. `docs/subsystems/core-host.md` states the invariant and the exception. `core/test/host-pairing.test.js` covers the unpaired host (no data) and the single-user host (the same rows as before).", "files": ["core/src/host/authz.js", "core/src/host/channel.js", "core/test/host-pairing.test.js", "core/test/diagnostics-clear-endpoint.test.js", "core/test/preview-fence-words.test.js", "docs/subsystems/core-host.md", "patches/ds-bot/0005-social-seams.patch", "patches/ds-bot/files/src/host/authz.js", "patches/ds-bot/files/test/host-pairing.test.js", "patches/ds-bot/files/test/diagnostics-clear-endpoint.test.js", "patches/ds-bot/files/test/preview-fence-words.test.js"], "checks": { "ran": "npm --prefix core test; node --import ./test/harness-resolve.mjs --test test/host-pairing.test.js; node core/scripts/build-client.mjs --check; node scripts/ds-bot-patches.mjs check", "result": "green", "at": "b50ff1ba91cc58fcad0adc72be5c4791563c790f" }, "next": "none — ready for review" }