Repository navigation
Closed
Labels
automatedOpened by an automationbugBugpriority: mediumMedium prioritysecurityservice: platformPlatform service
Description
Area / route
Org settings → Members table. /dashboard/{org}/settings/organization. Frontend: services/platform/app/features/settings/organization/components/member-table.tsx. Backend: services/platform/convex/members/mutations.ts (removeMember).
Steps to reproduce
- Sign in as an org admin (not the owner) and open
/dashboard/{org}/settings/organization. - In the Members table, tick the row-select checkbox on your OWN row (and/or the owner row) plus other rows.
- Use the
BulkDeleteBarfooter to remove the selection.
Expected
Consistent with the single-row action menu, which hides Delete for self and owner (member-row-actions.tsx:73, visible: canManageMembers && !isViewingSelf && !isOwner):
- The current-user row and the owner row should NOT be selectable for bulk-delete (per-row
enableRowSelectionpredicate). removeMembershould reject self-removal at the backend (defense in depth), regardless of how the request is issued.
Actual
- Bulk-select is rendered for every row with no gating.
createSelectColumn<Member>()(member-table.tsx:94) has nogetCanSelect/disabled predicate (seecolumn-builders.tsx:316-354), and the table passes a bare booleanenableRowSelection(member-table.tsx:189). So the current-user row and the owner row are both selectable. removeMember(members/mutations.ts:132-237) guards: unauthenticated (138), member-not-found (150), caller-is-admin (168), target-is-owner (172), legal-hold (192-201). It never comparesauthUser.userId === member.userId, so an admin can delete their OWN membership. The companion test file has no self-removal case, confirming the guard is absent.- Removing one's own row drops the RLS mirror (
mutations.ts:211) and runscascadeOnMemberRemoved(mutations.ts:214), which hard-deletes that user'suserMemories+userPreferences+ org-scoped TTS chunks (personalization_cascade.ts:58-65) — a self-lockout plus irreversible self-data erasure, with no confirmation tuned to self-removal. - The owner row is backend-protected (
mutations.ts:172-174throws "The organization owner cannot be removed"), so an owner included in a bulk batch partial-fails: the row stays and an error toast surfaces (the code comment atmember-table.tsx:91-93acknowledges this). That part is a UX/affordance defect, not a security hole.
Evidence (file:line)
services/platform/app/features/settings/organization/components/member-table.tsx:94—createSelectColumn<Member>()with no predicateservices/platform/app/features/settings/organization/components/member-table.tsx:189— bareenableRowSelectionbooleanservices/platform/app/components/ui/data-table/column-builders.tsx:316-354—createSelectColumnrenders a checkbox on every row, nogetCanSelectservices/platform/app/features/settings/organization/components/member-row-actions.tsx:46,48,73— single-row Delete gated!isViewingSelf && !isOwnerservices/platform/convex/members/mutations.ts:132-237—removeMember; noauthUser.userId === member.userIdcheckservices/platform/convex/lib/cascades/personalization_cascade.ts:58-65—cascadeOnMemberRemovedhard-deletes the user's memories/preferences/TTS for the orgservices/platform/convex/members/mutations.test.ts:107-230— no self-removal test case
Notes
- The fix pattern already exists in-repo:
agents-table.tsx:298passesenableRowSelection={(row) => ...}as a per-row predicate, andDataTablealready typesenableRowSelection?: boolean | ((row) => boolean)(data-table.tsx:186). Gate selection onrow.original._id !== memberContext?.member?._idandrow.original.role?.toLowerCase() !== 'owner'. - Add the backend guard in
removeMember(e.g. throw ifauthUser.userId === member.userId) so the UI gate is enforced server-side, and add a regression test alongside the existing owner-guard test. - Severity is medium rather than high: the existing owner-guard means an org always retains its owner (no full org-orphaning), and self-removal is self-inflicted by an admin on their own row (not cross-user privilege escalation). The genuine harm is self-lockout, silent self-personalization erasure, and the UI/backend gating inconsistency.
Filed by an automated manual-review pass (live browser QA + a 25-agent code-grounded audit, each finding adversarially verified). Deduped against open issues (incl. #1972–#1999, settings/forms epic #1941–#1966, audit cluster #1842–#1846) and recently-closed issues.
Metadata
Metadata
Assignees
Labels
automatedOpened by an automationbugBugpriority: mediumMedium prioritysecurityservice: platformPlatform service
Activity
fix(platform): gate member bulk-select and guard self-removal (#2043) (…