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

split scc admission into mutating and validating #20605

Merged
merged 1 commit into from
Aug 16, 2018

Conversation

deads2k
Copy link
Contributor

@deads2k deads2k commented Aug 10, 2018

We have not split our admission chain into validating and mutating. Because of this we disable the webhook admission plugins by default and don't claim support. When they are turned on, they bypass our admission chain checks. There are more to do, but SCC stands out as one that is super important and we don't want people to get used to bypassing.

@openshift/sig-master
@liggitt as discussed

@openshift-ci-robot openshift-ci-robot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Aug 10, 2018
@openshift-ci-robot
Copy link

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

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci-robot openshift-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Aug 10, 2018
break loop
default:
glog.V(6).Infof("pod %s (generate: %s) validated against provider %s, but required mutation, skipping", pod.Name, pod.GenerateName, provider.GetSCCName())
glog.V(4).Infof("pod %s (generate: %s) validated against provider %s, but required mutation, skipping", pod.Name, pod.GenerateName, provider.GetSCCName())
Copy link
Contributor

@liggitt liggitt Aug 10, 2018

Choose a reason for hiding this comment

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

V(5), maybe? this one could be noisy

Copy link
Contributor

Choose a reason for hiding this comment

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

still outstanding

pod.ObjectMeta.Annotations[allocator.ValidatedSCCAnnotation] = allowingProvider.GetSCCName()
return nil
if allowedPod == nil || allowingProvider == nil {
return nil, "", validationErrs, nil
Copy link
Contributor

@liggitt liggitt Aug 10, 2018

Choose a reason for hiding this comment

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

if the pod wasn't allowed, why is this returning a nil error?

edit: returning nil is ok as long as all callers check for a nil allowedPod and reject otherwise

if err != nil {
return admission.NewForbidden(a, err)
}
if apiequality.Semantic.DeepEqual(pod, allowedPod) {
Copy link
Contributor

Choose a reason for hiding this comment

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

need to make sure allowedPod is non-nil here

Copy link
Contributor Author

Choose a reason for hiding this comment

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

need to make sure allowedPod is non-nil here

Just in case a deep equals of nil matches an actual pod?

// if this is an update, see if we are only updating the ownerRef. Garbage collection does this
// and we should allow it in general, since you had the power to update and the power to delete.
// The worst that happens is that you delete something, but you aren't controlling the privileged object itself
if a.GetOldObject() != nil && rbacregistry.IsOnlyMutatingGCFields(a.GetObject(), a.GetOldObject(), kapihelper.Semantic) {
Copy link
Contributor

@liggitt liggitt Aug 10, 2018

Choose a reason for hiding this comment

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

should we also be checking that the operation is UPDATE? I vaguely remember a recent change around this

Copy link
Contributor Author

Choose a reason for hiding this comment

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

should we also be checking that the operation is UPDATE?

This is a straight move. I didn't check. We have concerns about existing behavior?

Copy link
Contributor

Choose a reason for hiding this comment

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

tracked it down to a 1.12-era PR fixing admission for create-on-update cases (kubernetes/kubernetes#65572 (comment)). this is fine for 1.11, but we need to sweep before 1.12 to make sure we're not using GetOldObject() != nil when we really mean GetOperation() == UPDATE

@liggitt
Copy link
Contributor

liggitt commented Aug 10, 2018

nit on checking nil pod on return, lgtm otherwise

@deads2k
Copy link
Contributor Author

deads2k commented Aug 14, 2018

comments addressed.

@liggitt
Copy link
Contributor

liggitt commented Aug 14, 2018

forgot about the log level one, sorry

@deads2k deads2k added the lgtm Indicates that a PR is ready to be merged. label Aug 14, 2018
@enj
Copy link
Contributor

enj commented Aug 15, 2018

we disable the webhook admission plugins by default and don't claim support. When they are turned on, they bypass our admission chain checks.

Uh who exactly is they and why do they bypass checks?

cc @openshift/sig-security

@liggitt
Copy link
Contributor

liggitt commented Aug 15, 2018

who exactly is they and why do they bypass checks?

they is the webhook admission plugins, and they bypass checks because they go at the end of the list and we didn't split SCC to have a validation phase that guaranteed nothing in the webhooks undid or added something to the pod that wouldn't pass SCC policy

@deads2k
Copy link
Contributor Author

deads2k commented Aug 15, 2018

/retest

2 similar comments
@deads2k
Copy link
Contributor Author

deads2k commented Aug 15, 2018

/retest

@deads2k
Copy link
Contributor Author

deads2k commented Aug 15, 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 openshift-merge-robot merged commit 22d2e61 into openshift:master Aug 16, 2018
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/master 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.

None yet

6 participants