realm roles are assigned automatically as service account roles to a client in master realm for each newly created realm by this client · keycloak keycloak · Discussion #40722 · GitHub
You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
realm roles are assigned automatically as service account roles to a client in master realm for each newly created realm by this client
#40722
I provision keycloak with terraform, and have a separate client with the service role "create-realm".
With it, I create additional realms, which works, but keycloak is automatically assigning this client all default realm roles for the new created realm. The management of each realm is done with separate clients, with corresponding roles. This behaviour of automatically adding service roles to the service account during realm creation leads to several problems, first of all, automatically adding this roles for this new created realm is not not the wished behaviour, it gives the client access rights, which should not there. It is a separation of concerns problem. Secondly, the number of roles increase with the number of realms created, which can be so big, that the authorisation token gets so big, that for example an AWS Loadbalancer declines the request, because there is a hard limit on ELB for HEADER information which is 16kb.
Question is, can I disable this behaviour, secondly this is a security issue. I manage keycloak with terraform, that keycloak is adding these roles, and changes security behaviour is a no go.
Of course I can create a cleanup script in terraform, but why, this is a bad workaround. I already searched in documentation, and tried to analyse the source code, but could not find the place where it is executed.
Example of automatically assigned roles
new created realm is "exampleRealm"
automatically added roles are
"exampleRealm-realm"
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
I provision keycloak with terraform, and have a separate client with the service role "create-realm".
With it, I create additional realms, which works, but keycloak is automatically assigning this client all default realm roles for the new created realm. The management of each realm is done with separate clients, with corresponding roles. This behaviour of automatically adding service roles to the service account during realm creation leads to several problems, first of all, automatically adding this roles for this new created realm is not not the wished behaviour, it gives the client access rights, which should not there. It is a separation of concerns problem. Secondly, the number of roles increase with the number of realms created, which can be so big, that the authorisation token gets so big, that for example an AWS Loadbalancer declines the request, because there is a hard limit on ELB for HEADER information which is 16kb.
Question is, can I disable this behaviour, secondly this is a security issue. I manage keycloak with terraform, that keycloak is adding these roles, and changes security behaviour is a no go.
Of course I can create a cleanup script in terraform, but why, this is a bad workaround. I already searched in documentation, and tried to analyse the source code, but could not find the place where it is executed.
Example of automatically assigned roles
new created realm is "exampleRealm"
automatically added roles are
"exampleRealm-realm"
Greetings Andreas
All reactions