The simulator runs entirely in the browser using your workspace’s role definitions stored in Supabase.
Overview
The RBAC Simulator is available inside any policy view in your workspace. It has three tabs:
Open the simulator from the policy editor — it appears below the code editor when you select a policy.
1. Defining Roles
A role represents a user type in your system. Each role has a name, a set of permissions, custom attributes, and metadata.Role Structure
Creating a Role
- Open the RBAC Simulator and go to the Roles tab
- Click ”+ New Role”
- Fill in the role definition form
- Click Save
Built-in Example Roles
2. Running Simulations
Simulations execute your policy code with a specific role’s context injected, so you can see exactly what decision the policy makes for each user type.How It Works
- Go to the Simulate tab
- Select one or more roles from the role list
- Configure an evaluation scenario (prompt, provider, model, parameters)
- Click Run Simulation
simulateWithRole() for each selected role. Your policy’s evaluate() function receives a context object containing the role:
3. Comparing Role Results
The Compare tab shows simulation results side-by-side and highlights where roles produce different outcomes.4. Importing and Exporting Roles
Role definitions can be shared across workspaces or teams using JSON import/export.Exporting Roles
Click the Export button in the simulator header. All roles are exported as a JSON file.Importing Roles
Click the Import button, select a JSON file, and the simulator validates each role’s structure before adding them.5. Examples
Example 1: PII Access Control Policy
Example 2: Permission-Based Write Guard
Example 3: Clearance-Level Gating
6. Tips and Best Practices
- Start with the built-in roles. Admin, User, and Guest cover the most common access patterns.
- Use attributes for business logic. Permissions control actions; attributes let policies make context-aware decisions.
- Test edge cases. Create a role with zero permissions to verify graceful handling.
- Export roles to version control. Keep role definitions alongside policies for CI/CD testing.
- Check the
simulation: trueflag. Use it to skip side effects during test runs. - Compare after every policy change. Run a quick simulation across all roles to catch unintended access changes.
Related Guides
- Getting Started — Workspace setup and policy basics
- Governance Workflow — Approval processes and policy lifecycle
- CI/CD Integration — Automated policy testing with GitHub Actions
- Policy Templates — Pre-built templates including RBAC Enforcement

