kubernetes/pkg/apis/rbac/validation
Kubernetes Submit Queue 16454277aa Merge pull request #29930 from ericchiang/rbac-validation-dont-mix-non-resource-urls-and-resources
Automatic merge from submit-queue

rbac validation: rules can't combine non-resource URLs and regular resources

This PR updates the validation used for RBAC to prevent rules from mixing non-resource URLs and regular resources.

For example the following is no longer valid

```yml
kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1alpha1
metadata:
  name: admins
rules:
  - apiGroups: ["*"]
    resources: ["*"]
    verbs: ["*"]
    nonResourceURLs: ["*"]
```

And must be rewritten as so.

```yml
kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1alpha1
metadata:
  name: admins
rules:
  - apiGroups: ["*"]
    resources: ["*"]
    verbs: ["*"]
  - nonResourceURLs: ["*"]
    verbs: ["*"]
``` 

It also:
* Mandates non-zero length arrays for required resources.
* Mandates non-resource URLs only be used for ClusterRoles (not namespaced Roles).
* Updates the swagger validation so `verbs` are the only required field in a rule. Further validation is done by the server.

Also, do we need to bump the API version?

Discussed by @erictune and @liggitt  in #28304

Updates kubernetes/features#2

cc @kubernetes/sig-auth 

Edit:
* Need to update the RBAC docs if this change goes in.
2016-08-04 04:52:51 -07:00
..
cast.go Remove "All rights reserved" from all the headers. 2016-06-29 17:47:36 -07:00
policy_comparator_test.go Check all places to break the loop when object found 2016-07-23 13:49:04 +08:00
policy_comparator.go rbac authorizer: support non-resource urls with stars ("/apis/*") 2016-07-12 10:01:53 -07:00
rulevalidation_test.go Fix RBAC authorizer of ServiceAccount 2016-07-21 01:50:08 +09:00
rulevalidation.go Fix RBAC authorizer of ServiceAccount 2016-07-21 01:50:08 +09:00
validation_test.go RBAC: don't allow rules to mix non-resource URLs and resources 2016-08-02 13:33:34 -07:00
validation.go RBAC: don't allow rules to mix non-resource URLs and resources 2016-08-02 13:33:34 -07:00