From fcbdecf480871b87199fbbbcc3b4388f3aa958d2 Mon Sep 17 00:00:00 2001 From: Andriy Redko Date: Thu, 11 Nov 2021 15:57:34 -0500 Subject: [PATCH] [repository-azure] Update to the latest Azure Storage SDK v12, remove privileged runnable wrapper in favor of access helper (#1521) Signed-off-by: Andriy Redko --- plugins/repository-azure/build.gradle | 14 ++++++------- .../licenses/azure-core-1.20.0.jar.sha1 | 1 - .../licenses/azure-core-1.22.0.jar.sha1 | 1 + .../azure-core-http-netty-1.11.0.jar.sha1 | 1 - .../azure-core-http-netty-1.11.2.jar.sha1 | 1 + .../azure-storage-blob-12.13.0.jar.sha1 | 1 - .../azure-storage-blob-12.14.1.jar.sha1 | 1 + .../azure-storage-common-12.12.0.jar.sha1 | 1 - .../azure-storage-common-12.14.0.jar.sha1 | 1 + .../licenses/reactor-netty-1.0.12.jar.sha1 | 1 - .../licenses/reactor-netty-1.0.13.jar.sha1 | 1 + .../reactor-netty-core-1.0.12.jar.sha1 | 1 - .../reactor-netty-core-1.0.13.jar.sha1 | 1 + .../reactor-netty-http-1.0.12.jar.sha1 | 1 - .../reactor-netty-http-1.0.13.jar.sha1 | 1 + .../azure/AzureStorageService.java | 20 +++++++++---------- 16 files changed, 24 insertions(+), 24 deletions(-) delete mode 100644 plugins/repository-azure/licenses/azure-core-1.20.0.jar.sha1 create mode 100644 plugins/repository-azure/licenses/azure-core-1.22.0.jar.sha1 delete mode 100644 plugins/repository-azure/licenses/azure-core-http-netty-1.11.0.jar.sha1 create mode 100644 plugins/repository-azure/licenses/azure-core-http-netty-1.11.2.jar.sha1 delete mode 100644 plugins/repository-azure/licenses/azure-storage-blob-12.13.0.jar.sha1 create mode 100644 plugins/repository-azure/licenses/azure-storage-blob-12.14.1.jar.sha1 delete mode 100644 plugins/repository-azure/licenses/azure-storage-common-12.12.0.jar.sha1 create mode 100644 plugins/repository-azure/licenses/azure-storage-common-12.14.0.jar.sha1 delete mode 100644 plugins/repository-azure/licenses/reactor-netty-1.0.12.jar.sha1 create mode 100644 plugins/repository-azure/licenses/reactor-netty-1.0.13.jar.sha1 delete mode 100644 plugins/repository-azure/licenses/reactor-netty-core-1.0.12.jar.sha1 create mode 100644 plugins/repository-azure/licenses/reactor-netty-core-1.0.13.jar.sha1 delete mode 100644 plugins/repository-azure/licenses/reactor-netty-http-1.0.12.jar.sha1 create mode 100644 plugins/repository-azure/licenses/reactor-netty-http-1.0.13.jar.sha1 diff --git a/plugins/repository-azure/build.gradle b/plugins/repository-azure/build.gradle index 71356129845e5..ca8eb911e0c2e 100644 --- a/plugins/repository-azure/build.gradle +++ b/plugins/repository-azure/build.gradle @@ -44,9 +44,9 @@ opensearchplugin { } dependencies { - api 'com.azure:azure-core:1.20.0' - api 'com.azure:azure-storage-common:12.12.0' - api 'com.azure:azure-core-http-netty:1.11.0' + api 'com.azure:azure-core:1.22.0' + api 'com.azure:azure-storage-common:12.14.0' + api 'com.azure:azure-core-http-netty:1.11.2' api "io.netty:netty-codec-dns:${versions.netty}" api "io.netty:netty-codec-socks:${versions.netty}" api "io.netty:netty-codec-http2:${versions.netty}" @@ -54,12 +54,12 @@ dependencies { api "io.netty:netty-resolver-dns:${versions.netty}" api "io.netty:netty-transport-native-unix-common:${versions.netty}" implementation project(':modules:transport-netty4') - api 'com.azure:azure-storage-blob:12.13.0' + api 'com.azure:azure-storage-blob:12.14.1' api 'org.reactivestreams:reactive-streams:1.0.3' api 'io.projectreactor:reactor-core:3.4.11' - api 'io.projectreactor.netty:reactor-netty:1.0.12' - api 'io.projectreactor.netty:reactor-netty-core:1.0.12' - api 'io.projectreactor.netty:reactor-netty-http:1.0.12' + api 'io.projectreactor.netty:reactor-netty:1.0.13' + api 'io.projectreactor.netty:reactor-netty-core:1.0.13' + api 'io.projectreactor.netty:reactor-netty-http:1.0.13' api "org.slf4j:slf4j-api:${versions.slf4j}" api "com.fasterxml.jackson.core:jackson-annotations:${versions.jackson}" api "com.fasterxml.jackson.core:jackson-databind:${versions.jackson}" diff --git a/plugins/repository-azure/licenses/azure-core-1.20.0.jar.sha1 b/plugins/repository-azure/licenses/azure-core-1.20.0.jar.sha1 deleted file mode 100644 index 23e7e7ed4fdb6..0000000000000 --- a/plugins/repository-azure/licenses/azure-core-1.20.0.jar.sha1 +++ /dev/null @@ -1 +0,0 @@ -a98c6bd18aa2066ecd8b39bf7ac51bd8e7307851 \ No newline at end of file diff --git a/plugins/repository-azure/licenses/azure-core-1.22.0.jar.sha1 b/plugins/repository-azure/licenses/azure-core-1.22.0.jar.sha1 new file mode 100644 index 0000000000000..f57b83e5d9715 --- /dev/null +++ b/plugins/repository-azure/licenses/azure-core-1.22.0.jar.sha1 @@ -0,0 +1 @@ +194b21b804c20c85f7d2a6199280075f6747e188 \ No newline at end of file diff --git a/plugins/repository-azure/licenses/azure-core-http-netty-1.11.0.jar.sha1 b/plugins/repository-azure/licenses/azure-core-http-netty-1.11.0.jar.sha1 deleted file mode 100644 index ecf2b7db6f2e4..0000000000000 --- a/plugins/repository-azure/licenses/azure-core-http-netty-1.11.0.jar.sha1 +++ /dev/null @@ -1 +0,0 @@ -2177ae2dc9cff849e49f9180bf6b95b8e2c78e1b \ No newline at end of file diff --git a/plugins/repository-azure/licenses/azure-core-http-netty-1.11.2.jar.sha1 b/plugins/repository-azure/licenses/azure-core-http-netty-1.11.2.jar.sha1 new file mode 100644 index 0000000000000..3d3c0a59a77ba --- /dev/null +++ b/plugins/repository-azure/licenses/azure-core-http-netty-1.11.2.jar.sha1 @@ -0,0 +1 @@ +7d84ec31d73a7b51bc72044789768b25fb2b14f4 \ No newline at end of file diff --git a/plugins/repository-azure/licenses/azure-storage-blob-12.13.0.jar.sha1 b/plugins/repository-azure/licenses/azure-storage-blob-12.13.0.jar.sha1 deleted file mode 100644 index d34cbef4c7b52..0000000000000 --- a/plugins/repository-azure/licenses/azure-storage-blob-12.13.0.jar.sha1 +++ /dev/null @@ -1 +0,0 @@ -2743c7489761b18da1f578d934bb0b0363c2b2db \ No newline at end of file diff --git a/plugins/repository-azure/licenses/azure-storage-blob-12.14.1.jar.sha1 b/plugins/repository-azure/licenses/azure-storage-blob-12.14.1.jar.sha1 new file mode 100644 index 0000000000000..d9c6f462089e3 --- /dev/null +++ b/plugins/repository-azure/licenses/azure-storage-blob-12.14.1.jar.sha1 @@ -0,0 +1 @@ +384763aef32d779ee22ef3faa03049fee7e0f6de \ No newline at end of file diff --git a/plugins/repository-azure/licenses/azure-storage-common-12.12.0.jar.sha1 b/plugins/repository-azure/licenses/azure-storage-common-12.12.0.jar.sha1 deleted file mode 100644 index 06dbd9df253b5..0000000000000 --- a/plugins/repository-azure/licenses/azure-storage-common-12.12.0.jar.sha1 +++ /dev/null @@ -1 +0,0 @@ -3657650e3e17ce1f82b3a6fc5b68ba1005b869f9 \ No newline at end of file diff --git a/plugins/repository-azure/licenses/azure-storage-common-12.14.0.jar.sha1 b/plugins/repository-azure/licenses/azure-storage-common-12.14.0.jar.sha1 new file mode 100644 index 0000000000000..c2fbd451e785e --- /dev/null +++ b/plugins/repository-azure/licenses/azure-storage-common-12.14.0.jar.sha1 @@ -0,0 +1 @@ +ed58d3438a7fa3a2a5e9f60c0111795101dc8bf6 \ No newline at end of file diff --git a/plugins/repository-azure/licenses/reactor-netty-1.0.12.jar.sha1 b/plugins/repository-azure/licenses/reactor-netty-1.0.12.jar.sha1 deleted file mode 100644 index e072c974ac172..0000000000000 --- a/plugins/repository-azure/licenses/reactor-netty-1.0.12.jar.sha1 +++ /dev/null @@ -1 +0,0 @@ -4765023130d1dc1e8ec3e5e7842564953cf549db \ No newline at end of file diff --git a/plugins/repository-azure/licenses/reactor-netty-1.0.13.jar.sha1 b/plugins/repository-azure/licenses/reactor-netty-1.0.13.jar.sha1 new file mode 100644 index 0000000000000..be6cfc229b9b2 --- /dev/null +++ b/plugins/repository-azure/licenses/reactor-netty-1.0.13.jar.sha1 @@ -0,0 +1 @@ +cf216a9ba6b50210664761add9db744c9c3f51d8 \ No newline at end of file diff --git a/plugins/repository-azure/licenses/reactor-netty-core-1.0.12.jar.sha1 b/plugins/repository-azure/licenses/reactor-netty-core-1.0.12.jar.sha1 deleted file mode 100644 index 16e86450c14dc..0000000000000 --- a/plugins/repository-azure/licenses/reactor-netty-core-1.0.12.jar.sha1 +++ /dev/null @@ -1 +0,0 @@ -2b5b9fee56a6e492db277cd27e8baa7e1988e3cd \ No newline at end of file diff --git a/plugins/repository-azure/licenses/reactor-netty-core-1.0.13.jar.sha1 b/plugins/repository-azure/licenses/reactor-netty-core-1.0.13.jar.sha1 new file mode 100644 index 0000000000000..8f81861f48dde --- /dev/null +++ b/plugins/repository-azure/licenses/reactor-netty-core-1.0.13.jar.sha1 @@ -0,0 +1 @@ +a67949c5946dd66c7ab0a3b059213c23345c32b1 \ No newline at end of file diff --git a/plugins/repository-azure/licenses/reactor-netty-http-1.0.12.jar.sha1 b/plugins/repository-azure/licenses/reactor-netty-http-1.0.12.jar.sha1 deleted file mode 100644 index dc1f350c360f4..0000000000000 --- a/plugins/repository-azure/licenses/reactor-netty-http-1.0.12.jar.sha1 +++ /dev/null @@ -1 +0,0 @@ -494c9d45bc4de180e2eb911d1af7077c80740276 \ No newline at end of file diff --git a/plugins/repository-azure/licenses/reactor-netty-http-1.0.13.jar.sha1 b/plugins/repository-azure/licenses/reactor-netty-http-1.0.13.jar.sha1 new file mode 100644 index 0000000000000..e6b4cb0b9a4e8 --- /dev/null +++ b/plugins/repository-azure/licenses/reactor-netty-http-1.0.13.jar.sha1 @@ -0,0 +1 @@ +de7a38101098db9438c18fdd09acc5b79a2ec02a \ No newline at end of file diff --git a/plugins/repository-azure/src/main/java/org/opensearch/repositories/azure/AzureStorageService.java b/plugins/repository-azure/src/main/java/org/opensearch/repositories/azure/AzureStorageService.java index 7eaff6d6875d6..0faa8283c372e 100644 --- a/plugins/repository-azure/src/main/java/org/opensearch/repositories/azure/AzureStorageService.java +++ b/plugins/repository-azure/src/main/java/org/opensearch/repositories/azure/AzureStorageService.java @@ -46,6 +46,7 @@ import com.azure.core.http.ProxyOptions.Type; import com.azure.core.http.netty.NettyAsyncHttpClientBuilder; import com.azure.core.http.policy.HttpPipelinePolicy; +import com.azure.core.util.Configuration; import com.azure.core.util.Context; import com.azure.core.util.logging.ClientLogger; import com.azure.storage.blob.BlobServiceClient; @@ -67,9 +68,7 @@ import java.net.InetSocketAddress; import java.net.Proxy; import java.net.URISyntaxException; -import java.security.AccessController; import java.security.InvalidKeyException; -import java.security.PrivilegedAction; import java.time.Duration; import java.util.Arrays; import java.util.HashMap; @@ -103,6 +102,14 @@ public class AzureStorageService implements AutoCloseable { volatile Map storageSettings = emptyMap(); private final Map clients = new ConcurrentHashMap<>(); + static { + // See please: + // - https://github.com/Azure/azure-sdk-for-java/issues/24373 + // - https://github.com/Azure/azure-sdk-for-java/pull/25004 + // - https://github.com/Azure/azure-sdk-for-java/pull/24374 + Configuration.getGlobalConfiguration().put("AZURE_JACKSON_ADAPTER_USE_ACCESS_HELPER", "true"); + } + public AzureStorageService(Settings settings) { // eagerly load client settings so that secure settings are read final Map clientsSettings = AzureStorageSettings.load(settings); @@ -366,14 +373,7 @@ private static class NioThreadFactory implements ThreadFactory { } public Thread newThread(Runnable r) { - // See please: https://github.com/Azure/azure-sdk-for-java/pull/24374 - final Runnable priviledged = () -> { - AccessController.doPrivileged((PrivilegedAction) () -> { - r.run(); - return null; - }); - }; - final Thread t = new Thread(group, priviledged, namePrefix + threadNumber.getAndIncrement(), 0); + final Thread t = new Thread(group, r, namePrefix + threadNumber.getAndIncrement(), 0); if (t.isDaemon()) { t.setDaemon(false);