Shhh
Keep secrets out of emails or chat logs, share them using secure links with passphrase and expiration dates.
Keep secrets out of emails or chat logs, share them using secure links with passphrase and expiration dates.
<p align="center"> <img width="100px" src="https://github.com/smallwat3r/shhh/blob/master/shhh/static/img/logo.png" /> </p> <p align="center">Keep secrets out of emails and chat logs.</p> <p align="center"> <a href="https://codecov.io/gh/smallwat3r/shhh" rel="nofollow"><img src="https://codecov.io/gh/smallwat3r/shhh/branch/master/graph/badge.svg" style="max-width:100%;"></a> <a href="https://codeclimate.com/github/smallwat3r/shhh/maintainability" rel="nofollow"><img src="https://api.codeclimate.com/v1/badges/f7c33b1403dd719407c8/maintainability" style="max-width:100%;"></a> <a href="https://github.com/smallwat3r/shhh/blob/master/LICENSE" rel="nofollow"><img src="https://img.shields.io/badge/License-MIT-green.svg" style="max-width:100%;"></a> </p> ## Sunsetting... This project is being sunset in favor of [secretapi](https://github.com/smallwat3r/secretapi), which offers a more streamline approach to achieving the same functionality as shhh. ## What is it? **Shhh** is a tiny Flask app to create encrypted secrets and share them securely with people. The goal of this application is to get rid of plain text sensitive information into emails or chat logs. Shhh is deployed [here](https://www.shhh-encrypt.com) (_temporary unavailable until new deployment solution_), but **it's better for organisations and people to deploy it on their own personal / private server** for even better security. You can find in this repo everything you need to host the app yourself. Or you can **one-click deploy to Heroku** using the below button. It will generate a fully configured private instance of Shhh immediately (using your own server running Flask behind Gunicorn and Nginx, and your own PostgreSQL database). You can see the Heroku configuration files [here](https://github.com/smallwat3r/shhh-heroku-deploy/tree/main). [![Deploy][heroku-shield]][heroku] (see [here](#initiate-the-database-tables) to initiate the db tables after deploying on Heroku) Also, checkout [shhh-cli](https://github.com/smallwat3r/shhh-cli), a Go client to interact with the Shhh API from the command line. ## How does it work? The sender has to set an expiration date along with a passphrase to protect the information he wants to share. A unique link is generated by Shhh that the sender can share with the receiver in an email, alongside the temporary passphrase he created in order to reveal the secret. The secret will be **permanently removed** from the database as soon as one of these events happens: * the expiration date has passed. * the receiver has decrypted the message. * the amount of tries to open the secret has exceeded. The secrets are encrypted in order to make the data anonymous, especially in the database, and the passphrases are not stored anywhere. _Encryption method used: Fernet with password, random salt value and strong iteration count (100 000)._ _Tip: for better security, avoid writing any info on how/where to use the secret you're sharing (like urls, websites or emails). Instead, explain this in your email or chat, with the link and passphrase generated from Shhh. So even if someone got access to your secret, there is no way for the attacker to know how and where to use it._ ## Is there an API? Yes, you can find some doc [here](https://app.swaggerhub.com/apis-docs/smallwat3r/shhh-api/1.0.0). ## How to launch Shhh? These instructions are for development purpose only. For production use you might want to use a more secure configuration. #### Deps The application will use the development env variables from [/environments/dev-docker-postgres.env](https://github.com/smallwat3r/shhh/blob/master/environments/dev-docker-postgres.env). #### Docker From the root of the repository, run ```sh make dc-start # to start the app make dc-start-adminer # to start the app with adminer (SQL editor) make dc-stop # to stop the app ``` Once the container image has finished building and has started, you can access: * Shhh at <http://localhost:8081> * Adminer at <http://localhost:8082> (if launched with `dc-start-adminer`) _You can find the development database credentials from the env file at [/environments/dev-docker-postgres.env](https://github.com/smallwat3r/shhh/blob/master/environments/dev-docker-postgres.env)._ You have also the option to use `MySQL` instead of `PostgreSQL`, using these commands: ```sh make dc-start-mysql # to start the app make dc-start-adminer-mysql # to start the app with adminer (SQL editor) make dc-stop-mysql # to stop the app ``` #### Migrations Run the migrations using: ``` sh make db c='upgrade' ``` If deployed on Heroku, you can run the migrations using: ``` sh heroku run --app=<heroku-app-name> python3 -m flask db upgrade ``` This will ensure the necessary tables are created and up-to-date in the database, and make sure your deployed Shhh application works as expected. You can write a revision using: ``` sh make db c='revision "my revision"' ``` #### Development tools You can run tests and linting / security reports using the Makefile. Make sure you have `make`, `docker`, `yarn`, and a version of Python 3.12 installed on your machine. Tests, linting, security tools do not run from the Docker container, so you need to have a Python virtual environment configured locally. You can do so with the following command: ``` sh make venv deps ``` The following command will display all the commands available from the Makefile: ``` sh make help ``` * Enter a Flask shell (from the running shhh container) ``` sh make shell ``` * Run sanity checks ```sh make tests # run tests make ruff # run Ruff report make bandit # run Bandit report make mypy # run Mypy report ``` * Run code formatter ```sh make yapf # format code using Yapf ``` * Generate frontend lockfile ```sh make yarn # install the frontend deps using Yarn ``` ## Environment variables Bellow is the list of environment variables used by Shhh. #### Mandatory * `FLASK_ENV`: the environment config to load (`testing`, `dev-local`, `dev-docker`, `heroku`, `production`). * `DB_HOST`: Database hostname * `DB_USER`: Database username * `DB_PASSWORD`: Database password * `DB_NAME`: Database name * `DB_ENGINE`: Database engine to use (ex: `postgresql+psycopg2`, `mysql+pymysql`) Depending if you can use PostgreSQL or MySQL you might also need to set (these need to match the values you've specified as `DB_NAME`, `DB_PASSWORD` and `DB_NAME` above): * `POSTGRES_USER`: Postgresql username * `POSTGRES_PASSWORD`: Postgresql password * `POSTGRES_DB`: Postgresql database name or * `MYSQL_USER`: MySQL username * `MYSQL_PASSWORD`: MySQL password * `MYSQL_DATABASE`: MySQL database name #### Optional * `SHHH_HOST`: This variable can be used to specify a custom hostname to use as the domain URL when Shhh creates a secret (ex: `https://<domain-name.com>`). If not set, the hostname defaults to request.url_root, which should be fine in most cases. * `SHHH_SECRET_MAX_LENGTH`: This variable manages how long the secrets your share with Shhh can be. It defaults to 250 characters. * `SHHH_DB_LIVENESS_RETRY_COUNT`: This variable manages the number of tries to reach the database before performing a read or write operation. It could happens that the database is not reachable or is asleep (for instance this happens often on Heroku free plans). The default retry number is 5. * `SHHH_DB_LIVENESS_SLEEP_INTERVAL`: This variable manages the interval in seconds between the database liveness retries. The default value is 1 second. ## License See [LICENSE](https://github.com/smallwat3r/shhh/blob/master/LICENSE) file. ## Contact Please report issues or questions [here](https://github.com/smallwat3r/shhh/issues). [![Buy me a coffee][buymeacoffee-shield]][buymeacoffee] [buymeacoffee-shield]: https://www.buymeacoffee.com/assets/img/guidelines/download-assets-sm-2.svg [buymeacoffee]: https://www.buymeacoffee.com/smallwat3r [heroku-shield]: https://www.herokucdn.com/deploy/button.svg [heroku]: https://heroku.com/deploy?template=https://github.com/smallwat3r/shhh-heroku-deploy
Open source email alias solution to protect your email address. Comes with browser extensions and mobile apps.