-
Notifications
You must be signed in to change notification settings - Fork 707
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
[fluxv2] check RBAC settings of the currently logged in user when listing packages/repositories #4390
Comments
So one complication that arose is this: Also, before someone asks 'why use |
I'm not sure that returning an empty list is the solution, wouldn't that mean that only admins (or users who can read
The auth'd user is asking "what packages are available for me to install". I thought we relied on the cache (whether it's best effort only or not) to respond with the packages available to install? I'm not sure how you could check for |
Mostly true what you said above (see below) I am thinking that |
we don't have this problem with helm plugin, because its cache 'postgresql' is unbounded. If it had an upper limit on how many entries can be stored, we'd have the same issue with helm |
No, that's not quite what I meant. Right now the API raises an error. Hopefully we all agree that is not what we want. All I was trying to say is that API should be always be returning a list of packages from repos they have access to. If there are no such repos, the response would be empty. I was not trying to say that only those with cluster-wide access would get a non-empty response. I understand that is not practical. What I was trying to say I need to come up with a practical solution that satisfies that goal. |
Yep, makes sense. It might still be expensive to determine the repos the caller doesn't have access to, but I'm sure you'll find a solution :) |
Yep, because it's disk-based (not memory).
Yep. |
so far this approach appears to work |
Hi FWIW, I think |
I usually reason about these type of questions by checking what the CLI does. If I check with helm:
or carvel (just kubectl):
So those two CLIs choose to give a strong immediate error identifying the problem, rather than returning an empty list. Yes, we have a slight difference in that we also want to be able to aggregate the results of Perhaps the original question? AIUI, the issue was that with Flux, the authenticated user may have access to (the namespace of ) the installed package ( |
One problem I see is an inconsistency in flux plugin API semantics. We've said above that |
yes, I will make it work that way |
Did we? I couldn't find that (but may have missed it). I thought we said that when a user calls
Cool - if that works, great. Seems to keep the behaviour similar to the CLI. |
regarding |
See related discussion in #4298 (comment)
Flux plugin currently has an issue. For the purpose of this issue, consider 2 "personas" involved:
an out-of-band background process running in the context of
kubeapps-internal-kubeappsapis
service account that watches all helm repositories added/updated/delete in the cluster and sync's them to redis cachea user who logs into the UX dashboard or (gRPC API server) and is wishing to
list available packages or maybe install a package. This user may have very different
RBAC settings from those of
kubeapps-internal-kubeappsapis
service account, which may or may notallow them to list a given repository (e.g. by not having read access to the namespace in which the repository exists)
Flux plugin currently ignores (2). That is, any user that can login to the dashboard will
be allowed to read any repository from redis cache thus bypassing the RBAC settings for this user.
This needs to be fixed. As a start, I may want to do something along the lines of what
direct helm plugin does in
hasAccessToNamespace()
https://github.com/kubeapps/kubeapps/blob/5d4ea934808f8258d44d7edee7f71d5a6c1494e0/cmd/kubeapps-apis/plugins/helm/packages/v1alpha1/server.go#L439. To be clear this is not a 100% accurate solution because the RBAC access may be more fine-grained than the namespace-level but its a startThe text was updated successfully, but these errors were encountered: