Skip to content

Commit fefb191

Browse files
feat: keep secret length in logs
1 parent bd91a8f commit fefb191

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

bridge.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,7 @@ func newInterceptionProcessor(p provider.Provider, cbs *circuitbreaker.ProviderC
247247
slog.F("streaming", interceptor.Streaming()),
248248
slog.F("credential_kind", string(cred.Kind)),
249249
slog.F("credential_hint", cred.Hint),
250+
slog.F("credential_length", cred.Length),
250251
)
251252

252253
log.Debug(ctx, "interception started")

intercept/credential.go

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,18 @@ const (
1414

1515
// CredentialInfo holds credential metadata for an interception.
1616
type CredentialInfo struct {
17-
Kind CredentialKind
18-
Hint string
17+
Kind CredentialKind
18+
Hint string
19+
Length int
1920
}
2021

2122
// NewCredentialInfo creates a CredentialInfo from a raw credential.
2223
// The credential is automatically masked before storage so that the
2324
// original secret is never retained.
2425
func NewCredentialInfo(kind CredentialKind, credential string) CredentialInfo {
2526
return CredentialInfo{
26-
Kind: kind,
27-
Hint: utils.MaskSecret(credential),
27+
Kind: kind,
28+
Hint: utils.MaskSecret(credential),
29+
Length: len(credential),
2830
}
2931
}

0 commit comments

Comments
 (0)