SafeHold is a secure, cross-platform environment variable manager with both CLI and GUI interfaces. It stores environment variables and secrets encrypted at rest, supporting unlocked projects (app-managed key) and locked projects (password-protected). Perfect for managing project-specific and global environment variables without exposing sensitive data.
- Secure Storage: All environment variables encrypted with AES-256-GCM or XSalsa20-Poly1305.
- Flexible Projects: Create unlocked or password-locked environment variable sets per project.
- Global Environment Variables: Manage global credentials outside of projects for shared access.
- ๐ Global Master Lock: Unified password protection for ALL projects - when enabled, all projects require the same master password for ultimate security consistency.
- โ๏ธ Application Settings: Persistent GUI and CLI preferences stored separately from project data, including security settings and interface preferences.
- Full CRUD Operations: Create, Read, Update, Delete operations for both projects and credentials.
- Count & Statistics: Count credentials per project and get detailed statistics.
- Maintenance Operations: Clean cache files and perform administrative cleanup with safety confirmations.
- Developer Information: Comprehensive about command showing application, security, and developer details.
- CLI Interface: Comprehensive command-line operations for all features with intuitive aliases.
- GUI Interface: Cross-platform graphical interface with Global tab, master lock controls, and persistent settings.
- Export & Run: Decrypt to
.envfiles or inject into processes. - Clean Up: Find and remove stray plaintext
.envfiles. - Modal Error Handling: GUI displays errors and warnings as modal dialogs requiring user acknowledgment.
- Comprehensive Error Handling: Robust error propagation with graceful handling of corrupted data and missing files.
- Confirmation Prompts: All destructive operations require explicit confirmation with
--forcebypass options. - Cross-Platform: Works on Windows, macOS, and Linux with comprehensive testing.
- Rust 1.70+ (install via rustup)
CLI only:
cargo install safeholdCLI + GUI:
cargo install safehold --features guiDownload pre-built binaries for your platform from the Releases page:
- Windows:
safehold-windows-x64.exe.ziporsafehold-windows-x64-gnu.exe.zip - macOS:
safehold-macos-x64.tar.gz(Intel) orsafehold-macos-arm64.tar.gz(Apple Silicon) - Linux:
safehold-linux-x64.tar.gz,safehold-linux-arm64.tar.gz, orsafehold-linux-x64-musl.tar.gz
Each release includes both CLI-only and GUI-enabled binaries.
-
Clone the repository:
git clone https://github.com/muhammad-fiaz/safehold.git cd safehold -
Build the CLI version:
cargo build --release
-
(Optional) Build with GUI support:
cargo build --release --features gui
-
Install locally (CLI only):
cargo install --path . -
Install locally with GUI:
cargo install --path . --features gui
SafeHold includes scripts for building across multiple platforms:
Unix/Linux/macOS:
chmod +x build.sh
./build.shWindows:
build.batThis will create binaries for Windows, macOS, and Linux in the dist/ directory.
-
Add to PATH:
- Windows:
setx PATH "%USERPROFILE%\.cargo\bin;%PATH%" - Linux/macOS: Add
export PATH="$HOME/.cargo/bin:$PATH"to your shell profile (e.g.,~/.bashrc).
- Windows:
-
Verify installation:
safehold --help
-
Run initial setup:
safehold setup --add-path
SafeHold can be installed in two modes:
- CLI only (default):
cargo install safehold- Installs the command-line interface only.
- CLI + GUI:
cargo install safehold --features gui- Installs both CLI and the graphical UI.
If you try to launch the GUI without installing it, the CLI will inform you how to reinstall with the GUI feature.
SafeHold can be run in a Docker container for isolated environments or server deployments.
- Docker and Docker Compose installed
-
Clone the repository:
git clone https://github.com/muhammad-fiaz/safehold.git cd safehold -
Start the container:
docker-compose up -d
-
Use SafeHold commands:
# Check version docker-compose exec safehold safehold version # Create a project docker-compose exec safehold safehold create myproject # Set environment variables docker-compose exec safehold safehold set --project myproject MY_VAR "my_value" # List variables docker-compose exec safehold safehold list --project myproject # Interactive shell docker-compose exec safehold bash
-
View logs:
docker-compose logs safehold
-
Stop the container:
docker-compose down
- Persistent Data: Environment variables stored in named Docker volume
- Security: Runs as non-root user inside container
- Health Checks: Built-in container health monitoring
- Minimal Footprint: Multi-stage build for optimized image size
SAFEHOLD_DATA_DIR: Data storage directory (default:/app/data)RUST_LOG: Logging level (default:info)
For detailed Docker usage, see DOCKER.md.
SafeHold automatically checks for updates and includes built-in update management.
CLI:
safehold check-updateGUI: Update notifications appear automatically when a new version is available, with options to visit the release page.
SafeHold stores all your projects and credentials in a separate data directory (~/.safehold/ on Linux/macOS, or equivalent on Windows). Updating SafeHold will never delete or remove your existing data.
To update to the latest version:
-
From crates.io:
cargo install safehold --features gui # or without --features for CLI-only -
From GitHub releases: Download the latest binary from the releases page
-
From source:
git pull cargo build --release --features gui cargo install --path . --features gui
Your projects, credentials, and settings will remain intact. The update only replaces the SafeHold executable with the latest version.
Important: While data loss is unlikely, it's always good practice to back up your ~/.safehold/ directory before major updates.
SafeHoldโs CLI supports global switches to control colors and animations:
--color <auto|always|never>: force color usage. Default isauto(uses color only when attached to a TTY).--style <fancy|plain>: choosefancyto enable spinner animations and styled prefixes, orplainfor simple text. Default isfancy.--quiet: suppress non-essential output.
Examples:
- Disable colors and animations:
safehold --color never --style plain list-projects - Keep colors but disable spinners:
safehold --style plain create projectA --password secret - Quiet mode for scripting:
safehold --quiet export --project projectA --file .env
SafeHold stores data in ~/.safehold/ (or equivalent on Windows/macOS). Run safehold setup for initial setup and PATH guidance.
- Create unlocked project:
safehold create <name>(aliases:new) - Create locked project:
safehold create <name> --lock(prompts for password) orsafehold create <name> --password <pwd> - List projects:
safehold list-projects(aliases:ls,projects) - Delete project:
safehold delete-project <id|name> [--force](aliases:rm,remove)
- Add key:
safehold add --project <id|name> --key <key> --value <value>(aliases:set) - Get value:
safehold get --project <id|name> --key <key>(aliases:show) - Update key:
safehold update --project <id|name> --key <key> --value <value>(aliases:modify,change,edit) - List keys:
safehold list --project <id|name>(aliases:keys) - Delete key:
safehold delete --project <id|name> --key <key> [--force](aliases:del,rm-key) - Count credentials:
safehold count [--project <id|name>] [--detailed] [--include-global](aliases:total)
- Add global credential:
safehold global-add --key <key> --value <value>(aliases:gadd,global-set) - Get global credential:
safehold global-get --key <key>(aliases:gget,global-show) - Update global credential:
safehold global-update --key <key> --value <value>(aliases:gupdate,global-modify) - List global credentials:
safehold global-list(aliases:glist,global-keys) - Delete global credential:
safehold global-delete --key <key> [--force](aliases:gdel,global-rm)
- Export to
.env:safehold export --project <id|name> [--file <name>] [--force] [--temp] - Export global:
safehold export --global [--file <name>] [--force] [--temp] - Run with env vars:
safehold run --project <id|name> [--with-global] -- <command>(aliases:exec)
- Show all:
safehold show-all(prompts for locked sets) (aliases:all) - Clean stray
.env:safehold clean - Clean cache:
safehold clean-cache [--force](aliases:clear-cache,cache-clean) - Application info:
safehold about(aliases:info) - Setup:
safehold setup [--add-path]prints PATH guidance;--add-pathattempts to add Cargo's bin folder to PATH automatically - Launch GUI:
safehold launch --guilaunches the GUI when installed with theguifeature; otherwise shows a hint to reinstall with GUI - Check for updates:
safehold check-update(aliases:update-check,check-updates) checks for new releases from crates.io
- Global Master Lock:
safehold master-lock [--enable|--disable](aliases:mlock,global-master)- ๐ Enable: ALL projects require the SAME master password (unified security)
- ๐ Disable: Projects use individual lock settings (standard security)
- Status: Run without flags to see current master lock status
- Environment Variable: Set
SAFEHOLD_MASTER_PASSWORDto bypass prompts when master lock is enabled
- DELETE ALL DATA:
safehold delete-all [--force](aliases:clear-all,nuke)โ ๏ธ WARNING: This permanently deletes ALL projects, credentials, and configuration filesโ ๏ธ CANNOT BE UNDONE: All data will be lost forever- Use
--forceto skip confirmation (DANGEROUS!) - Without
--force, requires typing "DELETE ALL MY DATA" to confirm
If built with --features gui, launch the graphical interface:
safehold launch --gui- Sidebar: Lists Global and all projects.
- Main Panel: Displays decrypted credentials for selected project (prompts for password if locked).
- Global Tab: Manage global credentials independent of projects.
- Settings: Display version and author information.
- Actions: Create projects, add/edit/delete keys, export
.env, update/modify credentials. - Error Handling: Errors and warnings displayed as modal dialogs requiring user acknowledgment.
- Confirmations: All destructive operations show confirmation dialogs with option to force.
-
Create and populate a project:
safehold create project1 safehold add --project project1 --key GITHUB_TOKEN --value ghp_1234567890abcdef safehold add --project project1 --key DB_PASS --value mysecretpassword safehold list --project project1
-
Update and manage credentials:
safehold update --project project1 --key GITHUB_TOKEN --value new_token_value safehold count --project project1 safehold count --detailed --include-global
-
Global credentials management:
safehold global-add --key COMMON_API_KEY --value shared_secret safehold global-list safehold global-update --key COMMON_API_KEY --value updated_secret
-
Create a locked project:
safehold create secureproj --lock # Enter password when prompted safehold add --project secureproj --key API_KEY --value supersecret -
Export and run:
safehold export --project project1 --temp safehold run --project project1 --with-global -- cargo run -
Maintenance and information:
safehold about # Show comprehensive application information safehold clean-cache # Clean temporary files (will prompt for confirmation) safehold clean-cache --force # Clean without confirmation
-
Global Master Lock Security ๐:
# Check current master lock status safehold master-lock # Enable Global Master Lock (ALL projects will require the same password) safehold master-lock --enable # Will prompt for master password creation # Now ALL projects use the master password safehold get --project myproject --key API_KEY # Uses master password safehold global-get --key SHARED_KEY # Uses master password # Disable Global Master Lock (return to individual project passwords) safehold master-lock --disable # Will prompt for master password verification
-
Emergency cleanup
โ ๏ธ :# WARNING: These operations are DESTRUCTIVE and PERMANENT! safehold delete-all # Will prompt for "DELETE ALL MY DATA" confirmation safehold delete-all --force # Bypasses confirmation - USE WITH EXTREME CAUTION!
-
Force operations for automation:
# Delete project without confirmation (for scripts) safehold delete-project myproject --force # Delete credential without confirmation safehold delete --project myproject --key API_KEY --force # Delete global credential without confirmation safehold global-delete --key SHARED_KEY --force
SafeHold stores persistent application preferences separately from your project data. Settings are automatically saved and restored across sessions.
- Password Visibility: Control whether passwords are shown by default in the GUI
- Window Preferences: Remember window size and position
- Auto-save: Configure automatic saving intervals
- Default Tab: Set which tab opens by default (Projects/Global)
- Color Output: Control colored terminal output (
auto,always,never) - Output Style: Choose between
fancy(with spinners) orplaintext output - Verbose Help: Show detailed help information by default
- Destructive Confirmations: Control confirmation prompts for dangerous operations
- Session Timeout: Automatically lock after inactivity (configurable minutes)
- Clipboard Security: Automatically clear copied credentials from clipboard
- Confirmation Requirements: Require confirmation for all destructive operations
Settings are stored in app_settings.json in your SafeHold data directory and are preserved across updates.
- Encryption: AES-256-GCM for unlocked projects (app-managed key); Argon2id KDF for locked projects.
- At Rest: All data encrypted as
.env.enc; passwords never stored. - In Memory: Sensitive data zeroized after use.
- Best Practices: Use locked sets for sensitive data; avoid
--passwordin shared shells.
We welcome contributions! Please see our Contributing Guide for detailed information on how to get started, development setup, and contribution guidelines.
See CHANGELOG.md for a complete list of changes and version history.
For questions, support, or feedback:
- Email: contact@muhammadfiaz.com
- GitHub Issues: Create an issue
MIT License. See LICENSE for details.