Skip to content

Self-service credentials: delete the Key Vault secret when a credential is removed #9

Description

@selic

DELETE /api/me/credentials/:upstreamId/:field removes only the SQLite ref row; the secret itself (gw-user-<principalSlug>-<upstreamId>-<field>) stays in the store forever. Re-registering overwrites it (deterministic name), so this is hygiene, not a correctness bug — but orphaned personal credentials accumulating in the platform vault is exactly the kind of residue the self-service flow was meant to avoid.

Scope

  • On credential delete, also delete the secret from the configured store (SecretStore gets a delete(path/name) method: Key Vault beginDeleteSecret, OpenBao KV v2 metadata delete, memory store for tests).
  • Deletion failures should not block removing the ref (log + proceed) — the ref row is the source of truth for what the gateway will use.
  • Ops prerequisite (NDR): the gateway MI on ndr-mspstack-kv currently has secrets get/list/set (set added 2026-07-17 for registration); add delete when this ships.
  • Consider the same for upstream removal: per-user secrets for a deleted upstream are also orphaned (gw-user-*-<upstreamId>-* sweep needs a list-by-prefix, KV supports it).

🤖 Generated with Claude Code

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions