istiod crash via AuthorizationPolicy with empty to or from entry in ambient mode
Description
An AuthorizationPolicy with an empty to or from entry crashes istiod mesh-wide in ambient mode, and istiod crash-loops until the policy is removed.
Details
In ambient mode istiod converts each AuthorizationPolicy for ztunnel in handleRule (pilot/pkg/serviceregistry/ambient/authorization.go). It reads to.operation and from.source without a nil check, so a rule with to: [{}] or from: [{}] panics on a krt goroutine and takes istiod down. The CRD schema does not require operation or source, so only the validating webhook rejects these objects. When an AuthorizationPolicy is not validated, e.g. global.configValidation=false, an install without istiod-default-validator (no default revision) and an object with no istio.io/rev label, or the fail-open window before the webhook is ready, the object is stored and istiod crash-loops on every restart until it is deleted. The sidecar and waypoint path is not affected.
Patches
Fixes are available in 1.30.8 and 1.31.4
Workarounds
Keep the validating webhook enforcing for all AuthorizationPolicy objects (global.configValidation=true, and a default revision or default revision tag so istiod-default-validator exists). Delete the offending AuthorizationPolicy to recover.
Proof of concept
- Install Istio with ambient mode and an AuthorizationPolicy path that skips validation (e.g.
--set values.global.configValidation=false). - In any namespace, create:
```yaml apiVersion: security.istio.io/v1 kind: AuthorizationPolicy metadata: name: crash spec: rules:
- to:
- {} ```
- istiod panics with a nil pointer dereference and crash-loops; deleting the AuthorizationPolicy recovers it.
from: [{}]has the same effect.
Impact
Denial of service against the istiod control plane. A tenant with AuthorizationPolicy-create in their own namespace can crash istiod for the whole mesh, crossing a namespace boundary. Config distribution and certificate rotation stall mesh-wide until the policy is removed. Ambient mode only, and only where the AuthorizationPolicy is not rejected by the validating webhook.