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

A role holding admit but not role.assign can never admit anyone

Closed
Closed chadtmiller.com opened this issue 0 comments

What happened

admitMember requires admit, but it checks the roles it gives against members.assignable(&mine, "role.assign"). That set only draws on the caller's grants that carry role.assign. Suppose you define putRole {role: "gatekeeper", actions: ["admit"], assignable: [{role: "member"}]} and give it to bob. Bob gets past the admit check, but admitMember {did} with the default roles answers NotAssignable (["member"]), so his role is useless. This is unlike ejectMember, which scopes the check by its own action (assignable(&mine, "eject"), group_members.rs:472). The lexicon says only "Requires admit", which misleads. The tests only admit as the default admin, which holds every action, so none covers this (tests/joining.rs).

How to see it

Read against docs/fresh at 4636e6d, the code at: group_join.rs:176. Paths are under crates/group-host/src unless they say otherwise. Severity: medium.

What you expected

Use members.assignable(&mine, "admit"), so the admitting grant's own assignable list decides, as eject does.

Where

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