Skip to content

remove subjectlocator shim and divide responsibility - #18152

Merged
openshift-merge-robot merged 1 commit into
openshift:masterfrom
deads2k:authz-12-upstreamsubjectlocator
Jan 19, 2018
Merged

openshift-merge-robot merged 1 commit into
openshift:masterfrom
deads2k:authz-12-upstreamsubjectlocator

Conversation

@deads2k

@deads2k deads2k commented Jan 17, 2018 •

Copy link
Copy Markdown
Contributor

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 {

@liggitt liggitt Jan 17, 2018 •

Copy link
Copy Markdown
Contributor

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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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

enj commented Jan 18, 2018

Copy link
Copy Markdown
Contributor

Bruno had started this work in #16034

Comment thread pkg/cmd/server/origin/authorizer.go Outdated
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

> 0

@enj

enj commented Jan 18, 2018

Copy link
Copy Markdown
Contributor

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

@enj

enj commented Jan 18, 2018

Copy link
Copy Markdown
Contributor

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

deads2k commented Jan 18, 2018

Copy link
Copy Markdown
Contributor Author

comments addressed

@enj enj left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Minor nit, LGTM otherwise.

Comment thread pkg/project/auth/reviewer.go Outdated
package auth

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

Copy link
Copy Markdown
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

deads2k commented Jan 18, 2018

Copy link
Copy Markdown
Contributor Author

fixed

@enj

enj commented Jan 18, 2018

Copy link
Copy Markdown
Contributor

/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
Copy Markdown

[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.

Details 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

deads2k commented Jan 18, 2018

Copy link
Copy Markdown
Contributor Author

/retest

@openshift-bot

Copy link
Copy Markdown
Contributor

/retest

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

@openshift-merge-robot

Copy link
Copy Markdown
Contributor

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

@openshift-ci-robot

openshift-ci-robot commented Jan 19, 2018 •

Copy link
Copy Markdown

@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.

Details

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
Copy Markdown
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