-
Notifications
You must be signed in to change notification settings - Fork 40k
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
Fix RBAC authorizer of ServiceAccount #29071
Fix RBAC authorizer of ServiceAccount #29071
Conversation
Can one of the admins verify that this patch is reasonable to test? If so, please reply "ok to test". This message may repeat a few times in short succession due to jenkinsci/ghprb-plugin#292. Sorry. Otherwise, if this message is too spammy, please complain to ixdy. |
4 similar comments
Can one of the admins verify that this patch is reasonable to test? If so, please reply "ok to test". This message may repeat a few times in short succession due to jenkinsci/ghprb-plugin#292. Sorry. Otherwise, if this message is too spammy, please complain to ixdy. |
Can one of the admins verify that this patch is reasonable to test? If so, please reply "ok to test". This message may repeat a few times in short succession due to jenkinsci/ghprb-plugin#292. Sorry. Otherwise, if this message is too spammy, please complain to ixdy. |
Can one of the admins verify that this patch is reasonable to test? If so, please reply "ok to test". This message may repeat a few times in short succession due to jenkinsci/ghprb-plugin#292. Sorry. Otherwise, if this message is too spammy, please complain to ixdy. |
Can one of the admins verify that this patch is reasonable to test? If so, please reply "ok to test". This message may repeat a few times in short succession due to jenkinsci/ghprb-plugin#292. Sorry. Otherwise, if this message is too spammy, please complain to ixdy. |
Yes these are mixed up. Thanks for the fix. lgtm |
@kubernetes/sig-auth can someone okay to test this? I'd consider it a pretty high priority bug. |
@k8s-bot ok to test |
@@ -202,7 +202,7 @@ func appliesToUser(user user.Info, subject rbac.Subject) (bool, error) { | |||
return false, fmt.Errorf("subject of kind service account without specified namespace") | |||
} | |||
// TODO(ericchiang): Is there a better way of matching a service account name? | |||
return "system:serviceaccount:"+subject.Name+":"+subject.Namespace == user.GetName(), nil |
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.
Use MakeUsername in pkg/serviceaccount
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.
can remove the TODO now as well :)
and go ahead and squash |
Thanks for your review ! |
squash, then LGTM |
RBAC authorizer assigns a role to a wrong service account.
ef803b4
to
d1b14e2
Compare
Thanks for you support. I'm a newbie and learning about git. |
LGTM |
@ericchiang can you cherry-pick this to the release-1.3 branch? |
GCE e2e build/test passed for commit d1b14e2. |
@k8s-bot test this [submit-queue is verifying that this PR is safe to merge] |
GCE e2e build/test passed for commit d1b14e2. |
Automatic merge from submit-queue |
@albatross0 Cherrypick approved. Please create a PR for this. Thank you. |
PR #29313 already exists. Could you tell me what I should do ? |
…9071-upstream-release-1.3 Automatic merge from submit-queue Automated cherry pick of #29071 upstream release 1.3
…pick-of-#29071-upstream-release-1.3 Automatic merge from submit-queue Automated cherry pick of kubernetes#29071 upstream release 1.3
RBAC authorizer assigns a role to a wrong service account.
How to reproduce
1.Create role and rolebinding to allow default user in kube-system namespace to read secrets in kube-system namespace.
2.Set a credential of default user
3.Try to get secrets as default user in kube-system namespace
As shown above, default user could not access to secrets.
But if I have kube-system user in default namespace, it is allowed access to secrets.
4.Create a service account and try to get secrets as kube-system user in default namespace