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's mistakes?
shellfirm will intercept any risky patterns and immediately prompt a small challenge that will double verify your action, think of it as a captcha for your terminal.
#######################
# RISKY COMMAND FOUND #
#######################
)
How does 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 to verify your command.
Example

Setup your shell
Install via brew
&&
Or download the binary file from releases page, unzip the file and move to /usr/local/bin folder.
Validate shellfirm installation
shellfirm --version
Verify installation
mkdir /tmp/shellfirm
cd /tmp/shellfirm
git reset --hard
Select your shell
Add shellfirm to the list of Oh My Zsh plugins when Zsh is loaded(inside ~/.zshrc):
plugins=(... shellfirm)
# Download bash-preexec hook functions.
# Source our file at the end of our bash profile (e.g. ~/.bashrc, ~/.profile, or ~/.bash_profile)
# Download shellfirm pre-exec function
# Load pre-exec command on shell initialized
# Add shellfirm to conf.d fishshell folder
:information_source: Open a new shell session
:eyes: :eyes: Verify installation :eyes: :eyes:
You should get a shellfirm prompt challenge.
If you didn't get the prompt challenge:
- Make sure the
shellfirm --versionreturns a valid response. - Make sure that you downloaded the Zsh plugin and added it to the Oh My Zsh plugins in .zshrc.
Risky commands
We have predefined a baseline of risky groups command that will be enabled by default, these are risky commands that might be destructive.
| Group | Enabled By Default |
|---|---|
| base | true |
| git | true |
| fs | true |
| fs-strict | false |
| kubernetes | false |
| kubernetes-strict | false |
| heroku | false |
| terraform | false |
Add/Remove new group checks
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 a risky command by hitting ^C
Ignore pattern:
You can disable one or more patterns in a selected group by running the command:
Deny pattern command:
Restrict user run command by select pattern id's that you not allow to run in the shell:
To Upgrade shellfirm
Contributing
Thank you for your interest in contributing! Please refer to contribution guidelines for guidance.
Copyright
Copyright (c) 2022 @kaplanelad. See LICENSE for further details.