Skip to content

Commit 1a24c95

Browse files
Address review feedback for mTLS default trust handling
1 parent b6f5f6b commit 1a24c95

4 files changed

Lines changed: 18 additions & 31 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
#### Exporters
88

9-
* OTLP: Fix OkHttp HTTP sender dropping client certificates when client TLS is configured without custom trusted certificates.
9+
* Fix OkHttp client mTLS when using the platform default trust store. (#8565)
1010

1111
## Version 1.63.0 (2026-06-05)
1212

exporters/common/src/main/java/io/opentelemetry/exporter/internal/TlsConfigHelper.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ public X509TrustManager getTrustManager() {
112112
}
113113

114114
@Nullable
115-
public X509TrustManager getEffectiveTrustManager() throws SSLException {
115+
X509TrustManager getEffectiveTrustManager() throws SSLException {
116116
if (trustManager != null) {
117117
return trustManager;
118118
}

exporters/common/src/test/java/io/opentelemetry/exporter/internal/TlsConfigHelperTest.java

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -97,19 +97,6 @@ void setSslContext_AlreadyExists_Throws() throws Exception {
9797
.hasMessageContaining("sslContext or trustManager has been previously configured");
9898
}
9999

100-
@Test
101-
void getEffectiveTrustManager_returnsConfiguredTrustManager()
102-
throws CertificateEncodingException, SSLException {
103-
helper.setTrustManagerFromCerts(serverTls.certificate().getEncoded());
104-
105-
assertThat(helper.getEffectiveTrustManager()).isSameAs(helper.getTrustManager());
106-
}
107-
108-
@Test
109-
void getEffectiveTrustManager_returnsDefaultTrustManager() throws SSLException {
110-
assertThat(helper.getEffectiveTrustManager()).isNotNull();
111-
}
112-
113100
@Test
114101
void getSslContext_wrapsDefaultTrustManagerFailure() {
115102
String originalAlgorithm = Security.getProperty("ssl.TrustManagerFactory.algorithm");

exporters/sender/okhttp/src/test/java/io/opentelemetry/exporter/sender/okhttp/internal/OkHttpHttpSenderTest.java

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
import static org.assertj.core.api.Assertions.assertThat;
99
import static org.assertj.core.api.Assertions.assertThatThrownBy;
10+
import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
1011

1112
import io.opentelemetry.sdk.common.export.HttpResponse;
1213
import io.opentelemetry.sdk.common.export.MessageWriter;
@@ -70,22 +71,21 @@ void constructor_usesDefaultTrustManagerWhenTrustManagerIsNull() throws Exceptio
7071
SSLContext sslContext = SSLContext.getInstance("TLS");
7172
sslContext.init(null, null, null);
7273

73-
OkHttpHttpSender sender =
74-
new OkHttpHttpSender(
75-
URI.create("https://localhost"),
76-
"text/plain",
77-
null,
78-
Duration.ofSeconds(10),
79-
Duration.ofSeconds(10),
80-
Collections::emptyMap,
81-
null,
82-
null,
83-
sslContext,
84-
null,
85-
null,
86-
Long.MAX_VALUE);
87-
88-
assertThat(sender).isNotNull();
74+
assertDoesNotThrow(
75+
() ->
76+
new OkHttpHttpSender(
77+
URI.create("https://localhost"),
78+
"text/plain",
79+
null,
80+
Duration.ofSeconds(10),
81+
Duration.ofSeconds(10),
82+
Collections::emptyMap,
83+
null,
84+
null,
85+
sslContext,
86+
null,
87+
null,
88+
Long.MAX_VALUE));
8989
}
9090

9191
@Test

0 commit comments

Comments
 (0)