Skip to content

Secret references in the stack file, resolved by pluggable providers #517

Open

Description

@7schmiede

Problem

A stack often needs real secrets in development: an API key for an external sandbox, a mail account, a token for a partner's test system. Today they end up in one of three places, none of them good:

  • a tracked env file (.env.defaults, devstack.env) with the value in plain text,
  • an untracked .env that every developer fills by hand and that drifts,
  • a per-repo script that chains env → .env → user secrets → a secret manager → prompt.

In addition, secrets in a lane's env files travel to remote pool nodes (ADR-0027), and an agent working through the MCP can read them via files or logs.

Proposal: secret references in the stack file, resolved by pluggable providers

[services.api.env]
PARTNER_API_KEY = { secret = "partner/sandbox/api-key" }            # default provider
MAIL_PASSWORD   = { secret = "dev/mail/password", provider = "ciphr" }
  • devstack resolves a reference when it starts the service and puts the value into the process environment only. It is never written to an env file, the journal, status/logs output or the MCP.
  • The MCP and the dashboard show whether a reference resolved (and from which provider), never the value.
  • A missing secret is a clear start error naming the reference and the provider, not an empty variable.

Providers: an open interface, no secret manager baked in

devstack ships two built-ins and an exec protocol, like git credential helpers or Docker credential helpers:

Provider Source
keychain (built-in) the OS keychain the hub already uses for upstream tokens
env (built-in) the developer's environment (CI, quick start)
exec:<name> an external helper devstack-secret-<name> on PATH

Exec protocol (sketch): devstack runs devstack-secret-<name> get with a JSON request on stdin ({"refs": ["dev/mail/password", …], "project": "<repo>"}) and reads {"values": {…}, "errors": {…}} from stdout. Exit code ≠ 0 = provider unavailable. The helper does its own authentication (its own token in its own store); devstack never sees the helper's credentials.

A secret manager such as ciphr then ships its own helper (devstack-secret-ciphr, using its existing /v1/export surface and a per-developer token). Nothing ciphr-specific lives in devstack, and another team can plug in Vault, 1Password, pass or a cloud secret store.

Pool

  • The pool coordinator distributes configuration only: which provider a project expects, its URL/CA if any, and which reference paths a project uses. Never values. A coordinator holding secrets would become the most valuable target in the network.
  • Every member authenticates with their own identity at the provider, so revocation and audit stay per person.
  • Lanes on a remote node: open question. Options: (a) a lane with secret references stays local by default (explicit opt-in to move it), (b) the node resolves with a token the member delegates for the lane's lifetime, (c) values are sent over the pool's mTLS channel into the remote process env only. (a) is the safe default; (b) is the clean long-term answer.

Not in scope

  • A developer login for the stack's own app. That should not be a secret at all: a well-known demo credential that structurally cannot reach production (seed only in dev, refuse to start in production when the demo credential exists).

Questions

  1. Is { secret = "…" } in env the right shape, or a separate [secrets] table per service?
  2. Exec protocol: JSON on stdin/stdout as above, or reuse an existing format (Docker credential helper protocol)?
  3. Default for remote lanes: (a), (b) or (c)?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions