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

use normal impersonation headers to speaking back to ourselves #18379

Closed
wants to merge 1 commit into from

Conversation

deads2k
Copy link
Contributor

@deads2k deads2k commented Jan 31, 2018

I think this is right, but callers need to be chased to be sure its for loopbacks. I suspect some of these can be made private.

Fixes #18374

/assign @simo5
/assign @enj

@openshift-ci-robot
Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: deads2k

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these OWNERS Files:

You can indicate your approval by writing /approve in a comment
You can cancel your approval by writing /approve cancel in a comment

@openshift-ci-robot openshift-ci-robot added approved Indicates a PR has been approved by an approver from all required OWNERS files. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Jan 31, 2018
req.SetHeader(transport.ImpersonateUserHeader, c.user.GetName())
req.SetHeader(transport.ImpersonateGroupHeader, c.user.GetGroups()...)
for k, vv := range c.user.GetExtra() {
req.SetHeader(transport.ImpersonateUserExtraHeaderPrefix+k, vv...)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is a different header than scopes, but should be respected for several releases of servers now

Copy link
Contributor

Choose a reason for hiding this comment

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

Do we really need to put in all Extras when impersonating ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Do we really need to put in all Extras when impersonating ?

for the general case, yes

@openshift-ci-robot
Copy link

openshift-ci-robot commented Jan 31, 2018

@deads2k: The following test failed, say /retest to rerun them all:

Test name Commit Details Rerun command
ci/openshift-jenkins/cmd c3191f0 link /test cmd

Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here.

@simo5
Copy link
Contributor

simo5 commented Feb 1, 2018

Are you proposing this instead of #18378 ?
What's wrong with that approach ?

// NewImpersonatingConfig wraps the config's transport to impersonate a user, including user, groups, and scopes
func NewImpersonatingConfig(user user.Info, config restclient.Config) restclient.Config {
oldWrapTransport := config.WrapTransport
config.WrapTransport = func(rt http.RoundTripper) http.RoundTripper {
return newImpersonatingRoundTripper(user, oldWrapTransport(rt))
return transport.NewImpersonatingRoundTripper(transport.ImpersonationConfig{
Copy link
Contributor

Choose a reason for hiding this comment

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

Our call used to delete all headers, looking upstream tough this is not done in their RoundTrip function, groups and extras are Added to existing headers. Doesn't this risk incorrect impersonation by adding more privileged groups scopes ?

Copy link
Contributor

Choose a reason for hiding this comment

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

Fundamentally the difference here is that if there is already impersonation, new impersonation is skipped now, is this correct ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fundamentally the difference here is that if there is already impersonation, new impersonation is skipped now, is this correct ?

Correct. I don't think any existing callers were hoping for double impersonation powers, but I could see an argument to change upstream if you wish.

@deads2k
Copy link
Contributor Author

deads2k commented Feb 1, 2018

I'd like to collapse onto the upstream. closing since #18378 is close

@deads2k deads2k closed this Feb 1, 2018
@deads2k deads2k deleted the auth-01-impersonate branch July 3, 2018 17:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants