Sentin8:Secrets - Detailed Design Document
1. Scope & Context
Sentin8:Secrets is the platform's secret-reference store: provider
credentials, API keys, and webhook signing secrets are envelope-encrypted
at rest (AES-256-GCM under a 32-byte master key), addressed by name
(stripe/api_key), versioned on rotation, and revealed only through two
audited paths - the programmatic POST /v1/secrets/resolve and the
admin reveal - with an append-only reveal audit trail that is never
pruned.
- Owns (schema
secrets):secrets(current values),versions(append-only rotation history),reads(reveal audit),outbox(DBX producer),audit_journal. - Does NOT own: the secrets' lifecycle decisions (callers rotate and disable), provider connectivity, or key rotation scheduling (the daily version-prune sweep is a Sentin8:Cron schedule; re-encrypt stays manual).
Trust boundary: plaintext exists only inside a request's scope -
SecretValue zeroizes on drop, the master key is a Zeroizing wrapper
that never prints, logs, or persists, and metadata surfaces are
value-free by construction.
2. Runtime Architecture
| Module | Role |
|---|---|
handlers.rs | Secret CRUD (PUT/GET/DELETE), rotate, history, reveal, resolve (secrets:// / sentin8-secrets:// / bare name), reads audit, maintenance (prune/re-encrypt), cron proxy-back (/v1/internal/schedules/run: expiry-scan + version-prune); emit_event (outbox with the caller's publisher identity); inline SQL (no separate store module). |
admin_ui.rs | SDUI pages + admin CRUD + cross-env reveal/rotate (resolve_env_id requires admin roles for foreign envs). |
config.rs | Master key load (fail-closed panic; dev-mode ephemeral key with loud warning), prune window, dev mode flag. |
auth.rs / policy.rs / server.rs / registration.rs | Certificate-or-bearer verification (platform workloads vs user/delegated callers) + raw-bearer extraction (publisher identity); Shield bridge; routes; self-description. |
Reveal lifecycle (the security-critical family):