Create User adds null user role

Hi,

I have created a custom user role to access APIs, and marked this role along with ‘system minimal’ as Defaults. While creating a new user, I expect these two roles added to the user as they are defaults (two entry in table sec_user_role. In total three records in this table). However, I found there is an additional role added with null value (in sec_user_role). This is frustrating as it is not required at all.

Also, I noticed that RolesService.getDefaultRoles() is returning three objects, one with a ‘null’ roleName.

Is this a known bug or am I missing something here? Any help is appreciated.

Please note that we have role definition with the same name as role, and it is somehow picking up both of them instead of just one.