How Can I Safely Integrate External Script Execution into a Web-Based Game?
Briefly

Allowing users to run scripts in a browser-based game can enhance customization but brings significant security challenges. One approach is embedding a Lua virtual machine, which can enable users to write Lua scripts safely. Using sandboxed iframes or WebAssembly can help create a controlled environment for script execution, mitigating risks associated with arbitrary code execution. However, developers must implement strict security measures to prevent potential exploits and vulnerabilities that could arise from user-generated scripts and provide mechanisms for validating and sanitizing inputs effectively.
While enabling Lua script execution in a browser environment should always prioritize security, it is possible to embed a Lua VM to allow limited scripting capabilities.
Sandboxed iframes could offer a secure method for executing scripts in a browser by restricting access to the parent document's DOM.
The major security implications include potential vulnerabilities that can be exploited via arbitrary code execution, necessitating strict validation and sandboxing.
WebAssembly can indeed be a viable option to execute more complex scripts securely, given its performance benefits and more controlled execution environment.
Read at SitePoint Forums | Web Development & Design Community
[
|
]