feat(channel): redact credentials from IM error messages (#240)

This commit is contained in:
Menci
2026-03-14 21:27:32 +08:00
committed by GitHub
parent e7844dfa89
commit be3d769013
19 changed files with 474 additions and 15 deletions
+9 -1
View File
@@ -12,6 +12,7 @@ import (
"github.com/jackc/pgx/v5"
"github.com/jackc/pgx/v5/pgtype"
"github.com/memohai/memoh/internal/channel"
"github.com/memohai/memoh/internal/db"
"github.com/memohai/memoh/internal/db/sqlc"
)
@@ -487,7 +488,14 @@ func FetchProviderByID(ctx context.Context, queries *sqlc.Queries, providerID st
if err != nil {
return sqlc.LlmProvider{}, err
}
return queries.GetLlmProviderByID(ctx, parsed)
provider, err := queries.GetLlmProviderByID(ctx, parsed)
if err != nil {
return sqlc.LlmProvider{}, err
}
if strings.TrimSpace(provider.ApiKey) != "" {
channel.SetIMErrorSecrets("llm-provider:"+providerID, provider.ApiKey)
}
return provider, nil
}
func intToInt4(value int, name string) (pgtype.Int4, error) {