Skip to content

Commit

Permalink
Restrict polyglot host access
Browse files Browse the repository at this point in the history
Signed-off-by: Andre Kurait <[email protected]>
  • Loading branch information
AndreKurait committed Jan 11, 2025
1 parent bc6e289 commit a1c3a6a
Showing 1 changed file with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import lombok.Getter;
import lombok.extern.slf4j.Slf4j;
import org.graalvm.polyglot.Context;
import org.graalvm.polyglot.HostAccess;
import org.graalvm.polyglot.Value;
import org.graalvm.polyglot.proxy.ProxyArray;
import org.graalvm.polyglot.proxy.ProxyExecutable;
Expand All @@ -18,7 +19,14 @@ public class ScriptRunner {

public ScriptRunner() {
this.context = Context.newBuilder("js")
.allowAllAccess(true)
.allowHostAccess(HostAccess.newBuilder()
.allowArrayAccess(true)
.allowMapAccess(true)
.allowListAccess(true)
.allowIterableAccess(true)
.allowAccessInheritance(true)
.allowBufferAccess(true)
.build())
.build();
}

Expand Down

0 comments on commit a1c3a6a

Please sign in to comment.