Skip to content

Conversation

@rcarvalhoxavier
Copy link

Problem

When using OIDC_GROUPS_ATTRIBUTE with attributes that return a string instead of a list (e.g., Google's hd attribute for hosted domain), the code was iterating over each character of the string, creating individual group entries for each character.

For example, with OIDC_GROUPS_ATTRIBUTE=hd and domain gupy.com.br, the groups table would be populated with:

id group_name
1 c
2 o
3 m
4 p
5 a
6 n
7 y
... ...

Solution

This fix ensures user_groups is always converted to a list before being passed to populate_groups() and update_user(), preventing the character-by-character iteration issue.

Changes

  • Added type check in auth.py to convert string attributes to a single-element list

Testing

Tested with Google OIDC provider using hd (hosted domain) as the groups attribute.

When using OIDC_GROUPS_ATTRIBUTE with attributes that return a string
instead of a list (e.g., Google's 'hd' attribute for hosted domain),
the code was iterating over each character of the string, creating
individual group entries for each character.

This fix ensures user_groups is always converted to a list before
being passed to populate_groups() and update_user(), preventing
the character-by-character iteration issue.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant