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