internal/secret: secrets-engine registry with yaegi extension interface #936

Closed
opened 2026-10-27 13:38:22 +00:00 by sam · 0 comments
Owner

Add a secret-management package that avoids hard-coding secrets backends. Defines an Engine interface (Name, Version, Resolve(ref string) (map[string]string, error)) that custom secrets engines implement as yaegi-interpreted .go plugins, loaded the same way internal/plugin.LoadDir already loads daemon plugins (main.Engine export, resolved via yaegiutil.Resolve). Includes a built-in compiled-in 'env' engine, a Registry type, and a config.SecretRef type ({Engine, Ref string}) that directly REPLACES the existing TokenEnv/APIKeyEnv string fields across config.go (Forge, Provider, NATSConfig, TelegramConfig, etc) -- no backwards-compatibility shim, this is a clean cutover since the end user is the repo owner, not an external customer base. Ships no third-party engines yet (sops/bws/vault-openbao are follow-up beads) but proves the extension point with the env engine and a directory-loaded custom engine in tests.

Design

Mirrors internal/plugin's Plugin interface (Name/Version) + one Resolve method. Built-in env engine is native Go (trivial, no yaegi needed) registered by default. Custom/shipped engines are yaegi .go files loaded from a configurable directory via yaegiutil.Resolve[Engine](i, src, "main.Engine").

Acceptance Criteria

internal/secret package exists with Engine interface, Registry, LoadDir (yaegi-based, mirrors internal/plugin conventions) -- DONE. config.Forge.Token (SecretRef) replaces Forge.TokenEnv end-to-end including per-identity validation -- DONE. Provider/NATS/Telegram migration deferred to archie-core-xec.4 (scope narrowed mid-implementation after discovering the name-forwarding architecture fork). task check passes -- DONE. Adversarial review found zero surviving findings after fix pass -- DONE.


Imported from beads archie-core-1786637500522-408-28b934f6 · GitHub #429 · type feature · priority P2 · created 2026-08-08 · closed 2026-08-08

Add a secret-management package that avoids hard-coding secrets backends. Defines an Engine interface (Name, Version, Resolve(ref string) (map[string]string, error)) that custom secrets engines implement as yaegi-interpreted .go plugins, loaded the same way internal/plugin.LoadDir already loads daemon plugins (main.Engine export, resolved via yaegiutil.Resolve). Includes a built-in compiled-in 'env' engine, a Registry type, and a config.SecretRef type ({Engine, Ref string}) that directly REPLACES the existing TokenEnv/APIKeyEnv string fields across config.go (Forge, Provider, NATSConfig, TelegramConfig, etc) -- no backwards-compatibility shim, this is a clean cutover since the end user is the repo owner, not an external customer base. Ships no third-party engines yet (sops/bws/vault-openbao are follow-up beads) but proves the extension point with the env engine and a directory-loaded custom engine in tests. ### Design Mirrors internal/plugin's Plugin interface (Name/Version) + one Resolve method. Built-in env engine is native Go (trivial, no yaegi needed) registered by default. Custom/shipped engines are yaegi .go files loaded from a configurable directory via yaegiutil.Resolve[Engine](i, src, "main.Engine"). ### Acceptance Criteria internal/secret package exists with Engine interface, Registry, LoadDir (yaegi-based, mirrors internal/plugin conventions) -- DONE. config.Forge.Token (SecretRef) replaces Forge.TokenEnv end-to-end including per-identity validation -- DONE. Provider/NATS/Telegram migration deferred to archie-core-xec.4 (scope narrowed mid-implementation after discovering the name-forwarding architecture fork). task check passes -- DONE. Adversarial review found zero surviving findings after fix pass -- DONE. --- _Imported from beads `archie-core-1786637500522-408-28b934f6` · GitHub #429 · type feature · priority P2 · created 2026-08-08 · closed 2026-08-08_
sam added the mediumfeature labels 2026-10-27 13:38:22 +00:00
sam self-assigned this 2026-10-27 13:38:22 +00:00
sam closed this issue 2026-10-27 13:38:22 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: sam/archie#936