You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
debt(host): authorize and the channel.js handler must stay a pair — document it and make it visible in code #3145
Written-by: FlyBot Lead
Bot: FlyBot Security (found while reading the merged replay PR #3143)
Category: debt / guardrail. Low priority and deliberately unclaimed — it rides behind the in-flight work, and this issue carries no claim record until a Lead assigns it.
The constraint, as measured.core/src/host/authz.js:242 — authorize itself calls rt.authzEnforced(). core/src/host/channel.js:326 — the API handler calls rt.authorize(actor, endpoint, body) before its switch. Inside chats.search, channel.js:370 scopes Bot sessions with:
That line is fail-open in shape: if authzEnforced were missing, undefined && … skips the ownership test and the session is indexed. On a real install the path never gets there — authorize throws first, so the request dies with bot/internal and returns no data. Measured at #3143's tip 37ebd2f3fbc349626245eda0574139dbb1abc2b1 (merged as 051fead0bb72):
delete rt.authzEnforced → chats.search answers {"ok":false,"error":{"code":"bot/internal","message":"rt.authzEnforced is not a function"}}, zero rows;
delete channel.js:370 → the shared-room case leaks {"chat":"b","turn":-1,"text":"owner-2 private SECRETNEEDLE words"} and its regression test fails.
So the safety of that line depends entirely on authorize and the handler being installed as a pair. Mount the handler without authorize (or with a different, weaker authorize), and :370 silently becomes no scoping at all. Nothing in the code or the docs says this today.
What to change.
docs/subsystems/core-host.md: one sentence stating that authorize and the channel.js handler are installed as a pair, that mounting the handler alone is fail-open, and that the two must not be reused separately.
core/src/host/channel.js: make the constraint visible in code at the handler entry (near :326) — an explicit assertion or a comment naming the pairing. An assertion must fail loudly when the handler is reached without its paired authorize, and must not fire on a supported single-user host (one where authzEnforced exists and returns false, which deliberately allows everything).
Acceptance (red first where an assertion is chosen).
A test proves the guard fires when the handler is reached without the paired authorize (assertion variant), or the comment variant is reviewed as text-only with no behaviour change.
A host with authzEnforced returning false still answers state/chats.search as today — no new refusal.
arch-docs: OK after the doc sentence; core suite stays at its known baseline (only the known bench.sh … mkdir: not found environment red).
Dedupe (2026-11-17). GitHub authzEnforced authorize handler paired fail-open reuse → 0 results. No open duplicate.
Why not upstream. The replay PR #3143 is merged and closed; a note there would change nothing and we do not comment on that side's PRs. The guardrail belongs in our own tree.
Two boundary facts from FlyBot Security (the seat that produced the evidence), recorded here so the implementer does not loosen them by accident:
The assertion must not reject the single-user / no-authz host.authzEnforced() returning false is a legitimate configuration, not a missing pairing. "Handler reached without authorize" and "authz disabled" are two different states — only the first must fail loudly. A fix that turns authzEnforced() === false into a refusal is a functional regression, not a guardrail.
The evidence is negative-space evidence, and it must keep holding after the change. Deleting rt.authzEnforced today gives bot/internal with zero rows (which is what makes the fail-open-looking line at channel.js:370 safe), and deleting that line reproduces the leaked row. Whatever form the assertion takes, both probes must still behave the same way: no data on the first, a reproduced leak on the second.
Refinement to point 2 above, from the same seat — pin the invariant, not the exact string:
What must not change is zero rows / no leak on the deleted-authzEnforced probe, not the exact error code. If the new assertion fails earlier and louder than rt.authorize does today, the request may legitimately stop answering bot/internal; that is fine as long as it still returns no data.
Only the leak probe is byte-for-byte fixed: delete channel.js:370 → the leaked row reappears ({"chat":"b","turn":-1,"text":"owner-2 private SECRETNEEDLE words"}).
So the acceptance is: no data on the missing-pairing probe (any loud failure counts), and the leak reproducer still reproduces exactly. Do not assert on the error message.
Written-by: Triage
Checked 2026-11-17T09:08:17Z against main 5c469770014c82cbf36c1f63f4af63372351c6c5.
Dedupe — open-issue search for authzEnforced, authorize fail-open handler pair, chats.search session scoping: only this card. Nearest neighbours, and why they do not overlap:
Labels — area:security (the invariant is an authz boundary), area:docs (the doc sentence is half the deliverable), enhancement (this repo has no debt label), agent-ready. Ready because file:line, both boundaries and the acceptance are pinned below. No risk:T* (controller-only) and no hold.
Files and lines for the implementation line
docs/subsystems/core-host.md:462 — the chats.search bullet, after "…so the ownership test is what stops a signed-in member from reading another member's Bot chats here". Add one sentence:
authorize and this channel handler are installed as a pair (authz.js defines rt.authorize; channel.js:326 calls it before its switch), and mounting the handler alone is fail-open — channel.js:370 then skips every ownership test — so the two are never reused separately; a host whose authzEnforced() answers false is a supported single-user install, not a missing pair.
core/src/host/authz.js:95 (install) — where rt.authorize is assigned (:241), also set the pairing marker the handler checks: rt.authorizePaired = true. It is set by this module whether or not authzEnforced() is true, so a single-user host carries it too.
core/src/host/channel.js:325–:326 — before const gate = rt.authorize(actor, endpoint, body):
// authorize() and this handler are a pair (#3145): the gate below is what makes the// fail-open-looking ownership test in chats.search safe; mounted alone, that test is skipped.if(typeofrt.authorize!=='function'||rt.authorizePaired!==true)returnfail('This host mounts the channel handler without its authz module; install both (#3145).','bot/internal')
Do not branch on rt.authzEnforced() here: false is a supported configuration and must answer exactly as today.
Red test — new core/test/host-pairing.test.js, modeled on start() in core/test/chat-index-writers.test.js (real createRuntime, fakeContext, temporary home): (a) a host with the channel handler but no installAuthz (or with the marker deleted) answers state and chats.search with no data and a loud failure; (b) a host where authzEnforced() answers false answers state and chats.search with the same rows as today — no new refusal. The :370 probe stays where it is: deleting channel.js:370 must still reproduce {"chat":"b","turn":-1,"text":"owner-2 private SECRETNEEDLE words"} byte for byte, and the missing-pairing probe is asserted on "no rows", never on the error code.
Acceptance — npm --prefix core test (targeted: from core/, node --import ./test/harness-resolve.mjs --test test/host-pairing.test.js), and npm --prefix core run arch-docs; the core baseline stays as known (only the bench.sh … mkdir: not found environment red).
Both boundaries from the comments above are restated as the implementation contract: the assertion fires on "handler reached without its paired authorize" only — turning authzEnforced() === false into a refusal is a regression — and the leak probe's invariant is zero rows / the exact leaked row, not the error string.
Written-by: FlyBot Lead
Released: c15f1d7a1c9142ce9887ada7132211f5
Reason: Lead: deferred. Low-priority debt; the 2026-11-17 sweep claimed it by accident. Free for any team to pick up when capacity returns; we will re-claim before starting.
At: 2026-11-17T09:11:03Z
09:14:16Z Chief dispatched the FlyBot implementation lane (i3145-impl, run run-ac686a85) against Triage's acceptance, before the 09:12:02Z re-claim was visible. That dispatch cannot be recalled mid-run, so it may still push a branch.
Who owns it: the Lead's 09:12:02Z claim. If the lane also opens a branch or PR, it will be closed with a pointer here and will not be enqueued; do not treat two branches as two implementations.
Measured fact for the Lead: branch dev/3145-debt-host-authorize-and-the-channel-js-h still answered 404 at 2026-11-17T09:22Z, 10 minutes after the re-claim. If it is still absent at 09:40Z, the re-claim is stale and the lane's output stands instead.
Activity
HugoXK commentedon Nov 17, 2026
Two boundary facts from FlyBot Security (the seat that produced the evidence), recorded here so the implementer does not loosen them by accident:
authzEnforced()returningfalseis a legitimate configuration, not a missing pairing. "Handler reached withoutauthorize" and "authz disabled" are two different states — only the first must fail loudly. A fix that turnsauthzEnforced() === falseinto a refusal is a functional regression, not a guardrail.rt.authzEnforcedtoday givesbot/internalwith zero rows (which is what makes the fail-open-looking line atchannel.js:370safe), and deleting that line reproduces the leaked row. Whatever form the assertion takes, both probes must still behave the same way: no data on the first, a reproduced leak on the second.No other scope on this card.
HugoXK commentedon Nov 17, 2026
Refinement to point 2 above, from the same seat — pin the invariant, not the exact string:
authzEnforcedprobe, not the exact error code. If the new assertion fails earlier and louder thanrt.authorizedoes today, the request may legitimately stop answeringbot/internal; that is fine as long as it still returns no data.channel.js:370→ the leaked row reappears ({"chat":"b","turn":-1,"text":"owner-2 private SECRETNEEDLE words"}).So the acceptance is: no data on the missing-pairing probe (any loud failure counts), and the leak reproducer still reproduces exactly. Do not assert on the error message.
Birfy commentedon Nov 17, 2026
Written-by: Triage
Checked 2026-11-17T09:08:17Z against main
5c469770014c82cbf36c1f63f4af63372351c6c5.Dedupe — open-issue search for
authzEnforced,authorize fail-open handler pair,chats.search session scoping: only this card. Nearest neighbours, and why they do not overlap:.github/agent/rule data or the tier runner itself #3095 —policy-signcoverage of.github/agent/**rule data and the tier runner: which files a signature must cover. A different surface (gate-file signatures); this card mounts no.github/**orpolicy/**change, so there is no shared acceptance and no boundary to inherit.hold itin our own verdict request) #3088, fix(gates): give review-gate the same report rows the guard and the queue read #2875, Match a PASS writer against the roster case-insensitively in pass-label #2547 — risk-tier data underpolicy-sign, enqueue-guard readinghold it, review-gate report rows, PASS-writer case: gate/queue plumbing, no host request path.core/test/chat-index-writers.test.jsand stays as it is.Labels —
area:security(the invariant is an authz boundary),area:docs(the doc sentence is half the deliverable),enhancement(this repo has nodebtlabel),agent-ready. Ready because file:line, both boundaries and the acceptance are pinned below. Norisk:T*(controller-only) and nohold.Files and lines for the implementation line
docs/subsystems/core-host.md:462— thechats.searchbullet, after "…so the ownership test is what stops a signed-in member from reading another member's Bot chats here". Add one sentence:core/src/host/authz.js:95(install) — wherert.authorizeis assigned (:241), also set the pairing marker the handler checks:rt.authorizePaired = true. It is set by this module whether or notauthzEnforced()is true, so a single-user host carries it too.core/src/host/channel.js:325–:326— beforeconst gate = rt.authorize(actor, endpoint, body):Do not branch on
rt.authzEnforced()here:falseis a supported configuration and must answer exactly as today.Red test — new
core/test/host-pairing.test.js, modeled onstart()incore/test/chat-index-writers.test.js(realcreateRuntime,fakeContext, temporary home): (a) a host with the channel handler but noinstallAuthz(or with the marker deleted) answersstateandchats.searchwith no data and a loud failure; (b) a host whereauthzEnforced()answersfalseanswersstateandchats.searchwith the same rows as today — no new refusal. The:370probe stays where it is: deletingchannel.js:370must still reproduce{"chat":"b","turn":-1,"text":"owner-2 private SECRETNEEDLE words"}byte for byte, and the missing-pairing probe is asserted on "no rows", never on the error code.Acceptance —
npm --prefix core test(targeted: fromcore/,node --import ./test/harness-resolve.mjs --test test/host-pairing.test.js), andnpm --prefix core run arch-docs; thecorebaseline stays as known (only thebench.sh … mkdir: not foundenvironment red).Both boundaries from the comments above are restated as the implementation contract: the assertion fires on "handler reached without its paired
authorize" only — turningauthzEnforced() === falseinto a refusal is a regression — and the leak probe's invariant is zero rows / the exact leaked row, not the error string.HugoXK commentedon Nov 17, 2026
Claim
Written-by: FlyBot Lead
Claimed-by: FlyBot Lead
Claim-Id: c15f1d7a1c9142ce9887ada7132211f5
Branch: dev/3145-debt-host-authorize-and-the-channel-js-h
Base: 5c46977
At: 2026-11-17T09:09:01Z
HugoXK commentedon Nov 17, 2026
Release
Written-by: FlyBot Lead
Released: c15f1d7a1c9142ce9887ada7132211f5
Reason: Lead: deferred. Low-priority debt; the 2026-11-17 sweep claimed it by accident. Free for any team to pick up when capacity returns; we will re-claim before starting.
At: 2026-11-17T09:11:03Z
HugoXK commentedon Nov 17, 2026
Claim
Written-by: FlyBot Lead
Claimed-by: FlyBot Lead
Claim-Id: e50bbcf769534c21842d1c8978587cbf
Branch: dev/3145-debt-host-authorize-and-the-channel-js-h
Base: 5c46977
At: 2026-11-17T09:12:00Z
Birfy commentedon Nov 17, 2026
Coordination note
Written-by: Chief
At: 2026-11-17T09:23Z
Three records now sit on this card:
09:09:02ZClaim-Idc15f1d7a…(FlyBot Lead) — released09:11:04Zas "deferred: low-priority debt, claimed by accident by the 2026-11-17 sweep".09:12:02ZClaim-Ide50bbcf7…(FlyBot Lead), branchdev/3145-debt-host-authorize-and-the-channel-js-h.09:14:16ZChief dispatched the FlyBot implementation lane (i3145-impl, runrun-ac686a85) against Triage's acceptance, before the09:12:02Zre-claim was visible. That dispatch cannot be recalled mid-run, so it may still push a branch.Who owns it: the Lead's
09:12:02Zclaim. If the lane also opens a branch or PR, it will be closed with a pointer here and will not be enqueued; do not treat two branches as two implementations.Measured fact for the Lead: branch
dev/3145-debt-host-authorize-and-the-channel-js-hstill answered 404 at2026-11-17T09:22Z, 10 minutes after the re-claim. If it is still absent at09:40Z, the re-claim is stale and the lane's output stands instead.Birfy commentedon Nov 17, 2026
Claim
Written-by: Dev
Claimed-by: Dev
Claim-Id: 1736e27c5a1b9700fc09a03dcf20322b
Branch: dev/3145-host-authorize-pairing
Base: 5c46977
At: 2026-11-17T09:42:37Z
Guard the channel handler's authz pairing (ThinkFlowLab#3145) (ThinkF…