Skip to content

fix(desktop): stop offering guests the add-members search - #9784

Draft
shani-singh1 wants to merge 1 commit into
block:mainfrom
shani-singh1:fix/desktop-guests-cannot-add-members
Draft

shani-singh1 wants to merge 1 commit into
block:mainfrom
shani-singh1:fix/desktop-guests-cannot-add-members

Conversation

@shani-singh1

Copy link
Copy Markdown
Contributor

Summary

Since #8143 (announce channels and join_role), the relay refuses every channel add from a guest. A guest can read and leave, but not write, and adding people is a write. The rule lives in buzz_core::channel::decide_member_put:

  • may_add = role.can_post()
  • can_post is false only for Guest
  • otherwise it returns GuestCannotAdd

The relay applies it in handlers/channel_authz.rs, and the DB applies it again under the membership lock.

The 0.X desktop's copy of that rule is canAddChannelMembers in desktop/src/features/channels/lib/channelMemberAdmission.ts. It still treated anyone in an open channel, and every active member of a private channel, as able to add, guests included. Its test, from #5493 (before #8143), even asserted that a guest can add.

So a guest saw the "Add people and agents" search in the members sidebar, and the composer offered to invite mentioned people. Every add they chose was rejected with "only members can add people in this channel".

Change

  • canAddChannelMembers returns false for a guest, alongside the existing DM check. Its doc comment now points at decide_member_put.
  • The denial notice now reads "Only channel members who can post can add people to a private channel". Without that, a guest, who is a member, would see copy that says only members can add.

Not included: an open channel whose join_role is guest also refuses adds from non-members. The desktop doesn't read join_role today, so that case is unchanged.

Related issue

None found. I searched PRs and issues for "guest add members desktop", "canAddChannelMembers", "guest cannot add", "channelMemberAdmission" and "guests add people", and checked open PRs touching these files. None changes who may add people.

Testing

New test: guests never add anyone, as the relay's decide_member_put refuses.

  • On main: it fails with "a guest … must not be offered adds", true !== false.
  • With this change: it passes.

The existing private-channel test no longer expects guests to add. Results:

  • the file's tests: 5/5 pass
  • ForumComposer.lifecycle.test.mjs, which uses the notice text: passes
  • pnpm typecheck, biome on the changed files, and node scripts/check-file-sizes.mjs: clean

Manual check

  1. Against a local relay, have an owner make a second account a guest in a private channel.
  2. On the guest's desktop, open the channel's members sidebar.
  3. The search reads "Search people and agents", and no "Not in this channel" results are offered. The notice explains why.
  4. A member of the same channel still gets "Add people and agents" and can add someone.

The relay's kind:9000 rule (buzz_core::channel::decide_member_put)
refuses every add from a guest since announce channels (block#8143): a guest
can read and leave but not write, and adding people is a write. The
desktop's mirror of that rule, canAddChannelMembers, still allowed any
active member of a private channel and anyone in an open channel, so a
guest was offered the add-members search and every add they picked was
rejected by the relay.

canAddChannelMembers now returns false for a guest, as the relay does.
The denial notice says the add needs a member who can post, which also
reads correctly for a guest.

Signed-off-by: Shani Singh <teamdeveloperworld@gmail.com>
@github-actions

Copy link
Copy Markdown

🔐 Codex Security Review

Status: review required for the current range.

The current range is ee4a6ed6b6e58955859a2018855188f6500beeb0...b9176f9b0189d225cfadb1cca003cff649623f2d.
A new review must complete for this exact range. When manual authorization
is required, a user with write access must comment exactly
@buzz-security-review b9176f9b0189d225cfadb1cca003cff649623f2d to authorize a new review.
Any previous review applies only to its recorded range.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant