Skip to content

feat(config): add secret management for KMS config files#932

Open
p0wline wants to merge 16 commits into
developfrom
feat/config-secret-management
Open

feat(config): add secret management for KMS config files#932
p0wline wants to merge 16 commits into
developfrom
feat/config-secret-management

Conversation

@p0wline
Copy link
Copy Markdown
Contributor

@p0wline p0wline commented Apr 28, 2026

Closes #882

What

Add secret management support to KMS TOML configuration files so that sensitive values (passwords, tokens, API keys) are never stored in clear text.

Changes

Phase 1 — Local secret handling

  • Env var interpolation: ${VAR_NAME} and ${VAR_NAME:-default} syntax resolved at startup in all config values
  • Secrets file: split sensitive values into a separate TOML file, referenced via secrets_file key in the main config or COSMIAN_KMS_SECRETS_CONF env var; deep-merged at startup before deserialization
  • New pkg/secrets.toml template with documented examples

Phase 2 — External secret backends (optional feature flags)

URI schemes resolved at startup:

URI scheme Feature flag Backend
vault://<mount>/<path>[#<field>] secret-vault HashiCorp Vault KV-v2
aws-ssm://<region>/<param-path> secret-aws AWS SSM Parameter Store (SecureString)
azure-kv://<vault>/secrets/<name> secret-azure Azure Key Vault REST API

Each backend spawns a dedicated OS thread with its own Tokio runtime to avoid nested-runtime panics at startup.

Testing

  • Unit tests: env var interpolation, secrets file deep-merge, loading via config key and env var
  • End-to-end tested: Vault ✅, AWS SSM ✅, Azure KV ✅

@p0wline p0wline requested a review from Manuthor April 28, 2026 09:36
Copy link
Copy Markdown
Contributor

@Manuthor Manuthor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this!

Only a partial review.
Could you rebase please?

Comment thread crate/server/Cargo.toml
Comment thread .github/workflows/test_all.yml Outdated
Comment thread .github/scripts/nix.sh Outdated
Comment thread .github/scripts/nix.sh Outdated
Comment thread deny.toml Outdated
Comment thread .cargo/audit.toml Outdated
@p0wline p0wline force-pushed the feat/config-secret-management branch 2 times, most recently from f7fd394 to e03d7e0 Compare May 18, 2026 09:21
@Manuthor
Copy link
Copy Markdown
Contributor

We should also support our own KMS server for storing this kind of config files secrets and support another URI scheme for a Cosmian KMS

@p0wline p0wline force-pushed the feat/config-secret-management branch from d3e4c7e to 6411945 Compare May 21, 2026 13:40
@p0wline p0wline force-pushed the feat/config-secret-management branch from 8e5fcb6 to 98791ca Compare May 22, 2026 08:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Configuration secret management: no clear-text secrets in TOML

2 participants