Whitelisted some extra LuaJIT and Minetest utility functions

This commit is contained in:
prestidigitator 2015-06-01 15:20:58 -07:00
parent 8f56d4fc79
commit 1e66bbb46e
2 changed files with 15 additions and 9 deletions

View File

@ -46,6 +46,7 @@ local TOP_LEVEL_WHITELIST =
_G = false, -- Replaced by environment itself _G = false, -- Replaced by environment itself
_VERSION = true, _VERSION = true,
assert = true, assert = true,
bit = true, -- (luajit)
collectgarbage = true, collectgarbage = true,
dofile = false, -- Wrapped below dofile = false, -- Wrapped below
error = true, error = true,
@ -53,6 +54,7 @@ local TOP_LEVEL_WHITELIST =
getfenv = false, -- Wrapped below getfenv = false, -- Wrapped below
getmetatable = false, -- Wrapped below getmetatable = false, -- Wrapped below
ipairs = true, ipairs = true,
jit = false, -- Removed completely (luajit)
load = false, -- Wrapped below load = false, -- Wrapped below
loadfile = false, -- Wrapped below loadfile = false, -- Wrapped below
loadstring = false, -- Wrapped below loadstring = false, -- Wrapped below
@ -598,14 +600,15 @@ end;
sandboxEnv.module = wrappedModule; sandboxEnv.module = wrappedModule;
sandboxEnv.require = wrappedRequire; sandboxEnv.require = wrappedRequire;
sandboxEnv.package.config = std.package.config; sandboxEnv.package.config = std.package.config;
sandboxEnv.package.cpath = nil; sandboxEnv.package.cpath = nil;
sandboxEnv.package.loaded = {}; sandboxEnv.package.loaded = {};
sandboxEnv.package.loaders = { sandboxSearcher, builinSearcher }; sandboxEnv.package.loaders = { sandboxSearcher, builinSearcher };
sandboxEnv.package.loadlib = nil; -- Removed completely sandboxEnv.package.loadlib = nil; -- Removed completely
sandboxEnv.package.path = ""; sandboxEnv.package.path = "";
sandboxEnv.package.preload = {}; sandboxEnv.package.preload = {};
sandboxEnv.package.seeall = wrappedSeeAll; sandboxEnv.package.searchpath = nil; -- (luajit)
sandboxEnv.package.seeall = wrappedSeeAll;
sandboxEnv.package.loaded._G = sandboxEnv; sandboxEnv.package.loaded._G = sandboxEnv;
sandboxEnv.package.loaded.coroutine = sandboxEnv.coroutine; sandboxEnv.package.loaded.coroutine = sandboxEnv.coroutine;

View File

@ -104,4 +104,7 @@ sandboxEnv.minetest.get_modpath = wrappedGetModPath;
sandboxEnv.minetest.create_schematic = wrappedCreateSchematic; sandboxEnv.minetest.create_schematic = wrappedCreateSchematic;
sandboxEnv.minetest.place_schematic = wrappedPlaceSchematic; sandboxEnv.minetest.place_schematic = wrappedPlaceSchematic;
sandboxEnv.Settings = wrappedSettings; sandboxEnv.string.split = std.string.split;
sandboxEnv.string.trim = std.string.trim;
sandboxEnv.table.copy = std.table.copy;
sandboxEnv.Settings = wrappedSettings;