> ## Documentation Index
> Fetch the complete documentation index at: https://pipedream.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Guardrails

> Block, redact or log content that matches your rules in what connectors list, receive and return.

> [!WARNING]
>
> **Beta:** Guardrails is in beta, and its settings pages stay hidden until the
> Pipedream team gives you a link that turns them on. To try it,
> [contact the Pipedream team](https://pipedream.com/docs/conduit/cloud.md#support).

Access policies decide which tools people can use. Guardrails decide what
content can pass through those tools. A guardrail checks everything that
passes between your workspace's remote connectors and your members' AI
assistants:

* the tools, prompts and resources a connector lists, including their
  descriptions and parameters;
* what a member's assistant sends a connector: a tool call's arguments, a
  prompt's arguments, the value a completion is for, and the address of a
  resource it reads;
* everything a connector sends back: tool results, prompts, resources,
  completions, errors, and the log messages and progress updates it sends
  while answering.

Rules read text with invisible formatting characters removed and special
letter forms replaced by ordinary ones (fullwidth and mathematical letters,
ligatures, non-breaking spaces), so neither can hide a phrase or a secret
from them. Write rules in ordinary characters: a rule that spells a word with
invisible characters or special letter forms could never match, so it's
refused when you save, with the spelling to use. Look-alike letters from
other scripts aren't converted; the **Look-alike letters** managed rule flags
them. A redacting guardrail masks every word that mixes scripts in full, so
a message spoofed throughout comes back mostly as `[REDACTED]`; for this rule,
**Block** or **Log** usually serves better than **Redact**.

Rules read structured content, such as a tool call's arguments, as the text
it holds: every string, member name and number, one after another with a line
break between them. A pattern that can cross a line break, such as one that
allows any whitespace between two words, can match across two values. One
that can't, as no credential pattern can, doesn't find a value split across
two, such as a key sent in two halves.

Admins still see what a connector actually lists, including anything
guardrails hide from assistants, in workspace settings and the API's
connector catalog.

Workspace admins manage guardrails in **Settings → Guardrails**.

> [!NOTE]
>
> Local connectors run on members' own machines, and their traffic never reaches
> Conduit, so guardrails don't check it. Conduit's own tools aren't checked
> either.

## What a guardrail is

A guardrail has a name, a list of rules, and an action. It matches when any of
its rules matches. Rules come in three kinds:

| Kind | What it is |
| - | - |
| **Managed rules** | Rules Conduit maintains and updates with each release. You choose which to use, and can read how each is written but can't edit them. |
| **Regular expression** | One pattern you write, in [RE2 syntax](https://github.com/google/re2/wiki/Syntax). Patterns are case-sensitive; start one with `(?i)` to ignore case. |
| **YARA rules** | YARA source your security team already maintains, pasted in or uploaded as `.yar`/`.yara` files (one rule per file). |

Managed rules cover:

* **Secrets:** leaked API keys, access tokens, private keys and passwords,
  using [gitleaks](https://github.com/gitleaks/gitleaks)' default rules with
  their keywords, entropy checks and allowlists. A rule runs only on content
  that contains one of its keywords, as gitleaks runs it.
* **Injection and tool poisoning:** instructions hidden in tool descriptions,
  prompt injection, coercive instructions, credential harvesting, data
  exfiltration, and code, command, script and SQL injection, using the YARA
  rules from [Cisco's MCP Scanner](https://github.com/cisco-ai-defense/mcp-scanner).
* **Hidden text:** invisible characters, bidirectional overrides, Unicode tag
  characters, and look-alike letters that mix Latin with Cyrillic or Greek.
* **Personal data:** email addresses, phone numbers, US Social Security
  numbers, payment card numbers (checked with the Luhn checksum) and IBANs
  (checked with their country's length and checksum).

YARA rules run on text, so only the text subset of YARA is supported: text and
regular-expression strings with the `nocase` and `fullword` modifiers, and
conditions built from those strings (`and`, `or`, `not`, `defined`, `any of`,
`all of`, `none of`, `N of` or `N% of`, and references to earlier rules,
private ones included). Conditions can also read where and how often a string
matches: counts (`#a`), offsets (`@a[i]`, `$a at 10`, `$a in (0..100)`) and
lengths (`!a[i]`), with arithmetic and comparisons over them, and `for` loops
over a range, a list of numbers or a set of strings. These count matches as
YARA does. Offsets are into the text being checked as Conduit reads it:
hidden characters removed and compatibility forms replaced, with the values
of a call joined by newlines. As in YARA, a regular expression's match counted
or measured is at most 1,024 bytes long (a text string's is as long as the
text), and at most 1,000,000 matches of a string are counted.
Conduit's answer differs from YARA's in a few cases, most of them where
YARA's depends on how it splits an expression internally:

* A string that only matches across more than 1,024 bytes still matches
  (`$a`), though it has no counted matches (`#a` is 0). In YARA it doesn't
  match at all; in Conduit, padding text past the limit doesn't hide what a
  rule looks for.
* When two alternatives of a regular expression both match at the same
  offset, Conduit always reports the first alternative's match, where YARA
  sometimes reports the other's. In `abc`, `/abc|ab/` is 3 bytes long; YARA
  can say 2.
* A `fullword` string matches when any of its matches from an offset is a
  whole word. YARA sometimes checks only one of them, so it can find nothing
  where Conduit finds a match: `/foo(b|bar)/ fullword` matches `foobar` in
  Conduit, not in YARA.
* YARA reads text as bytes and Conduit as characters, so outside ASCII a `.`
  or a character class matches a whole character rather than one byte.
* YARA counts the 1,024-byte limit from a piece of the match it finds first,
  not always from the start, so a long match can be cut differently.
* A repetition count over 1,000 (`a{0,1100}`) is refused when you save.
* YARA repeats `+` over a group that begins with an optional element only
  once, so `/xyzw(a?b)+/` matches 5 bytes of `xyzwbbbb` in YARA and all 8 in
  Conduit.
* A lazy repetition inside a lazy counted one (`(a|a{1,2}?c){0,2}?`) can
  match a different alternative in YARA.
* `nocase` matches the Unicode case variants of a letter (`k` matches the
  Kelvin sign), where YARA folds ASCII letters only.
* Conduit accepts a few things YARA refuses: `(?:...)` groups, a string no
  condition uses, a loop variable reusing an outer one's name, and a
  percentage of strings outside 1–100% (over 100% never holds).

As in YARA, a regular expression can't mix greedy and lazy quantifiers (`+`
and `+?`): saving a rule that adds one is refused. A guardrail already saved
with one keeps running and can still be renamed or switched to another action,
and testing runs such a rule as a saved one runs.

Modules, includes, global rules, hex strings, the `wide`, `xor` and `base64`
modifiers, file sizes (`filesize`), byte reads (`uint32` and the like),
bitwise operators and floating-point numbers are refused when you save, with
the rule that uses them named. So is a rule that would match when a string is
absent, since it would match almost everything. In a regular expression, byte
escapes such as `\xC3\xA9` match the character their bytes spell in UTF-8
(here `é`); escapes that don't spell whole characters, or that sit inside a
character class, are refused, since text never holds a lone byte.

## What happens when a rule matches

The guardrail's action decides what happens to a tool call, and to what a
prompt or completion request sends:

| Action | Tool call arguments | Tool call result |
| - | - | - |
| **Block** | The call isn't sent to the connector. | The result is withheld. |
| **Redact** | What matched is replaced with `[REDACTED]` before the call is sent. Hidden characters are removed instead. | What matched is replaced with `[REDACTED]`, and hidden characters are removed. |
| **Log** | The call goes through unchanged. | The result is returned unchanged. |

A blocked call returns an error that names the guardrail, never what it
matched. A match disguised with invisible characters or special letter forms
is masked as it's written, the disguising characters included. If a
redacting guardrail matches something redaction can't mask, such as a tool's
name or a match that spans two values, it blocks instead.
A prompt's arguments and the value a completion is for are masked or
blocked the same way before the request reaches the connector; a blocked
completion comes back empty. A resource address that matches a blocking or
redacting guardrail is refused before it's read, since an address can't be
masked.

Anything else a blocking or redacting guardrail matches is withheld:

* A tool, prompt or resource whose definition matches is left out of what the
  connector lists, so no assistant sees it. Members' tool lists on **Home**
  and the API's connector catalog leave it out too; admins still see every
  tool when editing a policy.
* A prompt or resource whose content matches is refused when it's requested.
* A completion that matches comes back empty.
* An error whose message matches is replaced by one naming the guardrail.
* A log message a connector sends while answering is dropped, and a progress
  update loses its message (its progress still shows).

This content reaches an assistant as context rather than as the result of a
call someone made, so it's never passed on once it matches, masked or not.

The one exception is a redacting guardrail whose only matches are hidden
characters (from the **Invisible characters**, **Bidirectional overrides**
and **Unicode tag characters** managed rules). Removing those characters changes
nothing a person can see, so the content passes with them removed: a tool
description, a prompt, a resource, a completion, a log message or a progress
update. Hidden characters in something that can't be rewritten, such as a
tool's name or a resource's address, still withhold it.

A logging guardrail only records its matches, here as everywhere: what it
matches still reaches the assistant.

## Create a guardrail

1. In **Settings → Guardrails**, select **Create guardrail**.
2. Name it. The name appears in members' error messages and in the audit log.
3. Choose its action.
4. Add rules with **Add rule**: built-in (managed) rules, a regular
   expression, YARA rules to paste, or YARA files to upload. A managed rule's
   **View definition** action shows how it's written.
5. To check the rules before you save, select **Test rules** and paste sample
   text. You see which rules match, where, and what redaction would leave.
6. Select **Create guardrail**.

A new guardrail takes effect immediately for every member of the workspace.
Connected assistants are told to refresh their tool lists, since a guardrail
can hide tools. Turn a guardrail off with its switch to stop it checking
anything without deleting it.

To try a rule on real traffic before it changes anything, create the guardrail
with **Log**, check the audit log, then change the action.

## If a guardrail can't run

Guardrails fail closed. If a stored guardrail can no longer run, for example
because a release stopped shipping a managed rule it uses, Conduit refuses the
workspace's connector traffic rather than let it through unchecked. The
guardrails page names the guardrail and the problem. Turn it off to restore
traffic, then fix or delete it.

A guardrail whose rules take longer than 15 seconds to compile can't be
saved. If one that's already saved takes that long to compile, for example
while the server is under heavy load, the workspace's traffic is refused for
about a minute and then Conduit compiles it again. If the server is too busy
to compile your rules when you save or test them, you're asked to try again
shortly; your rules aren't rejected.

A YARA condition that reads counts or offsets takes longer the more often its
strings match, and a `for` loop takes longer the more it iterates. Checking a
piece of text allows work in proportion to its length, up to about a quarter
of a second of processing for the YARA rules of all the workspace's blocking
and redacting guardrails together, and a quarter of that for its logging
ones. A condition that only checks which strings matched (`$a and not $b`,
`2 of them`) takes the same time on any text and always runs.

When a blocking or redacting guardrail needs more, the text is refused rather
than let through unchecked, and the member is told a guardrail's rules take
too long to check it: a loop over every pair of a string's matches in a long
text, say, or megabytes of text made of little but the phrases the rules look
for. A logging guardrail that runs out records that in the audit log and lets
the text through, without taking time from the guardrails that block. If a
guardrail blocks the text anyway, it's blocked as usual. A tool, prompt or
resource definition that can't be checked is left out of listings. Testing a
guardrail on such sample text says so too, checking the guardrail on its own
with the time its action allows. A blocking or redacting guardrail shares
that time with the workspace's others, so it can run out on text it tested
clean on.

## Audit log and telemetry

Every match is recorded in the workspace's audit log (**Settings → Audit Log**) as
`guardrail.blocked`, `guardrail.redacted` or `guardrail.matched` (for a
logging guardrail), with the guardrail, the rules that matched, the tool,
prompt or resource, and the member. It never includes the matched text. Content
a guardrail's YARA rules took too long to check is recorded the same way,
marked `too_costly` and with no rules: as `guardrail.blocked` for the
blocking or redacting guardrail whose rules took the time, with whatever
else matched beside it, and as `guardrail.matched` with the outcome
`too_costly` when a logging guardrail let it through unchecked. A
tool, prompt or resource definition that keeps matching is recorded once per
version of it, not on every listing, and as Conduit's own finding rather than
any one member's.

A logging guardrail that matches routine traffic adds one audit log entry per
matching call, and the audit log is kept indefinitely, so a broad logging
guardrail on a busy workspace grows it quickly. Matches in the log messages and
progress updates a connector sends during one call, and in the definitions of
one listing, are recorded up to a fixed number each; past that they're still
withheld, just not recorded again.

The guardrails list shows each guardrail's matches over the last 30 days and
when it last matched. Select the count to open the audit log on that
guardrail's history: its matches and every change to it.

Creating, changing and deleting guardrails is recorded as
`config.guardrail.created`, `config.guardrail.updated` and
`config.guardrail.deleted`, with each rule's kind and name but never its
pattern or YARA source.

The same events go to your [telemetry](https://pipedream.com/docs/conduit/configure/telemetry.md) exporters, and a
blocked tool call's error type is `denied_guardrail`.

## Limits

* A workspace can have up to 50 guardrails, each with up to 100 rules.
* A regular expression can be up to 4 KB, and YARA source up to 256 KB.
* Base64 media isn't checked: image and audio content, and resources whose
  type is an image, audio, video or font. Any other base64 resource is
  decoded and checked, whatever its type (none, `application/octet-stream`,
  `application/x-sh`). Text is checked as text, skipping the odd byte that
  isn't valid text. A binary file, such as a PDF or an archive, is checked
  only for the runs of plain text it contains (16 characters or more), so
  compressed content inside it isn't checked.
* Saving and testing guardrails is rate-limited per workspace.
* Withholding a tool's definition hides the tool from listings, but a
  client that already knows its name can still call it, directly or through
  `call_tool`. The call's arguments and result are checked like any other
  call's.
* A redacting guardrail can mask text values only. A match in a JSON member
  name or number (a card number sent as a number, for example) can't be
  masked without changing the data's shape, so the call is blocked instead.
