Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Management] If "All" cluster privileges is selected, allowing unchecked other options is misleading #18482

Open
elasticmachine opened this issue Apr 18, 2017 · 14 comments
Labels
enhancement New value added to drive a business result Feature:Users/Roles/API Keys Team:Security Team focused on: Auth, Users, Roles, Spaces, Audit Logging, and more!

Comments

@elasticmachine
Copy link
Contributor

Original comment by @stacey-gammon:

Unless I am missing something, the following seems to give the role security access:

screen shot 2017-04-18 at 2 49 39 pm

But this doesn't:
screen shot 2017-04-18 at 2 51 08 pm 1

Is there any reason, that selecting "All" doesn't automatically select all the other options, and if one of the sub areas is unchecked, then it would automatically uncheck "all"?

cc @skearns64 @cjcenizal @snide

@elasticmachine
Copy link
Contributor Author

Original comment by @skearns64:

++ this is a bug. It's not a critical one, but it can lead to a misunderstanding of cluster privileges.

I'm happy with your suggested approach, but I prefer the behavior to be: "if all is checked, all the other cluster privilege checkboxes are grayed out". This simplifies the interaction a bit.

I marked this as low-fruit on the assumption that is true, anyone is welcome to remove that label if I've guessed wrong :)

@elasticmachine elasticmachine added :Management bug Fixes for quality problems that affect the customer experience good first issue low hanging fruit labels Apr 25, 2018
@timroes timroes added Team:Security Team focused on: Auth, Users, Roles, Spaces, Audit Logging, and more! and removed :Management DO NOT USE labels Nov 27, 2018
@elasticmachine
Copy link
Contributor Author

Pinging @elastic/kibana-security

@legrego legrego removed the good first issue low hanging fruit label Nov 27, 2018
@legrego
Copy link
Member

legrego commented Nov 27, 2018

Now that the cluster privileges are using a multi-select dropdown, the interaction is a bit different, but still misleading.

I think in general we would want a more comprehensive solution, since I believe that we have other cluster privileges that effectively grant other cluster privileges. Or to say another way, some privileges are subsets of other privileges, and we shouldn't only come up with a solution to the all case.

@kobelb kobelb added enhancement New value added to drive a business result and removed bug Fixes for quality problems that affect the customer experience labels Jan 14, 2020
@exalate-issue-sync exalate-issue-sync bot added impact:low Addressing this issue will have a low level of impact on the quality/strength of our product. loe:small Small Level of Effort labels Aug 4, 2021
@legrego
Copy link
Member

legrego commented Feb 11, 2022

Since this issue was opened, we have started relying on the "builtin privileges API" to populate the available cluster and index privileges.

In order to make progress here, we would need to enhance the ES API to give us the relationship between each of these privileges. Kibana does not have enough information to make this determination on its own.

@legrego
Copy link
Member

legrego commented Aug 11, 2022

Since this issue was opened, we have started relying on the "builtin privileges API" to populate the available cluster and index privileges.

In order to make progress here, we would need to enhance the ES API to give us the relationship between each of these privileges. Kibana does not have enough information to make this determination on its own.

@elastic/es-security do you have thoughts on the technical feasibility of this? Essentially, this is asking for a privilege hierarchy for cluster (and I suppose index) privileges, so we know which privileges are subsets of others.

@ywangd
Copy link
Member

ywangd commented Aug 12, 2022

On the ES side, to improve error message when access is denied, @tvernum added sorting for both index and cluster privileges (elastic/elasticsearch#60357, elastic/elasticsearch#66900) so that we can recommend privileges from least to most powerful.

The sorting is not perfect though. It is based on the number of privileges implied by a privilege, e.g. all implies all other privileges so that it is the most powerful. But because the actual heirarchy is not linear, it cannot really be represented by a list. For example, manage_api_key and manage_token have no real order between them. But in a list, you have to place them in order but the order does not really mean much. This imperfection is not an issue for our use case because those unrelated privileges do not simultaneously grant permission to the same (denied) action. But for Kibana's use case, it may be an issue?

The current GetBuiltinPrivileges API return privileges sorted by names. We can change (maybe subject to BWC) the sort order to be "least-to-most-powerful" as described above if this is helpful for Kibana.

Alternatively, it may also be possible to build full hierarchy of the privileges. A new API is probably needed to expose this result. This will be an overall larger effort.

@legrego
Copy link
Member

legrego commented Aug 12, 2022

Thanks, Yang. It sounds like what we would really need is the full hierarchy, but I don't think it's worth taking on at this point given that it's not a trivial amount of work.

@tvernum
Copy link
Contributor

tvernum commented Aug 15, 2022

I don't think it's a huge technical effort. We know which privileges imply which other privileges, and we can find a way to return that in an API. But the existing API isn't really designed to be evolved that way.

I threw something together in the background (tvernum/elasticsearch@b118aa329d7) that horribly abuses the current API by adding a format=tree option that returns something like:

    {
      "name": "manage",
      "implies": [
        "cancel_task",
        "create_snapshot",
        "manage_autoscaling",
        "manage_data_frame_transforms",
        "manage_enrich",
        "manage_ilm",
        "manage_index_templates",
        "manage_ingest_pipelines",
        "manage_logstash_pipelines",
        "manage_ml",
        "manage_pipeline",
        "manage_rollup",
        "manage_slm",
        "manage_transform",
        "manage_watcher",
        "monitor",
        "monitor_data_frame_transforms",
        "monitor_ml",
        "monitor_rollup",
        "monitor_snapshot",
        "monitor_text_structure",
        "monitor_transform",
        "monitor_watcher",
        "read_ilm",
        "read_pipeline",
        "read_slm",
        "transport_client"
      ]
    },
    {
      "name": "manage_api_key",
      "implies": [
        "grant_api_key",
        "manage_own_api_key"
      ]
    },
    {
      "name": "manage_autoscaling"
    },
    {
      "name": "manage_ccr",
      "implies": [
        "read_ccr"
      ]
    },

The problem isn't the amount of work (I hacked something together on a couple of hours while working on something else), it's coming up with a way to fit it into ES without just adding a whole new API.

@ywangd
Copy link
Member

ywangd commented Aug 15, 2022

I don't think it's a huge technical effort.

I don't think it's huge either. I meant it is a "larger" effort, not "large" ("larger" than just sorting the existing returned values in GetPrivileges API that is).

it's coming up with a way to fit it into ES without just adding a whole new API.

That's where the majority of work would be. I suspect the Clients team would rather dislike the idea of having a query parameter to control the response format. I haven't asked them, but it feels something challenging with existing client generation framework. I think this is an idea worth exploring in general. I had similar thought when trying to come up a way for HasPrivileges to return "partial". It is a middle-ground between breaking changes and entirely new APIs. Our BWC guideline says:

  • Adding a query parameter is not a breaking change
  • Changing the response format is a break change

But did not say anything about whether it is a breaking change if we add the above two together. Some clarification on this topic would be very helpful.

@ywangd
Copy link
Member

ywangd commented Aug 15, 2022

For this specific API, maybe we can get away with just adding a new top level field, say hierarchy, in the response. Currently the top level fields are cluster and index. They do not match up with hierarchy too nicely. But it is not too bad either.

@legrego
Copy link
Member

legrego commented Aug 16, 2022

Thanks Tim & Yang. It feels like adding a new hierarchy field would be a reasonable compromise given our constraints. @elastic/kibana-security do you have any thoughts on the response format, given the constraints that Tim and Yang mentioned above?

@azasypkin
Copy link
Member

Thanks Tim & Yang. It feels like adding a new hierarchy field would be a reasonable compromise given our constraints. https://github.com/orgs/elastic/teams/kibana-security do you have any thoughts on the response format, given the constraints that Tim and Yang #18482 (comment) #18482 (comment)?

I don't have a strong opinion to be honest, privilege's specific implies field feels more appropriate, but if it comes with a high cost (including more complex or "loosy" signatures in Elasticsearch clients) then a separate top-level hierarchy/explanation field sounds reasonable too.

@tvernum
Copy link
Contributor

tvernum commented Aug 22, 2022

I don't have a strong opinion to be honest, privilege's specific implies field feels more appropriate

You could have something like:

{
  "cluster": [ ... ],
  "index": [ ... ],
  "implies": {
    "cluster": {
      "manage_api_key": [ "grant_api_key", "manage_own_api_key" ],
      "manage_autoscaling": [ ],
      "manage_ccr": [ "read_ccr" ]
     },
    "index": { ... }
}

I haven't attempted to work out how well that sits with the API guidelines. It's a bit of a band-aid though, because it solves this immediate need, but doesn't help prepare for any future changes.

@azasypkin
Copy link
Member

You could have something like:

Yeah, I meant that having hierarchy or implies on the same level as different privileges "scopes" feels a bit weird (since it doesn't define another "scope", but rather clarifies other scopes), but it's not a big concern, I was just nitpicking.

@legrego legrego removed the loe:small Small Level of Effort label Aug 22, 2022
@legrego legrego removed the impact:low Addressing this issue will have a low level of impact on the quality/strength of our product. label Aug 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New value added to drive a business result Feature:Users/Roles/API Keys Team:Security Team focused on: Auth, Users, Roles, Spaces, Audit Logging, and more!
Projects
None yet
Development

No branches or pull requests

8 participants