Skip to content
Status

Security and Policy / Detection Rules

Detection Rules

The catalog of built-in and custom detection rules behind guardrail policies, with a playground for testing rules and AI-assisted custom rule authoring.

The Detection Rules tab of the Guardrails page catalogs the reusable rules that guardrail policies scan with: a built-in library grouped by category, and the organization’s custom rules. Policies use rules in both directions, to flag messages and to exempt them through exclusion rules. A rule detects nothing on its own until a policy turns it on.

Open it from Security and Policy > Guardrails in the dashboard and select the Detection Rules tab. Old links to the standalone Detection Rules page redirect to the tab.

Viewing the tab requires the org:admin scope.

This page covers:

  1. Select a category. Its rule list expands, one row per rule with the rule’s name and id.

    The Detection Rules catalog with the Secrets category highlighted and its rule list expanded below

  2. Select a rule. The rule sheet opens with the rule’s category, a description of what it detects, and a playground.

    The rule sheet for a secrets rule, showing its category, description, and playground

The Built-in group lists the detector categories from the detector category table, each with its rule count. The organization’s own rules sit above it in a Custom group.

Every rule sheet carries a playground that runs the rule with the same scanner code the production worker uses.

  1. Choose the input: Paste sample for pasted text, or Run on a chat to run the rule over an existing agent session, picked by external user.

  2. Paste a sample value, an MCP payload, or a chat message snippet, and select Run rule.

    The playground with the input mode radios, a pasted sample containing a fake API key, and the Run rule button highlighted

  3. Review the matches. Each match shows the rule id, the match span, the confidence, the category, the matched value, and a description of the finding.

    The playground result with the match count and a match row highlighted, showing span, confidence, category, and the matched value

A run that returns 0 matches on a value the rule should catch usually means the sample doesn’t match the detector’s canonical format. Built-in secret detectors are tuned to the issuing service’s exact token shape.

  1. Select Custom Detection Rule. The new rule sheet opens.

    The Detection Rules tab with the Custom Detection Rule button highlighted

  2. Describe what to detect and select Suggest with AI, or select Skip, fill manually to start from empty fields. Include a sample value or the format in the description, so the model writes a tight expression.

    The new rule sheet with a filled description of a token format and the Skip, fill manually and Suggest with AI buttons highlighted

  3. Review the suggested rule and adjust any field:

    • Rule ID: the identifier that policies and findings use to reference the rule. It always starts with custom., must be unique across all built-in and custom rules, and cannot change after creation
    • Title: the rule’s display name in the catalog and on findings
    • Description: what the rule detects and why it matters, shown to reviewers alongside findings
    • Detection expression: the CEL expression the scanner evaluates against message content. The example chips below it insert working patterns to start from

    The suggested rule with the rule ID, title, description, and CEL detection expression filled in

  4. Select Create rule. The rule appears in the Custom group of the catalog.

    The catalog with the Custom Rules group and a custom rule row highlighted, showing its title and CEL expression

A custom rule attaches to a policy from the Custom Rules section of the policy’s Detect step, where each rule is selected individually.

  1. In the Custom group, select the rule. Its sheet opens as an editor, with the rule’s fields and the playground.

    The custom rule editor sheet with the title, description, detection expression, playground, and Save changes button

  2. Adjust the title, description, or detection expression. Test the change in the playground, then select Save changes.

    The editor sheet with an edited description highlighted and the enabled Save changes button

  3. To remove the rule, select Delete rule in the sheet’s footer, beside Save changes. Deletion is immediate: there is no confirmation step.

Built-in rules cannot be edited or deleted. To narrow one, disable it for a policy on the Detect step’s Customize panel, or suppress specific values with an exclusion rule.