Skip to main content

A CLI tool to whisper your secrets between secure vault and your local environment

Project description

Downloads Coverage Status

Whispr

Logo

Whispr (Pronounced as whisper) is a CLI tool to safely inject secrets from your favorite secret vault (Ex: AWS Secrets Manager, Azure Key Vault etc.) into your app's environment. This is very useful for enabling secure local software development.

Whispr uses keys (with empty values) specified in a .env file and fetches respective secrets from a vault, and sets them as environment variables before launching an application.

Install whispr easily with pip!

pip install whispr

Key Features of Whispr:

  • Safe Secret Injection: Fetch and inject secrets from your desired vault using HTTPS, SSL encryption, strict CERT validation.
  • Just In Time (JIT) Privilege: Set environment variables for developers only when they're needed.
  • Secure Development: Eliminate plain-text secret storage and ensure a secure development process.
  • Customizable Configurations: Configure project-level settings to manage multiple secrets for multiple projects.
  • No Custom Scripts Required: Whispr eliminates the need for custom bash scripts or cloud CLI tools to manage secrets, making it easy to get started.
  • Easy Installation: Cross-platform installation with PyPi.

Supported Vault Technologies:

Supported-vaults

Why use Whispr ?

The MITRE ATT&CK Framework Tactic 8 (Credential Access) suggests that adversaries can exploit plain-text secrets and sensitive information stored in files like .env. It is essential to avoid storing sensitive information in unencrypted files. To help developers, Whispr can safely fetch and inject secrets from a vault into the app environment or pass them as standard input just in time. This enables developers to securely manage credentials and mitigate advisory exploitation tactics.

Getting Started

Installing Whispr

To get started with Whispr, simply run:

pip install whispr

Configuring Your Project

Step 1: Initialize Whispr

Run whispr init <vault_type> in your terminal to create a whispr.yaml file in your project root. This file will store your configuration settings.

The available vault types are: aws, azure, and gcp.

Example whispr.yaml contents (For: AWS):

env_file: '.env'
secret_name: <your_secret>
vault: aws

This default configuration will inject fetched secrets into os.environ of main process. If your app instead want to receive secrets as STDIN arguments, use no_env: true field. This is a secure way than default control but app now should parse arguments itself.

env_file: '.env'
secret_name: <your_secret>
vault: aws
no_env: true # Setting true will send KEY1=VAL1 secret pairs as command args

Setting Up Your Injectable Secrets

Step 2: Create or Configure a Secret File

Create a new .env file with empty values for your secret keys. For example:

POSTGRES_USERNAME=
POSTGRES_PASSWORD=

Note: You can also control filename with env_file key in your whispr.yaml.

Step 3: Authenticating to Your Vault (Ex:AWS)

  • Authenticate to AWS using Short-term credentials.
  • Alternatively, set temporary AWS credentials using a config file or environment variables.

Note: Use respective authentication methods for other vaults.

Programmatic access of Whispr (Doesn't require a configuration file)

In addition to installing Whispr as a tool, one can make use of core utility functions like this:

pip install whispr

Then from Python code you can import important functions like this:

from whispr.utils.vault import fetch_secrets
from whispr.utils.process import execute_command

config = {
  "vault": "aws",
  "secret_name": "<your_secret_name>",
  "region": "us-west-2"
}

secrets = fetch_secrets(config)

# Now, inject secrets into your command's environment
command = "ls -l"
cp = execute_command(command.split(), no_env=False, secrets=secrets) #cp is CompletedProcess object.

That's it. This is a programmatic equivalent to the tool usage.

Launch any Application using Whispr (Requires a configuration file: whispr.yaml)

In contrary to programmatic access, if you want to run a script/program do: whispr run '<your_app_command_with_args>' (mind the single quotes around command) to inject your secrets before starting the subprocess.

Examples:

whispr run 'python main.py' # Inject secrets and run a Python program
whispr run 'node server.js --threads 4' # Inject secrets and run a Node.js express server
whispr run 'django manage.py runserver' # Inject secrets and start a Django server
whispr run '/bin/sh ./script.sh' # Inject secrets and run a custom bash script. Script should be permitted to execute
whispr run 'semgrep scan --pro' # Inject Semgrep App Token and scan current directory with Semgrep SAST tool.

TODO

Support:

  • HashiCorp Vault
  • 1Password Vault
  • K8s secret patching
  • Container patching (docker)

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

whispr-0.5.0.tar.gz (167.3 kB view details)

Uploaded Source

Built Distribution

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

whispr-0.5.0-py3-none-any.whl (13.3 kB view details)

Uploaded Python 3

File details

Details for the file whispr-0.5.0.tar.gz.

File metadata

  • Download URL: whispr-0.5.0.tar.gz
  • Upload date:
  • Size: 167.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.0.1 CPython/3.12.8

File hashes

Hashes for whispr-0.5.0.tar.gz
Algorithm Hash digest
SHA256 1901eae835691316c0420a06ef02e73905282dcf4a02e397b5b59338496a52be
MD5 cc8ad932dc0b398a5dd29d156c981713
BLAKE2b-256 77d7e14a002734c4578761d5abd7b280d060b5ecf9c7ee95083732d5d6753734

See more details on using hashes here.

Provenance

The following attestation bundles were made for whispr-0.5.0.tar.gz:

Publisher: release.yml on cybrota/whispr

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file whispr-0.5.0-py3-none-any.whl.

File metadata

  • Download URL: whispr-0.5.0-py3-none-any.whl
  • Upload date:
  • Size: 13.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.0.1 CPython/3.12.8

File hashes

Hashes for whispr-0.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9500624a87cca5810b11c0aca53c96a19e855a711d8c77a50197705b76070b2d
MD5 0afc8c9b05eed6c62187ae8739cf640b
BLAKE2b-256 d0e989b50aa34ea191c7a06d0969c70d4bdb783229bf48465df8f341fbdc2628

See more details on using hashes here.

Provenance

The following attestation bundles were made for whispr-0.5.0-py3-none-any.whl:

Publisher: release.yml on cybrota/whispr

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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