Skip to content

fix(desktop): only offer owners the removal of a channel owner - #9785

Draft
shani-singh1 wants to merge 1 commit into
block:mainfrom
shani-singh1:fix/desktop-owner-removal-precedence
Draft

shani-singh1 wants to merge 1 commit into
block:mainfrom
shani-singh1:fix/desktop-owner-removal-precedence

Conversation

@shani-singh1

Copy link
Copy Markdown
Contributor

Summary

Since #9592, the relay lets only an owner remove another owner. That holds even when the owner being removed is the remover's own agent. The rule is classify_remove_other in crates/buzz-relay/src/handlers/channel_authz.rs, and the DB enforces it again under the lock ("only owners may remove another owner").

The 0.X desktop's members sidebar decides whether to show Remove with its own inline check, which wasn't updated. It showed Remove on an owner to:

  • every admin
  • a member whose own agent had become an owner

The kind:9001 was sent and then rejected. The bulk removal of managed bots (removableManagedBots) uses the same check.

Change

The sidebar's inline check moves into a small pure function, canRemoveChannelMember, in desktop/src/features/channels/lib/channelMemberRemoval.ts, next to the existing add rule. It also hides Remove on an owner from anyone who isn't an owner.

Every other case gives the same answer as before:

  • anyone may remove themselves
  • admins may remove anyone else
  • owners may remove non-owners
  • members may remove their own agents

One gap remains on purpose: the relay also lets an owner remove another owner, but the desktop already didn't offer that. Keeping it hidden is the conservative direction, so it's left alone.

Related issue

None found. I searched PRs and issues for "remove owner admin desktop", "canRemoveMember", "admin remove owner", "owner precedence desktop" and "classify_remove_other".

Heads-up: open #5774 ("let a declared owner remove their own stale agent seat") rewrites the same check into memberUtils.ts for a different defect. Its test still expects an admin to be able to remove an owner, which the relay now refuses, so the two will need reconciling.

Testing

New channelMemberRemoval.test.mjs:

  • anyone may remove themselves
  • admins and owners remove members, members only their own agents
  • only an owner removes an owner, as the relay's classify_remove_other requires

On main: the function doesn't exist there yet. So I first moved main's exact predicate into it unchanged, and the owner-precedence test failed: "an admin must not be offered removing an owner", true !== false. The other two tests passed.

With this change: all 3 pass.

pnpm typecheck, biome on the changed files, and node scripts/check-file-sizes.mjs are clean.

Manual check

  1. Against a local relay, make a second account an admin of a channel that has an owner.
  2. On the admin's desktop, open the members sidebar.
  3. The owner's card shows no Remove action. Members and guests still show Remove.
  4. Signed in as the owner, Remove is still offered on members and admins.

Since block#9592 the relay refuses a kind:9001 removal of an owner unless the
actor is an owner too (classify_remove_other), including when the owner
is the actor's own agent. The members sidebar still offered Remove on an
owner to every admin, and to a member whose own agent had become an
owner, so the removal was sent and rejected.

Move the sidebar's removal predicate into canRemoveChannelMember, next
to the add rule, and deny an owner target to anyone who is not an
owner. Every other case keeps its current answer.

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...d19f04339dc26ab8f03f3c2879fb56307b5599f3.
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 d19f04339dc26ab8f03f3c2879fb56307b5599f3 to authorize a new review.
Any previous review applies only to its recorded range.

@jedwards27

Copy link
Copy Markdown
Contributor

🤖 Thanks for all your work on these. Heads-up: the 0.X desktop app in this repo is being retired, and Buzz's desktop app now lives in block/buzz-app (setup guide), so changes to desktop/ here won't ship. That covers this PR and your others here: #9761, #9774, #9775, #9777, #9778, #9781, #9782 and #9784. If any of them still apply to the new app, could you open them against block/buzz-app instead? Contributions there are welcome. We'll close all of them on or after December 3, 2026, unless you'd rather keep one open for a reason we've missed.

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.

2 participants