-
Notifications
You must be signed in to change notification settings - Fork 705
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
Remove namespace usage #782
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am fine with the change removing the namespace (this was something mostly inherited from HelmCRD) but the problem right now is that an user could make a request GET /namespace/foo/release/bar
and we would be returning a release that potentially is not in foo
without returning any kind of error.
I know that we are safe because we are doing proper requests from the front end but before we forget and we leave this in a inconsistent state I would remove the namespace from the routes that are not needed (unless you plan to do that in a different PR).
@andresmgot yes, you are right, that's why I added a comment here https://github.com/kubeapps/kubeapps/pull/782/files#diff-a8ee397eb96fc3f4801cb4e038840e1bR146 I was thinking of tackling this in a different PR #783 |
Yes, what I want to clarify is that we are adding a regression (which was not included in this PR but in #781). This PR leaves the code in a better status from what is in master right now so I am okay merging it. |
A regression? Where? The functionality is the same no? If you meant that we are not using the namespace to filter a release name you are right, but in practice I believe that it does not make any difference. Am I missing anything? |
I don't think this is that important, but if we want we can always verify the namespace after getting the release. I'm also confused about the regression @andresmgot mentions, let's hold this until we find out what he meant. |
cmd/tiller-proxy/main.go
Outdated
@@ -144,6 +143,8 @@ func main() { | |||
ProxyClient: proxy, | |||
} | |||
// Routes | |||
// TODO Some of these routes do not require namespace anymore (i.e getRelease) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
actually, all the routes do require the namespace, because we render the manifest with ResolveManifest and go through each kind
to ensure a user can get, create, update or delete the kind
in the namespace
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh, true, I forgot about that.
Sorry, what I meant is that previously a As @prydonius comments, the (Unchecked) The above seems important because for example, when upgrading an application, an user could try to upgrade |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(see comment above)
Great catch, @andresmgot - you're absolutely right that this change would leave this security hole open. We should definitely ensure we don't introduce this regression in this PR. |
Thank you @andresmgot for the explanation, I agree with you that it is a regression so I've rolled back the previous implementation to just focus on fixing it. Basically what I do is to retrieve the release with the "new way" but then confirm that the namespace of that release is the one we provided (if any) and previously verified in the handler. Let me know if it makes sense. In any case, I have mixed feelings about the current API, for example I do not think that we should allow/require passing a In any case, this is not in my opinion worth discussion now. Thank you for raising this issue @andresmgot!! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the changes!
Yes, the only case in which it's necessary is when deploying a new app so I wouldn't mind changing the routes and make the namespace a field of the request body in that case. Anyway, what I like of the current routes is that they are not helm specific (even though the proxy is specific to tiller). What I mean is that the routes would be the same if the backend is an App CRD controller for example (in case that for App CRDs names are not cluster-unique) so hypothetically we could extend this proxy to use different backends. |
Right, it is just that to me, it is a little bit confusing and personally I prefer to build things from bottom up, starting with the current case unless there is another use case in the horizon. Also the current implementation is more error prone (as we could see when I added the regression) since we rely on doing a check in two places. Truth is that this would have been discovered if we had a test for it. In any case I do not think this is worth changing right now and I really appreciate your help on finding this issue. Sorry about that |
Namespaces in Helm are global, not scoped by namespace. Here #781 we have updated the
get release
code to not to rely on listing and filtering releases, which means that we do not need to filter per namespace anymore.This patch renames
get
forgetRelease
and updates some of those proxy handlers to stop passing the unnecessary namespace.NOTE: This does not change the tiller proxy API which eventually we might want to revisit
Refs #765