Tighten which classes can exit

Today we allow exiting solely by being in certain packages. This commit
upgrades the securesm dependency to a new version that supports being
explicit about which classes can exit. We utilize that here to only
allow exiting from the uncaught exception handler and the base CLI
command class.

Relates #27482
This commit is contained in:
Jason Tedor 2017-11-21 16:37:41 -05:00 committed by GitHub
parent 3427062c3a
commit f5a79af578
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 5 additions and 5 deletions

View File

@ -55,7 +55,7 @@ dependencies {
compile "org.apache.lucene:lucene-spatial3d:${versions.lucene}"
compile "org.apache.lucene:lucene-suggest:${versions.lucene}"
compile 'org.elasticsearch:securesm:1.1'
compile 'org.elasticsearch:securesm:1.2'
// utilities
compile "org.elasticsearch:elasticsearch-cli:${version}"

View File

@ -1 +0,0 @@
1e423447d020041534be94c0f31a49fbdc1f2950

View File

@ -0,0 +1 @@
4c28f5b634497d64b727961430a516f351a099d5

View File

@ -19,9 +19,8 @@
package org.elasticsearch.bootstrap;
import org.elasticsearch.Build;
import org.elasticsearch.SecureSM;
import org.elasticsearch.Version;
import org.elasticsearch.cli.Command;
import org.elasticsearch.common.SuppressForbidden;
import org.elasticsearch.common.io.PathUtils;
import org.elasticsearch.common.network.NetworkModule;
@ -120,7 +119,8 @@ final class Security {
Policy.setPolicy(new ESPolicy(createPermissions(environment), getPluginPermissions(environment), filterBadDefaults));
// enable security manager
System.setSecurityManager(new SecureSM(new String[] { "org.elasticsearch.bootstrap.", "org.elasticsearch.cli" }));
final String[] classesThatCanExit = new String[] { ElasticsearchUncaughtExceptionHandler.class.getName(), Command.class.getName()};
System.setSecurityManager(new SecureSM(classesThatCanExit));
// do some basic tests
selfTest();