Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add missing runtime permission to TikaImpl #28602

Merged
merged 1 commit into from Feb 9, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -52,8 +52,8 @@
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.
Expand Down Expand Up @@ -161,6 +161,8 @@ static PermissionCollection getRestrictedPermissions() {
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"));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that we should have left an assertion here that the Java version is not JDK 11 (I think we will be able to remove this for JDK 11). I also think that this code should have been guarded by an if block checking that we are on JDK 10 and otherwise not add this permission.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Of course. I can add the conditional check. Whats the best (in terms of least changing) system property used for this that is the same across different JVMs? Maybe "java.specification.version" or a prefix of "java.version"?
About adding an assertion, are we sure that this is going to change back in JDK 11? Would an issue to trask this be better?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I opened #28603.

perms.setReadOnly();
return perms;
}
Expand Down
Expand Up @@ -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";
};