Repository navigation
Conversation
Channel deletes and their authorization lookups now use the casefolded sequence target as well as the msgid. This prevents a copy under another target from being selected or deleted. Direct-message lookup behavior stays unchanged. Add a SQLite regression test with the same msgid under two channel targets; deleting one target must leave the other copy intact.
664a3ad to
5a278e9
Compare
I cannot reproduce this, e.g. which accords with my understanding of the implementation here: Lines 2469 to 2471 in 6e25291 |
|
You're right, thanks for checking. I misread the multi-target path: The one place I found where a msgid does repeat across channels is NICK/QUIT events, since the same item is written to every channel the user is in ( |
|
Thanks, I opened #2464 to look into this |
Problem
A single IRC message sent to multiple targets has the same msgid in each target's history.
DeleteMessagereceives a target and checks permission against it, but persistent-history lookup used only the msgid withLIMIT 1. It could select and delete a copy from another target, leaving the requested copy in place. In some paths, the wrong row could also trigger a permission failure for a valid request.Deleting every row with that msgid would be worse: it would erase history from targets the delete did not name, without a corresponding REDACT there.
Change
Scope history lookup and deletion by both msgid and the casefolded
sequence.targetin SQLite, MySQL, and PostgreSQL. Only the requested target's row is affected; copies in other targets remain intact. This keeps the database mutation aligned with the target used for authorization and avoids cross-target data loss.Regression test
TestDeleteMsgidIsTargetScopedstores one msgid under two targets, verifies lookup selects the requested target, deletes that copy, and confirms the unrelated copy remains.Checked in
golang:1.27:go test -tags "i18n mysql postgresql sqlite" ./...andgo vetpass;gofmtis clean. MySQL and PostgreSQL were compile-tested, not run against live databases.I am new to this codebase, so please flag it if I have misunderstood the target-scoping semantics.