Skip to main content

Sometimes security is protection from yourself.

Project description

The Third Factor

Sometimes you're writing a dev tool script that your team needs, but you'd like everyone to be very careful when they use it, so you add an extra prompt.

Sometimes you want them to be REALLY careful when they use it; for these times, there's the Third Factor. The third factor is designed to eliminate the script user's ability to blindly press Y/Enter and do something dumb.

Suggested use cases:

  • Connecting to the production database
  • Deploying to prod from your local branch
  • Clearing an S3 bucket
  • Anything to do with git history rewriting
  • Twiddling config files directly in prod
  • When you just can't get that one person (you know who I mean) to stop and think

The possibilities are as endless as your team's capacity for unintentional destruction!

Installation

Definitely install this in your root python installation since you want it to be available everywhere.

pip install third-factor

Usage

Just slap it in your shell script before the part you don't want people to do!

Linux shell scripts

# Do some safe stuff here...

thirdfactor || exit 1

# NOW DO THE RISKY STUFF

Don't omit the exit 1! Otherwise your script will continue even if the user fails third-factor authentication.

Windows .bat file (No judgement)

Rem Do some safe stuff here...

thirdfactor
if !errorlevel! neq 0 exit /b !errorlevel!

Rem NOW DO THE RISKY STUFF

Demo

~/projects/third-factor$ python3 -m third_factor "connect to the prod db"
You're about to connect to the prod db, which is risky. Are you sure this is a good idea?
Type YES to continue: YES
--------------------------
Are you sure there isn't a better, safer way to achieve what you're about to do?
Type I AM SURE THERE IS NOT to continue: I AM SURE THERE IS NOT
--------------------------
You're not too sleep deprived, under-caffeinated, too many beers etc.?
Type I AM OF SOUND MIND to continue: I AM OF SOUND MIND
--------------------------
Prove it: type this random string.
Type PZBBEYNIBF to continue: PZBBEYNIBF
--------------------------
Let's cool off for 10 seconds and think...
1..2..3..4..5..6..7..8..9..10..
You're still sure?
Type YES to continue: YES
--------------------------
Be careful, and don't say you weren't warned…

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

third_factor-0.0.2.tar.gz (2.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

third_factor-0.0.2-py3-none-any.whl (2.4 kB view details)

Uploaded Python 3

File details

Details for the file third_factor-0.0.2.tar.gz.

File metadata

  • Download URL: third_factor-0.0.2.tar.gz
  • Upload date:
  • Size: 2.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.14

File hashes

Hashes for third_factor-0.0.2.tar.gz
Algorithm Hash digest
SHA256 034e67a520bc49c5a368f9fa0da7158bb8ebf2246ba1dfba0a9c745f349d815e
MD5 868d6067ed986863c42bd257a1044159
BLAKE2b-256 76558b5c9ad43cf512baf393f318653d846411aa47ca70a88133c481651e8863

See more details on using hashes here.

File details

Details for the file third_factor-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: third_factor-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 2.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.14

File hashes

Hashes for third_factor-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 d9de880cf66e1c02ecc9704e601153fddb656cca47d1515f85ef6a7daa24ae79
MD5 556aaafb5377e0709ee5146a31bcd600
BLAKE2b-256 e451b9c85a68d16e4c6dc06812d90e443c9cf0e6841c52ccb53e8bffbfcc7bcf

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page