-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
Conversation
[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 |
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...) |
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.
This is a different header than scopes, but should be respected for several releases of servers now
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.
Do we really need to put in all Extras when impersonating ?
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.
Do we really need to put in all Extras when impersonating ?
for the general case, yes
@deads2k: The following test failed, say
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. |
Are you proposing this instead of #18378 ? |
// 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{ |
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.
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 ?
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.
Fundamentally the difference here is that if there is already impersonation, new impersonation is skipped now, is this correct ?
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.
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.
I'd like to collapse onto the upstream. closing since #18378 is close |
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