Kubernetes integration for Helvetisafe secret management — sidecar agent, Secret sync, and init-container injection
Project description
helvetisafe-vault-k8s
Python package for consuming Helvetisafe secrets in any environment — locally, in CI, or inside a Kubernetes workload. Built on the Helvetisafe Python client and its zero-knowledge encryption model.
Three CLI modes are available:
| Mode | Command | Description |
|---|---|---|
| Serve | helvetisafe-vault-k8s serve |
HTTP agent that exposes decrypted secrets on 127.0.0.1 |
| Inject | helvetisafe-vault-k8s inject |
Write secrets to a .env file once at startup |
| Sync | helvetisafe-vault-k8s sync |
Sync secrets into a Kubernetes Secret object |
Kubernetes deployment manifests and examples are maintained separately in the aegis repository under
clients/kubernetes/.
Status
✅ v0.1.0 — available
Installation
pip install helvetisafe-vault-k8s
The sync mode requires the kubernetes extra:
pip install "helvetisafe-vault-k8s[kubernetes]"
Requirements: Python 3.8+ · helvetisafe-client >= 0.1.0 (auto-installed) · kubernetes >= 28.0.0 (optional, sync only)
Configuration
All settings are read from environment variables.
| Variable | Required | Default | Description |
|---|---|---|---|
HELVETISAFE_BASE_URL |
✅ | — | Base URL of the Helvetisafe instance, e.g. https://vault.helvetisafe.ch |
HELVETISAFE_CLIENT_ID |
✅ | — | OAuth 2.0 client ID |
HELVETISAFE_CLIENT_SECRET |
✅ | — | OAuth 2.0 client secret |
HELVETISAFE_PASSWORD |
one of three | — | Service account password |
HELVETISAFE_PRIVATE_KEY_PATH |
one of three | — | Path to a PEM private key file |
HELVETISAFE_PRIVATE_KEY_PEM |
one of three | — | PEM private key as a string |
HELVETISAFE_AGENT_PORT |
8080 |
Port the serve agent listens on | |
HELVETISAFE_AGENT_HOST |
127.0.0.1 |
Host the serve agent binds to | |
HELVETISAFE_K8S_NAMESPACE |
default |
Kubernetes namespace (sync mode) | |
HELVETISAFE_K8S_SECRET_NAME |
— | Kubernetes Secret name (sync mode) | |
HELVETISAFE_SECRET_KEYS |
— | Comma-separated keys to fetch; empty means all |
Exactly one of HELVETISAFE_PASSWORD, HELVETISAFE_PRIVATE_KEY_PATH, or HELVETISAFE_PRIVATE_KEY_PEM must be set.
Modes
Serve
Starts a lightweight HTTP server bound to 127.0.0.1 (loopback only). Any process on the same host can fetch decrypted secrets without implementing any cryptographic logic.
helvetisafe-vault-k8s serve [--port PORT] [--host HOST]
| Method | Path | Description |
|---|---|---|
GET |
/health |
Returns {"status": "ok"} |
GET |
/secrets |
Lists all secret key names |
GET |
/secret/{key} |
Returns the decrypted value of a secret |
import requests
value = requests.get("http://localhost:8080/secret/database_password").json()["value"]
Inject
Fetches secrets once and writes them to a shell-compatible .env file.
helvetisafe-vault-k8s inject --output /path/to/secrets.env
Output format:
KEY_NAME="plaintext-value"
ANOTHER_KEY="another-value"
Backslashes, double quotes, and newlines in values are escaped automatically.
Sync
Fetches secrets and creates or updates a Kubernetes Secret object.
helvetisafe-vault-k8s sync [--output /path/to/secrets.env]
Requires the kubernetes extra and a service account with get, create, and update permissions on secrets in the target namespace.
Architecture
Client process
├── Your application
│ └─► GET http://127.0.0.1:8080/secret/db_password (serve mode)
│
└── helvetisafe-vault-k8s
├─► POST https://vault.helvetisafe.ch/oauth/token
│ ← access_token
├─► GET /api/v1/credentials/org-key
│ ← encrypted Org Key (RSA-OAEP)
│ RSA decrypt → Org Key (in memory only)
└─► GET /api/v1/secrets/db_password
← AES-256-GCM ciphertext
AES decrypt → plaintext
Plaintext values never leave the process memory. The Helvetisafe server only ever stores and transmits ciphertext.
Project Structure
helvetisafe-vault-k8s/
├── pyproject.toml
├── src/
│ └── helvetisafe_k8s/
│ ├── agent.py # Serve mode HTTP server
│ ├── cli.py # CLI entry point
│ ├── config.py # Environment-variable config loader
│ └── sync.py # Inject / sync utilities
└── tests/
├── test_agent.py
├── test_config.py
└── test_sync.py
Running Tests
pip install -e ".[dev]"
pytest tests/ -v
Contributing
Contributions are welcome. Please open an issue or pull request in this repository.
License
MIT
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file helvetisafe_vault_k8s-0.1.0.tar.gz.
File metadata
- Download URL: helvetisafe_vault_k8s-0.1.0.tar.gz
- Upload date:
- Size: 16.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
aff7b5bfa9d06fd9db66c445c50dd98a2e10832da0e491b1faacd8832f50c15c
|
|
| MD5 |
36e0b4345cea91176167453e6d5b59bb
|
|
| BLAKE2b-256 |
798f5ecb4ab4f3e15b8a6c7b60c44b343c64344f01db4585ee153123f38d46d4
|
Provenance
The following attestation bundles were made for helvetisafe_vault_k8s-0.1.0.tar.gz:
Publisher:
publish-helvetisafe-vault-k8s.yml on TheM0f/helvetisafe-vault-k8s
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
helvetisafe_vault_k8s-0.1.0.tar.gz -
Subject digest:
aff7b5bfa9d06fd9db66c445c50dd98a2e10832da0e491b1faacd8832f50c15c - Sigstore transparency entry: 1369004234
- Sigstore integration time:
-
Permalink:
TheM0f/helvetisafe-vault-k8s@73b1ceacc2beea5f3e060bcd7668cc99a9d24744 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/TheM0f
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-helvetisafe-vault-k8s.yml@73b1ceacc2beea5f3e060bcd7668cc99a9d24744 -
Trigger Event:
release
-
Statement type:
File details
Details for the file helvetisafe_vault_k8s-0.1.0-py3-none-any.whl.
File metadata
- Download URL: helvetisafe_vault_k8s-0.1.0-py3-none-any.whl
- Upload date:
- Size: 13.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3d7dab16be6a647eddb790c7bed51735227d7b3860fe26278bdd700a727d4ef8
|
|
| MD5 |
3bd9f70469ccbe72a5d0e16b95d30a91
|
|
| BLAKE2b-256 |
4d34fc58e7b0002ce3898c9ff222a2342d6e0602bc8de33b0e5d7d20278e966e
|
Provenance
The following attestation bundles were made for helvetisafe_vault_k8s-0.1.0-py3-none-any.whl:
Publisher:
publish-helvetisafe-vault-k8s.yml on TheM0f/helvetisafe-vault-k8s
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
helvetisafe_vault_k8s-0.1.0-py3-none-any.whl -
Subject digest:
3d7dab16be6a647eddb790c7bed51735227d7b3860fe26278bdd700a727d4ef8 - Sigstore transparency entry: 1369004349
- Sigstore integration time:
-
Permalink:
TheM0f/helvetisafe-vault-k8s@73b1ceacc2beea5f3e060bcd7668cc99a9d24744 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/TheM0f
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-helvetisafe-vault-k8s.yml@73b1ceacc2beea5f3e060bcd7668cc99a9d24744 -
Trigger Event:
release
-
Statement type: