mirror of
https://github.com/luanti-org/luanti.git
synced 2025-09-15 18:57:08 +00:00
Create a filesystem abstraction layer for CSM and only allow accessing files that are scanned into it. (#5965)
* Load client-side mods into memory before executing them. This removes the remaining filesystem access that client-sided mods had and it will hopefully make then more secure. * Lua Virtual filesystem: don't load the files into memory just scan the filenames into memory. * Fix the issues with backtrace * fix most of the issues * fix code style. * add a comment
This commit is contained in:
parent
2e53801fc0
commit
f3ad75691a
24 changed files with 230 additions and 101 deletions
|
@ -1,5 +1,5 @@
|
|||
-- Minetest: builtin/client/init.lua
|
||||
local scriptpath = core.get_builtin_path()..DIR_DELIM
|
||||
local scriptpath = core.get_builtin_path()
|
||||
local clientpath = scriptpath.."client"..DIR_DELIM
|
||||
local commonpath = scriptpath.."common"..DIR_DELIM
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
|
||||
local scriptpath = core.get_builtin_path()..DIR_DELIM
|
||||
local scriptpath = core.get_builtin_path()
|
||||
local commonpath = scriptpath.."common"..DIR_DELIM
|
||||
local gamepath = scriptpath.."game"..DIR_DELIM
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@ os.setlocale("C", "numeric")
|
|||
minetest = core
|
||||
|
||||
-- Load other files
|
||||
local scriptdir = core.get_builtin_path() .. DIR_DELIM
|
||||
local scriptdir = core.get_builtin_path()
|
||||
local gamepath = scriptdir .. "game" .. DIR_DELIM
|
||||
local clientpath = scriptdir .. "client" .. DIR_DELIM
|
||||
local commonpath = scriptdir .. "common" .. DIR_DELIM
|
||||
|
|
|
@ -264,7 +264,7 @@ end
|
|||
-- read_all: whether to ignore certain setting types for GUI or not
|
||||
-- parse_mods: whether to parse settingtypes.txt in mods and games
|
||||
local function parse_config_file(read_all, parse_mods)
|
||||
local builtin_path = core.get_builtin_path() .. DIR_DELIM .. FILENAME
|
||||
local builtin_path = core.get_builtin_path() .. FILENAME
|
||||
local file = io.open(builtin_path, "r")
|
||||
local settings = {}
|
||||
if not file then
|
||||
|
@ -775,4 +775,4 @@ end
|
|||
|
||||
-- Generate minetest.conf.example and settings_translation_file.cpp
|
||||
|
||||
--assert(loadfile(core.get_builtin_path()..DIR_DELIM.."mainmenu"..DIR_DELIM.."generate_from_settingtypes.lua"))(parse_config_file(true, false))
|
||||
--assert(loadfile(core.get_builtin_path().."mainmenu"..DIR_DELIM.."generate_from_settingtypes.lua"))(parse_config_file(true, false))
|
||||
|
|
|
@ -27,12 +27,12 @@ local basepath = core.get_builtin_path()
|
|||
defaulttexturedir = core.get_texturepath_share() .. DIR_DELIM .. "base" ..
|
||||
DIR_DELIM .. "pack" .. DIR_DELIM
|
||||
|
||||
dofile(basepath .. DIR_DELIM .. "common" .. DIR_DELIM .. "async_event.lua")
|
||||
dofile(basepath .. DIR_DELIM .. "common" .. DIR_DELIM .. "filterlist.lua")
|
||||
dofile(basepath .. DIR_DELIM .. "fstk" .. DIR_DELIM .. "buttonbar.lua")
|
||||
dofile(basepath .. DIR_DELIM .. "fstk" .. DIR_DELIM .. "dialog.lua")
|
||||
dofile(basepath .. DIR_DELIM .. "fstk" .. DIR_DELIM .. "tabview.lua")
|
||||
dofile(basepath .. DIR_DELIM .. "fstk" .. DIR_DELIM .. "ui.lua")
|
||||
dofile(basepath .. "common" .. DIR_DELIM .. "async_event.lua")
|
||||
dofile(basepath .. "common" .. DIR_DELIM .. "filterlist.lua")
|
||||
dofile(basepath .. "fstk" .. DIR_DELIM .. "buttonbar.lua")
|
||||
dofile(basepath .. "fstk" .. DIR_DELIM .. "dialog.lua")
|
||||
dofile(basepath .. "fstk" .. DIR_DELIM .. "tabview.lua")
|
||||
dofile(basepath .. "fstk" .. DIR_DELIM .. "ui.lua")
|
||||
dofile(menupath .. DIR_DELIM .. "common.lua")
|
||||
dofile(menupath .. DIR_DELIM .. "gamemgr.lua")
|
||||
dofile(menupath .. DIR_DELIM .. "modmgr.lua")
|
||||
|
|
|
@ -23,7 +23,7 @@ local function get_bool_default(name, default)
|
|||
return val
|
||||
end
|
||||
|
||||
local profiler_path = core.get_builtin_path()..DIR_DELIM.."profiler"..DIR_DELIM
|
||||
local profiler_path = core.get_builtin_path().."profiler"..DIR_DELIM
|
||||
local profiler = {}
|
||||
local sampler = assert(loadfile(profiler_path .. "sampling.lua"))(profiler)
|
||||
local instrumentation = assert(loadfile(profiler_path .. "instrumentation.lua"))(profiler, sampler, get_bool_default)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue