Page 1 of 1

Directory policy exception

Posted: Tue Jan 12, 2021 18:07
by bzt
Hi,

Would it be possible to add one exception to the security policy?

Normally Lua scripts can only access files under the world directory. This is very good and perfectly fine except for schematics. Would it be possible to add "schems" folder next to "world" and "mods" folder and add an exception so that Lua scripts could load and save files in this (only one) directory (which is "../../schems" from the world directory)?

Right now it is very problematic to load schematics into multiple worlds, users have to exit the game, create directory and copy files then restart the game. This exception would make it simple, and it poses no security risk (there would be no access to other worlds nor to the mods directory for example). WorldEdit, Schematic Editor etc. then could check for the MTS file in "world/(world)/schems/mtsfile", and if not found then try to load from "schems/mtsfile".

Cheers,
bzt

Re: Directory policy exception

Posted: Mon Apr 19, 2021 17:49
by Sokomine
You're not the only one with that problem. My handle_schematics mod was intended to offer schematics found in folders. But it can't do that because MT got too restrictive.

Re: Directory policy exception

Posted: Tue Apr 20, 2021 00:39
by Minix
Have you tried using symbolic links on Linux ? or if you use Windows I think there is a way to make links between files as well. I do not make mods so I do not know much about that, it is just a suggestion.

Re: Directory policy exception

Posted: Tue Apr 20, 2021 04:08
by philipbenr
Windows since Vista (using NTFS specifically) has supported symlinks. Here's a good How2Geek article about it if that helps: https://www.howtogeek.com/howto/16226/c ... -or-linux/

Re: Directory policy exception

Posted: Fri May 14, 2021 18:28
by bzt
If one could escape the Lua jail with a simple symbolic link, then the whole directory security policy is garbage and you could throw it out on the window.
Other than that, symlink is no good, because you have to create them manually outside of the game. Meaning
1. start MT
2. create world
3. exit MT
4. locate the world folder
5. create symlink
6. restart MT
7. load world
With that effort I could just simply copy the schem files, no need for symlink, and that's exactly what I try to avoid. The point is, players should be able to load schem files from a common folder without exiting the game after creating a world.

Cheers,
bzt