feat(secrets): add provider-neutral credential hooks

This commit is contained in:
Joseph Magly
2026-08-22 10:02:49 -04:00
parent 2c7f6d78f1
commit 3390fe551b
12 changed files with 530 additions and 24 deletions
+47
View File
@@ -289,6 +289,53 @@ output_dir: results/my_run
obliteratus run my_study.yaml
```
## Credentials and optional vault integration
Environment variables remain the default for quick local development and tests:
```bash
export HF_TOKEN=hf_example
export HF_PUSH_TOKEN=hf_example
export OPENROUTER_API_KEY=sk-or-v1-example
```
OBLITERATUS also provides a provider-neutral secret hook for deployments backed by
OpenBao, HashiCorp Vault, Kubernetes, Docker, systemd credentials, or another secret
manager. No vault SDK is required. Each existing credential name resolves in this
order:
1. explicit UI or Python argument, where supported;
2. its existing environment variable;
3. `<NAME>_FILE`, such as `OPENROUTER_API_KEY_FILE`;
4. a file in `OBLITERATUS_SECRET_DIR`;
5. a systemd credential in `CREDENTIALS_DIRECTORY`;
6. the trusted executable configured by `OBLITERATUS_SECRET_COMMAND`.
Mounted directories use normalized lowercase filenames. For example,
`OPENROUTER_API_KEY` maps to `openrouter-api-key`, and `HF_TOKEN` maps to
`hf-token`. Existing uppercase filenames are also accepted. A Vault/OpenBao Agent
can render those files into a private tmpfs mount:
```bash
export OBLITERATUS_SECRET_DIR=/run/secrets/obliteratus
obliteratus ui
```
For brokers that fetch values on demand, configure one absolute executable path:
```bash
export OBLITERATUS_SECRET_COMMAND=/usr/local/libexec/obliteratus-secret
obliteratus ui
```
The executable receives exactly one argument—the normalized environment-variable
name—and writes only the secret value to stdout. Exit `0` returns a value, exit `2`
means the credential is unavailable, and other statuses fail closed. It runs without
a shell and with a bounded timeout. Treat the executable as privileged deployment
configuration; never point it at contributor-controlled code or emit diagnostics on
stdout. Secrets are resolved at use time so mounted-file and broker rotations do not
require restarting the application.
## Two intervention paradigms
OBLITERATUS supports both permanent and reversible liberation: