Data UI Backlog

Row-role holder check on update

The otherwise branch of update-roles (lisp/backend.lisp) — row resource roles on non-:users types — still lets a row editor attach any existing role to the row's resource, held or not. be-update validates keyword :roles through (valid-user-roles user (remove-existing-non-user-roles user roles)), the same loosening the :users escalation rode (roles the actor does not hold drop out of the checked list), and no gate re-tightens adds on this branch. Unprobed live — the :users twin was probed (pactor=/=ptarget, the admin-cannot-assign-admin plan); this one is read from source. The UI path is already narrower: the row-roles palette (selectable-roles) offers a non-admin only its own roles, public, the type's :type-roles, and other users' shareable exclusives — the hole is the hand-crafted POST /api/update, same shape as the :users case. Severity is contained: an attached role widens access to that row's resource; it grants the actor nothing.

The fix mirrors the :users arm: a holder check on adds — (valid-user-roles user to-add) after the set-difference against the resource's existing roles — with removals staying free (the D12 strip doctrine). One decision the :users arm did not need: the palette deliberately offers the type's :type-roles to non-holders, so the plan must settle bare valid-user-roles (which would newly refuse :type-roles adds the checkbox offers — a UI behavior change) versus a row-role variant that also exempts the type's :type-roles (shareable exclusives are already exempt inside valid-user-roles). Pin the force-added pair while at it: the branch appends admin and the actor's exclusive (add-to-list roles "admin" exclusive-role) — admin is always already on the resource so it is never an add, and the actor holds their own exclusive; tests should say neither trips the check.

Surfaced by the admin-cannot-assign-admin review (its plan's out-of-scope list named this branch); the honest-gap clause on the "Propagate a grant" recipe in docs/roles.md tracks it until this lands.

Slot
7192
Status
60 Done
Tags
mvp, backend, bug, sec, concurrency
Contributors
Donnie, Kimi-hs, Rose
Plans
Plan: Row-role holder check on update