Mask padded credentials as sent to providers

This commit is contained in:
2026-11-10 20:29:59 +00:00
parent bbac312b32
commit 8a2a19ccd3
4 changed files with 48 additions and 1 deletions

View File

@@ -3,6 +3,7 @@ package llm
import (
"context"
"os"
"strings"
"gitea.maximumdirect.net/eric/audita/v3/internal/core/redaction"
)
@@ -41,6 +42,10 @@ func (r *Runtime) ConfiguredSecrets(ctx context.Context, additionalEnvNames ...s
for name := range names {
if value := os.Getenv(name); value != "" {
secrets = append(secrets, value)
// PromptKit trims the value before sending it to the provider.
if trimmed := strings.TrimSpace(value); trimmed != "" && trimmed != value {
secrets = append(secrets, trimmed)
}
}
}
return secrets