CEL by Example#
CEL (Common Expression Language) evaluates expressions against data—simple values, a Protobuf message, or a JSON object.
CEL's fast, portable, and safe: it's used in Kubernetes admission control, Google Cloud IAM conditions, Firebase security rules, Envoy Proxy routing, and Protovalidate's constraint rules.
Let's explore CEL together, starting with a simple User message:
{ "name" : "Alice" , "roles" : [ "admin" , "editor" , "viewer" ], "age" : 30 , "email" : "[email protected]" , "created" : timestamp ( "2025-12-14T00:00:00Z" ), "email_verified" : timestamp ( "2025-12-14T18:30:00Z" ) }
Strings and numbers#
A basic comparison: is the user over 18?
user . age >= 18 // result: true (bool)
Check the user's email domain with a string function.
user . email . endsWith ( "@example.com" ) // result: true (bool)
... continue reading