Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added settings to disable sandboxing #430

Closed
wants to merge 4 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Added support for removal of sandbox to luaj
  • Loading branch information
Kilobyte22 committed Jul 23, 2014
commit b0e4a71b22bbd1f9425d54f7afab6c06b44fdb66
Original file line number Diff line number Diff line change
Expand Up @@ -203,13 +203,21 @@ class LuaJLuaArchitecture(val machine: api.machine.Machine) extends Architecture

override def initialize() = {
lua = JsePlatform.debugGlobals()
lua.set("package", LuaValue.NIL)
lua.set("io", LuaValue.NIL)
lua.set("luajava", LuaValue.NIL)

// Remove some other functions we don't need and are dangerous.
lua.set("dofile", LuaValue.NIL)
lua.set("loadfile", LuaValue.NIL)
if (Settings.get.hardwareSandbox) {
lua.set("package", LuaValue.NIL)
lua.set("require", LuaValue.NIL)
lua.set("io", LuaValue.NIL)
lua.set("luajava", LuaValue.NIL)

// Remove some other functions we don't need and are dangerous.
lua.set("dofile", LuaValue.NIL)
lua.set("loadfile", LuaValue.NIL)
} else {
val t = LuaValue.tableOf()
t.set("io", lua.get("io"))
t.set("os", lua.get("os"))
lua.set("native", t)
}

apis.foreach(_.initialize())

Expand Down