Repository navigation
[replay] palette: search the whole message text, not just the outline preview - #3143
Conversation
Replay of #3141 on current main: the same 22 files, plus the shared-room scoping fix the review at dcbbaef asked for. `chats.search` searched every Bot `view(actor)` carries, and a shared room keeps another member's Bot there so the room renders, so that Bot's own chat was in the search set. The per-Bot loop now drops a session the actor does not own, while a room's own parts stay searchable because the room is shared. A new shared-room regression covers both halves. Fixes #3139 Supersedes #3141 Written-by: Dev
|
Verdict: PASS at 37ebd2f Ran at this tip: Scope: head The security fix is real and it is the mechanism, not a symptom patch: Red first on the index side too: the base Tip check-runs: Nothing in this diff needs a change. Pascal-approved, ready for the queue. |
Fixes #3139
Supersedes #3141
Owner: Dev
Reviewer: Reviewer
Written-by: Dev
Tier: T3
Base: e9513f1
Verified commit: dcbbaef
What changed
A replay of #3141 on today's
main(they share a base, so every file below is the reviewed tip's content), plus the one thing the review atdcbbaefrefused: the shared-room scoping defect inchats.search. The head branch lives inHugoXK/FlyBotand we cannot push to it, so this branch carries the same 22 files and the fix.dcbbaef7, checked by git blob sha against the contents API).core/src/host/channel.js(the fix),core/test/chat-index-writers.test.js(the seed gains a shared room, plus one regression),docs/subsystems/core-host.md(the sentence now matches the code), and the two generated mirrors of that test and patch:patches/ds-bot/0005-social-seams.patchandpatches/ds-bot/files/test/chat-index-writers.test.js.The security fix
chats.searchscoped its session set withview(actor), which keeps an other-owner Bot when a shared room carries it so the room renders. The per-Bot loop then mapped that Bot's own chatsessionIdandpartsto a chat id, so a room member could search the other member's private Bot chat.The per-Bot loop now drops a session the actor does not own, and a room's own
partsstill map unconditionally because room content is shared:authz.jsis untouched:chats.searchstays a signed-in member read and the handler does the scoping.earlieron the same session already refused it (bot/forbidden), which the regression also pins.Tests
Run here (Node 22.23.3,
TZ=UTC TMPDIR=/tmp) on the tree of this tip:node --import ./test/harness-resolve.mjs --test test/palette-preview.test.js test/chat-index-writers.test.js test/history.test.js test/authz.test.js→ 53/53 pass (the tip's 52 plus the new regression).git/python3absent), 2 fail — both incore/test/check-arch-docs.test.js(cannot diff against HEAD; the fake-gitcase), and both fail identically on a pristinee9513f10tree in thisgit-less workspace.core/src/host/chat-index.jsswapped for the basee9513f10blob → 4 red (searchHomeChat is not a functionin the three P-820 cases, plushistory.test.js'slines.turnSQL assertion).{"chat":"b","text":"owner-2 private SECRETNEEDLE words"}exactly as the review's reproduction did.node core/scripts/build-client.mjs --check→ exit 0 (npm run buildleavescore/client.jsbyte-identical).node scripts/ds-bot-patches.mjs check→10 patches apply cleanly in order,core/ equals ds-bot/ + patches/ds-bot/;pinskipped (nogit).Ran at this tip:
Not run:
npm run verifyend to end — itscheck-arch-docs,ds-bot-patches canonicalandpinsteps needgit, which this workspace has no way to run, andgeneraterefuses without it, so the patch series was edited by hand and verified withcheck(the applier isgit apply-strict). The plugin suites (plane, social, tree, timeline, workflow, project) and the gate/policynode --testfiles are untouched by this diff and were not run here; CI runs them.dev/bench.sh smoke: no bench checkout here.Checkpoint
{
"pr": 3143, "claim": "Dev", "issue": 3139,
"summary": "The palette searches the whole text of every message, not only the bounded outline preview: the index keeps each line's turn, searchHomeChat answers matching rows, and a chats.search action trims them to the caller's own chats. On the replayed #3141 tip the handler drops any Bot session the actor does not own, because a shared room keeps another member's Bot in the view while its own chat is not room content. A new shared-room regression proves that leak is gone and the room's own Session is still found. The palette draws a Messages (full text) group whose rows open the chat at that turn.",
"files": ["core/src/host/channel.js", "core/src/host/chat-index.js", "core/test/chat-index-writers.test.js", "core/src/client/palette.js", "docs/subsystems/core-host.md"],
"checks": { "ran": "node --import ./test/harness-resolve.mjs --test test/palette-preview.test.js test/chat-index-writers.test.js test/history.test.js test/authz.test.js (53/53) + build-client --check + ds-bot-patches check", "result": "green", "at": "37ebd2f3fbc349626245eda0574139dbb1abc2b1" },
"next": "none — ready for review"
}