Skip to content

Commit 81669e7

Browse files
committed
🛡️ Sentinel: [CRITICAL] Prevent leaking Azure OpenAI API key in logs
When `OPENAI_LOG` is configured, `HttpLoggingInterceptor` logs HTTP requests/responses. Previously, only the `Authorization` header was redacted. This commit also redacts the `api-key` header to ensure Azure API keys are not exposed in application logs.
1 parent 5a09e6b commit 81669e7

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

  • openai-java-client-okhttp/src/main/kotlin/com/openai/client/okhttp

openai-java-client-okhttp/src/main/kotlin/com/openai/client/okhttp/OkHttpClient.kt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,10 @@ internal constructor(@JvmSynthetic internal val okHttpClient: okhttp3.OkHttpClie
9595
}
9696
if (logLevel != null) {
9797
clientBuilder.addNetworkInterceptor(
98-
HttpLoggingInterceptor().setLevel(logLevel).apply { redactHeader("Authorization") }
98+
HttpLoggingInterceptor().setLevel(logLevel).apply {
99+
redactHeader("Authorization")
100+
redactHeader("api-key")
101+
}
99102
)
100103
}
101104

0 commit comments

Comments
 (0)