lua-basedir is a module that limits file and directory operations to be performed under a specified directory.
$ luarocks install basedir
root