From 763747df716059c9c06cc33b5035fcec5d4c1e6e Mon Sep 17 00:00:00 2001 From: Robert Muir Date: Thu, 3 Dec 2015 23:36:02 -0500 Subject: [PATCH] don't let pluginmanager install modules --- .../org/elasticsearch/plugins/PluginManager.java | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/core/src/main/java/org/elasticsearch/plugins/PluginManager.java b/core/src/main/java/org/elasticsearch/plugins/PluginManager.java index fa190354018..599395807d0 100644 --- a/core/src/main/java/org/elasticsearch/plugins/PluginManager.java +++ b/core/src/main/java/org/elasticsearch/plugins/PluginManager.java @@ -66,6 +66,10 @@ public class PluginManager { "plugin", "plugin.bat", "service.bat")); + + static final Set MODULES = unmodifiableSet(newHashSet( + "lang-expression", + "lang-groovy")); static final Set OFFICIAL_PLUGINS = unmodifiableSet(newHashSet( "analysis-icu", @@ -78,8 +82,6 @@ public class PluginManager { "discovery-ec2", "discovery-gce", "discovery-multicast", - "lang-expression", - "lang-groovy", "lang-javascript", "lang-python", "mapper-attachments", @@ -221,6 +223,12 @@ public class PluginManager { PluginInfo info = PluginInfo.readFromProperties(root); terminal.println(VERBOSE, "%s", info); + // don't let luser install plugin as a module... + // they might be unavoidably in maven central and are packaged up the same way) + if (MODULES.contains(info.getName())) { + throw new IOException("plugin '" + info.getName() + "' cannot be installed like this, it is a system module"); + } + // update name in handle based on 'name' property found in descriptor file pluginHandle = new PluginHandle(info.getName(), pluginHandle.version, pluginHandle.user); final Path extractLocation = pluginHandle.extractedDir(environment);