[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Sandbox implementation, attempt #2
- From: "David F" <kumpuu@...>
- Date: Sat, 18 Mar 2017 23:26:43 +0100
Hello,
Sorry, I forgot to turn off HTML in my previous posting.
I'm currently adding lua (5.1/luajit) to a game (the stock modding system they provide is really crappy).
Now I don't want any modders to mess peoples PC's up, that's why I decided it needs a sandbox (also, hosting providers wouldn't accept it otherwise). So I patched one together from bits and pieces I found while doing research and extended it with my own ideas.
The problem is, sandboxing has many pitfalls, and I'm really new to lua. So I would really appreciate if anyone could take a look at my code and tell me if there is anything wrong with it. Don't want to waste anyones time but I figured this is the place to ask.
My goals were:
- Lock user to a specific directory and allow I/O on everything in it
- Prevent program execution, except lua scripts in user dir
- Prevent access to parent environment
I don't care about crashes.
I decided to link the code instead of pasting it, because the message would be really long otherwise.
https://bitbucket.org/Kumpuu/warband-script-enhancer/src/a2132009816653d67352332429137620f98e044d/WSELib/LuaSandbox.txt?at=lua&fileviewer=file-view-default
Cheers, David.