> ## Documentation Index
> Fetch the complete documentation index at: https://hoopdev-fix-add-missing-mechanic-for-session-download-button.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Guardrails Configuration

> Create and manage custom rules to protect and guide usage within your connections

<Frame>
  <img src="https://mintcdn.com/hoopdev-fix-add-missing-mechanic-for-session-download-button/JA0PdC0o4BPvOEZ9/images/clients/webapp/guardrails-light.png?fit=max&auto=format&n=JA0PdC0o4BPvOEZ9&q=85&s=72b33b3e272a794b1d5403d3212b7e0a" className="block dark:hidden" width="1408" height="768" data-path="images/clients/webapp/guardrails-light.png" />

  <img src="https://mintcdn.com/hoopdev-fix-add-missing-mechanic-for-session-download-button/JA0PdC0o4BPvOEZ9/images/clients/webapp/guardrails-dark.png?fit=max&auto=format&n=JA0PdC0o4BPvOEZ9&q=85&s=9c0595d0ddc47425eb5565cf0278175c" className="hidden dark:block" width="1408" height="768" data-path="images/clients/webapp/guardrails-dark.png" />
</Frame>

Guardrails allow you to create custom rules that protect and guide how your connections are used. These rules can be applied to specific connections or serve as default policies across your organization.

## Setup

This service currently supports Microsoft Presidio for configuring Guardrails rules.

<Steps>
  <Step title="Install">
    Check the Microsoft Presidio documentation to install it.

    <CardGroup cols={2}>
      <Card title="Microsoft Presidio Docker Installation" icon="docker" href="https://microsoft.github.io/presidio/installation/#docker-installation">
        Visit the Microsoft Presidio documentation to install it using Docker.
      </Card>

      <Card title="Microsoft Presidio Kubernetes Installation" icon="dharmachakra" href="https://microsoft.github.io/presidio/samples/deployments/k8s/">
        Visit the Microsoft Presidio documentation to install it using Kubernetes.
      </Card>
    </CardGroup>
  </Step>

  <Step title="Set up">
    Set the new environment variables in hoop.dev's Gateway with the following values:

    | Environment variable key    | Value                       |
    | --------------------------- | --------------------------- |
    | `DLP_PROVIDER`              | mspresidio                  |
    | `DLP_MODE`                  | `best-effort` or `strict`   |
    | `MSPRESIDIO_ANALYZER_URL`   | `<host-to-analyzer:port>`   |
    | `MSPRESIDIO_ANONYMIZER_URL` | `<host-to-anonymizer:port>` |
  </Step>

  <Step title="Run hoop.dev's Gateway with the new configs">
    After setting up the environment variables, hoop.dev will use Microsoft Presidio to mask sensitive data in real-time in the data stream of any connection you configure.
  </Step>
</Steps>

## Creating a Guardrail

<Steps>
  <Step title="Access Guardrails">
    Navigate to the Guardrails section from the sidebar menu
  </Step>

  <Step title="Create New">
    Click the "Create a new Guardrail" button in the top-right corner
  </Step>

  <Step title="Set Basic Information">
    Provide:

    * Name for the guardrail
    * Description (Optional) explaining its purpose
  </Step>

  <Step title="Configure Rules">
    Provide:

    * Input Rules
    * Output Rules
  </Step>
</Steps>

## Configuring Rules

### Input Rules

Rules that evaluate incoming commands or queries:

* **Pattern Matching**: Define patterns to match specific commands or queries
* **Conditions**: Set conditions that trigger the rule

### Output Rules

Rules that control or modify the output of commands:

* **Information Control**: Control what information can be returned

## Rule Types

<AccordionGroup>
  <Accordion title="Pattern Rules">
    Create rules based on command or query patterns:

    * Regular expressions
    * Exact matches
    * Wildcard patterns
  </Accordion>

  <Accordion title="Security Rules">
    Enforce security policies:

    * Block dangerous commands
    * Require additional approvals
    * Limit access to sensitive data
  </Accordion>

  <Accordion title="Compliance Rules">
    Ensure compliance requirements:

    * Data access restrictions
    * Audit logging requirements
    * Regulatory compliance rules
  </Accordion>
</AccordionGroup>

## Applying Guardrails

### Connection Assignment

<Steps>
  <Step title="Select Connections">
    Choose which connections will use the guardrail
  </Step>

  <Step title="Set Priority">
    Define the order of rule evaluation when multiple guardrails apply
  </Step>

  <Step title="Configure Behavior">
    Specify how rules should be enforced:

    * Block non-compliant actions
    * Warn users
    * Require approval
  </Step>
</Steps>

## Best Practices

<CardGroup cols={2}>
  <Card title="Start Simple" icon="list-check">
    Begin with basic rules and expand as needed
  </Card>

  <Card title="Test Rules" icon="vial">
    Validate rules in a test environment first
  </Card>

  <Card title="Document Purpose" icon="file-lines">
    Clearly describe what each rule does
  </Card>

  <Card title="Regular Review" icon="rotate">
    Periodically review and update rules
  </Card>
</CardGroup>

## Learn More

<CardGroup cols={2}>
  <Card title="Managing Access" icon="users" href="/clients/webapp/managing-access">
    Learn about access control configuration
  </Card>

  <Card title="Command Reviews" icon="shield-check" href="/setup/configuration/reviews/command-reviews-configuration">
    Configure command review workflows
  </Card>
</CardGroup>
