Skip to content

Commit 474d07c

Browse files
committed
[zh-cn]sync subject-access-review-v1.md
Signed-off-by: xin.li <xin.li@daocloud.io>
1 parent a554c9b commit 474d07c

File tree

1 file changed

+46
-54
lines changed

1 file changed

+46
-54
lines changed

content/zh-cn/docs/reference/kubernetes-api/authorization-resources/subject-access-review-v1.md

Lines changed: 46 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -48,13 +48,13 @@ SubjectAccessReview 检查用户或组是否可以执行某操作。
4848
Spec holds information about the request being evaluated
4949
- **status** (<a href="{{< ref "../authorization-resources/subject-access-review-v1#SubjectAccessReviewStatus" >}}">SubjectAccessReviewStatus</a>)
5050
Status is filled in by the server and indicates whether the request is allowed or not
51-
-->
51+
-->
5252
- **spec** (<a href="{{< ref "../authorization-resources/subject-access-review-v1#SubjectAccessReviewSpec" >}}">SubjectAccessReviewSpec</a>),必需
53-
53+
5454
spec 包含有关正在评估的请求的信息。
5555

5656
- **status** (<a href="{{< ref "../authorization-resources/subject-access-review-v1#SubjectAccessReviewStatus" >}}">SubjectAccessReviewStatus</a>)
57-
57+
5858
status 由服务器填写,表示请求是否被允许。
5959

6060
## SubjectAccessReviewSpec {#SubjectAccessReviewSpec}
@@ -75,16 +75,16 @@ resourceAuthorizationAttributes 和 nonResourceAuthorizationAttributes 二者必
7575
- **groups** ([]string)
7676
7777
*Atomic: will be replaced during a merge*
78-
78+
7979
Groups is the groups you're testing for.
8080
-->
8181
- **extra** (map[string][]string)
82-
82+
8383
extra 对应于来自鉴权器的 user.Info.GetExtra() 方法。
8484
由于这是针对 Authorizer 的输入,所以它需要在此处反映。
8585

8686
- **groups** ([]string)
87-
87+
8888
**原子:将在合并期间被替换**
8989

9090
groups 是你正在测试的组。
@@ -103,18 +103,18 @@ resourceAuthorizationAttributes 和 nonResourceAuthorizationAttributes 二者必
103103
Verb is the standard HTTP verb
104104
-->
105105
- **nonResourceAttributes** (NonResourceAttributes)
106-
106+
107107
nonResourceAttributes 描述非资源访问请求的信息。
108-
108+
109109
<a name="NonResourceAttributes"></a>
110110
**nonResourceAttributes 包括提供给 Authorizer 接口进行非资源请求鉴权时所用的属性。**
111111

112112
- **nonResourceAttributes.path** (string)
113-
113+
114114
path 是请求的 URL 路径。
115-
115+
116116
- **nonResourceAttributes.verb** (string)
117-
117+
118118
verb 是标准的 HTTP 动作。
119119

120120
<!--
@@ -126,42 +126,38 @@ resourceAuthorizationAttributes 和 nonResourceAuthorizationAttributes 二者必
126126
*ResourceAttributes includes the authorization attributes available for resource requests to the Authorizer interface*
127127
-->
128128
- **resourceAttributes** (ResourceAttributes)
129-
129+
130130
resourceAuthorizationAttributes 描述资源访问请求的信息。
131-
131+
132132
<a name="ResourceAttributes"></a>
133133
**resourceAttributes 包括提供给 Authorizer 接口进行资源请求鉴权时所用的属性。**
134134

135135
<!--
136136
- **resourceAttributes.fieldSelector** (FieldSelectorAttributes)
137137
138138
fieldSelector describes the limitation on access based on field. It can only limit access, not broaden it.
139-
140-
This field is alpha-level. To use this field, you must enable the `AuthorizeWithSelectors` feature gate (disabled by default).
141139
-->
142140

143141
- **resourceAttributes.fieldSelector** (FieldSelectorAttributes)
144142

145143
fieldSelector 描述基于字段的访问限制。此字段只能限制访问权限,而不能扩大访问权限。
146144

147-
此字段处于 Alpha 级别。要使用此字段,你必须启用 `AuthorizeWithSelectors` 特性门控(默认禁用)。
148-
149145
<!--
150146
<a name="FieldSelectorAttributes"></a>
151147
*FieldSelectorAttributes indicates a field limited access. Webhook authors are encouraged to * ensure rawSelector and requirements are not both set * consider the requirements field if set * 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. For the *SubjectAccessReview endpoints of the kube-apiserver: * If rawSelector is empty and requirements are empty, the request is not limited. * If rawSelector is present and requirements are empty, the rawSelector will be parsed and limited if the parsing succeeds. * If rawSelector is empty and requirements are present, the requirements should be honored * If rawSelector is present and requirements are present, the request is invalid.*
152148
-->
153149

154150
<a name="FieldSelectorAttributes"></a>
155151
FieldSelectorAttributes 表示一个限制访问的字段。建议 Webhook 的开发者们:
156-
152+
157153
* 确保 rawSelector 和 requirements 未被同时设置
158154
* 如果设置,则考虑 requirements 字段
159155
* 如果设置,不要尝试解析或考虑 rawSelector 字段。
160-
156+
161157
这是为了避免出现另一个 CVE-2022-2880(即我们不希望不同系统以一致的方式解析某个查询),
162158
有关细节参见 https://www.oxeye.io/resources/golang-parameter-smuggling-attack
163159
对于 kube-apiserver 的 SubjectAccessReview 端点:
164-
160+
165161
* 如果 rawSelector 为空且 requirements 为空,则请求未被限制。
166162
* 如果 rawSelector 存在且 requirements 为空,则 rawSelector 将被解析,并在解析成功的情况下进行限制。
167163
* 如果 rawSelector 为空且 requirements 存在,则应优先使用 requirements。
@@ -213,7 +209,7 @@ resourceAuthorizationAttributes 和 nonResourceAuthorizationAttributes 二者必
213209
- **resourceAttributes.fieldSelector.requirements.values** ([]string)
214210
215211
*Atomic: will be replaced during a merge*
216-
212+
217213
values is an array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty.
218214
-->
219215

@@ -240,45 +236,41 @@ resourceAuthorizationAttributes 和 nonResourceAuthorizationAttributes 二者必
240236
-->
241237

242238
- **resourceAttributes.group** (string)
243-
239+
244240
group 是资源的 API 组。
245241
"*" 表示所有资源。
246242

247243
<!--
248244
- **resourceAttributes.labelSelector** (LabelSelectorAttributes)
249245
250246
labelSelector describes the limitation on access based on labels. It can only limit access, not broaden it.
251-
252-
This field is alpha-level. To use this field, you must enable the `AuthorizeWithSelectors` feature gate (disabled by default).
253247
-->
254248

255249
- **resourceAttributes.labelSelector** (LabelSelectorAttributes)
256250

257251
labelSelector 描述基于标签的访问限制。此字段只能限制访问权限,而不能扩大访问权限。
258252

259-
此字段处于 Alpha 级别。要使用此字段,你必须启用 `AuthorizeWithSelectors` 特性门控(默认禁用)。
260-
261253
<!--
262254
<a name="LabelSelectorAttributes"></a>
263255
*LabelSelectorAttributes indicates a label limited access. Webhook authors are encouraged to * ensure rawSelector and requirements are not both set * consider the requirements field if set * 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. For the *SubjectAccessReview endpoints of the kube-apiserver: * If rawSelector is empty and requirements are empty, the request is not limited. * If rawSelector is present and requirements are empty, the rawSelector will be parsed and limited if the parsing succeeds. * If rawSelector is empty and requirements are present, the requirements should be honored * If rawSelector is present and requirements are present, the request is invalid.*
264256
-->
265257

266258
<a name="LabelSelectorAttributes"></a>
267259
LabelSelectorAttributes 表示通过标签限制的访问。建议 Webhook 开发者们:
268-
260+
269261
* 确保 rawSelector 和 requirements 未被同时设置
270262
* 如果设置,则考虑 requirements 字段
271263
* 如果设置,不要尝试解析或考虑 rawSelector 字段。
272-
264+
273265
这是为了避免出现另一个 CVE-2022-2880(即让不同系统以一致的方式解析为何某个查询不是我们想要的),
274266
有关细节参见 https://www.oxeye.io/resources/golang-parameter-smuggling-attack
275267
对于 kube-apiserver 的 SubjectAccessReview 端点:
276-
268+
277269
* 如果 rawSelector 为空且 requirements 为空,则请求未被限制。
278270
* 如果 rawSelector 存在且 requirements 为空,则 rawSelector 将被解析,并在解析成功的情况下进行限制。
279271
* 如果 rawSelector 为空且 requirements 存在,则应优先使用 requirements。
280272
* 如果 rawSelector 存在,requirements 也存在,则请求无效。
281-
273+
282274
<!--
283275
- **resourceAttributes.labelSelector.rawSelector** (string)
284276
@@ -295,7 +287,7 @@ resourceAuthorizationAttributes 和 nonResourceAuthorizationAttributes 二者必
295287
- **resourceAttributes.labelSelector.requirements** ([]LabelSelectorRequirement)
296288
297289
*Atomic: will be replaced during a merge*
298-
290+
299291
requirements is the parsed interpretation of a label selector. All requirements must be met for a resource instance to match the selector. Webhook implementations should handle requirements, but how to handle them is up to the webhook. Since requirements can only limit the request, it is safe to authorize as unlimited request if the requirements are not understood.
300292
301293
<a name="LabelSelectorRequirement"></a>
@@ -325,10 +317,10 @@ resourceAuthorizationAttributes 和 nonResourceAuthorizationAttributes 二者必
325317
- **resourceAttributes.labelSelector.requirements.values** ([]string)
326318
327319
*Atomic: will be replaced during a merge*
328-
320+
329321
values is an array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. This array is replaced during a strategic merge patch.
330322
-->
331-
323+
332324
- **resourceAttributes.labelSelector.requirements.key** (string),必需
333325

334326
key 是选择算符应用到的标签键。
@@ -352,7 +344,7 @@ resourceAuthorizationAttributes 和 nonResourceAuthorizationAttributes 二者必
352344
-->
353345

354346
- **resourceAttributes.name** (string)
355-
347+
356348
name 是 "get" 正在请求或 "delete" 已删除的资源。
357349
""(空字符串)表示所有资源。
358350

@@ -365,24 +357,24 @@ resourceAuthorizationAttributes 和 nonResourceAuthorizationAttributes 二者必
365357
366358
- **resourceAttributes.subresource** (string)
367359
Subresource is one of the existing resource types. "" means none.
368-
-->
360+
-->
369361

370362
- **resourceAttributes.namespace** (string)
371-
363+
372364
namespace 是正在请求的操作的命名空间。
373365
目前,无命名空间和所有命名空间之间没有区别。
374366
对于 LocalSubjectAccessReviews,默认为 ""(空字符串)。
375367
对于集群范围的资源,默认为 ""(空字符串)。
376368
对于来自 SubjectAccessReview 或 SelfSubjectAccessReview 的命名空间范围的资源,
377369
""(空字符串)表示 "all"(所有资源)。
378-
370+
379371
- **resourceAttributes.resource** (string)
380-
372+
381373
resource 是现有的资源类别之一。
382374
"*" 表示所有资源类别。
383-
375+
384376
- **resourceAttributes.subresource** (string)
385-
377+
386378
subresource 是现有的资源类别之一。
387379
"" 表示无子资源。
388380

@@ -395,12 +387,12 @@ resourceAuthorizationAttributes 和 nonResourceAuthorizationAttributes 二者必
395387
-->
396388

397389
- **resourceAttributes.verb** (string)
398-
390+
399391
verb 是 kubernetes 资源的 API 动作,例如 get、list、watch、create、update、delete、proxy。
400392
"*" 表示所有动作。
401-
393+
402394
- **resourceAttributes.version** (string)
403-
395+
404396
version 是资源的 API 版本。
405397
"*" 表示所有版本。
406398

@@ -410,14 +402,14 @@ resourceAuthorizationAttributes 和 nonResourceAuthorizationAttributes 二者必
410402
411403
- **user** (string)
412404
User is the user you're testing for. If you specify "User" but not "Groups", then is it interpreted as "What if User were not a member of any groups
413-
-->
405+
-->
414406

415407
- **uid** (string)
416-
408+
417409
有关正在请求的用户的 UID 信息。
418410

419411
- **user** (string)
420-
412+
421413
user 是你正在测试的用户。
422414
如果你指定 “user” 而不是 “groups”,它将被解读为“如果 user 不是任何组的成员,将会怎样”。
423415

@@ -435,12 +427,12 @@ SubjectAccessReviewStatus
435427
Denied is optional. True if the action would be denied, otherwise false. If both allowed is false and denied is false, then the authorizer has no opinion on whether to authorize the action. Denied may not be true if Allowed is true.
436428
-->
437429
- **allowed** (boolean),必需
438-
430+
439431
allowed 是必需的。
440432
如果允许该操作,则为 true,否则为 false。
441433

442434
- **denied** (boolean)
443-
435+
444436
denied 是可选的。
445437
如果拒绝该操作,则为 true,否则为 false。
446438
如果 allowed 和 denied 均为 false,则 Authorizer 对是否鉴权操作没有意见。
@@ -454,13 +446,13 @@ SubjectAccessReviewStatus
454446
Reason is optional. It indicates why a request was allowed or denied.
455447
-->
456448
- **evaluationError** (string)
457-
449+
458450
evaluationError 表示鉴权检查期间发生一些错误。
459451
出现错误的情况下完全有可能继续确定鉴权状态。
460452
例如,RBAC 可能缺少一个角色,但仍存在足够多的角色进行绑定,进而了解请求有关的原因。
461453

462454
- **reason** (string)
463-
455+
464456
reason 是可选的。
465457
它表示为什么允许或拒绝请求。
466458

@@ -503,19 +495,19 @@ POST /apis/authorization.k8s.io/v1/subjectaccessreviews
503495
- **body**: <a href="{{< ref "../authorization-resources/subject-access-review-v1#SubjectAccessReview" >}}">SubjectAccessReview</a>,必需
504496

505497
- **dryRun** (**查询参数**): string
506-
498+
507499
<a href="{{< ref "../common-parameters/common-parameters#dryRun" >}}">dryRun</a>
508500

509501
- **fieldManager** (**查询参数**): string
510-
502+
511503
<a href="{{< ref "../common-parameters/common-parameters#fieldManager" >}}">fieldManager</a>
512504

513505
- **fieldValidation** (**查询参数**): string
514-
506+
515507
<a href="{{< ref "../common-parameters/common-parameters#fieldValidation" >}}">fieldValidation</a>
516508

517509
- **pretty** (**查询参数**): string
518-
510+
519511
<a href="{{< ref "../common-parameters/common-parameters#pretty" >}}">pretty</a>
520512

521513
<!--

0 commit comments

Comments
 (0)