[FEATURE]: Permission system hardening: Role policies and member user-link restriction #406
Labels
No labels
bug
duplicate
enhancement
help wanted
high priority
invalid
L
low priority
M
medium priority
needs refinement
optional
question
S
UX research
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: local-it/mitgliederverwaltung#406
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Description
Implement two security improvements identified in the permission system analysis:
Role resource: add defense-in-depth
The Role resource currently has no
authorizersand nopoliciesblock. Page access to/admin/rolesis protected byCheckPagePermission, but resource-level authorization is missing. Add Ash policies so that only users with the admin permission set can read, create, update, or destroy roles. This ensures authorization is enforced at both page and resource layers.Member create/update: restrict user link to admins
Today, any user with
Membercreate permission (includingnormal_user/ Kassenwart) can pass the:userargument when creating or updating a member and thus link any member to any user. The intended rule is: only admins may set or change the user–member link. Enforce this with a policy-based approach: keep a single create (and update) action, and add a forbid policy that applies when the:userargument is present and the actor is not an admin. No new actions are required; only the policy layer is extended.Acceptance criteria
Role resource
authorizers: [Ash.Policy.Authorizer]to the Role resource.policies do ... endblock that authorizes read, create, update, and destroy viaMv.Authorization.Checks.HasPermission(admin is the only permission set with Role permissions in PermissionSets).authorize?: falsewhere they already do; no change to Role’s public API (code interface).Member user link (create & update)
Mv.Authorization.Checks.ForbidMemberUserLinkUnlessAdmin) that returns “forbid” when the action has the:userargument (or equivalent relationship input) set and the actor is not an admin (useMv.Authorization.Actor.admin?/1orMv.Authorization.Checks.ActorIsAdmin).:user: addforbid_if ForbidMemberUserLinkUnlessAdmin(or equivalent) beforeauthorize_if HasPermission, so that normal_user and read_only cannot pass:userwhen creating a member.:user: apply the same forbid check when the:userargument (or relationship) is being changed, so only admins can set or change the user link on update.docs/roles-and-permissions-architecture.md(e.g. “Only admins may set or change the user–member link on create or update”).:user; normal_user cannot create/update member with:userset; admin can create/update member with or without:user.General
:user.