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 subjectlocator shim and divide responsibility #18152

Conversation

deads2k
Copy link
Contributor

@deads2k deads2k commented Jan 17, 2018

This removes an unnecessary shim interface, makes construction of separate things separate, makes an existing bug obvious (RAR doesn't take into account node authorizer), and will ease rebases.

@openshift/sig-security
/assign enj
/assign simo5
/assign soltysh

Fixes #15816

@openshift-ci-robot openshift-ci-robot added approved Indicates a PR has been approved by an approver from all required OWNERS files. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Jan 17, 2018

func RBACSubjectsToUsersAndGroups(subjects []rbac.Subject, defaultNamespace string) (users []string, groups []string) {
for _, subject := range subjects {
if subject.APIGroup != rbac.GroupName {
Copy link
Contributor

@liggitt liggitt Jan 17, 2018

Choose a reason for hiding this comment

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

misses service account subjects, right? is there a test that would have caught that?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

misses service account subjects, right? is there a test that would have caught that?

betting we'll find out.

Copy link
Contributor

Choose a reason for hiding this comment

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

This goes in pkg/authorization/util/subject.go

Copy link
Contributor Author

Choose a reason for hiding this comment

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

misses service account subjects, right? is there a test that would have caught that?
betting we'll find out.

Yes, there are integration tests that fail when this is wrong.

if len(subject.Namespace) > 0 {
ns = subject.Namespace
}
if len(ns) >= 0 {
Copy link
Contributor

Choose a reason for hiding this comment

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

>= 0, huh?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

= 0, huh?

ze germans?

Copy link
Contributor

Choose a reason for hiding this comment

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

Well that looks unfortunate.

@enj
Copy link
Contributor

enj commented Jan 18, 2018

Bruno had started this work in #16034

rbacregistryvalidation "k8s.io/kubernetes/pkg/registry/rbac/validation"
"k8s.io/kubernetes/plugin/pkg/auth/authorizer/node"
rbacauthorizer "k8s.io/kubernetes/plugin/pkg/auth/authorizer/rbac"
kbootstrappolicy "k8s.io/kubernetes/plugin/pkg/auth/authorizer/rbac/bootstrappolicy"

"github.com/openshift/origin/pkg/authorization/authorizer"
oauthorizer "github.com/openshift/origin/pkg/authorization/authorizer"
Copy link
Contributor

Choose a reason for hiding this comment

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

I think I called this openshiftauthorizer elsewhere. I do not care what we use, but lets make them match.

if len(subject.Namespace) > 0 {
ns = subject.Namespace
}
if len(ns) >= 0 {
Copy link
Contributor

Choose a reason for hiding this comment

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

Well that looks unfortunate.


func RBACSubjectsToUsersAndGroups(subjects []rbac.Subject, defaultNamespace string) (users []string, groups []string) {
for _, subject := range subjects {
if subject.APIGroup != rbac.GroupName {
Copy link
Contributor

Choose a reason for hiding this comment

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

This goes in pkg/authorization/util/subject.go

if len(subject.Namespace) > 0 {
ns = subject.Namespace
}
if len(ns) >= 0 {
Copy link
Contributor

Choose a reason for hiding this comment

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

> 0

@enj
Copy link
Contributor

enj commented Jan 18, 2018

@deads2k I marked this as fixing the appropriate issue. #15828 is the other one you are looking for.

@enj
Copy link
Contributor

enj commented Jan 18, 2018

RAR doesn't take into account node authorizer

Issue to track?

@deads2k deads2k force-pushed the authz-12-upstreamsubjectlocator branch from 61269b1 to dde2bf2 Compare January 18, 2018 16:49
@deads2k
Copy link
Contributor Author

deads2k commented Jan 18, 2018

comments addressed

Copy link
Contributor

@enj enj left a comment

Choose a reason for hiding this comment

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

Minor nit, LGTM otherwise.

@@ -1,9 +1,9 @@
package auth

import (
authorizationutil "github.com/openshift/origin/pkg/authorization/util"
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: separate origin import from kube

@deads2k deads2k force-pushed the authz-12-upstreamsubjectlocator branch from dde2bf2 to 5f4c30a Compare January 18, 2018 18:21
@deads2k
Copy link
Contributor Author

deads2k commented Jan 18, 2018

fixed

@enj
Copy link
Contributor

enj commented Jan 18, 2018

/lgtm

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Jan 18, 2018
@openshift-ci-robot
Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: deads2k, enj

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

@deads2k
Copy link
Contributor Author

deads2k commented Jan 18, 2018

/retest

@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-merge-robot
Copy link
Contributor

/test all [submit-queue is verifying that this PR is safe to merge]

@openshift-ci-robot
Copy link

openshift-ci-robot commented Jan 19, 2018

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

Test name Commit Details Rerun command
ci/openshift-jenkins/extended_conformance_gce 5f4c30a link /test extended_conformance_gce

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.

@openshift-merge-robot
Copy link
Contributor

Automatic merge from submit-queue (batch tested with PRs 18129, 18152, 17403, 18020, 18165).

@openshift-merge-robot openshift-merge-robot merged commit 109465c into openshift:master Jan 19, 2018
@deads2k deads2k deleted the authz-12-upstreamsubjectlocator branch January 24, 2018 14:29
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. lgtm Indicates that a PR is ready to be merged. sig/security size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants