OIDC sign-in resets manually assigned roles to the default role #646
Labels
No labels
bug
duplicate
enhancement
help wanted
high priority
invalid
L
low priority
M
medium priority
needs refinement
optional
question
S
security
technical improvement
UX Improvement
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
local-it/mitgliederverwaltung#646
Loading…
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?
Problem
With
OIDC_ADMIN_GROUP_NAMEset, every OIDC sign-in overwrites the user's role. Users in the admin group get Admin; everyone else gets the default role ("Mitglied"), including users an admin deliberately gave another role (e.g. a board role based onnormal_user). Those users lose their permissions on their next sign-in, for example to review join requests.Reported by a club using Authentik with
OIDC_ADMIN_GROUP_NAME="admin",OIDC_GROUPS_CLAIM=groups,OIDC_ONLY="true".Cause
Mv.OidcRoleSync.apply_admin_role_from_user_info/3runs after every OIDC registration and sign-in (after_actionhook inMv.Accounts.User) and does:It only knows two roles and does not look at the current one. Existing tests pin the Admin ↔ Mitglied cases (
test/mv/oidc_role_sync_test.exs), but no test covers a user holding any other role.Related risks found in the same code
groupsis[], so every Admin is downgraded on sign-in.do_set_role/2maps{:error, _}to:ok. A refused change (e.g. the last-admin guardEnsureAdminRemains) leaves no trace in the log.Intended behavior (decision needed)
vorstand→ board role); users in no mapped group keep their role.A fixes the reported case with the smallest change; C is a feature in its own right and can follow later.
Acceptance criteria
Workaround until fixed
Unset
OIDC_ADMIN_GROUP_NAME(and the "Admin group name" setting, if set) and redeploy: the sync becomes a no-op and roles assigned in Mila persist. Admin rights are then no longer granted via the identity-provider group. Users whose role was reset need it reassigned once.