Understand the three layers of Lua security
mainRunning untrusted Lua scripts safely requires a multi-layered approach. Lua provides three distinct layers of protection:
- Capability sandboxing: Controls which standard-library functions the script can call (e.g., restricting filesystem, OS, or module loading access).
- Resource limits: Bounds on a single script's allocations and recursion, enforced internally by the VM (e.g., preventing massive string allocations or infinite recursion).
- Host-level isolation: Enforces wall-clock time and total memory usage. These are not enforced by the VM itself and must be managed by the host (e.g., using Elixir processes with timeouts and heap limits).