openhab-core/bundles
Yannick Schaus 4e045204ac
[automation] Create Nashorn script engines with the proper class loader (#1799)
This should fix the issue reported here:
https://community.openhab.org/t/openhab-3-0-milestone-2-discussion/107564/8

where the Nashorn script engine would be created with the
current thread's class loader, causing JS code like this:
```
var Log = Java.type("org.openhab.core.model.script.actions.Log");
Log.logError("Experiments", "This is an OH error log");
Log.logWarn("Experiments", "This is an OH warn log");
Log.logInfo("Experiments", "This is an OH info log");
Log.logDebug("Experiments", "This is an OH debug log");
```
to run fine when the rule was triggered but fail to find the Log
class when run from the REST API's `/rest/rules/{ruleUID}/runnow`,
because in that case the generic createScriptEngine implementation
would return script engines using the JAX-RS class loader as the
"app" class loader.

Note:
We also have an opportunity to restrict which classes are exposed
to the script with a ClassFilter to a specific set:
https://docs.oracle.com/javase/8/docs/jdk/api/nashorn/jdk/nashorn/api/scripting/NashornScriptEngineFactory.html#getScriptEngine-java.lang.String:A-java.lang.ClassLoader-jdk.nashorn.api.scripting.ClassFilter-
This could prove useful to mitigate code execution vulnerabilities,
as the script code is modifiable remotely.

Signed-off-by: Yannick Schaus <github@schaus.net>
2020-11-14 15:17:33 +01:00
..
org.openhab.core Do not provide unit information for plain number items (#1811) 2020-11-12 22:13:28 +01:00
org.openhab.core.addon.sample [infrastructure] add external null-annotations (#1775) 2020-11-03 21:33:48 +01:00
org.openhab.core.audio [infrastructure] add external null-annotations (#1775) 2020-11-03 21:33:48 +01:00
org.openhab.core.auth.jaas [infrastructure] add external null-annotations (#1775) 2020-11-03 21:33:48 +01:00
org.openhab.core.auth.oauth2client [infrastructure] add external null-annotations (#1775) 2020-11-03 21:33:48 +01:00
org.openhab.core.automation [automation] Fixes NPE when no command is given in a member-of-group trigger (#1806) 2020-11-11 16:27:31 +01:00
org.openhab.core.automation.module.media [infrastructure] add external null-annotations (#1775) 2020-11-03 21:33:48 +01:00
org.openhab.core.automation.module.script [automation] Create Nashorn script engines with the proper class loader (#1799) 2020-11-14 15:17:33 +01:00
org.openhab.core.automation.module.script.rulesupport [infrastructure] add external null-annotations (#1775) 2020-11-03 21:33:48 +01:00
org.openhab.core.automation.rest [infrastructure] add external null-annotations (#1775) 2020-11-03 21:33:48 +01:00
org.openhab.core.binding.xml [infrastructure] add external null-annotations (#1775) 2020-11-03 21:33:48 +01:00
org.openhab.core.config.core [infrastructure] add external null-annotations (#1775) 2020-11-03 21:33:48 +01:00
org.openhab.core.config.discovery Remove Map null annotation workarounds (#1780) 2020-11-03 22:12:22 +01:00
org.openhab.core.config.discovery.mdns Remove Map null annotation workarounds (#1780) 2020-11-03 22:12:22 +01:00
org.openhab.core.config.discovery.upnp [infrastructure] add external null-annotations (#1775) 2020-11-03 21:33:48 +01:00
org.openhab.core.config.discovery.usbserial Remove Map null annotation workarounds (#1780) 2020-11-03 22:12:22 +01:00
org.openhab.core.config.discovery.usbserial.linuxsysfs [infrastructure] add external null-annotations (#1775) 2020-11-03 21:33:48 +01:00
org.openhab.core.config.dispatch [infrastructure] add external null-annotations (#1775) 2020-11-03 21:33:48 +01:00
org.openhab.core.config.serial [infrastructure] add external null-annotations (#1775) 2020-11-03 21:33:48 +01:00
org.openhab.core.config.xml [infrastructure] add external null-annotations (#1775) 2020-11-03 21:33:48 +01:00
org.openhab.core.ephemeris [infrastructure] add external null-annotations (#1775) 2020-11-03 21:33:48 +01:00
org.openhab.core.id [infrastructure] add external null-annotations (#1775) 2020-11-03 21:33:48 +01:00
org.openhab.core.io.bin2json [infrastructure] add external null-annotations (#1775) 2020-11-03 21:33:48 +01:00
org.openhab.core.io.console [infrastructure] add external null-annotations (#1775) 2020-11-03 21:33:48 +01:00
org.openhab.core.io.console.eclipse [infrastructure] add external null-annotations (#1775) 2020-11-03 21:33:48 +01:00
org.openhab.core.io.console.karaf [infrastructure] add external null-annotations (#1775) 2020-11-03 21:33:48 +01:00
org.openhab.core.io.console.rfc147 [infrastructure] add external null-annotations (#1775) 2020-11-03 21:33:48 +01:00
org.openhab.core.io.http [infrastructure] add external null-annotations (#1775) 2020-11-03 21:33:48 +01:00
org.openhab.core.io.http.auth [infrastructure] add external null-annotations (#1775) 2020-11-03 21:33:48 +01:00
org.openhab.core.io.http.auth.basic [infrastructure] add external null-annotations (#1775) 2020-11-03 21:33:48 +01:00
org.openhab.core.io.jetty.certificate [infrastructure] add external null-annotations (#1775) 2020-11-03 21:33:48 +01:00
org.openhab.core.io.monitor [infrastructure] add external null-annotations (#1775) 2020-11-03 21:33:48 +01:00
org.openhab.core.io.net [infrastructure] add external null-annotations (#1775) 2020-11-03 21:33:48 +01:00
org.openhab.core.io.rest [infrastructure] add external null-annotations (#1775) 2020-11-03 21:33:48 +01:00
org.openhab.core.io.rest.audio [infrastructure] add external null-annotations (#1775) 2020-11-03 21:33:48 +01:00
org.openhab.core.io.rest.auth Remove Map null annotation workarounds (#1780) 2020-11-03 22:12:22 +01:00
org.openhab.core.io.rest.core Print 'ItemChannelLink' configuration in output of console commands (#1794) 2020-11-05 09:22:01 +01:00
org.openhab.core.io.rest.log [infrastructure] add external null-annotations (#1775) 2020-11-03 21:33:48 +01:00
org.openhab.core.io.rest.mdns [infrastructure] add external null-annotations (#1775) 2020-11-03 21:33:48 +01:00
org.openhab.core.io.rest.sitemap [infrastructure] add external null-annotations (#1775) 2020-11-03 21:33:48 +01:00
org.openhab.core.io.rest.sse [infrastructure] add external null-annotations (#1775) 2020-11-03 21:33:48 +01:00
org.openhab.core.io.rest.swagger [infrastructure] add external null-annotations (#1775) 2020-11-03 21:33:48 +01:00
org.openhab.core.io.rest.ui [infrastructure] add external null-annotations (#1775) 2020-11-03 21:33:48 +01:00
org.openhab.core.io.rest.voice [infrastructure] add external null-annotations (#1775) 2020-11-03 21:33:48 +01:00
org.openhab.core.io.transport.mdns [infrastructure] add external null-annotations (#1775) 2020-11-03 21:33:48 +01:00
org.openhab.core.io.transport.mqtt transport/mqtt: Introduce setUnsubscribeOnStop() function (#1724) 2020-11-10 22:37:46 +01:00
org.openhab.core.io.transport.serial [infrastructure] add external null-annotations (#1775) 2020-11-03 21:33:48 +01:00
org.openhab.core.io.transport.serial.javacomm [infrastructure] add external null-annotations (#1775) 2020-11-03 21:33:48 +01:00
org.openhab.core.io.transport.serial.rxtx [infrastructure] add external null-annotations (#1775) 2020-11-03 21:33:48 +01:00
org.openhab.core.io.transport.serial.rxtx.rfc2217 [infrastructure] add external null-annotations (#1775) 2020-11-03 21:33:48 +01:00
org.openhab.core.io.transport.upnp [infrastructure] add external null-annotations (#1775) 2020-11-03 21:33:48 +01:00
org.openhab.core.karaf [infrastructure] add external null-annotations (#1775) 2020-11-03 21:33:48 +01:00
org.openhab.core.model.codegen Renamed packages 2019-12-28 12:18:16 +01:00
org.openhab.core.model.core [infrastructure] add external null-annotations (#1775) 2020-11-03 21:33:48 +01:00
org.openhab.core.model.item [infrastructure] add external null-annotations (#1775) 2020-11-03 21:33:48 +01:00
org.openhab.core.model.item.ide [infrastructure] add external null-annotations (#1775) 2020-11-03 21:33:48 +01:00
org.openhab.core.model.item.runtime [infrastructure] add external null-annotations (#1775) 2020-11-03 21:33:48 +01:00
org.openhab.core.model.lazygen [infrastructure] add external null-annotations (#1775) 2020-11-03 21:33:48 +01:00
org.openhab.core.model.lsp [infrastructure] add external null-annotations (#1775) 2020-11-03 21:33:48 +01:00
org.openhab.core.model.persistence [infrastructure] add external null-annotations (#1775) 2020-11-03 21:33:48 +01:00
org.openhab.core.model.persistence.ide [infrastructure] add external null-annotations (#1775) 2020-11-03 21:33:48 +01:00
org.openhab.core.model.persistence.runtime [infrastructure] add external null-annotations (#1775) 2020-11-03 21:33:48 +01:00
org.openhab.core.model.rule Log reason for rules/scripts refresh (#1812) 2020-11-13 21:38:35 +01:00
org.openhab.core.model.rule.ide [infrastructure] add external null-annotations (#1775) 2020-11-03 21:33:48 +01:00
org.openhab.core.model.rule.runtime [infrastructure] add external null-annotations (#1775) 2020-11-03 21:33:48 +01:00
org.openhab.core.model.script Log reason for rules/scripts refresh (#1812) 2020-11-13 21:38:35 +01:00
org.openhab.core.model.script.ide [infrastructure] add external null-annotations (#1775) 2020-11-03 21:33:48 +01:00
org.openhab.core.model.script.runtime [automation] Correctly map the state context variable of the ItemStateEvent to the implicit var newState (#1809) 2020-11-13 07:29:56 +01:00
org.openhab.core.model.sitemap [infrastructure] add external null-annotations (#1775) 2020-11-03 21:33:48 +01:00
org.openhab.core.model.sitemap.ide [infrastructure] add external null-annotations (#1775) 2020-11-03 21:33:48 +01:00
org.openhab.core.model.sitemap.runtime [infrastructure] add external null-annotations (#1775) 2020-11-03 21:33:48 +01:00
org.openhab.core.model.thing [infrastructure] add external null-annotations (#1775) 2020-11-03 21:33:48 +01:00
org.openhab.core.model.thing.ide [infrastructure] add external null-annotations (#1775) 2020-11-03 21:33:48 +01:00
org.openhab.core.model.thing.runtime [infrastructure] add external null-annotations (#1775) 2020-11-03 21:33:48 +01:00
org.openhab.core.persistence Allow max, min and avg calculations on other types (#1563) 2020-11-10 22:40:55 +01:00
org.openhab.core.semantics [infrastructure] add external null-annotations (#1775) 2020-11-03 21:33:48 +01:00
org.openhab.core.storage.json [infrastructure] add external null-annotations (#1775) 2020-11-03 21:33:48 +01:00
org.openhab.core.test [infrastructure] add external null-annotations (#1775) 2020-11-03 21:33:48 +01:00
org.openhab.core.test.magic [infrastructure] add external null-annotations (#1775) 2020-11-03 21:33:48 +01:00
org.openhab.core.thing Changed comparison from equals() to reference (#1817) 2020-11-14 13:46:03 +01:00
org.openhab.core.thing.xml [infrastructure] add external null-annotations (#1775) 2020-11-03 21:33:48 +01:00
org.openhab.core.transform [infrastructure] add external null-annotations (#1775) 2020-11-03 21:33:48 +01:00
org.openhab.core.ui [infrastructure] add external null-annotations (#1775) 2020-11-03 21:33:48 +01:00
org.openhab.core.ui.icon [infrastructure] add external null-annotations (#1775) 2020-11-03 21:33:48 +01:00
org.openhab.core.voice [infrastructure] add external null-annotations (#1775) 2020-11-03 21:33:48 +01:00
antlr-generator-3.2.0-patch.jar [model] don't require to download antlr generator on build time (#810) 2019-05-14 09:04:35 +02:00
pom.xml [infrastructure] add external null-annotations (#1775) 2020-11-03 21:33:48 +01:00