Recipes
Catalog of the regex rules and suppressions shipped with DefenseClaw's bundled policy packs — search, filter, and copy the YAML.
The recipe catalog is the same library the Policy creator draws from.
It holds every rule in the bundled strict pack, the strict pack's pre-judge strips and finding
suppressions, and the default pack's tool suppressions (the strict pack has none). The other
suppressions of the default and permissive packs are not in it; read them in the pack's
suppressions.yaml. Copy an entry's YAML into your own pack, or use the creator to drop one into a
draft and tune it.
Where these come from
Rules come from the strict pack's rules/ files. Suppressions come from
policies/guardrail/strict/suppressions.yaml, and tool suppressions from
policies/guardrail/default/suppressions.yaml. Each card names its source file. The catalog is generated at build
time by docs-site/scripts/build-policy-assets.ts, so it changes when the packs change.
Reading a recipe
| Field | Meaning |
|---|---|
kind | What this recipe slots into: a rule file (rule:secret, rule:command, …) or one of the three suppression layers (pre_judge_strip, finding_suppression, tool_suppression). |
id | Stable identifier the engine uses for findings and telemetry. Keep it stable across edits. |
pattern | The Go regexp (RE2) source the engine compiles. The creator's regex tester checks it is RE2-compatible. |
severity | CRITICAL, HIGH, MEDIUM or LOW. The active pack, or guardrail block-at and alert-at, maps it to an action. |
confidence | How often a match is a true positive, from 0 to 1. |
tags | Free-form labels for filtering and reporting. |
examples / counterexamples | Strings the creator's live tester runs through the pattern. Add your own in the regex tester. |
Each card's YAML view shows the entry as one list item. Paste a rule under the rules: key
of a file in your pack's rules/ directory, and a suppression under the matching list in
suppressions.yaml.
Write a rule with an agent
Hand this page to your agent
Paste this into your agent:
Read https://cisco-ai-defense.github.io/defenseclaw/docs/policies/recipes/llms.md and follow it. Show me the rule before you apply it.You are an AI agent. Turn one sentence from the user into one rule in a custom rule pack, check it offline, and apply it to one agent only after the user agrees.
Hard rules
- Observe first. Do not switch an agent to action mode, change a fail mode, disable a connector or edit
config.yamlby hand without the user's yes.use-packeditsconfig.yamlthrough the CLI; ask first. - Never put a real key, token or customer string in a rule or an example.
- Stop on a managed computer: exit code
3, or"deployment_mode": "managed_enterprise"indefenseclaw status --json(Managed command availability). There, the administrator delivers packs. - Never edit the shipped
default,strictorpermissivepacks. Copy one.
Steps
-
Restate the rule. Write one line: what command or content, which agent, what severity (
CRITICALalways blocks; lower severities follow the block level). Ask the user to confirm. -
Copy the default pack.
PACK=~/.defenseclaw/policies/guardrail/my-rule cp -R ~/.defenseclaw/policies/guardrail/default "$PACK"Expected: no output. If the source folder is missing, run
defenseclaw initfirst and tell the user. In every mode, observe included, DefenseClaw blocks an agent that copies into~/.defenseclaw(tamper.detector_state_write: DefenseClaw protects its own files with every rule pack). Then ask the user to run step 2 themselves, and continue. -
Write the rule file. Use this shape, which the quickstart demo also uses. Replace the id, expression, pattern and title.
version: 1 category: my-rule rules: - id: MY-RULE-1 tool_call_only: true expression: >- f.commands.exists(c, 'example-marker' in c.argv) pattern: '\bexample-marker\b' title: "Example marker" severity: CRITICAL confidence: 0.99 tags: [custom]Save it as
$PACK/rules/my-rule.yaml.expressionis a CEL check on the parsed command;patternis the RE2 fallback (CEL reference, Regex cookbook). -
Validate offline.
defenseclaw guardrail validate-pack "$PACK"Expected:
Rule pack valid: "/home/alice/.defenseclaw/policies/guardrail/my-rule" rules: 240/244 enabled across 8 files components: judges=4 judge_categories=23 local_patterns=11 suppressions=9 sensitive_tools=6 digest: b8f9…13e9e0 files digest: 4b04…8fa71b (the guardrail.custom_packs pin)If it prints
Rule pack invalidand exits1: the next line is<code> at <file>: <reason>. Fix that file and repeat. Do not apply an invalid pack. -
Show the user the rule and the digest. Ask: "Apply this to
<agent>only?" -
Apply to one agent, after the user says yes.
defenseclaw guardrail use-pack my-rule --connector <agent>Expected: the pack is validated, its digest pinned in
guardrail.custom_packs.my-rule, and the agent switched to it. The gateway reloads without a restart. If it differs: quote the message. Do not editconfig.yamlby hand. -
Check.
defenseclaw guardrail list-packs defenseclaw doctorExpected:
list-packsshows<agent>usingmy-rule; doctor shows no new[FAIL]. Optionally ask the user to run the matching command in the agent in observe mode and look atdefenseclaw alerts --limit 5. The rule blocks only when that agent is in action mode; that switch is the user's decision. -
To undo:
defenseclaw guardrail use-pack --clear --connector <agent>.
Report
Reply with:
- The user's sentence and the rule you wrote (the YAML).
- The
validate-packresult and digest. - The agent it applies to and whether that agent is in observe or action mode.
- The undo command.
Browse the recipes
- webhook.site (known exfil)rule:c2RECIPE-C2-WEBHOOK-SITEegress_external
Pattern shipped in the bundled strict rule pack (c2.yaml). Severity HIGH.
YAML
- id: C2-WEBHOOK-SITE pattern: (?i)(?:^|[^a-zA-Z0-9-])webhook\.site(?:[^a-zA-Z0-9.-]|$) title: webhook.site (known exfil) severity: HIGH confidence: 0.9 tags: - exfiltration - c2policies/guardrail/strict/rules/c2.yaml - ngrok tunnel (exfil risk)rule:c2RECIPE-C2-NGROKegress_external
Pattern shipped in the bundled strict rule pack (c2.yaml). Severity HIGH.
YAML
- id: C2-NGROK pattern: (?i)(?:^|[^a-zA-Z0-9-])(?:ngrok\.io|ngrok-free\.app)(?:[^a-zA-Z0-9.-]|$) title: ngrok tunnel (exfil risk) severity: HIGH confidence: 0.85 tags: - exfiltration - c2policies/guardrail/strict/rules/c2.yaml - Pipedream (known exfil)rule:c2RECIPE-C2-PIPEDREAMegress_external
Pattern shipped in the bundled strict rule pack (c2.yaml). Severity HIGH.
YAML
- id: C2-PIPEDREAM pattern: (?i)pipedream\.net title: Pipedream (known exfil) severity: HIGH confidence: 0.9 tags: - exfiltration - c2policies/guardrail/strict/rules/c2.yaml - RequestBin (known exfil)rule:c2RECIPE-C2-REQUESTBINegress_external
Pattern shipped in the bundled strict rule pack (c2.yaml). Severity HIGH.
YAML
- id: C2-REQUESTBIN pattern: (?i)requestbin\.com title: RequestBin (known exfil) severity: HIGH confidence: 0.9 tags: - exfiltration - c2policies/guardrail/strict/rules/c2.yaml - HookBin (known exfil)rule:c2RECIPE-C2-HOOKBINegress_external
Pattern shipped in the bundled strict rule pack (c2.yaml). Severity HIGH.
YAML
- id: C2-HOOKBIN pattern: (?i)hookbin\.com title: HookBin (known exfil) severity: HIGH confidence: 0.9 tags: - exfiltration - c2policies/guardrail/strict/rules/c2.yaml - Burp Collaborator (pentest C2)rule:c2RECIPE-C2-BURPegress_external
Pattern shipped in the bundled strict rule pack (c2.yaml). Severity HIGH.
YAML
- id: C2-BURP pattern: (?i)burpcollaborator\.net title: Burp Collaborator (pentest C2) severity: HIGH confidence: 0.9 tags: - exfiltration - c2policies/guardrail/strict/rules/c2.yaml - interact.sh (OOB exfil)rule:c2RECIPE-C2-INTERACTSHegress_external
Pattern shipped in the bundled strict rule pack (c2.yaml). Severity HIGH.
YAML
- id: C2-INTERACTSH pattern: (?i)interact\.sh title: interact.sh (OOB exfil) severity: HIGH confidence: 0.9 tags: - exfiltration - c2policies/guardrail/strict/rules/c2.yaml - oast.fun (OOB testing)rule:c2RECIPE-C2-OASTegress_external
Pattern shipped in the bundled strict rule pack (c2.yaml). Severity HIGH.
YAML
- id: C2-OAST pattern: (?i)(?:^|[^a-zA-Z0-9-])oast\.fun(?:[^a-zA-Z0-9.-]|$) title: oast.fun (OOB testing) severity: HIGH confidence: 0.85 tags: - exfiltration - c2policies/guardrail/strict/rules/c2.yaml - Canary Tokensrule:c2RECIPE-C2-CANARYegress_external
Pattern shipped in the bundled strict rule pack (c2.yaml). Severity MEDIUM.
YAML
- id: C2-CANARY pattern: (?i)canarytokens\.com title: Canary Tokens severity: MEDIUM confidence: 0.75 tags: - exfiltration - c2policies/guardrail/strict/rules/c2.yaml - Pastebin raw fetchrule:c2RECIPE-C2-PASTEBINegress_external
Pattern shipped in the bundled strict rule pack (c2.yaml). Severity MEDIUM.
YAML
- id: C2-PASTEBIN pattern: (?i)pastebin\.com/raw/ title: Pastebin raw fetch severity: MEDIUM confidence: 0.7 tags: - exfiltration - c2policies/guardrail/strict/rules/c2.yaml - AWS metadata endpoint (SSRF)rule:c2RECIPE-C2-METADATA-AWSsensitive_accessegress_external
Pattern shipped in the bundled strict rule pack (c2.yaml). Severity CRITICAL.
YAML
- id: C2-METADATA-AWS expression: f.commands.exists(c, c.argv_complete && defenseclaw.guardrail.semantic.v1.OperationKind.OPERATION_KIND_FETCH in c.operations && f.network.exists(n, n.command_id == c.id && n.action in [defenseclaw.guardrail.semantic.v1.NetworkAction.NETWORK_ACTION_DOWNLOAD, defenseclaw.guardrail.semantic.v1.NetworkAction.NETWORK_ACTION_CONNECT])) pattern: 169\.254\.169\.254 title: AWS metadata endpoint (SSRF) severity: CRITICAL confidence: 0.95 tags: - ssrf - credentialpolicies/guardrail/strict/rules/c2.yaml - GCP metadata endpoint (SSRF)rule:c2RECIPE-C2-METADATA-GCPsensitive_accessegress_external
Pattern shipped in the bundled strict rule pack (c2.yaml). Severity CRITICAL.
YAML
- id: C2-METADATA-GCP pattern: (?i)(?:^|[^a-zA-Z0-9-])metadata\.google\.internal(?:[^a-zA-Z0-9.-]|$) title: GCP metadata endpoint (SSRF) severity: CRITICAL confidence: 0.95 tags: - ssrf - credentialpolicies/guardrail/strict/rules/c2.yaml - Azure metadata endpoint (SSRF)rule:c2RECIPE-C2-METADATA-AZUREsensitive_accessegress_external
Pattern shipped in the bundled strict rule pack (c2.yaml). Severity CRITICAL.
YAML
- id: C2-METADATA-AZURE pattern: 169\.254\.169\.254/metadata title: Azure metadata endpoint (SSRF) severity: CRITICAL confidence: 0.95 tags: - ssrf - credentialpolicies/guardrail/strict/rules/c2.yaml - AWS metadata endpoint (hex-encoded SSRF)rule:c2RECIPE-C2-METADATA-HEXsensitive_accessegress_external
Pattern shipped in the bundled strict rule pack (c2.yaml). Severity CRITICAL.
YAML
- id: C2-METADATA-HEX pattern: (?i)0xa9fea9fe title: AWS metadata endpoint (hex-encoded SSRF) severity: CRITICAL confidence: 0.95 tags: - ssrf - credentialpolicies/guardrail/strict/rules/c2.yaml - AWS metadata endpoint (decimal-encoded SSRF)rule:c2RECIPE-C2-METADATA-DECIMALsensitive_accessegress_external
Pattern shipped in the bundled strict rule pack (c2.yaml). Severity CRITICAL.
YAML
- id: C2-METADATA-DECIMAL pattern: (?:^|[/])2852039166(?:$|[/]) title: AWS metadata endpoint (decimal-encoded SSRF) severity: CRITICAL confidence: 0.93 tags: - ssrf - credentialpolicies/guardrail/strict/rules/c2.yaml - AWS metadata endpoint (octal-encoded SSRF)rule:c2RECIPE-C2-METADATA-OCTALsensitive_accessegress_external
Pattern shipped in the bundled strict rule pack (c2.yaml). Severity CRITICAL.
YAML
- id: C2-METADATA-OCTAL pattern: 0251\.0376\.0251\.0376 title: AWS metadata endpoint (octal-encoded SSRF) severity: CRITICAL confidence: 0.93 tags: - ssrf - credentialpolicies/guardrail/strict/rules/c2.yaml - DNS TXT query with high-entropy label (tunneling indicator)rule:c2RECIPE-C2-DNS-TUNNELegress_external
Pattern shipped in the bundled strict rule pack (c2.yaml). Severity HIGH.
YAML
- id: C2-DNS-TUNNEL pattern: (?i)\b(?:dig|host|nslookup|drill)\b\s+[^;\n]*\$\((?:whoami|hostname|id(?:\s+-u)?|cat\s+(?:/etc/hostname|/etc/machine-id))\)[A-Za-z0-9._-]*\.[A-Za-z0-9-]+(?:\.[A-Za-z0-9-]+)+ title: DNS TXT query with high-entropy label (tunneling indicator) severity: HIGH confidence: 0.78 tags: - exfiltration - dns-tunnelpolicies/guardrail/strict/rules/c2.yaml - nslookup with hex subdomain (DNS exfil)rule:c2RECIPE-C2-DNS-EXFILegress_external
Pattern shipped in the bundled strict rule pack (c2.yaml). Severity HIGH.
YAML
- id: C2-DNS-EXFIL pattern: (?i)\bnslookup\b\s+[a-f0-9]{8,}\.\w+\. title: nslookup with hex subdomain (DNS exfil) severity: HIGH confidence: 0.8 tags: - exfiltration - dns-tunnelpolicies/guardrail/strict/rules/c2.yaml - SOUL.md active-file mutationrule:cognitive-fileRECIPE-COG-SOULsensitive_access
Pattern shipped in the bundled strict rule pack (cognitive.yaml). Severity CRITICAL.
YAML
- id: COG-SOUL tool_call_only: true expression: f.paths.exists(p, p.access in [defenseclaw.guardrail.semantic.v1.PathAccess.PATH_ACCESS_WRITE, defenseclaw.guardrail.semantic.v1.PathAccess.PATH_ACCESS_APPEND, defenseclaw.guardrail.semantic.v1.PathAccess.PATH_ACCESS_DELETE]) pattern: (?i)SOUL\.md title: SOUL.md active-file mutation severity: CRITICAL confidence: 0.95 tags: - cognitive-tamperingpolicies/guardrail/strict/rules/cognitive.yaml - IDENTITY.md active-file mutationrule:cognitive-fileRECIPE-COG-IDENTITYsensitive_access
Pattern shipped in the bundled strict rule pack (cognitive.yaml). Severity CRITICAL.
YAML
- id: COG-IDENTITY tool_call_only: true expression: f.paths.exists(p, p.access in [defenseclaw.guardrail.semantic.v1.PathAccess.PATH_ACCESS_WRITE, defenseclaw.guardrail.semantic.v1.PathAccess.PATH_ACCESS_APPEND, defenseclaw.guardrail.semantic.v1.PathAccess.PATH_ACCESS_DELETE]) pattern: (?i)IDENTITY\.md title: IDENTITY.md active-file mutation severity: CRITICAL confidence: 0.95 tags: - cognitive-tamperingpolicies/guardrail/strict/rules/cognitive.yaml - MEMORY.md mutation or referencerule:cognitive-fileRECIPE-COG-MEMORYsensitive_access
Pattern shipped in the bundled strict rule pack (cognitive.yaml). Severity HIGH.
YAML
- id: COG-MEMORY expression: f.paths.exists(p, p.access in [defenseclaw.guardrail.semantic.v1.PathAccess.PATH_ACCESS_WRITE, defenseclaw.guardrail.semantic.v1.PathAccess.PATH_ACCESS_APPEND, defenseclaw.guardrail.semantic.v1.PathAccess.PATH_ACCESS_DELETE]) pattern: (?i)MEMORY\.md title: MEMORY.md mutation or reference severity: HIGH confidence: 0.85 tags: - cognitive-tamperingpolicies/guardrail/strict/rules/cognitive.yaml - CLAUDE.md active-file mutationrule:cognitive-fileRECIPE-COG-CLAUDE-MDsensitive_access
Pattern shipped in the bundled strict rule pack (cognitive.yaml). Severity HIGH.
YAML
- id: COG-CLAUDE-MD tool_call_only: true expression: f.paths.exists(p, p.access in [defenseclaw.guardrail.semantic.v1.PathAccess.PATH_ACCESS_WRITE, defenseclaw.guardrail.semantic.v1.PathAccess.PATH_ACCESS_APPEND, defenseclaw.guardrail.semantic.v1.PathAccess.PATH_ACCESS_DELETE]) pattern: (?i)CLAUDE\.md title: CLAUDE.md active-file mutation severity: HIGH confidence: 0.85 tags: - cognitive-tamperingpolicies/guardrail/strict/rules/cognitive.yaml - TOOLS.md active-file mutationrule:cognitive-fileRECIPE-COG-TOOLS-MDsensitive_access
Pattern shipped in the bundled strict rule pack (cognitive.yaml). Severity HIGH.
YAML
- id: COG-TOOLS-MD tool_call_only: true expression: f.paths.exists(p, p.access in [defenseclaw.guardrail.semantic.v1.PathAccess.PATH_ACCESS_WRITE, defenseclaw.guardrail.semantic.v1.PathAccess.PATH_ACCESS_APPEND, defenseclaw.guardrail.semantic.v1.PathAccess.PATH_ACCESS_DELETE]) pattern: (?i)TOOLS\.md title: TOOLS.md active-file mutation severity: HIGH confidence: 0.8 tags: - cognitive-tamperingpolicies/guardrail/strict/rules/cognitive.yaml - AGENTS.md active-file mutationrule:cognitive-fileRECIPE-COG-AGENTS-MDsensitive_access
Pattern shipped in the bundled strict rule pack (cognitive.yaml). Severity HIGH.
YAML
- id: COG-AGENTS-MD tool_call_only: true expression: f.paths.exists(p, p.access in [defenseclaw.guardrail.semantic.v1.PathAccess.PATH_ACCESS_WRITE, defenseclaw.guardrail.semantic.v1.PathAccess.PATH_ACCESS_APPEND, defenseclaw.guardrail.semantic.v1.PathAccess.PATH_ACCESS_DELETE]) pattern: a^ title: AGENTS.md active-file mutation severity: HIGH confidence: 0.8 tags: - cognitive-tamperingpolicies/guardrail/strict/rules/cognitive.yaml
Verify a policy locally
Test a policy-creator install script in an isolated DefenseClaw home, validate its Rego, and dry-run an admission decision before promotion.
Suppression cookbook
Patterns for tuning DefenseClaw's three LLM-judge suppression layers — pre-judge strips, finding suppressions, and tool suppressions — without losing real signals.