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

Remove headers that are unnecessary for proxy target #34076

Merged
merged 1 commit into from
Oct 6, 2016

Conversation

mbohlool
Copy link
Contributor

@mbohlool mbohlool commented Oct 5, 2016

Some headers like authorization is unnecessary to pass to the proxy target. We should start removing these headers in proxy requests.

Remove headers that are unnecessary for proxy target

This change is Reviewable

@k8s-github-robot k8s-github-robot added size/S Denotes a PR that changes 10-29 lines, ignoring generated files. release-note-label-needed labels Oct 5, 2016
@smarterclayton
Copy link
Contributor

@liggitt wasn't this there for a reason?

@smarterclayton
Copy link
Contributor

rephrase - I thought there are use cases where callers are using
Authorization.

On Wed, Oct 5, 2016 at 2:06 AM, k8s-ci-robot notifications@github.com
wrote:

Jenkins verification failed
https://k8s-gubernator.appspot.com/build/kubernetes-jenkins/pr-logs/pull/34076/kubernetes-pull-verify-all/16888/
for commit 75b8465
75b8465.
Full PR test history http://pr-test.k8s.io/34076.

The magic incantation to run this job again is @k8s-bot verify test this.
Please help us cut down flakes by linking to an open flake issue
https://github.com/kubernetes/kubernetes/issues?q=is:issue+label:kind/flake+is:open
when you hit one in your PR.


You are receiving this because you were assigned.
Reply to this email directly, view it on GitHub
#34076 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/ABG_p7aYFL7xTf9uPJuLrrLvsK-NJs4gks5qwz5cgaJpZM4KOcBS
.

@mbohlool
Copy link
Contributor Author

mbohlool commented Oct 5, 2016

I think the proxy target should not use authorization token meant to be for API server.

@liggitt
Copy link
Member

liggitt commented Oct 5, 2016

I think the proxy target should not use authorization token meant to be for API server.

agree, but we proxy in several places, and I'm not sure this is the right place to remove the header

@alex-mohr
Copy link
Contributor

It's an open question (to me) as to whether there are legitimate use cases for having user creds passed through the proxy to the k8s service -- e.g. the k8s UI/dashboard?

It also seems like an open question as to whether there's a security issue in blithely always forwarding these tokens along, which could result in unexpected disclosure of user creds.

If it's better security, but a nominally-breaking change, need to work through those impacts?

Also @philips fyi in case there's a CoreOS perspective here. Any other vendors who we should also CC?

@mbohlool
Copy link
Contributor Author

mbohlool commented Oct 5, 2016

@liggitt What other places are you talking about? As far as I can tell, this is the entry point for all proxy calls.

@lavalamp
Copy link
Member

lavalamp commented Oct 5, 2016

@erictune has plans for an impersonation mechanism. I do not think it is reasonable for people to use this in the short term--hopefully no one is. Perhaps we should test the UIs to make sure.

@mbohlool
Copy link
Contributor Author

mbohlool commented Oct 5, 2016

I've tried UI with this change (getting lists of pods, deployments, etc., creating apps, pods, ...). It looks fine. If there is an automated testing or a process to test the whole UI, I am not aware of it, but the UI looks fine to me.

@liggitt
Copy link
Member

liggitt commented Oct 5, 2016

@liggitt What other places are you talking about? As far as I can tell, this is the entry point for all proxy calls.

there are also proxy calls via nodes/proxy, pods/proxy, and services/proxy subresources, handled by https://github.com/kubernetes/kubernetes/blob/master/pkg/registry/generic/rest/proxy.go#L72

more broadly, I wonder if the authentication layer should consume the Authorization header (we do that in OpenShift as seen here)

@mbohlool
Copy link
Contributor Author

mbohlool commented Oct 6, 2016

@liggitt Removing authorization header in authentication layer is a good idea, but I think an Authenticator is not a place for it. First we do not expect an authenticator to mutate the request, and second we are chaining authenticators together and if a valid token is passed in header but another authenticator succeeded before we consume it, we will still send a valid token to the proxy target. I've removed it at the end of authentication cycle (if succeeded). Please take another look.

@mbohlool mbohlool added the priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release. label Oct 6, 2016
@@ -60,6 +60,9 @@ func WithAuthentication(handler http.Handler, mapper api.RequestContextMapper, a
return
}

// authorization header is not required anymore in case of a successful authorization.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in case of successful authentication

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also, update function godoc to describe the Authorization header being removed on success

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

@liggitt
Copy link
Member

liggitt commented Oct 6, 2016

LGTM

cc @kubernetes/sig-auth

@liggitt liggitt added release-note-none Denotes a PR that doesn't merit a release note. and removed release-note-label-needed labels Oct 6, 2016
@k8s-ci-robot
Copy link
Contributor

Jenkins verification failed for commit 5d3a8c7. Full PR test history.

The magic incantation to run this job again is @k8s-bot verify test this. Please help us cut down flakes by linking to an open flake issue when you hit one in your PR.

@mbohlool mbohlool added do-not-merge DEPRECATED. Indicates that a PR should not merge. Label can only be manually applied/removed. and removed do-not-merge DEPRECATED. Indicates that a PR should not merge. Label can only be manually applied/removed. labels Oct 6, 2016
@mbohlool mbohlool added this to the v1.4 milestone Oct 6, 2016
@mbohlool mbohlool added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Oct 6, 2016
@jessfraz
Copy link
Contributor

jessfraz commented Oct 6, 2016

This is in the v1.4 milestone do you need it for 1.4.1?

@k8s-github-robot
Copy link

Automatic merge from submit-queue

@k8s-github-robot k8s-github-robot merged commit c1d2b61 into kubernetes:master Oct 6, 2016
@lavalamp
Copy link
Member

lavalamp commented Oct 6, 2016

@jessfraz Yes, we would like it cherrypicked.

@mbohlool can you make the cherrypick PR? There is a script under hack/ that will do that for you. Thanks

@mbohlool
Copy link
Contributor Author

mbohlool commented Oct 6, 2016

Sure, will do.

@jessfraz jessfraz added the cherry-pick-approved Indicates a cherry-pick PR into a release branch has been approved by the release branch manager. label Oct 6, 2016
@mbohlool
Copy link
Contributor Author

mbohlool commented Oct 6, 2016

Done #34280 and #34281

@jessfraz
Copy link
Contributor

jessfraz commented Oct 6, 2016

Thanks!

On Thu, Oct 6, 2016 at 4:46 PM, mbohlool notifications@github.com wrote:

Done #34280 #34280 and
#34281 #34281


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#34076 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/ABYNbIB2gJCanrz4OvM-5lG7x4q0Aq6Xks5qxYhNgaJpZM4KOcBS
.

@jessfraz jessfraz added release-note Denotes a PR that will be considered when it comes time to generate release notes. and removed release-note-none Denotes a PR that doesn't merit a release note. labels Oct 7, 2016
k8s-github-robot pushed a commit that referenced this pull request Oct 7, 2016
…76-upstream-release-1.4

Automatic merge from submit-queue

Automated cherry pick of #34076

Cherry pick of #34076 on release-1.4.

#34076: Remove unnecessary authorization headers after authorization
@k8s-cherrypick-bot
Copy link

Commit found in the "release-1.4" branch appears to be this PR. Removing the "cherrypick-candidate" label. If this is an error find help to get your PR picked.

k8s-github-robot pushed a commit that referenced this pull request Oct 7, 2016
…76-upstream-release-1.3

Automatic merge from submit-queue

Automated cherry pick of #34076

Cherry pick of #34076 on release-1.3.

#34076: Remove unnecessary authorization headers after authorization
shyamjvs pushed a commit to shyamjvs/kubernetes that referenced this pull request Dec 1, 2016
…ck-of-#34076-upstream-release-1.4

Automatic merge from submit-queue

Automated cherry pick of kubernetes#34076

Cherry pick of kubernetes#34076 on release-1.4.

kubernetes#34076: Remove unnecessary authorization headers after authorization
shyamjvs pushed a commit to shyamjvs/kubernetes that referenced this pull request Dec 1, 2016
…ck-of-#34076-upstream-release-1.3

Automatic merge from submit-queue

Automated cherry pick of kubernetes#34076

Cherry pick of kubernetes#34076 on release-1.3.

kubernetes#34076: Remove unnecessary authorization headers after authorization
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cherry-pick-approved Indicates a cherry-pick PR into a release branch has been approved by the release branch manager. lgtm "Looks good to me", indicates that a PR is ready to be merged. priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/S Denotes a PR that changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

10 participants