From 93f79f881a718f35596dcd44e705b29b8c5c25c3 Mon Sep 17 00:00:00 2001 From: Peter Nied Date: Wed, 4 Oct 2023 15:48:42 -0500 Subject: [PATCH] [Build Break] Update custom serialization min supported version (#3458) Update custom serialization min supported version, should be 2.11.0 since the features backport [1] was merged. - [1] https://github.com/opensearch-project/security/pull/3444 Signed-off-by: Peter Nied --- .../org/opensearch/security/support/ConfigConstants.java | 2 +- .../security/transport/SecuritySSLRequestHandlerTests.java | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/opensearch/security/support/ConfigConstants.java b/src/main/java/org/opensearch/security/support/ConfigConstants.java index 9ac73cd579..1f5728edfb 100644 --- a/src/main/java/org/opensearch/security/support/ConfigConstants.java +++ b/src/main/java/org/opensearch/security/support/ConfigConstants.java @@ -326,7 +326,7 @@ public enum RolesMappingResolution { public static final String TENANCY_GLOBAL_TENANT_DEFAULT_NAME = ""; public static final String USE_JDK_SERIALIZATION = "plugins.security.use_jdk_serialization"; - public static final Version FIRST_CUSTOM_SERIALIZATION_SUPPORTED_OS_VERSION = Version.V_3_0_0; + public static final Version FIRST_CUSTOM_SERIALIZATION_SUPPORTED_OS_VERSION = Version.V_2_11_0; // On-behalf-of endpoints settings // CS-SUPPRESS-SINGLE: RegexpSingleline get Extensions Settings diff --git a/src/test/java/org/opensearch/security/transport/SecuritySSLRequestHandlerTests.java b/src/test/java/org/opensearch/security/transport/SecuritySSLRequestHandlerTests.java index 23a64e4be3..2c160dfe31 100644 --- a/src/test/java/org/opensearch/security/transport/SecuritySSLRequestHandlerTests.java +++ b/src/test/java/org/opensearch/security/transport/SecuritySSLRequestHandlerTests.java @@ -66,12 +66,17 @@ public void testUseJDKSerializationHeaderIsSetOnMessageReceived() throws Excepti TransportChannel transportChannel = mock(TransportChannel.class); Task task = mock(Task.class); doNothing().when(transportChannel).sendResponse(ArgumentMatchers.any(Exception.class)); - when(transportChannel.getVersion()).thenReturn(Version.V_2_11_0); + when(transportChannel.getVersion()).thenReturn(Version.V_2_10_0); when(transportChannel.getChannelType()).thenReturn("transport"); Assert.assertThrows(Exception.class, () -> securitySSLRequestHandler.messageReceived(transportRequest, transportChannel, task)); Assert.assertTrue(threadPool.getThreadContext().getTransient(ConfigConstants.USE_JDK_SERIALIZATION)); + threadPool.getThreadContext().stashContext(); + when(transportChannel.getVersion()).thenReturn(Version.V_2_11_0); + Assert.assertThrows(Exception.class, () -> securitySSLRequestHandler.messageReceived(transportRequest, transportChannel, task)); + Assert.assertFalse(threadPool.getThreadContext().getTransient(ConfigConstants.USE_JDK_SERIALIZATION)); + threadPool.getThreadContext().stashContext(); when(transportChannel.getVersion()).thenReturn(Version.V_3_0_0); Assert.assertThrows(Exception.class, () -> securitySSLRequestHandler.messageReceived(transportRequest, transportChannel, task));