Skip to main content

Policy Playground

The Policy Playground is an interactive browser tool for testing Igris governance policies against real gateway traffic before deploying them in production. URL: https://playground.igrisecurity.com The playground creates real policies and connections in your Igris account via the management API, fires actual requests through the MCP and LLM gateways, classifies the outcome (allowed / denied / redacted / alerted / error), then lets you clean up everything it created.

Before you start

You need:
  • A running Igris API and an API key (ig_...). Create the key under Settings → API Keys.
  • An LLM provider key, base URL, and model name. The playground requires them.
  • The bundled MCP mock server, reachable from both your browser and your Igris API (see below).
The playground creates and changes real connections and policies in your organization. The API key’s creator needs permission to manage them: connections:read, connections:write, policies:read, and policies:write. Owner, Admin, and Developer have these. An API key acts with its creator’s current role. See Roles and permissions.

Setup

On first launch, the playground opens a setup dialog. You cannot dismiss it until setup is complete. Click Test Connection. The dialog runs four checks, and all four must pass before Start Testing appears: Settings are stored in your browser’s localStorage, including both keys. To edit them later, click Settings in the header. That dialog can be closed with the X button, a click outside it, or Escape.

The MCP mock server

The playground ships its own mock MCP server with 28 tools across seven categories (file, database, code execution, network, destructive, system, and search), so MCP scenarios need no external server. It listens on port 3600 locally. Its URL is set at build time with NEXT_PUBLIC_MCP_URL (default http://localhost:3600). Both your browser and your Igris API must be able to reach it. The browser calls /health, and your API forwards tool calls to <MCP URL>/mcp. That means it cannot be localhost if your API runs elsewhere. The hosted playground uses https://mcp-playground.igrisecurity.com.

CORS

The playground calls your Igris API directly from the browser. The API’s CORS_ORIGIN setting must include the playground’s origin, for example https://playground.igrisecurity.com or http://localhost:3500. Otherwise the checks fail with the API shown as unreachable. If you run your own API, add the origin to CORS_ORIGIN and restart it.

What setup creates


Scenario Categories

The playground has eleven categories in four groups. Select one in the left sidebar to see its scenarios. The sidebar shows the number of scenarios in each category.

Running a Scenario

Click Run on a scenario card. The runner:
  1. Creates (or reuses) the required connection with POST /api/v1/connections
  2. Creates the scenario’s policy with POST /api/v1/policies, or reuses a policy that already has the same name
  3. Enables that policy and disables every other policy whose name starts with playground-, so only this scenario’s policy is enforced
  4. Fires the request or requests through the gateway
  5. Classifies each response and shows the result
Step 3 matters: the gateway uses the first matching policy, so leftover playground policies would give wrong results. It also means the playground edits the enabled flag of your playground- policies. Multi-request scenarios (rate limits, anomaly detection) show per-request status and a progress indicator. A result card links to View on dashboard. The link opens the Incidents page for denied and alert outcomes, but denials and alerts do not create incidents today, so look for them in the Audit Trail instead. The link assumes the dashboard runs on port 3200 next to an API on port 3100, so it is only reliable for local setups.

Paired Pass-Through

Detector-based cards (PII, Secrets, Injection, and Guard Actions) fire two requests under the same policy:
  1. A prompt containing the trigger content (an SSN, a secret, an injection phrase). The content guard acts on it according to the scenario.
  2. A clean prompt with no trigger content. The same policy lets it through to the LLM.
The result card shows one row per request. The allowed row displays the actual assistant reply returned by the model (choices[0].message.content). This shows that one policy blocks unsafe traffic while letting safe traffic pass.

Outcome Classification

The playground maps each gateway HTTP response to one of five outcomes:
The alert action forwards the request to upstream and logs the event, so the gateway response looks the same as allow. When a scenario expects alert and the request passes through cleanly, the playground reports alert. Confirm it in the Audit Trail, where the event shows the policy that matched, or through your policy_deny webhook. Alerts do not create incidents today. The playground cannot detect the alert from the response alone.

Cleanup

The playground tracks every connection slug and policy ID it creates in localStorage. Click Clean Up Resources at the bottom of the sidebar and confirm. It then:
  • Deletes tracked policies with DELETE /api/v1/policies/:id
  • Deletes tracked connections (playground-llm and playground-mcp) with DELETE /api/v1/connections/:slug
  • Treats resources that are already gone (404) as deleted
  • Keeps resources that fail to delete (auth error, network error) in tracking so a later cleanup can retry them
A message reports how many policies and connections were removed and lists any failures.
Cleanup removes policies and connections from your live Igris account, not just from the playground UI. If you renamed or reused a playground-created resource for real traffic, cleanup still deletes it.

How It Works

The playground is a static Next.js site that talks directly to your Igris API from the browser. There is no playground backend. Every request uses the API key you entered in setup. MCP scenarios send tool calls to POST /v1/mcp/:slug. LLM scenarios send chat completions to POST /llm/:slug/v1/chat/completions. The model field uses @slug/model syntax, and the playground substitutes the model name you configured at runtime.

Running it locally

Open http://localhost:3500 and enter your API URL and keys. The API’s CORS_ORIGIN must include http://localhost:3500.