Explicitly sandbox Lua instances (3/4)

This allows UI scripts (saved in preferences) to access
os.* functions (non-sandboxed), while preventing other
scripts to do so.

Lua scripts that can run os commands can execute arbitrary
code on the system. While this is a nice feature, it can be
equally dangerous.
This commit is contained in:
Robin Gareus 2023-10-04 02:07:13 +02:00
parent 6b3f25eb2a
commit c1be897eed
No known key found for this signature in database
GPG key ID: A090BCE02CF57F04
9 changed files with 46 additions and 40 deletions

View file

@ -33,7 +33,7 @@ int main (int argc, char **argv)
{
#ifdef LUABINDINGDOC
luabridge::setPrintBindings (true);
LuaState lua;
LuaState lua (false, false);
lua_State* L = lua.getState ();
#ifdef LUADOCOUT
printf ("-- %s\n", ARDOUR::revision);
@ -42,7 +42,7 @@ int main (int argc, char **argv)
printf ("[\n");
printf ("{\"version\" : \"%s\"},\n\n", ARDOUR::revision);
#endif
LuaInstance::register_classes (L);
LuaInstance::register_classes (L, false);
LuaInstance::register_hooks (L);
ARDOUR::LuaBindings::dsp (L);
#ifdef LUADOCOUT