rename vars and setup for test permissions

This commit is contained in:
Robert Muir 2015-06-26 23:28:18 -04:00
parent bda60d6d76
commit 641566d70c
2 changed files with 7 additions and 6 deletions

View File

@ -68,8 +68,8 @@ final class Security {
private static final Map<Pattern,String> SPECIAL_JARS; private static final Map<Pattern,String> SPECIAL_JARS;
static { static {
Map<Pattern,String> m = new IdentityHashMap<>(); Map<Pattern,String> m = new IdentityHashMap<>();
m.put(Pattern.compile(".*lucene-core-.*\\.jar$"), "es.security.lucene.core.jar"); m.put(Pattern.compile(".*lucene-core-.*\\.jar$"), "es.security.jar.lucene.core");
m.put(Pattern.compile(".*jsr166e-.*\\.jar$"), "es.security.twitter.jsr166e.jar"); m.put(Pattern.compile(".*jsr166e-.*\\.jar$"), "es.security.jar.twitter.jsr166e");
SPECIAL_JARS = Collections.unmodifiableMap(m); SPECIAL_JARS = Collections.unmodifiableMap(m);
} }
@ -95,7 +95,7 @@ final class Security {
} }
for (String prop : SPECIAL_JARS.values()) { for (String prop : SPECIAL_JARS.values()) {
if (System.getProperty(prop) == null) { if (System.getProperty(prop) == null) {
throw new IllegalStateException("property: " + prop + " was never set"); System.setProperty(prop, "/dev/null"); // no chance to be interpreted as "all"
} }
} }
} else { } else {

View File

@ -31,12 +31,12 @@ grant codeBase "file:${{java.ext.dirs}}/*" {
//// Very special jar permissions: //// Very special jar permissions:
//// These are dangerous permissions that we don't want to grant to everything. //// These are dangerous permissions that we don't want to grant to everything.
grant codeBase "${es.security.lucene.core.jar}" { grant codeBase "${es.security.jar.lucene.core}" {
// needed to allow MMapDirectory's "unmap hack" // needed to allow MMapDirectory's "unmap hack"
permission java.lang.RuntimePermission "accessClassInPackage.sun.misc"; permission java.lang.RuntimePermission "accessClassInPackage.sun.misc";
}; };
grant codeBase "${es.security.twitter.jsr166e.jar}" { grant codeBase "${es.security.jar.twitter.jsr166e}" {
// needed for LongAdder etc // needed for LongAdder etc
// TODO: remove this in java 8! // TODO: remove this in java 8!
permission java.lang.RuntimePermission "accessClassInPackage.sun.misc"; permission java.lang.RuntimePermission "accessClassInPackage.sun.misc";
@ -113,7 +113,8 @@ grant {
// needed by JDKESLoggerTests // needed by JDKESLoggerTests
permission java.util.logging.LoggingPermission "control"; permission java.util.logging.LoggingPermission "control";
// needed by Mockito // needed by Mockito to create mocks
// TODO: create simple securemock wrapper and only grant to that.
permission java.lang.RuntimePermission "reflectionFactoryAccess"; permission java.lang.RuntimePermission "reflectionFactoryAccess";
// needed to install SSLFactories, advanced SSL configuration, etc. // needed to install SSLFactories, advanced SSL configuration, etc.