OS: Mac OS 10.13.6
JDK: 1.8.0_191
Elasticsearch: 6.5.4
Dependencies management: Maven 3.6.0
I 've developed a Custom ES plugin with custom security policy, so I added the plugin-security.policy
file wich containing thegrant
statements for my additional permissions:
grant {
permission java.lang.RuntimePermission "accessDeclaredMembers";
permission java.lang.RuntimePermission "getClassLoader";
permission java.lang.RuntimePermission "setContextClassLoader";
permission java.lang.reflect.ReflectPermission "suppressAccessChecks";
permission org.hibernate.validator.HibernateValidatorPermission "accessPrivateMembers";
permission java.io.FilePermission "<<ALL FILES>>", "read,write,delete";
};
So far, my plugin runs greatly within an Elasticsearch instance.
Now I want to add integrations test for my plugin, so I integrate the elasticsearch-test framework and I loaded the plugin as mentioned here:
https://www.elastic.co/guide/en/elasticsearch/reference/6.6/integration-tests.html#changing-node-configuration,
After following those extra developement steps (https://github.com/elastic/elasticsearch/blob/master/CONTRIBUTING.md#configuring-ides-and-running-tests), I'm getting this Exception:
Caused by: java.security.AccessControlException: access denied ("java.lang.RuntimePermission" "accessDeclaredMembers")
at java.security.AccessControlContext.checkPermission(AccessControlContext.java:472)
at java.security.AccessController.checkPermission(AccessController.java:884)
at java.lang.SecurityManager.checkPermission(SecurityManager.java:549)
at java.lang.Class.checkMemberAccess(Class.java:2348)
So, I guess that my security-policy file which is placed at src/main/resources/plugin-metadata
, is not loaded at the test stage...
Can anyone, help me on how I include the security-policy file while testing?
Thanks,