minetest/minetest — pull request #1606 by ShadowNinja (2014-09-06 00:28:44+00:00)
Title: Add mod security

This preserves compatibility with most mods.

Things that you can't do anymore:
* Access any files not in the mod, world, user, or share path.
* Run Lua bytecode.
* Use `require()` or anything in the `package` library (`require()` and some `package` functions can load C modules, the rest are only useful if you have access to the other functions).
* Use `os.execute()` or `io.pcall()` to run shell commands.
* Load `stdin` as Lua code.
* Use the `debug` or `jit` libraries (`jit` seems safe, but I wasn't sure so I didn't include it).

You can do just about anything else, including using `getfenv` / `setfenv` and `getmetatable` / `setmetatable` (these functions are only dangerous if the sandbox is created from Lua).

Note:
This isn't quite ready yet, you can still load bytecode if `init.lua` is a bytecode file. I'd appreciate any comments on other possible security holes.