delight-rhino-sandbox

A safe sandbox for running JavaScript using the Rhino Engine in Java.

Лицензия

Лицензия

GPL
Группа

Группа

org.javadelight
Идентификатор

Идентификатор

delight-rhino-sandbox
Последняя версия

Последняя версия

0.0.15
Дата

Дата

Тип

Тип

bundle
Описание

Описание

delight-rhino-sandbox
A safe sandbox for running JavaScript using the Rhino Engine in Java.
Ссылка на сайт

Ссылка на сайт

https://github.com/javadelight/delight-rhino-sandbox
Система контроля версий

Система контроля версий

https://github.com/javadelight/delight-rhino-sandbox

Скачать delight-rhino-sandbox

Зависимости

compile (1)

Идентификатор библиотеки Тип Версия
org.mozilla : rhino jar 1.7.13

test (1)

Идентификатор библиотеки Тип Версия
junit : junit jar 4.13.1

Модули Проекта

Данный проект не имеет модулей.

Build Status Maven Central

Rhino Sandbox

A sandbox to execute JavaScript code with Rhino in Java.

Also see Nashorn Sandbox.

Usage

By default, access to all Java classes is blocked.

RhinoSandbox sandbox = RhinoSandboxes.create();

sandbox.eval("java.lang.System.out.println('hello');");
// --> Exception

Java objects must be made explicitly available.

RhinoSandbox sandbox = RhinoSandboxes.create();

sandbox.inject("fromJava", new Object());

sandbox.eval("fromJava.getClass();");

To protect against CPU abusive scripts, limits on the number of instructions allowed for the script can be set.

RhinoSandbox sandbox = RhinoSandboxes.create();

sandbox.setInstructionLimit(1000000);

sandbox.eval("while (true) { }");
// --> results in ScriptCPUAbuseException

Versions

Contributors

Maven

Just add the following dependency to your projects.

<dependency>
    <groupId>org.javadelight</groupId>
    <artifactId>delight-rhino-sandbox</artifactId>
    <version>0.0.14</version>
</dependency>

This artifact is available on Maven Central and BinTray.

Maven Central

Версии библиотеки

Версия
0.0.15
0.0.14
0.0.13
0.0.12
0.0.11
0.0.10
0.0.9
0.0.8
0.0.7
0.0.6