Usage
Description
The REPL provides an interactive environment where you can:- Test CEL expressions used in policy conditions
- Experiment with Cerbos-specific functions and variables
- Validate expression syntax before using them in policies
- Learn CEL syntax interactively
Flags
Path to history file for storing command historyIf not specified, history is stored in the default user data directory
Interactive Commands
Once in the REPL, you can use the following:- Enter expressions: Type any valid CEL expression and press Enter
- Multi-line mode: The REPL automatically detects incomplete expressions
- Ctrl+C: Exit the REPL
- Up/Down arrows: Navigate command history
- Tab completion: Auto-complete function names and variables
Examples
Start the REPL
Test a simple expression
Test condition expressions
Test Cerbos functions
Test complex conditions
Available Variables
The REPL provides access to common request context variables:request.principal- Principal (user) informationrequest.resource- Resource being accessedrequest.auxData- Auxiliary data from the requestvariables- Exported variables from policies
Available Functions
All Cerbos CEL functions are available in the REPL:Standard CEL Functions
- String manipulation:
contains(),startsWith(),endsWith(),matches() - Collection operations:
size(),in,all(),exists(),filter(),map() - Arithmetic:
+,-,*,/,% - Comparison:
==,!=,<,<=,>,>= - Logical:
&&,||,!
Cerbos-Specific Functions
hierarchy()- Generate scope hierarchytimeSince()- Calculate time since a timestampnow()- Current timestamptimestamp()- Parse timestamp string
History
Command history is automatically saved and persisted between sessions. The default location is:- Linux/macOS:
~/.local/share/cerbos/repl_history - Windows:
%LOCALAPPDATA%\cerbos\repl_history
Use Cases
Policy development
Policy development
Test condition expressions before adding them to your policies to ensure they work as expected.
Debugging
Debugging
Reproduce and test specific condition logic that may be causing unexpected authorization decisions.
Learning CEL
Learning CEL
Experiment with CEL syntax and functions in an interactive environment without needing to write full policies.
Expression validation
Expression validation
Verify that complex expressions evaluate correctly with different input values.
Notes
The REPL evaluates expressions in isolation. It does not have access to actual policies or make authorization decisions - it only evaluates the expressions you enter.