PRD: Encrypted at-rest egress secrets (SecretProvider interim slice) #458

Merged
didericis merged 7 commits from prd-secret-provider-encrypted-env into main 2026-07-23 17:48:26 -04:00

7 Commits

Author SHA1 Message Date
didericis-codex 26d0f5e3b2 refactor(secrets): keep ciphertext format minimal
tracker-policy-pr / check-pr (pull_request) Successful in 15s
test / integration-docker (pull_request) Successful in 35s
test / unit (pull_request) Successful in 46s
test / integration-firecracker (pull_request) Successful in 4m17s
test / coverage (pull_request) Successful in 16s
test / publish-infra (pull_request) Has been skipped
test / integration-docker (push) Successful in 14s
prd-number / assign-numbers (push) Failing after 31s
test / unit (push) Successful in 41s
Update Quality Badges / update-badges (push) Successful in 44s
lint / lint (push) Successful in 1m0s
test / integration-firecracker (push) Successful in 4m59s
test / coverage (push) Successful in 24s
test / publish-infra (push) Successful in 1m49s
2026-07-23 21:39:07 +00:00
didericis-codex bc4e559775 test(secrets): satisfy static coverage checks 2026-07-23 21:39:07 +00:00
didericis-codex 854f6b5696 fix(secrets): recover encrypted tokens on all backends 2026-07-23 21:39:07 +00:00
didericis-claude 28953bfe0b fix(types): remove unused new_env_var_secret import
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-07-23 21:38:33 +00:00
didericis 1ffc553ade test(secrets): cover per-bottle egress secret encryption
Add unit coverage for the encrypted at-rest egress secrets: the
secret_store round-trip (new_env_var_secret/encrypt_value/decrypt_value)
and the registry/service wiring that injects ENV_VAR_SECRET.

Recovered from the bot-bottle-claude-agent-1 VM after the CI runner's
disk filled and forced its rootfs read-only; committed work was already
on origin, these were the agent's uncommitted changes.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-23 21:38:33 +00:00
didericis-claude 9014c07b86 feat(secrets): encrypt egress tokens at rest with per-bottle ENV_VAR_SECRET
Implements the interim secret-provider design (PRD prd-new-secret-provider):
each agent receives a random ENV_VAR_SECRET injected into its container env
at launch. The host uses this key to encrypt each egress auth token value
(HMAC-SHA256 CTR mode, stdlib-only) and store it in a new
bottled_agent_secrets table (one row per env var, key column plaintext for
auditing). The key never touches the DB.

On infra container restart the in-memory token map is lost. launch_consolidated
now calls _reprovision_running_bottles after ensure_running: for each
registered bottle still alive on the gateway network it execs
`printenv ENV_VAR_SECRET` into the agent container and posts the result to the
new POST /bottles/<id>/reprovision_gateway control-plane endpoint, which
decrypts the stored rows and restores _tokens — no manual intervention needed.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-07-23 21:38:33 +00:00
didericis 8e2465e241 docs(prd): draft encrypted at-rest egress secrets (SecretProvider interim)
The orchestrator holds each bottle's egress auth tokens in process memory
only, so recreating the infra container strips every already-running
bottle of its upstream credentials. The registry row and the gateway CA
both survive; the tokens do not, so /resolve serves an intact policy with
an empty token map and the addon fails closed on `token_env unset`.

Drafts the interim slice of #355: persist the tokens encrypted so they
survive a restart, without regressing to plaintext at rest and without
foreclosing the per-request minting end state. Design section is left for
the author to fill in.
2026-07-23 21:38:33 +00:00