shellfirm
How do I save myself from myself?
rm -rf *git reset --hardBefore hitting the enter key?kubectl delete nsStop! you are going to delete a lot of resources- And many more!
Do you want to learn from other people mistakes?
shellfirm will intercept any risky patterns (defined by default or any other user custom additions) it will immediately prompt a small challenge that will double verify your action, think of a captcha for your terminal.
#######################
# RISKY COMMAND FOUND #
#######################
)
How dose it work?
shellfirm will evaluate all the shell commands behind the scenes.
If a risky pattern is detected, you will immediately get a prompt with the relevant warning for verification you command.
Example

Installation
- Install via brew
&&
OR download the binary file from releases page, unzip the file and move to /usr/local/bin folder.
- select shell type:
If you use Oh My Zsh
- Download zsh plugin:
- Add
shellfirmas part of the list of Oh My Zsh plugins when Zsh is loaded(inside ~/.zshrc):
plugins=(... shellfirm)
If you use basic Bash
:eyes: How to check the installation? :eyes:
$ mkdir /tmp/shellfirm
$ cd /tmp/shellfirm
$ git reset --hard
You should expect to get shellfirm prompt challenge.
If you didn't got the prompt challenge:
- Make sure the
shellfirm --versionreturn you valid response. - Make sure that you download the Zsh plugin and load as part of Oh My Zsh plugins.
Risky commands
We have defined a baseline of risky groups command that will be enabled by default ,these risky group commands might be destructive.
| Group | Enabled By Default |
|---|---|
| base | true |
| git | true |
| fs | true |
| fs-strict | false shellfirm config update --check-group fs-strict |
| kubernetes | false shellfirm config update --check-group kubernetes |
| kubernetes-strict | false shellfirm config update --check-group kubernetes-strict |
Custom checks definition examples
shellfirm creates by default a configuration file at ~/.shellfirm/config.yaml. Make sure that you only edit enable field (in case you want to disable a specific check), all the rest fields are managed by shellfirm command (shellfirm config --help).
challenge: Math # Math, Enter, Yes
includes:
- base
- fs
- git
checks:
- test: git reset
method: Contains
enable: true
description: "This command going to reset all your local changes."
from: git
challenge: Default
- test: "rm.+(-r|-f|-rf|-fr)*"
method: Regex
enable: true
description: "You are going to delete everything in the path."
from: fs
challenge: Default
- test: ">.+/dev/sda"
method: Regex
enable: true
description: "Writing the data directly to the hard disk drive and damaging your file system."
from: fs
challenge: Default
- test: "mv+.*/dev/null"
method: Regex
enable: true
description: "The files will be discarded and destroyed."
from: fs
challenge: Default
:information_source: To define custom checks that are not part of shillfirm baseline, add new checks to the config.yaml with the following field: from: custom.
- test: "command to check"
method: Regex
enable: true
description: "Example of custom check."
from: custom
challenge: Default
:information_source: To define different challenge for a checks you can change the field challenge: Default with a different check.
Add new group checks
Remove new group checks
Disable specific checks
Edit the configuration file in ~/.shellfirm/config.yaml and change the check to enable:false.
Change challenge:
Currently we support 3 different challenges when a risky command is intercepted:
Math- Default challenge which requires you to solve a math question.Enter- Required only to pressEnterto continue.Yes- Required typingyesto continue.
You can change the default challenge by running the command:
At any time you can cancel risky command by hitting ^C
Upgrades
- Upgrade
shellfirm:
Contributing
Thank you for your interest in contributing! Please refer to contribution guidelines for guidance.