From cc9cb5356afad1c7d8de1d5a8b922e6f90dd399a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christoph=20B=C3=BCscher?= Date: Fri, 9 Feb 2018 14:41:24 +0100 Subject: [PATCH] Add missing runtime permission to TikaImpl (#28602) Tests on jdk10 were failing because of a change in its ZipFile implementation that now needs `accessDeclaredMembers` permissions. This change adds the missing permission to the plugins security policy and TikaImpl. Closes #28568 --- .../java/org/elasticsearch/ingest/attachment/TikaImpl.java | 4 +++- .../src/main/plugin-metadata/plugin-security.policy | 2 ++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/plugins/ingest-attachment/src/main/java/org/elasticsearch/ingest/attachment/TikaImpl.java b/plugins/ingest-attachment/src/main/java/org/elasticsearch/ingest/attachment/TikaImpl.java index 9c3366d160e..4cf7801502f 100644 --- a/plugins/ingest-attachment/src/main/java/org/elasticsearch/ingest/attachment/TikaImpl.java +++ b/plugins/ingest-attachment/src/main/java/org/elasticsearch/ingest/attachment/TikaImpl.java @@ -52,8 +52,8 @@ import java.security.SecurityPermission; import java.util.Arrays; import java.util.HashSet; import java.util.LinkedHashSet; -import java.util.Set; import java.util.PropertyPermission; +import java.util.Set; /** * Runs tika with limited parsers and limited permissions. @@ -161,6 +161,8 @@ final class TikaImpl { perms.add(new ReflectPermission("suppressAccessChecks")); // xmlbeans, use by POI, needs to get the context classloader perms.add(new RuntimePermission("getClassLoader")); + // ZipFile needs accessDeclaredMembers on Java 10 + perms.add(new RuntimePermission("accessDeclaredMembers")); perms.setReadOnly(); return perms; } diff --git a/plugins/ingest-attachment/src/main/plugin-metadata/plugin-security.policy b/plugins/ingest-attachment/src/main/plugin-metadata/plugin-security.policy index adf76991b59..0cd359a9973 100644 --- a/plugins/ingest-attachment/src/main/plugin-metadata/plugin-security.policy +++ b/plugins/ingest-attachment/src/main/plugin-metadata/plugin-security.policy @@ -29,4 +29,6 @@ grant { permission java.lang.reflect.ReflectPermission "suppressAccessChecks"; // needed by xmlbeans, as part of POI for MS xml docs permission java.lang.RuntimePermission "getClassLoader"; + // ZipFile needs accessDeclaredMembers on Java 10 + permission java.lang.RuntimePermission "accessDeclaredMembers"; };