~ knotless Search/
↑↓ move↵ open⇧↵ all results
0
0

Joining can give a member no `member` role, or no roles at all

Closed
Closed chadtmiller.com opened this issue 0 comments

What happened

assign_roles's doc says "Everyone in a group holds member", but joining doesn't enforce it: - default_roles returns only the roles marked default. After putRole member {default: false} and putRole rider {default: true}, anyone who then joins (open policy, invite, or admitMember without roles) holds only rider. - admitMember {roles: [{role: "moderator"}]} gives exactly [moderator]. Either way the newcomer can't read the members space, whose access is readableBy: [member], so they can't see their group's roster. The MemberRole guard (group_members.rs:397) only fires when member is already held. So assignRoles {roles: []} on such a member is accepted and writes a membership with no roles. The group's methods then treat them as a member (Members::membership is Some([])), while the space authority treats them as nobody (can_write_own/can_read need roles, rbac.rs:73,85,88). That is a split state. No test covers either path. an_open_group_admits_at_once marks both member and rider as defaults.

How to see it

Read against docs/fresh at 4636e6d, the code at: group_members.rs:96-108; group_join.rs:169-172; group_members.rs:397. Paths are under crates/group-host/src unless they say otherwise. Severity: medium.

What you expected

Have put_membership (or both join paths and assignRoles) always add member, and refuse an empty set in assignRoles.

Where

The host, as built from 4636e6d. Found while checking the docs against the code.