Skip to content

self-subject-access-review data source

Description

SelfSubjectAccessReviewDataSource observes access for the configured identity. A negative decision and any evaluation error are returned as data. The query does not create a permission grant. Choose exactly one resource or non-resource attribute object; subject identity comes from shared client configuration. Outputs omit the API reason: equivalent authorization decisions can name different matching RBAC bindings on consecutive reads, invalidating saved plans.

Source: internal/api/authorization/v1/self_subject_access_review_dsrc.go:23

Example usage:

imports: {
  kubernetes-authorization-v1: 'github.com/cloudboss/unobin-library-kubernetes//api/authorization/v1'
}

data-sources: {
  example: kubernetes-authorization-v1.self-subject-access-review {
    # Set input fields here.
  }
}

Inputs

resource-attributes

optional(object)
optional(
  object({
    namespace: optional(string)
    verb: string
    group: optional(string)
    version: optional(string)
    resource: string
    subresource: optional(string)
    name: optional(string)
  })
)

ResourceAttributes selects a resource request. An omitted or empty namespace queries all namespaces and does not inherit the configured namespace.

non-resource-attributes

optional(object)
optional(
  object({
    verb: string
    path: string
  })
)

Input Constraints

Field combinations

Exactly one of resource-attributes or non-resource-attributes.

Resource attributes rules

resource-attributes verb and resource must be nonempty.

Rule logic
When
input.resource-attributes != null
Require
@core.length(input.resource-attributes.verb ?? '') >= 1
&& @core.length(input.resource-attributes.resource ?? '') >= 1

Non resource attributes rules

non-resource-attributes requires a nonempty verb and an absolute path.

Rule logic
When
input.non-resource-attributes != null
Require
@core.length(input.non-resource-attributes.verb ?? '') >= 1
&& @core.length(input.non-resource-attributes.path ?? '') >= 1
&& @core.is-match(input.non-resource-attributes.path, '^/')

Outputs

allowed

boolean

denied

boolean

evaluation-error

string