Skip to main content

Production secret storage for the Stapel framework — OpenBao/HashiCorp Vault behind the stapel-core secret-provider seam

Project description

stapel-vault

Production secret storage for the Stapel framework. A facade over secret backends behind the stapel_core.secrets provider seam — the first backend is OpenBao / HashiCorp Vault (KV v2; their HTTP APIs are compatible, so one client speaks to both).

Local dev and the minimal preset keep reading secrets from the environment (stapel-core's default provider). In production, where env for secrets is unacceptable, point the seam at stapel-vault and the framework reads SECRET_KEY, JWT_SECRET_KEY, database passwords and LLM pool keys from Vault instead — with no change to the code that consumes them.

Install

pip install stapel-vault      # requires stapel-core with the SecretProvider seam

Wire it up

The provider is selected at settings-bootstrap time (production settings resolve SECRET_KEY before django.setup()), via environment — which is also where Vault's own connection/auth config belongs:

# control plane only — never a workload container (see MODULE.md, S1)
export STAPEL_SECRETS_PROVIDER=stapel_vault.VaultSecretProvider
export VAULT_ADDR=https://vault.internal:8200
export VAULT_K8S_ROLE=stapel-web       # Kubernetes auth (phase 2)

Then any stapel_core.secrets.get_secret("DJANGO_SECRET_KEY") — including the SECRET_KEY / JWT_SECRET_KEY reads in stapel_core.django.settings — comes from Vault. A missing secret is a hard, loud boot failure (fail_closed), not a silent None.

Secret layout (default convention)

A service's secrets are keys of one KV v2 secret (the "bundle") at secret/data/<prefix>/<app> (defaults secret/data/stapel/app):

bao kv put secret/stapel/app \
    DJANGO_SECRET_KEY=... JWT_SECRET_KEY=... POSTGRES_PASSWORD=...

DJANGO_SECRET_KEY then resolves to GET v1/secret/data/stapel/app.data.data["DJANGO_SECRET_KEY"]. Override per name with VAULT_SECRET_MAP (JSON). See MODULE.md for the full config reference, auth methods, rotation, and the deploy-mode map.

Auth methods

Method When Config
token local/dev VAULT_TOKEN
kubernetes prod on k8s (phase 2) VAULT_K8S_ROLE (+ projected SA JWT)
approle prod, non-k8s VAULT_ROLE_ID + VAULT_SECRET_ID

Auto-detected from what is present, or forced with VAULT_AUTH_METHOD.

License

MIT — see LICENSE.

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

stapel_vault-0.1.2.tar.gz (18.2 kB view details)

Uploaded Source

Built Distribution

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

stapel_vault-0.1.2-py3-none-any.whl (15.7 kB view details)

Uploaded Python 3

File details

Details for the file stapel_vault-0.1.2.tar.gz.

File metadata

  • Download URL: stapel_vault-0.1.2.tar.gz
  • Upload date:
  • Size: 18.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for stapel_vault-0.1.2.tar.gz
Algorithm Hash digest
SHA256 6dfeae2ccf8ee7562e0b80cdbf0f46a857110b5443d08775425d79ee20d70a40
MD5 1a818d466d90f0ebc96a57dab9866986
BLAKE2b-256 a96bfacde29bace4596d2b1c47a1aa8a3ee7a71348ffec22481cccb157fb2c7e

See more details on using hashes here.

Provenance

The following attestation bundles were made for stapel_vault-0.1.2.tar.gz:

Publisher: publish.yml on usestapel/stapel-vault

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

File details

Details for the file stapel_vault-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: stapel_vault-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 15.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for stapel_vault-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 6724bc38f27b6b9cd42fa87a3bfda510de38790e13f43a38e3f01e4ee5527a47
MD5 365b43297618445f5406d9b00b67a93d
BLAKE2b-256 f2c96f1822f7093b47b41101a1e248a74770d34d331e59b537a9e8aa3308810d

See more details on using hashes here.

Provenance

The following attestation bundles were made for stapel_vault-0.1.2-py3-none-any.whl:

Publisher: publish.yml on usestapel/stapel-vault

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