Skip to main content

Manage .env secrets via system keychain with cloud store plugins

Project description

enveloper

CI License: AGPL-3.0-or-later Python 3.10+ Ruff mypy PyPI version

Background

News Headlines

[ KrebsOnSecurity, DockerHub/GitGuardian, Toyota/GitGuardian]


When developing software, there are often secrets that every developer or team need to deal with. These include:

  • API keys
  • API secrets
  • Web passwords
  • User-Ids
  • User and Administrative Passwords
  • Tokens
  • Private endpoints
  • File paths
  • Universal Identifiers
  • Authorization keys
  • etc.

In some cases, these are inadvertently hard-coded into code, which is then pushed out to shared repositories. There are services to scan for these, but a recommended practice has been to place these in .env files.

News Headlines

[GitGuardian]


A Different Approach

.env files open up a new range of problems:

News Headlines

File-based .env files are best to be avoided.


Enter enveloper

enveloper allows you to avoid .env files or hard-coded credentials by storing secrets in your own protected system keychain. These can be injected into a build session at runtime, without any risk of inadvertent release.

Local keychains work well for individuals. But what about sharing secrets? Fortunately, cloud-based services have already solved this problem, by offering Secret Managers or Vaults stored in cryptographically secure locations.

enveloper lets you store all your secrets in your local keychain or cloud-based secret managers, and easily move them back and forth or share them without having to leave any data in the open.

Envelope Services

Manage environment secrets via your system keychain or cloud secret stores. Don't leave exposed .env files laying about your filesystem.


Installation

pip install enveloper            # CLI only (scripts, Make, Docker, CI)
pip install enveloper[sdk]       # CLI + SDK — recommended for Python apps (load_dotenv / dotenv_values)
pip install enveloper[all]        # CLI + SDK + all cloud backends

For Python applications that load secrets at runtime (keychain or cloud), install the SDK extra: pip install enveloper[sdk].

Examples: Runnable samples for Docker, Makefile, Kubernetes, CI/CD, shell scripts, GitHub Secrets, the Python SDK, and domains/versioning are in the examples folder.

Quick Start

# Sample .env file
Sample .env file
# Import an existing .env file into the keychain
enveloper import sample.env --domain dev --project Enveloper

Keys are stored in local keychain.

Sample .env file
# List what's stored

enveloper list key --domain dev --project Enveloper
Import and list values
# Load local environment settings from keychain

eval "$(enveloper --domain dev --project Enveloper export --format unix)"

# Values are loaded into local environment variables. 
# Use in Makefile, shell scripts, etc. 
# 'unix' format works for Linux, Mac, and Windows WSL. 
# For Windows Powershell, use 'win' as format.
Export from keychain to environment then unexport to clear out
# When done, you can use 'unexport' command to remove the set of env variables

eval "$(enveloper --domain dev --project Enveloper unexport --format unix)"

# Push to cloud service

enveloper --domain dev --project Enveloper push --service aws
Push all values from keychain to cloud

In the console, we can verify that the values are stored (in the case of AWS, in the SSM Parameter Store)

AWS Service Console
# Verify that they got pushed in AWS console for System Store > Parameters

enveloper list key --domain dev --project Enveloper --service aws
Env values in AWS SSM
# Pull from AWS SSM into local keychain

enveloper pull --domain dev --project Enveloper --service aws

# Clear environment settings
enveloper clear --domain dev --project Enveloper --service aws
Clear settings from cloud

Multiple cloud services

AWS logo

Amazon Web Services (aws)

AWS Terminal Push AWS Console Push AWS logo

Google Cloud (gcp)

GCP Terminal Push GCP Console Push AWS logo

Microsoft Azure Cloud (azure)

Azure Terminal Push Azure Console Push AWS logo

Hashicorp Vault (vault)

Vault Terminal Push Vault Console Push

Features

  • Backward compatible with .env files.
  • Store values in local keychains (Mac, Linux, Windows), or cloud service secret stores (see below).
  • Work with individual environment variables or sets.
  • Versioning of environment values using Semantic Versioning.
  • Use in build chains (Make, Gradle, etc.) or CI/CD, including Github Actions.
  • Support for hierarchical settings via domain and project sets.
  • Shared sanitization for keys, values, and file paths before secrets are persisted or exported.

Supported Backends

Backend Description
Local Keychain MacOS Keychain, Linux Secret Service, Windows Credential Locker
File Plain .env files
AWS SSM AWS Systems Manager Parameter Store
Vault HashiCorp Vault KV v2
GCP Google Cloud Secret Manager
Azure Azure Key Vault
Alibaba Alibaba Cloud KMS Secrets Manager (untested)
GitHub GitHub Actions secrets (coming soon)

Documentation

License

GNU AGPL v3.0 or later

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

enveloper-0.1.19.tar.gz (5.6 MB view details)

Uploaded Source

Built Distribution

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

enveloper-0.1.19-py3-none-any.whl (75.1 kB view details)

Uploaded Python 3

File details

Details for the file enveloper-0.1.19.tar.gz.

File metadata

  • Download URL: enveloper-0.1.19.tar.gz
  • Upload date:
  • Size: 5.6 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.12

File hashes

Hashes for enveloper-0.1.19.tar.gz
Algorithm Hash digest
SHA256 547d87427749dbb37d7ee19203e808f9dc264bfcfb2883a4b2addca3fd3cf9f8
MD5 8f61136665ce165eac1050812172796e
BLAKE2b-256 7db9e8f3ef2b431ef4f30dc3474489edb0a64aa6da56eaf8e4b7c0623134002c

See more details on using hashes here.

File details

Details for the file enveloper-0.1.19-py3-none-any.whl.

File metadata

  • Download URL: enveloper-0.1.19-py3-none-any.whl
  • Upload date:
  • Size: 75.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.12

File hashes

Hashes for enveloper-0.1.19-py3-none-any.whl
Algorithm Hash digest
SHA256 92cb42a72eef2ea270809f572248319fe8eef424166f706a4a5b9515fa507849
MD5 7678c844a0a821b8fe81194037304609
BLAKE2b-256 1a5d629e9b12080481c0b6f6a335ed87c7730ccbf1a377e95939f2c9e47fb4d2

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