feat(configcmd): Spec.SecretKeys redacts a program's own secret options

"config show" redacted only keys whose last segment is secrets, secret,
token or password. A program's own secrets (database.url,
oidc.client_secret, smtp.url, ...) were printed, so programs disabled
show. Spec.SecretKeys names them as dotted keys (a key covers everything
below it); Effective carries them to Values and Show. First consumer:
yaemp and yaemp-mcp.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
terminarandClaude Opus 5.5 committed 2026-11-21 17:32:16 +01:00
1 parent 31dbc347e8
commit 8513b6db4c
5 files changed
+67 -4

No files matched your search

+4
View File
@@ -73,6 +73,9 @@ type Effective struct {
// Loader is the Layered loader's own value for this configuration
// (e.g. its richer layer list), for its Unknown hook; nil otherwise.
Loader any
// SecretKeys are redacted by Values and Show in addition to the
// default secret names (Spec.SecretKeys).
SecretKeys []string
}
// Used returns the layers that contributed, highest priority first.
@@ -233,6 +236,7 @@ func (s Spec) show(explicit string, args []string, stdout, stderr io.Writer) int
return ExitProblem
}
used := s.usedFunc()
e.SecretKeys = s.SecretKeys
if err := e.Show(stdout, used, *asJSON, *secrets); err != nil {
fmt.Fprintf(stderr, "%s config show: %v\n", s.Name, err)
return ExitProblem