SelfSubjectAccessReview
apiVersion: authorization.k8s.io/v1
import "k8s.io/api/authorization/v1"
SelfSubjectAccessReview
SelfSubjectAccessReview 檢查當前使用者是否可以執行某個操作。不填寫 spec.namespace 意味著“在所有名稱空間中”。Self 是一個特殊情況,因為使用者應該始終能夠檢查他們是否可以執行某個操作
apiVersion: authorization.k8s.io/v1
kind: SelfSubjectAccessReview
metadata (ObjectMeta)
標準列表元資料。更多資訊:https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
spec (SelfSubjectAccessReviewSpec), required
Spec 包含有關正在評估的請求的資訊。user 和 groups 必須為空
status (SubjectAccessReviewStatus)
Status 由伺服器填充,指示請求是否被允許
SelfSubjectAccessReviewSpec
SelfSubjectAccessReviewSpec 是訪問請求的描述。必須設定 ResourceAuthorizationAttributes 和 NonResourceAuthorizationAttributes 中的一個且僅一個
nonResourceAttributes (NonResourceAttributes)
NonResourceAttributes 描述了非資源訪問請求的資訊
NonResourceAttributes 包含可用於 Authorizer 介面的非資源請求的授權屬性
nonResourceAttributes.path (string)
Path 是請求的 URL 路徑
nonResourceAttributes.verb (string)
Verb 是標準的 HTTP 動詞
resourceAttributes (ResourceAttributes)
ResourceAuthorizationAttributes 描述了資源訪問請求的資訊
ResourceAttributes 包含可用於 Authorizer 介面的資源請求的授權屬性
resourceAttributes.fieldSelector (FieldSelectorAttributes)
fieldSelector 描述了基於欄位的訪問限制。它只能限制訪問,不能擴大訪問範圍。
*FieldSelectorAttributes 表示一個欄位限制的訪問。Webhook 作者被鼓勵 * 確保 rawSelector 和 requirements 都不會同時設定 * 如果設定了 requirements 欄位,請考慮它 * 如果設定了 rawSelector 欄位,請不要嘗試解析或考慮它。這是為了避免另一個 CVE-2022-2880(即,讓不同的系統就如何解析查詢達成一致不是我們想要的),有關更多詳細資訊,請參閱 https://www.oxeye.io/resources/golang-parameter-smuggling-attack。對於 kube-apiserver 的 * SubjectAccessReview 端點: * 如果 rawSelector 為空且 requirements 為空,則請求沒有限制。 * 如果 rawSelector 存在且 requirements 為空,則將解析 rawSelector 並限制它(如果解析成功)。 * 如果 rawSelector 為空且 requirements 存在,則應遵守 requirements。 * 如果 rawSelector 存在且 requirements 也存在,則請求無效。*
resourceAttributes.fieldSelector.rawSelector (string)
rawSelector 是將包含在查詢引數中的欄位選擇器的序列化形式。Webhook 實現者被鼓勵忽略 rawSelector。kube-apiserver 的 * SubjectAccessReview 將解析 rawSelector,只要 requirements 不存在。
resourceAttributes.fieldSelector.requirements ([]FieldSelectorRequirement)
原子性:在合併期間將被替換
requirements 是欄位選擇器的已解析解釋。所有 requirements 都必須滿足,資源例項才能匹配選擇器。Webhook 實現者應該處理 requirements,但如何處理它們由 webhook 決定。由於 requirements 只能限制請求,如果 requirements 未被理解,則授權為無限制請求是安全的。
FieldSelectorRequirement 是一個選擇器,它包含值、鍵和一個運算子,該運算子關聯鍵和值。
resourceAttributes.fieldSelector.requirements.key (string), required
key 是 requirements 應用的欄位選擇器鍵。
resourceAttributes.fieldSelector.requirements.operator (string), required
operator 表示鍵與一組值之間的關係。有效的運算子是 In、NotIn、Exists、DoesNotExist。運算子列表將來可能會增加。
resourceAttributes.fieldSelector.requirements.values ([]string)
原子性:在合併期間將被替換
values 是一個字串值陣列。如果運算子是 In 或 NotIn,則 values 陣列必須非空。如果運算子是 Exists 或 DoesNotExist,則 values 陣列必須為空。
resourceAttributes.group (string)
Group 是資源的 API Group。“*” 表示所有。
resourceAttributes.labelSelector (LabelSelectorAttributes)
labelSelector 描述了基於標籤的訪問限制。它只能限制訪問,不能擴大訪問範圍。
*LabelSelectorAttributes 表示一個標籤限制的訪問。Webhook 作者被鼓勵 * 確保 rawSelector 和 requirements 都不會同時設定 * 如果設定了 requirements 欄位,請考慮它 * 如果設定了 rawSelector 欄位,請不要嘗試解析或考慮它。這是為了避免另一個 CVE-2022-2880(即,讓不同的系統就如何解析查詢達成一致不是我們想要的),有關更多詳細資訊,請參閱 https://www.oxeye.io/resources/golang-parameter-smuggling-attack。對於 kube-apiserver 的 * SubjectAccessReview 端點: * 如果 rawSelector 為空且 requirements 為空,則請求沒有限制。 * 如果 rawSelector 存在且 requirements 為空,則將解析 rawSelector 並限制它(如果解析成功)。 * 如果 rawSelector 為空且 requirements 存在,則應遵守 requirements。 * 如果 rawSelector 存在且 requirements 也存在,則請求無效。*
resourceAttributes.labelSelector.rawSelector (string)
rawSelector 是將包含在查詢引數中的欄位選擇器的序列化形式。Webhook 實現者被鼓勵忽略 rawSelector。kube-apiserver 的 * SubjectAccessReview 將解析 rawSelector,只要 requirements 不存在。
resourceAttributes.labelSelector.requirements ([]LabelSelectorRequirement)
原子性:在合併期間將被替換
requirements 是標籤選擇器的已解析解釋。所有 requirements 都必須滿足,資源例項才能匹配選擇器。Webhook 實現者應該處理 requirements,但如何處理它們由 webhook 決定。由於 requirements 只能限制請求,如果 requirements 未被理解,則授權為無限制請求是安全的。
標籤選擇器 requirement 是一個包含值、鍵和關係鍵與值的運算子的選擇器。
resourceAttributes.labelSelector.requirements.key (string), required
key 是選擇器適用的標籤鍵。
resourceAttributes.labelSelector.requirements.operator (string), required
operator 表示鍵與一組值之間的關係。有效運算子為 In、NotIn、Exists 和 DoesNotExist。
resourceAttributes.labelSelector.requirements.values ([]string)
原子性:在合併期間將被替換
values 是一個字串值陣列。如果 operator 是 In 或 NotIn,則 values 陣列必須非空。如果 operator 是 Exists 或 DoesNotExist,則 values 陣列必須為空。此陣列在戰略合併補丁期間被替換。
resourceAttributes.name (string)
Name 是“get”操作所請求資源的名稱,或“delete”操作要刪除的資源的名稱。“” (空) 表示所有。
resourceAttributes.namespace (string)
Namespace 是所請求操作的名稱空間。目前,沒有區分“無名稱空間”和“所有名稱空間”。“” (空) 是 LocalSubjectAccessReviews 的預設值。“” (空) 是叢集範圍資源的空值。“” (空) 表示 SubjectAccessReview 或 SelfSubjectAccessReview 中名稱空間範圍資源的“所有”。
resourceAttributes.resource (string)
Resource 是現有的資源型別之一。“*” 表示所有。
resourceAttributes.subresource (string)
Subresource 是現有的資源型別之一。“” 表示無。
resourceAttributes.verb (string)
Verb 是一個 Kubernetes 資源 API 動詞,例如:get、list、watch、create、update、delete、proxy。“*” 表示所有。
resourceAttributes.version (string)
Version 是資源的 API Version。“*” 表示所有。
操作
create
建立一個 SelfSubjectAccessReview
HTTP 請求
POST /apis/authorization.k8s.io/v1/selfsubjectaccessreviews
引數
body: SelfSubjectAccessReview, required
dryRun (在查詢中): string
fieldManager (在查詢中): string
fieldValidation (在查詢中): string
pretty (在查詢中): string
響應
200 (SelfSubjectAccessReview): OK
201 (SelfSubjectAccessReview): Created
202 (SelfSubjectAccessReview): Accepted
401: 未授權
本頁面是自動生成的。
如果你打算報告此頁面存在的問題,請在問題描述中提及此頁面是自動生成的。修復可能需要在 Kubernetes 專案的其他地方進行。