This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
NamelessKonata's profile picture

Safe environment

Started by NamelessKonata, 22 June 2013 - 05:17 AM
NamelessKonata #1
Posted 22 June 2013 - 07:17 AM
Hello again. I have to make safe environment. Like chroot in unix-like OSes. Is it possible to make and how hard it'll be to do? And will it require rewriting the io and fs?
Bomb Bloke #2
Posted 22 June 2013 - 08:58 AM
If someone gets to the point where they can attempt to browse your file system, then odds are they can undo whatever function overrides you're using to try to limit that access.

You can apply limits, but the best way to do so depends largely on what your actual end goal is.
Zudo #3
Posted 22 June 2013 - 09:00 AM
Bomb Bloke is correct, you could do this but it would be hard to close all the loopholes and make it totally "safe"
theoriginalbit #4
Posted 22 June 2013 - 09:04 AM
All that being said, the easiest way to make it "safe" is to actually put the overrides in the bios.lua file, because unlike any program the contents of these functions cannot be removed from within a computer, it requires access to the server files. And make sure that these functions are then safe from getfenv.
Grim Reaper #5
Posted 22 June 2013 - 07:40 PM
To add to what Bit said, you'll also want to make sure that your system is protected from people using metatables. There have been a few people who've posted programs which they believe to be protected but have actually been broken by the use of metatables. Just some food for thought, though.