[policy][keystone][horizon] scope mismatch between horizon and keystone
While digging into the unit tests failures recently surfacing after enforce_scope option was removed from oslo.policy[1], I discovered mismatch between current keystone policy rules and the expectation from horizon. I may need some input from both sides to fix this. [1] bugs.launchpad.net/bugs/2161292 Horizon uses domain-scoped token for most of the keystone API calls, when the following two options[2] are both true. [2] https://opendev.org/openstack/horizon/src/commit/f76caf9d083cee8bd76f69e805b... --- # Set this to True if running on a multi-domain model. When this is enabled, it # will require the user to enter the Domain name in addition to the username # for login. OPENSTACK_KEYSTONE_MULTIDOMAIN_SUPPORT = False # When multidomain support is enabled and user has any roles in a domain, # Horizon will mostly attempt to use domain scope for calls to Keystone. # This behavior does not work properly with some policy combinations, # and can be disabled here. OPENSTACK_KEYSTONE_PREFER_DOMAIN_TOKEN = True --- When this behavior is enabled, horizon uses domain-scoped context to evaluate policy rules, which is consistent with its API call behaviors. However, on the other hand, keystone permits access to some of the system-wide resources only for project scope and system scope. Identity provider is one example of such resources. The described inconsistency between the expected token scope is the problem and this is the core reason why unit tests started failing. This inconsistency means that, when multi domain support is enabled, horizon attempts to use domain scope token to most of keystone api calls, but some of them are actually rejected by keystone due to scope enforcement within keystone. Current horizon doesn't implement fallback between two different scopes, so unless multi domain support is disabled or domain role is removed, the user can't manipulate these resources any more. There are a few options I could think of now. 1. Allow all keystone resources to be manipulated by domain scope 2. Get rid of that "OPENSTACK_KEYSTONE_PREFER_DOMAIN_TOKEN" feature completely given that fact that domain scope is not really intended to be used to manage system-wide resources in keystone and project-scope should be used instead. 3. Make horizon use appropriate scope according to the target resources. 4. Implement scope fallback mechanism within horizon. I'm sending this email maikly to hear from the keystone folks if option 1 is something acceptable. I don't fully understand the context behind allowing access of these resources to only project scope and system scope. If the current scope may not be changed, we'd select 2 or 3, but I find 3 and 4 quite tricky, and if keystone expects only project scope or system scope for system-wide resources then 2 might be the only feasible solution, I guess. Thank you, Takashi -- Takashi Kajinami irc: tkajinam github: https://github.com/kajinamit launchpad: https://launchpad.net/~kajinamit
Just a minor (but important) correct.
When this behavior is enabled, horizon uses domain-scoped context to evaluate policy rules, which is consistent with its API call behaviors.
This isn't what horizon has done in existing releases but the recent fix attempted to implement.However this does not fully resolve the issue and we still have to disable scope check due to keystone not allowing all operations for domain admin. On 7/23/26 7:36 PM, Takashi Kajinami wrote:
While digging into the unit tests failures recently surfacing after enforce_scope option was removed from oslo.policy[1], I discovered mismatch between current keystone policy rules and the expectation from horizon. I may need some input from both sides to fix this.
[1] bugs.launchpad.net/bugs/2161292
Horizon uses domain-scoped token for most of the keystone API calls, when the following two options[2] are both true.
[2] https://opendev.org/openstack/horizon/src/commit/f76caf9d083cee8bd76f69e805b... --- # Set this to True if running on a multi-domain model. When this is enabled, it # will require the user to enter the Domain name in addition to the username # for login. OPENSTACK_KEYSTONE_MULTIDOMAIN_SUPPORT = False # When multidomain support is enabled and user has any roles in a domain, # Horizon will mostly attempt to use domain scope for calls to Keystone. # This behavior does not work properly with some policy combinations, # and can be disabled here. OPENSTACK_KEYSTONE_PREFER_DOMAIN_TOKEN = True ---
When this behavior is enabled, horizon uses domain-scoped context to evaluate policy rules, which is consistent with its API call behaviors.
However, on the other hand, keystone permits access to some of the system-wide resources only for project scope and system scope. Identity provider is one example of such resources.
The described inconsistency between the expected token scope is the problem and this is the core reason why unit tests started failing. This inconsistency means that, when multi domain support is enabled, horizon attempts to use domain scope token to most of keystone api calls, but some of them are actually rejected by keystone due to scope enforcement within keystone. Current horizon doesn't implement fallback between two different scopes, so unless multi domain support is disabled or domain role is removed, the user can't manipulate these resources any more.
There are a few options I could think of now.
1. Allow all keystone resources to be manipulated by domain scope
2. Get rid of that "OPENSTACK_KEYSTONE_PREFER_DOMAIN_TOKEN" feature completely given that fact that domain scope is not really intended to be used to manage system-wide resources in keystone and project-scope should be used instead.
3. Make horizon use appropriate scope according to the target resources.
4. Implement scope fallback mechanism within horizon.
I'm sending this email maikly to hear from the keystone folks if option 1 is something acceptable. I don't fully understand the context behind allowing access of these resources to only project scope and system scope.
If the current scope may not be changed, we'd select 2 or 3, but I find 3 and 4 quite tricky, and if keystone expects only project scope or system scope for system-wide resources then 2 might be the only feasible solution, I guess.
Thank you, Takashi
Personally I feel like the multi-domain support in Horizon was never really well defined and thought out, and that it could be beneficial to take a step back and decide how it should all work first, before deciding about implementation strategies. So far it has been all pretty much improvised, and I'm afraid there might be gaps between how the multi-domain feature was implemented on the side of the services, and how it was subsequently understood and implemented later in the user interface. I think we could greatly benefit from some concrete user stories here. This might also lead to removing the feature completely, if it turns out that our users don't actually need it for anything. Having said that, I also have an opinion about the proposed implementation strategies. In particular I think that it's a little wasteful to first implement a flexible and general role-based access control system, and then hard-wire in our code expectations about how the rules must look like for the thing to work consistently. There is a chance then that we will end up with a set of rules that are theoretically flexible and universal, but that in practice can never be modified, because that would break the assumptions made about them elsewhere. As such, it seems that going with option number three, making Horizon use the correct scope based on the rules themselves, possibly with some help from the supporting libraries like oslo.policy, which could add some easier ways for figuring out which scopes are expected for the particular combination of policy, user, and resource, would be the preferred, long-term solution. Other solutions might prove practical in the short term, though – the fallback mechanism, for example, while wasteful and inelegant, would be much easier to implement in the short term, not requiring modifications in the supporting libraries. In any case, before we start changing things, we should have a clear picture of what we want to achieve first. On Fri, Jul 24, 2026 at 4:49 PM Takashi Kajinami <kajinamit@oss.nttdata.com> wrote:
Just a minor (but important) correct.
When this behavior is enabled, horizon uses domain-scoped context to evaluate policy rules, which is consistent with its API call behaviors.
This isn't what horizon has done in existing releases but the recent fix attempted to implement.However this does not fully resolve the issue and we still have to disable scope check due to keystone not allowing all operations for domain admin.
On 7/23/26 7:36 PM, Takashi Kajinami wrote:
While digging into the unit tests failures recently surfacing after enforce_scope option was removed from oslo.policy[1], I discovered mismatch between current keystone policy rules and the expectation from horizon. I may need some input from both sides to fix this.
[1] bugs.launchpad.net/bugs/2161292
Horizon uses domain-scoped token for most of the keystone API calls, when the following two options[2] are both true.
[2] https://opendev.org/openstack/horizon/src/commit/f76caf9d083cee8bd76f69e805b... --- # Set this to True if running on a multi-domain model. When this is enabled, it # will require the user to enter the Domain name in addition to the username # for login. OPENSTACK_KEYSTONE_MULTIDOMAIN_SUPPORT = False # When multidomain support is enabled and user has any roles in a domain, # Horizon will mostly attempt to use domain scope for calls to Keystone. # This behavior does not work properly with some policy combinations, # and can be disabled here. OPENSTACK_KEYSTONE_PREFER_DOMAIN_TOKEN = True ---
When this behavior is enabled, horizon uses domain-scoped context to evaluate policy rules, which is consistent with its API call behaviors.
However, on the other hand, keystone permits access to some of the system-wide resources only for project scope and system scope. Identity provider is one example of such resources.
The described inconsistency between the expected token scope is the problem and this is the core reason why unit tests started failing. This inconsistency means that, when multi domain support is enabled, horizon attempts to use domain scope token to most of keystone api calls, but some of them are actually rejected by keystone due to scope enforcement within keystone. Current horizon doesn't implement fallback between two different scopes, so unless multi domain support is disabled or domain role is removed, the user can't manipulate these resources any more.
There are a few options I could think of now.
1. Allow all keystone resources to be manipulated by domain scope
2. Get rid of that "OPENSTACK_KEYSTONE_PREFER_DOMAIN_TOKEN" feature completely given that fact that domain scope is not really intended to be used to manage system-wide resources in keystone and project-scope should be used instead.
3. Make horizon use appropriate scope according to the target resources.
4. Implement scope fallback mechanism within horizon.
I'm sending this email maikly to hear from the keystone folks if option 1 is something acceptable. I don't fully understand the context behind allowing access of these resources to only project scope and system scope.
If the current scope may not be changed, we'd select 2 or 3, but I find 3 and 4 quite tricky, and if keystone expects only project scope or system scope for system-wide resources then 2 might be the only feasible solution, I guess.
Thank you, Takashi
-- Radomir Dopieralski
Although we haven't had further discussions related this topic, I've proposed a change in horizon to implement option 2. https://review.opendev.org/c/openstack/horizon/+/999879 Although option 3 may be appropriate, because all services keep project-admin as a whole system admin even after implementing SRBAC, and project scope is the "appropriate" scope for the almost all of the APIs. Considering the current direction using only project scope in horizon would be the best approach we can take now. We may change it when scope separation is re-designed and re-implemented, following the initial separation concept (though idk who will take that initiative really after we failed to implement it earlier). On 7/27/26 11:11 PM, Radomir Dopieralski wrote:
Personally I feel like the multi-domain support in Horizon was never really well defined and thought out, and that it could be beneficial to take a step back and decide how it should all work first, before deciding about implementation strategies. So far it has been all pretty much improvised, and I'm afraid there might be gaps between how the multi-domain feature was implemented on the side of the services, and how it was subsequently understood and implemented later in the user interface. I think we could greatly benefit from some concrete user stories here. This might also lead to removing the feature completely, if it turns out that our users don't actually need it for anything.
Having said that, I also have an opinion about the proposed implementation strategies. In particular I think that it's a little wasteful to first implement a flexible and general role-based access control system, and then hard-wire in our code expectations about how the rules must look like for the thing to work consistently. There is a chance then that we will end up with a set of rules that are theoretically flexible and universal, but that in practice can never be modified, because that would break the assumptions made about them elsewhere. As such, it seems that going with option number three, making Horizon use the correct scope based on the rules themselves, possibly with some help from the supporting libraries like oslo.policy, which could add some easier ways for figuring out which scopes are expected for the particular combination of policy, user, and resource, would be the preferred, long-term solution. Other solutions might prove practical in the short term, though – the fallback mechanism, for example, while wasteful and inelegant, would be much easier to implement in the short term, not requiring modifications in the supporting libraries.
In any case, before we start changing things, we should have a clear picture of what we want to achieve first.
On Fri, Jul 24, 2026 at 4:49 PM Takashi Kajinami <kajinamit@oss.nttdata.com <mailto:kajinamit@oss.nttdata.com>> wrote:
Just a minor (but important) correct.
> When this behavior is enabled, horizon uses domain-scoped context to evaluate > policy rules, which is consistent with its API call behaviors.
This isn't what horizon has done in existing releases but the recent fix attempted to implement.However this does not fully resolve the issue and we still have to disable scope check due to keystone not allowing all operations for domain admin.
On 7/23/26 7:36 PM, Takashi Kajinami wrote: > While digging into the unit tests failures recently surfacing after enforce_scope option > was removed from oslo.policy[1], I discovered mismatch between current keystone policy rules > and the expectation from horizon. I may need some input from both sides to fix this. > > [1] bugs.launchpad.net/bugs/2161292 <http://bugs.launchpad.net/bugs/2161292> > > Horizon uses domain-scoped token for most of the keystone API calls, when > the following two options[2] are both true. > > [2] https://opendev.org/openstack/horizon/src/commit/f76caf9d083cee8bd76f69e805b... <https://opendev.org/openstack/horizon/src/commit/f76caf9d083cee8bd76f69e805bbc49655b91449/openstack_dashboard/defaults.py#L396-L404> > --- > # Set this to True if running on a multi-domain model. When this is enabled, it > # will require the user to enter the Domain name in addition to the username > # for login. > OPENSTACK_KEYSTONE_MULTIDOMAIN_SUPPORT = False > # When multidomain support is enabled and user has any roles in a domain, > # Horizon will mostly attempt to use domain scope for calls to Keystone. > # This behavior does not work properly with some policy combinations, > # and can be disabled here. > OPENSTACK_KEYSTONE_PREFER_DOMAIN_TOKEN = True > --- > > When this behavior is enabled, horizon uses domain-scoped context to evaluate > policy rules, which is consistent with its API call behaviors. > > However, on the other hand, keystone permits access to some of the system-wide resources > only for project scope and system scope. Identity provider is one example of such resources. > > The described inconsistency between the expected token scope is the problem and this is > the core reason why unit tests started failing. This inconsistency means that, when multi > domain support is enabled, horizon attempts to use domain scope token to most of keystone > api calls, but some of them are actually rejected by keystone due to scope enforcement > within keystone. > Current horizon doesn't implement fallback between two different scopes, so unless multi > domain support is disabled or domain role is removed, the user can't manipulate these > resources any more. > > There are a few options I could think of now. > > 1. Allow all keystone resources to be manipulated by domain scope > > 2. Get rid of that "OPENSTACK_KEYSTONE_PREFER_DOMAIN_TOKEN" feature completely > given that fact that domain scope is not really intended to be used to > manage system-wide resources in keystone and project-scope should be > used instead. > > 3. Make horizon use appropriate scope according to the target resources. > > 4. Implement scope fallback mechanism within horizon. > > I'm sending this email maikly to hear from the keystone folks if option 1 is something acceptable. > I don't fully understand the context behind allowing access of these resources to only project > scope and system scope. > > If the current scope may not be changed, we'd select 2 or 3, but I find 3 and 4 quite tricky, and > if keystone expects only project scope or system scope for system-wide resources then 2 might be > the only feasible solution, I guess. > > Thank you, > Takashi >
-- Radomir Dopieralski
participants (2)
-
Radomir Dopieralski
-
Takashi Kajinami