Phase 2 and fix review H-L6-04 (a conversation's call is resolved like a community channel)
From mnema-talk v3.3.13, rendered on this site.
Reviewer: independent refuter and fix reviewer. I wrote none of the finding, the tests or the fix. I worked read-only: nothing in the repository changed and nothing was pushed. All scratch tests ran in the reviewer's worktree, were never committed, and were deleted before the full suite ran.
Inputs:
- findings/H-L6-04.md
- the lane test on msch128/hunt-lane6 (6a481c744)
- the fix on msch128/fix-h-l6-04, commit 93dae338e, based on 6a481c744
Protected area: internal/perm. Under the brief, this fix is prepared and reviewed but is not merged by the hunt; it goes on the owner's list.
Verdicts
| Part | Verdict |
|---|---|
| Phase 2 | STANDS at S3. It is a functional defect (it fails closed), not a security finding. |
| Fix 93dae338e | MERGE (once the owner agrees, since internal/perm is protected). No BLOCKER and no SHOULD-FIX. NOTEs below, plus one new candidate finding that predates this fix (section 8). |
1. Phase 2
Repro. I ran the finding's command at 6a481c744. The inverted known failure passes while the defect reproduces:
H-L6-04 still reproduces: the starter's chat answers 404, the other member's history 404, Connect false
--- PASS: TestKnownFailureACallOfAConversationNeedsTheCommunitysViewChannels
Is it documented? The strongest case that it is: doc/roles-and-permissions.md's Talks row at the base says "View channels + Connect to join". Read literally, that covers call Talks too. Three statements outweigh it:
- doc/talks.md, "Start a Talk from a direct message": "No lobby and no admin setup are needed, so it works on a fresh community". It also says the permission snapshot lets "only the conversation's members see and join it". It never says that View channels is needed.
OpenDMTalksays "a community needs no setup for calls in conversations".- SECURITY.md, "Who can read", and doc/architecture.md describe conversations as membership-based.
The server is also inconsistent with itself. StartDMTalk answers 201, rings the other members and posts an invitation card to a Talk that neither member can open. A design that required View channels would refuse the start. No test asserted the old behaviour as intended.
Is it reachable? Yes, through an ordinary setup: @everyone without View channels and channels opened by role. That is a common verification or onboarding gate. There is no attacker, and any member without such a role is affected.
Duplicate? No. Lanes 6 and 7 hold no other finding on how call Talks resolve.
Security or functional? Functional. The outcome fails closed: members lose access, and nobody gains any.
Severity. S3 under the brief: "wrong behaviour a user or operator can see". S4 does not fit: it needs no special rights, and the setup is common, not unusual.
Verdict: STANDS (S3).
2. What the fix changes (internal/perm/snapshot_channels.go)
In channelPerms, for a Talk in dmTalks, after the Owner shortcut (All) and the Administrator shortcut (base), the result is now base | ViewChannel. During the new-member speak wait, Connect, Speak and Video are removed (dmCallMask). Overwrites and the "no View channels clears ChannelScoped" step no longer apply to call Talks. The membership gate and the dmTalkMask in Channel, which removes Manage messages and Mention @all for everyone but the Owner, are unchanged. Timeouts and pending rules still apply, because globalUnheld already calls silence.
3. Does anything widen for someone outside the conversation?
No. channelPerms has exactly one caller: Snapshot.Channel, at internal/perm/snapshot_channels.go:83 (grep over internal/perm, non-test). Channel returns before that call in two cases:
- the channel is a conversation:
dmPerms, membership only; - the channel is a call Talk and the subject is not in
dms[dm]: it returns 0, for the Owner and Administrators too.
The other snapshot functions that read overwrites do not apply to call Talks:
EveryoneCanViewexcludes them throughIsPrivate.CategoryPerms,CategoryHeldandCategoryVisibleare per category, and call Talks have no category (talks.go:121-122 insertscategory_id NULL).- The view-as preview uses a made-up member who is never in a conversation.
Checked at run time:
- The fix's guard test shows 404 and an empty snapshot for a member with View channels, a moderator (Manage channels, Disconnect members, Manage messages, Manage Stages), an Administrator and the Owner.
TestNoCommunityRightOpensTheCallOfAConversationadds allow-all overwrites for outsiders.- My own reader spot-check (section 6): outsiders get no fan-out, no search hit, no mention, no read state and 404.
4. Does anything widen for a member beyond what the documents grant?
Members who hold View channels server-wide: nothing changes. At the base their result was base, then overwrites, then silence. No overwrite can exist on a call Talk:
SetOverwritesrefuses every temporary Talk (refuseTempTalk, internal/perm/store_overwrites_temp.go).- A call Talk has no lobby to copy rules from and no category.
So the base also returned base minus the speak-wait mask.
Members without View channels server-wide now hold, in their own call:
- View channels;
- the channel-scoped bits of their server-wide set: Send messages, Attach files, Add reactions, Connect, Speak, Video, Disconnect members and Manage Stages (Manage messages and Mention @all stay masked).
Non-channel bits such as Manage channels or Manage roles were never cleared by the View rule, so they are unchanged.
Each channel-scoped bit against what it opens on a call Talk. I grepped every per-channel check outside internal/perm: RequireChannel, Channel(...).Has, CheckChannel. The bits checked per channel are View, Send, Attach, React, Manage messages, Mention @all, Connect, Speak, Video, Disconnect members, Manage Stages (ws/stage.go) and Manage events (event location, which checks View only).
- Send, Attach, React, Connect, Speak, Video: what doc/talks.md now grants ("what they hold server-wide").
- Disconnect members: granted on purpose and documented in talks.md and moderation.md. A removal from a call Talk is not audited (H-L6-03).
- Manage Stages: does nothing. Every Stage action requires
snap.IsStage(ch)(ws/stage.go:173), and a call Talk is never a Stage. It is still not in the documented list. NOTE 1: mask it withdmTalkMaskfor tidiness, or name it. - Manage messages, Mention @all: masked, unchanged.
There is no Move-members bit and no priority-speaker bit in internal/perm/perm.go, so nothing else exists to mask.
5. Members who lack rights, and the Owner or an Administrator inside the conversation
Scratch integration test, @everyone without View channels and without Connect:
POST /api/dms/{id}/talkby a member without server-wide Connect answers 403 ("you may not join Talks in this community"). That member cannot start a call. This matches talks.md.- With Connect from a role, the starter gets 201. The other member, without Connect, holds View, Send, Attach and React in the call, reads its chat (200), and cannot join: voice_join does not answer the ring. This matches the documents: what they may do is "what they hold server-wide".
- A timed-out member holds only View (plus non-scoped bits) in the call, and posting answers 403.
- Pending rules:
silencecovers them in the same way as a timeout. Checked by code and by the reference model's "rules pending" feature (200,000 communities), not by an HTTP test. - A banned member of the conversation: a ban ends their sessions, so no request reaches the snapshot. Not tested.
StartDMTalk agrees with the resolution: both require server-wide Connect and respect the speak wait.
Owner and Administrators inside the conversation. Talks.md says "the Owner and Administrators included (like the conversation itself)". That means they get in only as members, which the code does.
- An Administrator member gets
AllminusdmTalkMask. That is unchanged and consistent with "nobody but the Owner moderates its chat". - An Owner member gets
All, including Manage messages in the call chat. That is unchanged by this fix. The conversation itself gives the Owner no moderation (dmPerms), and only the code comment ondmTalkMasksays the Owner keeps it. NOTE 2: talks.md could say so, or the Owner could be masked like everyone else; the owner should decide. - The Owner, as a member, learns nothing beyond being in the call, so this does not conflict with "who called whom".
6. Readers spot-checked (scratch integration test, @everyone without View channels, a call between alice and bobby, alice posting "zebraneedle @bobby @viewer" in its chat)
| Reader | bobby (member) | viewer (View channels) | Owner (not a member) |
|---|---|---|---|
| WebSocket message_create | received | not received | not received |
| GET /api/search?q= | hit | no hit | no hit |
| GET /api/search?dm=true&channel_id=call | 200, no hit | 404 | 404 |
| GET /api/mentions | hit | no hit | no hit |
| GET /api/read-state names the call | yes | no | no |
| GET /api/permissions, the call | View, Send, Attach, React, Connect, Speak, Video | 0 | 0 |
| voice join (fix's guard test) | answers the ring | (not in the conversation) | (not in the conversation) |
With snapshot_channels.go reverted to 6a481c744, the same test gives 404 and nothing for bobby on every row. That shows these readers follow Snapshot.Channel as the author says. I did not check web push recipients separately: they need a push subscription. The WebSocket fan-out and the mentions inbox stood in for "who is notified".
NOTE 3 (not caused by the fix): the call's chat shows up in the member's mentions inbox and in plain search. doc/architecture.md says conversations are "not in the mentions inbox ... not searchable except by their members (dm=true)". Whether a call's chat counts as "the conversation" for that sentence is not written down. Members with View channels saw the same at the base. It reaches members only.
7. The reference model, an independent rule, and the harness
The model's new call() is the code's structure, written again: unheld | View, then the speak-wait mask, then the chat mask. It is not independent. compareCalls checks only the six Talk bits against the model's unheld.
My own rule, written from doc/talks.md, doc/moderation.md (new-member waits, "joining or starting the call of a conversation ... follows the speak wait") and doc/roles-and-permissions.md only:
- Not a member: 0, for the Owner and Administrators too.
- The Owner as a member: everything.
- Any other member:
- View channels;
- plus Send, Attach, React, Connect, Speak, Video and Disconnect members, taken from the server-wide set (@everyone unless a bot, plus roles; Administrator means all);
- minus the timeout/rules mask;
- minus Connect, Speak and Video during the speak wait;
- never Manage messages or Mention @all.
The server-wide set is computed straight from State, not through the model's helpers. Only NewMemberWaits comes from the snapshot.
- Compared with
Snapshot.Channelon the channel-scoped bits for 20,000 generated communities: 49,619 questions, 19,687 of them for members. No disagreement except Manage Stages, held 11,483 times, which does nothing (NOTE 1). - With the fix reverted, my rule fails at seed 4, the same seed as the author's model.
Random-community harness (visibility_random_dm_integration_test.go): before, a call whose starter could not see it was skipped silently. Now it is t.Fatalf. That is stricter. With the fix reverted it fails ("the mirror says the starter of call ... cannot see it", two calls in the smoke run). With the fix it passes.
PERM_SWEEP=1: 200,000 communities, 11,139,939 questions, no disagreement, 12.8 s. The new features occurred:
| Feature | Communities |
|---|---|
| call member without View channels | 37,373 |
| call outsider with Administrator or Owner | 25,417 |
| call with an overwrite | 3,152 |
8. New candidate finding (predates the fix, outside its scope)
A conversation member who holds Manage events can create a community event located in the conversation's call Talk:
validateEventTalk(internal/communityevents/handler_validate.go:50-63) checks onlytype = 'voice'and View channels.- The audit entry
event.talk_createcarries the call Talk's id and the event title as ChannelID and details. - The Owner and Administrators who are not in the conversation read it, because privileged readers skip the class filter.
I checked this at run time with the default @everyone, so the fix is not the cause: "event in the call Talk: 201"; the Owner and an Administrator each read the call Talk's id and the title in the audit log.
This contradicts doc/talks.md: "Nothing about it reaches the audit log ... because that would tell the Owner who called whom". The fix only widens who can trigger it, to members without View channels who hold Manage events.
Suggested fix: refuse a call Talk as an event location (talks.IsDMTalk) or skip the audit for it. Suggested severity S3 or S4 (it needs Manage events). Proposed for the ledger as a new lane 6 finding; I have not written a finding file.
9. Revert checks
With snapshot_channels.go back at 6a481c744:
- perm unit tests:
TestSnapshotAgreesWithTheReferenceModelfails (seed 4, 15 disagreements).TestMembershipAloneOpensTheCallOfAConversationfails (alice, bob behind a member deny overwrite, and the timed-out member hold nothing).TestNoCommunityRightOpensTheCallOfAConversationandTestAModeratorInTheConversationMayRemoveFromItsCallpass, as expected: they guard against widening.
- server integration tests:
TestACallOfAConversationNeedsNoViewChannelsAndNoCommunityRightOpensItfails ("the starter writes in the call's chat: got 404").TestRandomCommunitiesShowEachMemberWhatTheSnapshotAllowsfails.
- My doc-rule test fails as well.
I restored the fix afterwards.
10. Documentation
- doc/talks.md and doc/upgrade.md match the code.
- doc/roles-and-permissions.md's Talks row now says the call Talk is "for the conversation's members only (not the Owner, not Administrators)". That means "not the Owner or Administrators as such", which agrees with talks.md's "the Owner and Administrators included". NOTE 4: the two read as opposites at first glance; "(the Owner and Administrators only as members)" would be clearer.
- talks.md lists Disconnect members among what a member holds. Manage Stages is missing (NOTE 1).
- talks.md says "Its chat follows the conversation's writing rule". That covers the call chat not following the write and react waits, which predates the fix and is unchanged.
11. Gates and full suite
All at 93dae338e:
- Full suite, run once:
go test -p 1 -tags=integration -count=1 ./internal/server/ ./internal/perm/. Both ok (internal/server 246 s). - Gates by exit code, all 0:
- gofmt: clean.
- go vet, with and without
-tags=integration, on internal/perm and internal/server. make complexity-check.go test ./internal/repo/ ./internal/perm/.node scripts/check-english-only.mjs.make openapi-check.
- File sizes: snapshot_channels.go is 283 lines and the tests are below 800.
- Commit type is
fix, with no!and no attribution line. - No allowlist entry was added, no limit was raised and no test was skipped. The harness changed from a skip to a failure, which is stricter.
What I did not check
- Web push recipients directly. The web client in a browser.
- The desktop client.
- A banned member at run time.
- Pending rules over HTTP; covered by the model sweep only.