How to limit the capabilities of lua (calling OS functions, modules, etc.)

I use Lua as a script language inside my C application.

This is very suitable for me, but I can’t understand how I can limit Lua not to call system functions, not include other modules, etc.

I want Lua to be able to call only functions that are allowed by me, because the user can do all kinds of bad things with the full power of Lua + Lua modules.

+2
source share
3 answers

The sandbox is the term you are looking for. In short, just export to Lua the functions you want users to call. It is simple, really.

+2
source

You can accomplish this without loading the os or package modules. Instead of luaL_openlibs , see this post .

0
source

Source: https://habr.com/ru/post/894516/


All Articles