Skip to content

D-SEC-1's state limb: the config-time seam persists a secret as Environment=; the fix is the type owner's bind returning a HANDLE #75

Closed

Description

@aitrawog

What

charly config persists a resolved secret into the deployment's unit as Environment=. That is state, and D-SEC-1 forbids it.

D-SEC-1 (DESIGN.md:2511): "Secrets come only from the configured backend; they never enter the store, artifacts, labels, IR, state or output."

state is listed separately from the IR, and the config-time seam plugin-deploy-pod#74 adds satisfies only the IR limb.

The contract's own answer, and it is already in the merged wire

#BindInput  { need!: #BindNeed, provided_by!: #Ref, deployment!: #Ref }
#BindOutput { binding!: #Opaque }

// `binding` is the HANDLE the type owner mints for this pairing: opaque to core, and the only
// thing later `unbind` can name. Core never inspects it -- that is what makes the type the owner
// of its own capability rather than a lookup table core reads.   (spec/schema/bind.cue:48-52)

binding is #Opaque. Core never inspects it. So what enters state is a HANDLE, not a value — and DESIGN.md:685 says when:

capability when how
env, secret, endpoint, network, harness at realize delivered by the type owner's bind

binding being opaque is not an implementation detail — it is the enforcement. A core that can inspect a binding can leak it; a core that cannot, cannot.

Why this is filed rather than fixed in-tree

#74 cannot fix it, because the mechanism it needs does not exist yet: there is no type:secret owner with a bind. Building that owner is a cutover of its own (a new provider class, its schema row, its bind/unbind, and the four consumers migrating onto it), and #74 is the ordering step that removes the value from the IR — a strict narrowing (plan + state → state), not a compliance claim.

Per R1 this is filed because the change is correct and complete without the fix, and the finding is genuinely separable. It is not parked: it is the named successor and it must land before D-SEC-1 can be said to hold end to end.

The work

  1. plugin-secrets gains type:secret — a capability-type owner with bind/unbind, returning #BindOutput{binding: <opaque handle>} per spec/schema/bind.cue.
  2. Core stores the handle, never the value: the deployment's state carries binding, and the config writer emits a reference the owner can resolve at realize.
  3. The type owner resolves the handle at realize and delivers the bytes to the consumer — DESIGN.md:387: a secret use delivers bytes.
  4. The four consumers migrate: layer-qdrant, pod-openwebui, vm-k3s-agent, vm-k3s-server (grep -rn 'secret_require:' --include='*.yml' | grep -v '/.build/' → 4, with the colon).
  5. Then InjectSecretsIntoPlans (sdk/deploykit/secret_declare.go) is deleted, and its two call sites are gone: plugin-deploy-pod/overlay.go and plugin-fleet/secrets_artifacts.go:61.

The evidence that this is real, not theoretical

plugin-deploy-pod#74's bed (check-seam-proof) PASSES with:

$ grep 'seam-proof-token' .check/check-seam-proof/2026.321.1729/config.log
  charly-check-seam-proof-seam-proof-token → created (from config)

That line is the exposure: the value reached the unit's environment at config time. The bed proves the delivery; this issue is the proof that the delivery still lands in state.

Acceptance

  • git -C <repo> grep -rn 'Environment=' <the rendered unit> names a reference, never a value.
  • A check asserts the rendered unit contains none of the secret's bytes (the absence assertion, not the transport one).
  • The four consumers still receive their variables, proven live.

Assisted-by: DeepSeek Harness ollama-cloud/deepseek-v4.1-flash (analysed on a live system)

Activity

  1. added a commit that references this issue on Nov 17, 2026
  2. aitrawog commented on Nov 17, 2026

    @aitrawog
    ContributorAuthor

    CLAIM — lead's agent is taking this.

    Scope: the type:secret owner's bind returning an #Opaque handle, so the value leaves state as well as the IR. The wire already exists (spec/schema/bind.cue:48-52); the owner does not.

    Order (RDD first): a spike answering ONE question — can a type:secret provider's bind return a handle core stores, and can that handle be resolved back to bytes at realize? — before anything ships.

    Measured starting facts:

    • spec/schema/capability.cue:153: secret: {key: #Name, need: {}, use: #SecretUse} — no provide: row.
    • plugin-secrets/candy/plugin-secrets/charly.yml:40-42 declares verb:credential and command:secrets, not type:secret.
    • Four consumers: layer-qdrant/charly.yml:33, pod-openwebui/charly.yml:128, vm-k3s-agent/charly.yml:19, vm-k3s-server/charly.yml:67.

    Already landed: plugin-deploy-pod#76 (the IR limb, merged) and charly#1193 (the bed, merged, PASS steps=16).

    Blocking: nothing.

    Agent: lead
    Assisted-by: DeepSeek Harness ollama-cloud/deepseek-v4.1-flash

  3. aitrawog commented on Nov 17, 2026

    @aitrawog
    ContributorAuthor

    RESOLVED — landed as #80 (merge commit 7d09b528).

    D-SEC-1's state limb is closed — and not by the mechanism the issue (and my own brief) said it would need.

    A spike answered the question before anything was written: the bind wire has no host side (spec#370 now tracks it). What the leak actually was, measured on the rendered artifact:

    Secret=charly-seam-proof-box-seam-proof-token,type=env,target=SEAM_PROOF_TOKEN
    Environment=SEAM_PROOF_TOKEN=p75-state-leak-probe-9f2c
    

    The unit carried both. Secret= is the handle-shaped delivery that already worked. Environment= was #76's duplicate — a second copy whose only effect was to persist the value.

    The fix is the return shape: PodEnvVarsWithSecrets → EnsureBoxChainSecrets, returning secret names, never values. A function returning map[string]string has somewhere to put a value; this one did.

    $ grep -c 'Environment=SEAM_PROOF_TOKEN' .check/check-seam-proof/2026.321.2005/config.log
    0

    The container still receives the token (check-live PASS); the unit no longer carries it. A duplicate delivery is not a redundancy — here it was the leak.

    Agent: lead
    Assisted-by: DeepSeek Harness ollama-cloud/deepseek-v4.1-flash

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