Production guardrails
Rules that ask for confirmation, warn, or block risky commands on production servers.
Production guardrails
Guardrails check each command line before it runs on a host marked Production, and can ask you
to confirm it, warn you, or block it. They catch mistakes like running rm -rf or restarting a
service in the wrong tab.
When they apply
- When you press Enter in a terminal, or run a command from the Blocks composer, on a Production host.
- When you run a snippet on several hosts: Block rules refuse the run if any host is Production.
- On Staging hosts too, if you turn on Settings › Guardrails › Also apply to Staging hosts.
Actions
| Action | What happens |
|---|---|
| Confirm | Harbor holds the command and asks before sending it. In Blocks mode it appears as an orange block with Cancel and Run on production. |
| Warn | The command runs, and Harbor shows a warning. |
| Block | The command isn’t sent. |
Default rules
| Pattern | Why | Action |
|---|---|---|
rm -rf * |
Recursive delete | Confirm |
systemctl stop|restart * |
Stops a running service | Confirm |
chmod -R 777 * |
Opens files to every user | Confirm |
DROP DATABASE|TABLE * |
Destroys data permanently | Block |
shutdown|reboot|poweroff |
Takes the host offline | Warn |
Edit rules
Open Settings › Guardrails to:
- Add rule with a pattern, an action and a reason (shown when it matches),
- edit or delete rules,
- Try a command to see which rule matches it, and
- Reset to defaults.
Pattern syntax
- Words are separated by spaces and must appear in that order.
a|baccepts either word:systemctl stop|restart.- A
*on its own matches the rest of the line;*inside a word matches any characters. - Matching ignores case, and finds the command anywhere in the line, such as after
sudo,&∨. - The last word must end there, so
rebootdoesn’t matchrebooted.
The first rule that matches decides the action.
Limits
Guardrails check the command line you type. They’re a safety net against slips, not a security boundary: they don’t see commands inside scripts, aliases or programs you start, and someone determined can work around them. Use server-side permissions (sudo rules, database roles) to enforce what people may do.