Skip to content

Decide: env-var secret exposure — fd/stdin injection or defer #31

Closed

Description

@tonibergholm

Part of #24

Question

sc run hands decrypted secrets to the child via environment variables, observable by same-user processes, crash dumps, and wrappers (documented P28 boundary; audit known-boundary finding). Does fd/stdin secret injection get specified now as an alternative or additional mode, or stay deferred with recorded rationale?

Activity

  1. self-assigned this
    on Jul 10, 2026
  2. tonibergholm commented on Jul 10, 2026

    @tonibergholm
    MemberAuthor

    Resolution

    fd/stdin secret injection stays deferred, with rationale. Env-var injection remains the contract for all three surfaces (sc run, sc work --with-secrets, sc ws run --with-secrets — one shared helper, secret_env, crates/repo/src/secrets.rs:330).

    Rationale (recorded, not implied):

    1. The security claim is mostly illusory against the boundary's named adversary. P28's threat model names same-user processes — but a same-user adversary reads the identity key file and .sc/ directly and decrypts everything; no injection mechanism changes that. What fd/stdin injection actually removes is accidental propagation — env dumps, inheritance by grandchildren — hygiene, not attack surface.
    2. Env stays the default mode forever regardless. Non-env modes require child cooperation (a program reading $API_KEY cannot read fd 3), so fd/stdin could only ever be an additional opt-in mode. Deferring an additive mode has no lock-in cost.
    3. The right convention is not yet decidable. An SC_SECRETS_FD pipe (KEY=VALUE lines) vs a systemd-LoadCredential-style credentials dir is a consumer-driven choice, and no real consumers exist yet; the credentials-dir shape additionally writes plaintext to disk (tmpfs only on Linux), colliding with the zero-plaintext-on-disk discipline. Windows lacks fd-inheritance parity — the platform story is part of the same open contract.

    Revisit triggers: real committed-secret use in agent sessions, or an observed env-leak incident class (agents dumping env into logs/committed files) — at which point the fd-pipe mode is the presumptive shape, and the accident-hygiene argument sharpens specifically because sc work/sc ws run hand secrets to agents, which are notorious env-dumpers.

    docs/THREAT-MODEL.md keeps P28's wording ("authorized local process context, NOT strong isolation"); ADR-0039's deferred-not-a-bug stance is reaffirmed by this decision.

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

Metadata

Metadata

Assignees

Labels

wayfinder:grillingWayfinder ticket: HITL grilling/decision

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions