- added second round of security sandboxing for lua scripts (disable a number of other potentially dangerous functions)

This commit is contained in:
Mark Vejvoda
2012-10-11 06:10:21 +00:00
parent e3e3832070
commit 6b324cbb4e
2 changed files with 28 additions and 1 deletions

View File

@@ -74,6 +74,33 @@ LuaScript::LuaScript() {
lua_setfield(luaState, -2, "remove");
lua_pushnil(luaState);
lua_setfield(luaState, -2, "exit");
lua_pushnil(luaState);
lua_setglobal(luaState, "loadfile");
lua_pushnil(luaState);
lua_setglobal(luaState, "dofile");
lua_pushnil(luaState);
lua_setglobal(luaState, "getfenv");
lua_pushnil(luaState);
lua_setglobal(luaState, "getmetatable");
lua_pushnil(luaState);
lua_setglobal(luaState, "load");
lua_pushnil(luaState);
lua_setglobal(luaState, "loadfile");
lua_pushnil(luaState);
lua_setglobal(luaState, "loadstring");
lua_pushnil(luaState);
lua_setglobal(luaState, "rawequal");
lua_pushnil(luaState);
lua_setglobal(luaState, "rawget");
lua_pushnil(luaState);
lua_setglobal(luaState, "rawset");
lua_pushnil(luaState);
lua_setglobal(luaState, "setfenv");
lua_pushnil(luaState);
lua_setglobal(luaState, "setmetatable");
lua_pop(luaState, 1);
}
}