From 88f175903e93e138687b5fbfe5140831df5440c2 Mon Sep 17 00:00:00 2001 From: liamfallon Date: Sat, 14 Sep 2019 12:39:25 +0100 Subject: Disable Jython Excutor for security The Jython interpreter pulls in many dependencies that are flagged as having security problems. We will disable Python support in apex-pdp until Frankfurt, users can compile from source if they wish to re-enable python support. Issue-ID: POLICY-1509 Change-Id: I84215ba8d1009cb7af99cd98ba19008fdff5c378 Signed-off-by: liamfallon --- .../apex/core/engine/EngineParameterConstants.java | 6 ++--- packages/apex-pdp-package-full/pom.xml | 5 ++-- .../plugins-executor-jython/pom.xml | 3 ++- plugins/plugins-executor/pom.xml | 2 +- pom.xml | 3 ++- .../integration/integration-executor-test/pom.xml | 5 ++-- .../executor/engine/TestApexEngineJython.java | 27 ++++++++++++---------- .../performance/performance-benchmark-test/pom.xml | 5 ++-- 8 files changed, 32 insertions(+), 24 deletions(-) diff --git a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/EngineParameterConstants.java b/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/EngineParameterConstants.java index 96a83f3a6..1ac0ef6c2 100644 --- a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/EngineParameterConstants.java +++ b/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/EngineParameterConstants.java @@ -5,15 +5,15 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - * + * * SPDX-License-Identifier: Apache-2.0 * ============LICENSE_END========================================================= */ diff --git a/packages/apex-pdp-package-full/pom.xml b/packages/apex-pdp-package-full/pom.xml index 064ed7ea3..2e015ba25 100644 --- a/packages/apex-pdp-package-full/pom.xml +++ b/packages/apex-pdp-package-full/pom.xml @@ -120,11 +120,12 @@ plugins-executor-jruby ${project.version} - + + org.onap.policy.apex-pdp.plugins.plugins-executor plugins-executor-mvel diff --git a/plugins/plugins-executor/plugins-executor-jython/pom.xml b/plugins/plugins-executor/plugins-executor-jython/pom.xml index d97ac4b32..b32ea76da 100644 --- a/plugins/plugins-executor/plugins-executor-jython/pom.xml +++ b/plugins/plugins-executor/plugins-executor-jython/pom.xml @@ -17,7 +17,8 @@ SPDX-License-Identifier: Apache-2.0 ============LICENSE_END========================================================= --> - + 4.0.0 org.onap.policy.apex-pdp.plugins.plugins-executor diff --git a/plugins/plugins-executor/pom.xml b/plugins/plugins-executor/pom.xml index 59f1567ad..8961053de 100644 --- a/plugins/plugins-executor/pom.xml +++ b/plugins/plugins-executor/pom.xml @@ -44,7 +44,7 @@ plugins-executor-java plugins-executor-javascript plugins-executor-jruby - plugins-executor-jython + plugins-executor-mvel diff --git a/pom.xml b/pom.xml index 566dd4345..0a0ba191c 100644 --- a/pom.xml +++ b/pom.xml @@ -238,7 +238,8 @@ ${project.basedir}/plugins/plugins-executor/plugins-executor-java/src ${project.basedir}/plugins/plugins-executor/plugins-executor-javascript/src ${project.basedir}/plugins/plugins-executor/plugins-executor-jruby/src - ${project.basedir}/plugins/plugins-executor/plugins-executor-jython/src + + ${project.basedir}/plugins/plugins-executor/plugins-executor-mvel/src ${project.basedir}/services/services-engine/src diff --git a/testsuites/integration/integration-executor-test/pom.xml b/testsuites/integration/integration-executor-test/pom.xml index 289287f17..ee759135c 100644 --- a/testsuites/integration/integration-executor-test/pom.xml +++ b/testsuites/integration/integration-executor-test/pom.xml @@ -54,12 +54,13 @@ ${project.version} test - + + org.onap.policy.apex-pdp.plugins.plugins-executor plugins-executor-javascript diff --git a/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/testsuites/integration/executor/engine/TestApexEngineJython.java b/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/testsuites/integration/executor/engine/TestApexEngineJython.java index 12a28e293..088d04fd7 100644 --- a/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/testsuites/integration/executor/engine/TestApexEngineJython.java +++ b/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/testsuites/integration/executor/engine/TestApexEngineJython.java @@ -5,15 +5,15 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - * + * * SPDX-License-Identifier: Apache-2.0 * ============LICENSE_END========================================================= */ @@ -32,11 +32,14 @@ import org.onap.policy.apex.context.parameters.SchemaParameters; import org.onap.policy.apex.core.engine.EngineParameters; import org.onap.policy.apex.core.infrastructure.threading.ThreadUtilities; import org.onap.policy.apex.model.basicmodel.concepts.ApexException; -import org.onap.policy.apex.plugins.executor.jython.JythonExecutorParameters; +import org.onap.policy.apex.plugins.executor.javascript.JavascriptExecutorParameters; import org.onap.policy.common.parameters.ParameterService; /** - * The Class TestApexEngineJython. + * The Class TestApexEngineJython should be the test class for the Jython interpreter. + * + *

It actually reruns the javascript tests as a placeholder until the Jython security issues are resolved. + * */ public class TestApexEngineJython { private SchemaParameters schemaParameters; @@ -49,12 +52,12 @@ public class TestApexEngineJython { @Before public void beforeTest() { schemaParameters = new SchemaParameters(); - + schemaParameters.setName(ContextParameterConstants.SCHEMA_GROUP_NAME); schemaParameters.getSchemaHelperParameterMap().put("JAVA", new JavaSchemaHelperParameters()); ParameterService.register(schemaParameters); - + contextParameters = new ContextParameters(); contextParameters.setName(ContextParameterConstants.MAIN_GROUP_NAME); @@ -66,9 +69,9 @@ public class TestApexEngineJython { ParameterService.register(contextParameters.getDistributorParameters()); ParameterService.register(contextParameters.getLockManagerParameters()); ParameterService.register(contextParameters.getPersistorParameters()); - + engineParameters = new EngineParameters(); - engineParameters.getExecutorParameterMap().put("JYTHON", new JythonExecutorParameters()); + engineParameters.getExecutorParameterMap().put("JAVASCRIPT", new JavascriptExecutorParameters()); ParameterService.register(engineParameters); } @@ -78,7 +81,7 @@ public class TestApexEngineJython { @After public void afterTest() { ParameterService.deregister(engineParameters); - + ParameterService.deregister(contextParameters.getDistributorParameters()); ParameterService.deregister(contextParameters.getLockManagerParameters()); ParameterService.deregister(contextParameters.getPersistorParameters()); @@ -96,8 +99,8 @@ public class TestApexEngineJython { */ @Test public void testApexEngineJython() throws ApexException, InterruptedException, IOException { - new TestApexEngine("JYTHON", engineParameters); + new TestApexEngine("JAVASCRIPT", engineParameters); ThreadUtilities.sleep(5000); - new TestApexEngine("JYTHON", engineParameters); + new TestApexEngine("JAVASCRIPT", engineParameters); } } diff --git a/testsuites/performance/performance-benchmark-test/pom.xml b/testsuites/performance/performance-benchmark-test/pom.xml index b849edbbb..bfc8e3c02 100644 --- a/testsuites/performance/performance-benchmark-test/pom.xml +++ b/testsuites/performance/performance-benchmark-test/pom.xml @@ -73,12 +73,13 @@ ${project.version} test - + + org.onap.policy.apex-pdp.plugins.plugins-executor plugins-executor-java -- cgit 1.2.3-korg