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

system:masters tokens are not restricted by scopes #18922

Open
simo5 opened this issue Mar 9, 2018 · 13 comments
Open

system:masters tokens are not restricted by scopes #18922

simo5 opened this issue Mar 9, 2018 · 13 comments
Assignees
Labels
kind/bug Categorizes issue or PR as related to a bug. lifecycle/frozen Indicates that an issue or PR should not be auto-closed due to staleness. priority/P2 sig/security

Comments

@simo5
Copy link
Contributor

simo5 commented Mar 9, 2018

While trying to build an integration test for webhooks I came up to the fact that a user that uses a token with system:masters in the groups and scopes has scopes completely ignored and full access a system:masters.

This is in master

@simo5
Copy link
Contributor Author

simo5 commented Mar 9, 2018

@deads2k @liggitt @enj comments ?

@liggitt
Copy link
Contributor

liggitt commented Mar 9, 2018

Not surprising, but not really concerning. No OAuth-authenticated users can have that group (it's not a valid Group API object name)

@enj
Copy link
Contributor

enj commented Mar 9, 2018

@deads2k made scopes authz come before system:masters, so it should deny.

@simo5
Copy link
Contributor Author

simo5 commented Mar 9, 2018

@liggitt I was passing in that group from an external authorizer with no issue, so that statement is not fully true

@simo5
Copy link
Contributor Author

simo5 commented Mar 9, 2018

@liggitt Note that passing system:masters as group is not a problem, but I remember discussing the authorization pipeline with @deads2k on a recent refactor and the scope authorizer was explicitly put before the system:masters check in order to allow using scopes in that case too

@deads2k
Copy link
Contributor

deads2k commented Mar 9, 2018

@liggitt Note that passing system:masters as group is not a problem, but I remember discussing the authorization pipeline with @deads2k on a recent refactor and the scope authorizer was explicitly put before the system:masters check in order to allow using scopes in that case too

Yeah, I'm surprised it didn't work. It didn't work before, so we haven't regressed and can fix it later, but I did swizzle the order to try to deny early:

https://github.com/openshift/origin/blob/master/pkg/cmd/server/origin/authorizer.go#L37-L46

@simo5
Copy link
Contributor Author

simo5 commented Mar 9, 2018

@deads2k that code is exactly what I was reminding, so we need to figure out at some point why it is not working.
I am not concerned this is a regression or anything or I would have made it a P0 and a Security issue :-)

@enj
Copy link
Contributor

enj commented Mar 16, 2018

See #18966 (comment) for an update on this.

@jwforres jwforres added kind/bug Categorizes issue or PR as related to a bug. priority/P2 labels Mar 20, 2018
@openshift-bot
Copy link
Contributor

Issues go stale after 90d of inactivity.

Mark the issue as fresh by commenting /remove-lifecycle stale.
Stale issues rot after an additional 30d of inactivity and eventually close.
Exclude this issue from closing by commenting /lifecycle frozen.

If this issue is safe to close now please do so with /close.

/lifecycle stale

@openshift-ci-robot openshift-ci-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Jun 18, 2018
@simo5
Copy link
Contributor Author

simo5 commented Jun 18, 2018

This was by design and the "bug" was fixed in a different way

@simo5 simo5 closed this as completed Jun 18, 2018
@enj
Copy link
Contributor

enj commented Jun 25, 2018

The underlying issue of not being able to scope system:masters still remains right? Or is there some changes in the upstream loopback token?

/remove-lifecycle stale
/lifecycle frozen

@enj enj reopened this Jun 25, 2018
@openshift-ci-robot openshift-ci-robot added lifecycle/frozen Indicates that an issue or PR should not be auto-closed due to staleness. and removed lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. labels Jun 25, 2018
@simo5
Copy link
Contributor Author

simo5 commented Jun 25, 2018

My understanding is that system:master is and will remain unscoped, but I'll defer to anyone that wants to do otherwise I guess.

@enj
Copy link
Contributor

enj commented Jan 2, 2019

I believe #21530 makes this impossible.

We should update

openshiftAuthorizer := authorizerunion.New(
// Wrap with an authorizer that detects unsafe requests and modifies verbs/resources appropriately so policy can address them separately.
// Scopes are first because they will authoritatively deny and can logically be attached to anyone.
browsersafe.NewBrowserSafeAuthorizer(scopeLimitedAuthorizer, user.AllAuthenticated),
// authorizes system:masters to do anything, just like upstream
authorizerfactory.NewPrivilegedGroups(user.SystemPrivilegedGroup),
nodeAuthorizer,
// Wrap with an authorizer that detects unsafe requests and modifies verbs/resources appropriately so policy can address them separately
browsersafe.NewBrowserSafeAuthorizer(kubeAuthorizer, user.AllAuthenticated),
)

to not give the false impression that system:masters honors any deny authorizer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Categorizes issue or PR as related to a bug. lifecycle/frozen Indicates that an issue or PR should not be auto-closed due to staleness. priority/P2 sig/security
Projects
None yet
Development

No branches or pull requests

7 participants