Skip to main content

Secure environment variable synchronization tool

Project description

Creds Vault ๐Ÿ”

PyPI version Python Support License: MIT

A secure command-line utility for sharing .env files across development teams using GitHub Gists with client-side AES-256 encryption.

๐Ÿš€ Features

  • ๐Ÿ”’ Client-side Encryption: AES-256 encryption with PBKDF2 key derivation
  • ๐Ÿ†“ Free Storage: Uses GitHub Gists (no additional service costs)
  • ๐Ÿ‘ฅ Team-friendly: Simple sharing via gist IDs
  • ๐Ÿ›ก๏ธ Zero-knowledge: GitHub never sees your plaintext secrets
  • ๐Ÿ“ Project-aware: Remembers vault configuration per project
  • ๐Ÿ” Secure by Default: Restricted file permissions (600)

๐Ÿ›ก๏ธ Security Architecture

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”    AES-256     โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”    HTTPS    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚   Local .env    โ”‚ โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–ถโ”‚  Encrypted Blob  โ”‚ โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–ถโ”‚ GitHub Gist โ”‚
โ”‚   (plaintext)   โ”‚   Client-side  โ”‚   (ciphertext)   โ”‚             โ”‚  (private)  โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜                โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜             โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
  • Your secrets never leave your machine in plaintext
  • Password-based encryption with 100,000 PBKDF2 iterations
  • Salt-based security prevents rainbow table attacks
  • Private GitHub Gists for encrypted storage

๐Ÿ“ฆ Installation

Option 1: Install from PyPI (Recommended)

pip install creds-vault

Option 2: Install from Source

git clone https://github.com/mirzamudassir/creds-vault.git
cd creds-vault
make install

Option 3: Development Installation

git clone https://github.com/mirzamudassir/creds-vault.git
cd creds-vault
make install-dev

โš™๏ธ Setup

1. GitHub Token Setup

Create a GitHub personal access token with gist scope:

  1. Go to GitHub Settings โ†’ Tokens
  2. Click "Generate new token (classic)"
  3. Select only the gist scope
  4. Copy the token
# Set environment variable
export GITHUB_TOKEN="ghp_your_token_here"

# Make it permanent
echo 'export GITHUB_TOKEN="ghp_your_token_here"' >> ~/.bashrc
source ~/.bashrc

2. Verify Installation

secrets --version
secrets --help

๐Ÿ”„ Usage

First-time Setup (Project Owner)

# Navigate to your project
cd my-awesome-project

# Create or edit your .env file
cat > .env << EOF
DATABASE_URL=postgresql://localhost:5432/myapp
API_KEY=sk-1234567890abcdef
STRIPE_SECRET=sk_test_xyz123
JWT_SECRET=super-secret-jwt-key
EOF

# Initialize encrypted vault
secrets init

# Output:
# โœ… Successfully initialized encrypted secrets vault
# ๐Ÿ”’ Content encrypted with AES-256
# ๐Ÿ“ Gist ID: xxxxxx
# 
# ๐Ÿ“ค Share this command with your team:
#    secrets pull --gist-id xxxxxx
# 
# โš ๏ธ  Important: Share the vault password securely!

Team Member Setup

# Navigate to project directory
cd my-awesome-project

# Pull secrets (replace with actual gist ID)
secrets pull --gist-id xxxxxx
# Enter vault password: โ€ขโ€ขโ€ขโ€ขโ€ขโ€ขโ€ขโ€ขโ€ขโ€ข

# โœ… Successfully pulled and decrypted .env
# ๐Ÿ“ Saved project configuration

Daily Workflow

# Check project status
secrets status

# Pull latest changes
secrets pull

# Make local changes to .env
echo "NEW_FEATURE_FLAG=true" >> .env

# Push changes to vault
secrets push

# Check what's configured
secrets status

๐Ÿ“‹ Command Reference

secrets init

Initialize encrypted vault with current .env file.

secrets init [--filename .env.local]

Options:

  • --filename: Specify custom env file name (default: .env)

secrets push

Push local env file to vault.

secrets push [--filename .env.local]

Options:

  • --filename: Specify custom env file name (default: .env)

secrets pull

Pull env file from vault.

secrets pull [--gist-id ID] [--filename .env] [--force]

Options:

  • --gist-id: Gist ID (required for first-time setup)
  • --filename: Custom filename (default: auto-detect)
  • --force: Overwrite without confirmation

secrets status

Show project status and configuration.

secrets status

๐Ÿ—๏ธ Project Structure

After installation, your project will have:

your-project/
โ”œโ”€โ”€ .env                     # Your secrets file
โ”œโ”€โ”€ .gitignore              # Should include .env
โ””โ”€โ”€ (other project files)

~/.creds-vault/
โ””โ”€โ”€ config.json             # Project โ†’ gist mappings

๐Ÿ”’ Security Best Practices

Password Security

  • Use strong passwords: Minimum 12 characters with mixed case, numbers, symbols
  • Unique passwords: Don't reuse passwords from other services
  • Secure sharing: Use password managers or secure channels to share vault passwords
  • Regular rotation: Consider rotating vault passwords periodically

GitHub Token Security

  • Minimal permissions: Only grant gist scope
  • Regular rotation: Rotate tokens every 3-6 months
  • Secure storage: Never commit tokens to code repositories
  • Team vs individual: Consider using team-specific tokens for organizations

File Security

  • Gitignore: Always add .env* to your .gitignore
  • Permissions: Tool automatically sets secure permissions (600)
  • Cleanup: Remove .env files when no longer needed

๐Ÿšจ Security Considerations

โœ… What's Protected

  • Plaintext secrets: Never transmitted or stored in the cloud
  • Man-in-the-middle: HTTPS protects data in transit
  • GitHub breaches: Encrypted data remains secure
  • Token compromise: Attackers only see encrypted blobs

โš ๏ธ Limitations

  • Password security: Vault security depends on password strength
  • Local compromise: If your machine is compromised, local files are at risk
  • Social engineering: Sharing passwords insecurely can compromise vaults
  • GitHub availability: Service depends on GitHub being accessible

๐Ÿข Compliance

  • Development environments: Suitable for dev/staging secrets
  • Production secrets: Consider dedicated secret management for production
  • Audit requirements: Tool doesn't provide audit logs (GitHub does)
  • Regulatory compliance: Evaluate against your specific requirements

๐Ÿ› ๏ธ Development

Setup Development Environment

git clone https://github.com/mirzamudassir/creds-vault.git
cd creds-vault
make install-dev

Run Tests

make test

Code Quality

make lint          # Run linting
make format        # Format code
make check         # Lint + test

Build and Release

make build         # Build distribution
make publish       # Publish to PyPI

๐Ÿ”ง Advanced Usage

Custom Filenames

# Initialize with custom filename
secrets init --filename .env.production

# Push/pull custom files
secrets push --filename .env.local
secrets pull --filename .env.staging

Multiple Projects

The tool automatically manages different vaults per project:

cd project-a
secrets init        # Creates vault A

cd ../project-b  
secrets init        # Creates vault B

secrets status      # Shows project B config
cd ../project-a
secrets status      # Shows project A config

CI/CD Integration

# In CI/CD pipeline
export GITHUB_TOKEN="${{ secrets.GITHUB_TOKEN }}"
secrets pull --gist-id $VAULT_ID --force

๐Ÿ› Troubleshooting

Common Issues

"Invalid GitHub token"

# Check token is set
echo $GITHUB_TOKEN

# Verify token has gist scope
curl -H "Authorization: token $GITHUB_TOKEN" https://api.github.com/user

"Project not initialized"

# Initialize new vault
secrets init

# Or link to existing vault
secrets pull --gist-id your-gist-id

"Decryption failed"

# Wrong password - try again
secrets pull

# Vault corrupted - contact vault creator

"File permission denied"

# Fix file permissions
chmod 600 .env

Debug Mode

# Enable verbose logging
export DEBUG=1
secrets status

๐Ÿค Contributing

We welcome contributions! Please see our Contributing Guide for details.

Quick Start

git clone https://github.com/mirzamudassir/creds-vault.git
cd creds-vault
make install-dev
make test

Reporting Issues

๐Ÿ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

๐Ÿ™ Acknowledgments

  • cryptography: For robust encryption primitives
  • requests: For HTTP client functionality
  • GitHub: For providing free Gist storage
  • Python community: For excellent tooling and libraries

๐Ÿ“š Resources


โญ Star us on GitHub | ๐Ÿ“– Read the Docs | ๐Ÿ› Report Issues

Made with โค๏ธ for developers who care about security

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

creds_vault-1.0.3.tar.gz (12.1 kB view details)

Uploaded Source

Built Distribution

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

creds_vault-1.0.3-py3-none-any.whl (12.0 kB view details)

Uploaded Python 3

File details

Details for the file creds_vault-1.0.3.tar.gz.

File metadata

  • Download URL: creds_vault-1.0.3.tar.gz
  • Upload date:
  • Size: 12.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.10

File hashes

Hashes for creds_vault-1.0.3.tar.gz
Algorithm Hash digest
SHA256 03505bdc4f870dab18cab5d0c9baba1e2f564f18eab6d5db20d1a2cdc4a959be
MD5 d5e589b48571c42a0ec4d5a07c5b9a4b
BLAKE2b-256 6ca2b0d90217aca0ede8ea8592d541e0a1dc8a4a56434652186f9d240ac8fd21

See more details on using hashes here.

File details

Details for the file creds_vault-1.0.3-py3-none-any.whl.

File metadata

  • Download URL: creds_vault-1.0.3-py3-none-any.whl
  • Upload date:
  • Size: 12.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.10

File hashes

Hashes for creds_vault-1.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 97f18e671976b29a225faeea0ed6deec294a237735add39a71af59920498ac34
MD5 60ba2eee6b53d1467450c830064d3326
BLAKE2b-256 52cf5d6b984cc2794801dcf77a26623d18c93bfdcac4bef4bb3cc8be7ebb3d05

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