Skip to main content
The RBAC Simulator lets you test how your policies behave under different user roles and permissions. Define roles like Admin, User, and Guest, run policy evaluations with each role’s context injected, and compare results side-by-side to verify your access control logic works as expected.
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

  1. Open the RBAC Simulator and go to the Roles tab
  2. Click ”+ New Role”
  3. Fill in the role definition form
  4. 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

  1. Go to the Simulate tab
  2. Select one or more roles from the role list
  3. Configure an evaluation scenario (prompt, provider, model, parameters)
  4. Click Run Simulation
The simulator calls 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: true flag. 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.