SelfSubjectAccessReview

SelfSubjectAccessReview 檢查目前使用者是否可以執行動作。

apiVersion: authorization.k8s.io/v1

import "k8s.io/api/authorization/v1"

SelfSubjectAccessReview

SelfSubjectAccessReview 檢查目前使用者是否可以執行動作。未填寫 spec.namespace 表示「在所有命名空間中」。Self 是一種特殊情況,因為使用者應始終能夠檢查他們是否可以執行動作


SelfSubjectAccessReviewSpec

SelfSubjectAccessReviewSpec 是存取請求的描述。ResourceAuthorizationAttributes 和 NonResourceAuthorizationAttributes 必須恰好設定其中一個


  • nonResourceAttributes (NonResourceAttributes)

    NonResourceAttributes 描述非資源存取請求的資訊

    NonResourceAttributes 包含可用於對 Authorizer 介面進行非資源請求的授權屬性

    • nonResourceAttributes.path (字串)

      Path 是請求的 URL 路徑

    • nonResourceAttributes.verb (字串)

      Verb 是標準 HTTP 動詞

  • resourceAttributes (ResourceAttributes)

    ResourceAuthorizationAttributes 描述資源存取請求的資訊

    ResourceAttributes 包含可用於對 Authorizer 介面進行資源請求的授權屬性

    • resourceAttributes.fieldSelector (FieldSelectorAttributes)

      fieldSelector 描述基於欄位對存取的限制。它只能限制存取,而不能擴大存取。

      此欄位為 Alpha 層級。若要使用此欄位,您必須啟用 AuthorizeWithSelectors 功能閘道(預設停用)。

      *FieldSelectorAttributes 指示欄位受限的存取。建議 Webhook 作者 * 確保 rawSelector 和 requirements 皆未設定 * 如果設定了 requirements 欄位,請考慮 requirements 欄位 * 如果設定了 rawSelector 欄位,請勿嘗試剖析或考慮 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 (字串)

        rawSelector 是將包含在查詢參數中的欄位選取器的序列化。建議 Webhook 實作忽略 rawSelector。kube-apiserver 的 *SubjectAccessReview 將剖析 rawSelector,只要 requirements 不存在。

      • resourceAttributes.fieldSelector.requirements ([]FieldSelectorRequirement)

        Atomic:將在合併期間替換

        requirements 是欄位選取器的已剖析解釋。資源實例必須滿足所有 requirements 才能符合選取器。Webhook 實作應處理 requirements,但如何處理取決於 Webhook。由於 requirements 只能限制請求,因此如果 requirements 未被理解,則授權為不受限制的請求是安全的。

        FieldSelectorRequirement 是一個選取器,其中包含值、鍵和運算子,這些運算子將鍵和值相關聯。

        • resourceAttributes.fieldSelector.requirements.key (字串),必要

          key 是 requirement 應用於的欄位選取器鍵。

        • resourceAttributes.fieldSelector.requirements.operator (字串),必要

          operator 代表鍵與一組值的關係。有效的運算子為 In、NotIn、Exists、DoesNotExist。運算子列表在未來可能會增長。

        • resourceAttributes.fieldSelector.requirements.values ([]字串)

          Atomic:將在合併期間替換

          values 是一個字串值陣列。如果運算子為 In 或 NotIn,則 values 陣列必須為非空。如果運算子為 Exists 或 DoesNotExist,則 values 陣列必須為空。

    • resourceAttributes.group (字串)

      Group 是 Resource 的 API 群組。「*」代表全部。

    • resourceAttributes.labelSelector (LabelSelectorAttributes)

      labelSelector 描述基於標籤的存取限制。它只能限制存取,不能擴展存取權限。

      此欄位為 Alpha 層級。若要使用此欄位,您必須啟用 AuthorizeWithSelectors 功能閘道(預設停用)。

      *LabelSelectorAttributes 指出基於標籤的存取限制。強烈建議 Webhook 作者* 確保 rawSelector 和 requirements 皆未設定 * 如果已設定 requirements 欄位,請考慮 requirements 欄位 * 如果已設定 rawSelector 欄位,請勿嘗試解析或考慮 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 (字串)

        rawSelector 是將包含在查詢參數中的欄位選取器的序列化。建議 Webhook 實作忽略 rawSelector。kube-apiserver 的 *SubjectAccessReview 將剖析 rawSelector,只要 requirements 不存在。

      • resourceAttributes.labelSelector.requirements ([]LabelSelectorRequirement)

        Atomic:將在合併期間替換

        requirements 是標籤選擇器的已解析解釋。所有 requirements 都必須滿足,資源實例才能符合選擇器。Webhook 實作應處理 requirements,但如何處理取決於 webhook。由於 requirements 只能限制請求,因此如果不理解 requirements,則授權為無限制請求是安全的。

        標籤選擇器需求是一個選擇器,其中包含值、鍵和將鍵和值關聯起來的運算符。

        • resourceAttributes.labelSelector.requirements.key (字串), 必填

          key 是選擇器套用的標籤鍵。

        • resourceAttributes.labelSelector.requirements.operator (字串), 必填

          operator 代表鍵與一組值之間的關係。有效的運算符為 In、NotIn、Exists 和 DoesNotExist。

        • resourceAttributes.labelSelector.requirements.values ([]字串)

          Atomic:將在合併期間替換

          values 是一個字串值陣列。如果運算符為 In 或 NotIn,則 values 陣列必須為非空。如果運算符為 Exists 或 DoesNotExist,則 values 陣列必須為空。此陣列在策略合併修補期間會被替換。

    • resourceAttributes.name (字串)

      Name 是針對 "get" 請求的資源名稱,或針對 "delete" 請求要刪除的資源名稱。「""」(空字串)代表全部。

    • resourceAttributes.namespace (字串)

      Namespace 是正在請求的動作的命名空間。目前,沒有命名空間和所有命名空間之間沒有區別。「""」(空字串)是 LocalSubjectAccessReviews 的預設值。「""」(空字串)對於叢集範圍的資源為空。「""」(空字串)對於來自 SubjectAccessReview 或 SelfSubjectAccessReview 的命名空間範圍資源表示「全部」。

    • resourceAttributes.resource (字串)

      Resource 是現有資源類型之一。「*」代表全部。

    • resourceAttributes.subresource (字串)

      Subresource 是現有資源類型之一。「""」代表無。

    • resourceAttributes.verb (字串)

      Verb 是一個 Kubernetes 資源 API 動詞,例如:get、list、watch、create、update、delete、proxy。「*」代表全部。

    • resourceAttributes.version (字串)

      Version 是 Resource 的 API 版本。「*」代表全部。

操作


create 建立 SelfSubjectAccessReview

HTTP 請求

POST /apis/authorization.k8s.io/v1/selfsubjectaccessreviews

參數

回應

200 (SelfSubjectAccessReview): OK(成功)

201 (SelfSubjectAccessReview): Created(已建立)

202 (SelfSubjectAccessReview): Accepted(已接受)

401: Unauthorized(未經授權)

此頁面為自動產生。

如果您計劃回報此頁面的問題,請在您的問題描述中註明此頁面是自動產生的。修正可能需要在 Kubernetes 專案的其他地方進行。

上次修改時間:2024 年 8 月 28 日下午 6:01 PST:Update generated API reference for v1.31 (8ba98c79c1)