Authorize on the request body
Send up to 8 KiB of the body to the agent so a policy can inspect it, and fail closed when the agent is unreachable.
Configuration
apiVersion: kuma.io/v1alpha1
kind: MeshOPA
metadata:
name: authorize-with-body
namespace: kong-mesh-demo
labels:
kuma.io/mesh: default
spec:
targetRef:
kind: Dataplane
labels:
app: backend
default:
authConfig:
onAgentFailure: Deny
statusOnError: 503
timeout: 1s
requestBody:
maxSize: 8192
sendRawBody: false
appendPolicies:
- rego:
type: Secret
secretRef:
kind: Secret
name: backend-authz-policyCopied!
type: MeshOPA
name: authorize-with-body
mesh: default
spec:
targetRef:
kind: Dataplane
labels:
app: backend
default:
authConfig:
onAgentFailure: Deny
statusOnError: 503
timeout: 1s
requestBody:
maxSize: 8192
sendRawBody: false
appendPolicies:
- rego:
type: Secret
secretRef:
kind: Secret
name: backend-authz-policyCopied!
Adjust konnect_mesh_control_plane.my_meshcontrolplane.id and konnect_mesh.my_mesh.name according to your current configuration.
resource "konnect_mesh_opa" "authorize_with_body" {
provider = konnect-beta
type = "MeshOPA"
name = "authorize-with-body"
spec = {
target_ref = {
kind = "Dataplane"
labels = {
app = "backend"
}
}
default = {
auth_config = {
on_agent_failure = "Deny"
status_on_error = 503
timeout = "1s"
request_body = {
max_size = 8192
send_raw_body = false
}
}
append_policies = [
{
rego = {
type = "Secret"
secret_ref = {
kind = "Secret"
name = "backend-authz-policy"
}
}
}
]
}
}
labels = {
"kuma.io/mesh" = konnect_mesh.my_mesh.name
}
cp_id = konnect_mesh_control_plane.my_meshcontrolplane.id
mesh = konnect_mesh.my_mesh.name
}
Copied!