generated.proto 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352
  1. /*
  2. Copyright The Kubernetes Authors.
  3. Licensed under the Apache License, Version 2.0 (the "License");
  4. you may not use this file except in compliance with the License.
  5. You may obtain a copy of the License at
  6. http://www.apache.org/licenses/LICENSE-2.0
  7. Unless required by applicable law or agreed to in writing, software
  8. distributed under the License is distributed on an "AS IS" BASIS,
  9. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  10. See the License for the specific language governing permissions and
  11. limitations under the License.
  12. */
  13. // This file was autogenerated by go-to-protobuf. Do not edit it manually!
  14. syntax = "proto2";
  15. package k8s.io.api.authorization.v1;
  16. import "k8s.io/apimachinery/pkg/apis/meta/v1/generated.proto";
  17. import "k8s.io/apimachinery/pkg/runtime/generated.proto";
  18. import "k8s.io/apimachinery/pkg/runtime/schema/generated.proto";
  19. // Package-wide variables from generator "generated".
  20. option go_package = "k8s.io/api/authorization/v1";
  21. // ExtraValue masks the value so protobuf can generate
  22. // +protobuf.nullable=true
  23. // +protobuf.options.(gogoproto.goproto_stringer)=false
  24. message ExtraValue {
  25. // items, if empty, will result in an empty slice
  26. repeated string items = 1;
  27. }
  28. // FieldSelectorAttributes indicates a field limited access.
  29. // Webhook authors are encouraged to
  30. // * ensure rawSelector and requirements are not both set
  31. // * consider the requirements field if set
  32. // * not try to parse or consider the rawSelector field if set. This is to avoid another CVE-2022-2880 (i.e. getting different systems to agree on how exactly to parse a query is not something we want), see https://www.oxeye.io/resources/golang-parameter-smuggling-attack for more details.
  33. // For the *SubjectAccessReview endpoints of the kube-apiserver:
  34. // * If rawSelector is empty and requirements are empty, the request is not limited.
  35. // * If rawSelector is present and requirements are empty, the rawSelector will be parsed and limited if the parsing succeeds.
  36. // * If rawSelector is empty and requirements are present, the requirements should be honored
  37. // * If rawSelector is present and requirements are present, the request is invalid.
  38. message FieldSelectorAttributes {
  39. // rawSelector is the serialization of a field selector that would be included in a query parameter.
  40. // Webhook implementations are encouraged to ignore rawSelector.
  41. // The kube-apiserver's *SubjectAccessReview will parse the rawSelector as long as the requirements are not present.
  42. // +optional
  43. optional string rawSelector = 1;
  44. // requirements is the parsed interpretation of a field selector.
  45. // All requirements must be met for a resource instance to match the selector.
  46. // Webhook implementations should handle requirements, but how to handle them is up to the webhook.
  47. // Since requirements can only limit the request, it is safe to authorize as unlimited request if the requirements
  48. // are not understood.
  49. // +optional
  50. // +listType=atomic
  51. repeated .k8s.io.apimachinery.pkg.apis.meta.v1.FieldSelectorRequirement requirements = 2;
  52. }
  53. // LabelSelectorAttributes indicates a label limited access.
  54. // Webhook authors are encouraged to
  55. // * ensure rawSelector and requirements are not both set
  56. // * consider the requirements field if set
  57. // * not try to parse or consider the rawSelector field if set. This is to avoid another CVE-2022-2880 (i.e. getting different systems to agree on how exactly to parse a query is not something we want), see https://www.oxeye.io/resources/golang-parameter-smuggling-attack for more details.
  58. // For the *SubjectAccessReview endpoints of the kube-apiserver:
  59. // * If rawSelector is empty and requirements are empty, the request is not limited.
  60. // * If rawSelector is present and requirements are empty, the rawSelector will be parsed and limited if the parsing succeeds.
  61. // * If rawSelector is empty and requirements are present, the requirements should be honored
  62. // * If rawSelector is present and requirements are present, the request is invalid.
  63. message LabelSelectorAttributes {
  64. // rawSelector is the serialization of a field selector that would be included in a query parameter.
  65. // Webhook implementations are encouraged to ignore rawSelector.
  66. // The kube-apiserver's *SubjectAccessReview will parse the rawSelector as long as the requirements are not present.
  67. // +optional
  68. optional string rawSelector = 1;
  69. // requirements is the parsed interpretation of a label selector.
  70. // All requirements must be met for a resource instance to match the selector.
  71. // Webhook implementations should handle requirements, but how to handle them is up to the webhook.
  72. // Since requirements can only limit the request, it is safe to authorize as unlimited request if the requirements
  73. // are not understood.
  74. // +optional
  75. // +listType=atomic
  76. repeated .k8s.io.apimachinery.pkg.apis.meta.v1.LabelSelectorRequirement requirements = 2;
  77. }
  78. // LocalSubjectAccessReview checks whether or not a user or group can perform an action in a given namespace.
  79. // Having a namespace scoped resource makes it much easier to grant namespace scoped policy that includes permissions
  80. // checking.
  81. message LocalSubjectAccessReview {
  82. // Standard list metadata.
  83. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
  84. // +optional
  85. optional .k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1;
  86. // Spec holds information about the request being evaluated. spec.namespace must be equal to the namespace
  87. // you made the request against. If empty, it is defaulted.
  88. optional SubjectAccessReviewSpec spec = 2;
  89. // Status is filled in by the server and indicates whether the request is allowed or not
  90. // +optional
  91. optional SubjectAccessReviewStatus status = 3;
  92. }
  93. // NonResourceAttributes includes the authorization attributes available for non-resource requests to the Authorizer interface
  94. message NonResourceAttributes {
  95. // Path is the URL path of the request
  96. // +optional
  97. optional string path = 1;
  98. // Verb is the standard HTTP verb
  99. // +optional
  100. optional string verb = 2;
  101. }
  102. // NonResourceRule holds information that describes a rule for the non-resource
  103. message NonResourceRule {
  104. // Verb is a list of kubernetes non-resource API verbs, like: get, post, put, delete, patch, head, options. "*" means all.
  105. // +listType=atomic
  106. repeated string verbs = 1;
  107. // NonResourceURLs is a set of partial urls that a user should have access to. *s are allowed, but only as the full,
  108. // final step in the path. "*" means all.
  109. // +optional
  110. // +listType=atomic
  111. repeated string nonResourceURLs = 2;
  112. }
  113. // ResourceAttributes includes the authorization attributes available for resource requests to the Authorizer interface
  114. message ResourceAttributes {
  115. // Namespace is the namespace of the action being requested. Currently, there is no distinction between no namespace and all namespaces
  116. // "" (empty) is defaulted for LocalSubjectAccessReviews
  117. // "" (empty) is empty for cluster-scoped resources
  118. // "" (empty) means "all" for namespace scoped resources from a SubjectAccessReview or SelfSubjectAccessReview
  119. // +optional
  120. optional string namespace = 1;
  121. // Verb is a kubernetes resource API verb, like: get, list, watch, create, update, delete, proxy. "*" means all.
  122. // +optional
  123. optional string verb = 2;
  124. // Group is the API Group of the Resource. "*" means all.
  125. // +optional
  126. optional string group = 3;
  127. // Version is the API Version of the Resource. "*" means all.
  128. // +optional
  129. optional string version = 4;
  130. // Resource is one of the existing resource types. "*" means all.
  131. // +optional
  132. optional string resource = 5;
  133. // Subresource is one of the existing resource types. "" means none.
  134. // +optional
  135. optional string subresource = 6;
  136. // Name is the name of the resource being requested for a "get" or deleted for a "delete". "" (empty) means all.
  137. // +optional
  138. optional string name = 7;
  139. // fieldSelector describes the limitation on access based on field. It can only limit access, not broaden it.
  140. // +optional
  141. optional FieldSelectorAttributes fieldSelector = 8;
  142. // labelSelector describes the limitation on access based on labels. It can only limit access, not broaden it.
  143. // +optional
  144. optional LabelSelectorAttributes labelSelector = 9;
  145. }
  146. // ResourceRule is the list of actions the subject is allowed to perform on resources. The list ordering isn't significant,
  147. // may contain duplicates, and possibly be incomplete.
  148. message ResourceRule {
  149. // Verb is a list of kubernetes resource API verbs, like: get, list, watch, create, update, delete, proxy. "*" means all.
  150. // +listType=atomic
  151. repeated string verbs = 1;
  152. // APIGroups is the name of the APIGroup that contains the resources. If multiple API groups are specified, any action requested against one of
  153. // the enumerated resources in any API group will be allowed. "*" means all.
  154. // +optional
  155. // +listType=atomic
  156. repeated string apiGroups = 2;
  157. // Resources is a list of resources this rule applies to. "*" means all in the specified apiGroups.
  158. // "*/foo" represents the subresource 'foo' for all resources in the specified apiGroups.
  159. // +optional
  160. // +listType=atomic
  161. repeated string resources = 3;
  162. // ResourceNames is an optional white list of names that the rule applies to. An empty set means that everything is allowed. "*" means all.
  163. // +optional
  164. // +listType=atomic
  165. repeated string resourceNames = 4;
  166. }
  167. // SelfSubjectAccessReview checks whether or the current user can perform an action. Not filling in a
  168. // spec.namespace means "in all namespaces". Self is a special case, because users should always be able
  169. // to check whether they can perform an action
  170. message SelfSubjectAccessReview {
  171. // Standard list metadata.
  172. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
  173. // +optional
  174. optional .k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1;
  175. // Spec holds information about the request being evaluated. user and groups must be empty
  176. optional SelfSubjectAccessReviewSpec spec = 2;
  177. // Status is filled in by the server and indicates whether the request is allowed or not
  178. // +optional
  179. optional SubjectAccessReviewStatus status = 3;
  180. }
  181. // SelfSubjectAccessReviewSpec is a description of the access request. Exactly one of ResourceAuthorizationAttributes
  182. // and NonResourceAuthorizationAttributes must be set
  183. message SelfSubjectAccessReviewSpec {
  184. // ResourceAuthorizationAttributes describes information for a resource access request
  185. // +optional
  186. optional ResourceAttributes resourceAttributes = 1;
  187. // NonResourceAttributes describes information for a non-resource access request
  188. // +optional
  189. optional NonResourceAttributes nonResourceAttributes = 2;
  190. }
  191. // SelfSubjectRulesReview enumerates the set of actions the current user can perform within a namespace.
  192. // The returned list of actions may be incomplete depending on the server's authorization mode,
  193. // and any errors experienced during the evaluation. SelfSubjectRulesReview should be used by UIs to show/hide actions,
  194. // or to quickly let an end user reason about their permissions. It should NOT Be used by external systems to
  195. // drive authorization decisions as this raises confused deputy, cache lifetime/revocation, and correctness concerns.
  196. // SubjectAccessReview, and LocalAccessReview are the correct way to defer authorization decisions to the API server.
  197. message SelfSubjectRulesReview {
  198. // Standard list metadata.
  199. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
  200. // +optional
  201. optional .k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1;
  202. // Spec holds information about the request being evaluated.
  203. optional SelfSubjectRulesReviewSpec spec = 2;
  204. // Status is filled in by the server and indicates the set of actions a user can perform.
  205. // +optional
  206. optional SubjectRulesReviewStatus status = 3;
  207. }
  208. // SelfSubjectRulesReviewSpec defines the specification for SelfSubjectRulesReview.
  209. message SelfSubjectRulesReviewSpec {
  210. // Namespace to evaluate rules for. Required.
  211. optional string namespace = 1;
  212. }
  213. // SubjectAccessReview checks whether or not a user or group can perform an action.
  214. message SubjectAccessReview {
  215. // Standard list metadata.
  216. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
  217. // +optional
  218. optional .k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1;
  219. // Spec holds information about the request being evaluated
  220. optional SubjectAccessReviewSpec spec = 2;
  221. // Status is filled in by the server and indicates whether the request is allowed or not
  222. // +optional
  223. optional SubjectAccessReviewStatus status = 3;
  224. }
  225. // SubjectAccessReviewSpec is a description of the access request. Exactly one of ResourceAuthorizationAttributes
  226. // and NonResourceAuthorizationAttributes must be set
  227. message SubjectAccessReviewSpec {
  228. // ResourceAuthorizationAttributes describes information for a resource access request
  229. // +optional
  230. optional ResourceAttributes resourceAttributes = 1;
  231. // NonResourceAttributes describes information for a non-resource access request
  232. // +optional
  233. optional NonResourceAttributes nonResourceAttributes = 2;
  234. // User is the user you're testing for.
  235. // If you specify "User" but not "Groups", then is it interpreted as "What if User were not a member of any groups
  236. // +optional
  237. optional string user = 3;
  238. // Groups is the groups you're testing for.
  239. // +optional
  240. // +listType=atomic
  241. repeated string groups = 4;
  242. // Extra corresponds to the user.Info.GetExtra() method from the authenticator. Since that is input to the authorizer
  243. // it needs a reflection here.
  244. // +optional
  245. map<string, ExtraValue> extra = 5;
  246. // UID information about the requesting user.
  247. // +optional
  248. optional string uid = 6;
  249. }
  250. // SubjectAccessReviewStatus
  251. message SubjectAccessReviewStatus {
  252. // Allowed is required. True if the action would be allowed, false otherwise.
  253. optional bool allowed = 1;
  254. // Denied is optional. True if the action would be denied, otherwise
  255. // false. If both allowed is false and denied is false, then the
  256. // authorizer has no opinion on whether to authorize the action. Denied
  257. // may not be true if Allowed is true.
  258. // +optional
  259. optional bool denied = 4;
  260. // Reason is optional. It indicates why a request was allowed or denied.
  261. // +optional
  262. optional string reason = 2;
  263. // EvaluationError is an indication that some error occurred during the authorization check.
  264. // It is entirely possible to get an error and be able to continue determine authorization status in spite of it.
  265. // For instance, RBAC can be missing a role, but enough roles are still present and bound to reason about the request.
  266. // +optional
  267. optional string evaluationError = 3;
  268. }
  269. // SubjectRulesReviewStatus contains the result of a rules check. This check can be incomplete depending on
  270. // the set of authorizers the server is configured with and any errors experienced during evaluation.
  271. // Because authorization rules are additive, if a rule appears in a list it's safe to assume the subject has that permission,
  272. // even if that list is incomplete.
  273. message SubjectRulesReviewStatus {
  274. // ResourceRules is the list of actions the subject is allowed to perform on resources.
  275. // The list ordering isn't significant, may contain duplicates, and possibly be incomplete.
  276. // +listType=atomic
  277. repeated ResourceRule resourceRules = 1;
  278. // NonResourceRules is the list of actions the subject is allowed to perform on non-resources.
  279. // The list ordering isn't significant, may contain duplicates, and possibly be incomplete.
  280. // +listType=atomic
  281. repeated NonResourceRule nonResourceRules = 2;
  282. // Incomplete is true when the rules returned by this call are incomplete. This is most commonly
  283. // encountered when an authorizer, such as an external authorizer, doesn't support rules evaluation.
  284. optional bool incomplete = 3;
  285. // EvaluationError can appear in combination with Rules. It indicates an error occurred during
  286. // rule evaluation, such as an authorizer that doesn't support rule evaluation, and that
  287. // ResourceRules and/or NonResourceRules may be incomplete.
  288. // +optional
  289. optional string evaluationError = 4;
  290. }