Skip to content

Commit 7fa5873

Browse files
committed
xds: Remove empty-string SNI handling
Remove handling that propagated an empty string as SNI when no SNI conditions were met. With the legacy authority-based fallback removed, omitting SNI is the intended behavior under gRFC A101. Relying on an empty string as an intermediate representation is unnecessary and couples behavior to an internal detail. This also removes a test that asserted the empty-string SNI, as it no longer reflects a stable or observable contract.
1 parent ac57eed commit 7fa5873

2 files changed

Lines changed: 0 additions & 19 deletions

File tree

xds/src/main/java/io/grpc/xds/internal/security/SecurityProtocolNegotiators.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -222,8 +222,6 @@ public void handlerAdded(ChannelHandlerContext ctx) throws Exception {
222222
if (sniToUse.isEmpty()) {
223223
if (CertificateUtils.useChannelAuthorityIfNoSniApplicable) {
224224
sniToUse = grpcHandler.getAuthority();
225-
} else {
226-
sniToUse = "";
227225
}
228226
autoSniSanValidationDoesNotApply = true;
229227
} else {

xds/src/test/java/io/grpc/xds/internal/security/SecurityProtocolNegotiatorsTest.java

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -296,23 +296,6 @@ public void sniInClientSecurityHandler_autoHostSniIsFalse_usesSniFromUpstreamTls
296296
assertThat(clientSecurityHandler.getSni()).isEqualTo(SNI_IN_UTC);
297297
}
298298

299-
@Test
300-
public void sniInClientSecurityHandler_noSniConditionsMet_omitsSni() {
301-
Bootstrapper.BootstrapInfo bootstrapInfoForClient = CommonBootstrapperTestUtils
302-
.buildBootstrapInfo("google_cloud_private_spiffe-client", CLIENT_KEY_FILE,
303-
CLIENT_PEM_FILE, CA_PEM_FILE, null, null, null, null, null);
304-
UpstreamTlsContext upstreamTlsContext = CommonTlsContextTestsUtil.buildUpstreamTlsContext(
305-
"google_cloud_private_spiffe-client", true, "", false);
306-
SslContextProviderSupplier sslContextProviderSupplier =
307-
new SslContextProviderSupplier(upstreamTlsContext,
308-
new TlsContextManagerImpl(bootstrapInfoForClient));
309-
310-
ClientSecurityHandler clientSecurityHandler =
311-
new ClientSecurityHandler(grpcHandler, sslContextProviderSupplier, HOSTNAME);
312-
313-
assertThat(clientSecurityHandler.getSni()).isEqualTo("");
314-
}
315-
316299
@Test
317300
public void serverSecurityHandler_addLast()
318301
throws InterruptedException, TimeoutException, ExecutionException {

0 commit comments

Comments
 (0)