Rules are created and managed in the console at app.subnomic.com.
Create a rule
- Go to Guardrails → New rule.
- Give it a name and a regex pattern (matched case-insensitively against the statement).
- Choose an action and severity, and a priority (lower = checked first).
- Save. Toggle Enabled on/off any time.
Common rules (recipes)
Copy the pattern into a new rule and pick the action. Patterns are case-insensitive, so drop
also matches DROP.
SELECTs too (e.g. require approval to read a sensitive table). RBAC's read/write
split is separate and applies first.
SQL (Postgres / MySQL)
Block dropping tables, databases or schemas outright.
Block TRUNCATE (instant, irreversible data wipe).
Block DELETE / UPDATE that has no WHERE clause (whole-table change).
Require approval before any write (DELETE / UPDATE / INSERT).
Block privilege / user-management statements.
Require approval to read a sensitive table (e.g. payments / pii) — yes, this gates SELECTs.
Discourage unbounded SELECT * (gate it behind approval).
Aggressive: require approval for any read on this target.
Redis
Block wiping the whole keyspace.
Gate admin / expensive commands (CONFIG, SHUTDOWN, KEYS *).
Mongo
Block destructive Mongo commands (the query is a JSON command document).
SSH (server terminals)
Set the rule's target type to server (or * for everything). The
pattern is matched against each command line you type — evaluated when you press Enter, before it reaches
the host. A denied command never runs; the line is cleared and a notice is shown.
Block recursive deletes that touch the filesystem root.
Block commands that take the host down.
Gate service-disrupting actions behind a just-in-time grant.
bash -c "…", base64 / eval, here-docs,
:!cmd from an editor, history recall, or pasting multi-line scripts). Parsing is also suspended
inside full-screen apps (vim, htop, less). Real enforcement stays in RBAC, the per-server
require approval to connect flag, and full session recording — guardrails are a guard against
mistakes and casual misuse on top.
Allow exceptions
Because the first matching rule wins, put a narrow allow rule at a lower priority (checked first) to carve an exception out of a broader deny:
# priority 10 — allow deletes on the scratch table pattern: \bdelete\s+from\s+scratch\b action: allow # priority 100 — deny every other delete pattern: \bdelete\b action: deny
\b marks a word boundary so \bdrop\b doesn't match "dropdown";
\s+ matches any whitespace; ^ anchors to the start (handy for Redis commands).
Patterns match the raw statement text, so they are a safety net, not a SQL parser — keep them simple and
layer deny + require_approval.
What happens
- deny — the query or command is blocked, recorded, and a system log is written.
- require_approval — blocked unless the user holds an active just-in-time grant for that target (see Access requests). The database console shows a "Request access" button; the SSH terminal shows a dismissible banner without dropping the session.
Guardrails apply per-query to the database console and per-command to SSH terminals (set a rule's target type to server). If the rule set can't be loaded, evaluation fails closed — the statement is blocked rather than allowed.