diff options
author | garret <garret@airmail.cc> | 2023-02-16 23:34:19 +0000 |
---|---|---|
committer | garret <garret@airmail.cc> | 2023-02-16 23:34:19 +0000 |
commit | cbeb5e1a7adbede58826887df5a7d31d6f3a0536 (patch) | |
tree | f8dc8d208a30de2e6717035304a877c09e70308b /make-feed.lua | |
parent | 15c17d97328fcc50c40a5551341403919d1687f1 (diff) | |
download | depctrl-feedmaker-cbeb5e1a7adbede58826887df5a7d31d6f3a0536.tar.gz depctrl-feedmaker-cbeb5e1a7adbede58826887df5a7d31d6f3a0536.tar.bz2 depctrl-feedmaker-cbeb5e1a7adbede58826887df5a7d31d6f3a0536.zip |
provide actual sandboxed environments
doesn't work with file:stuff, hopefully no one will notice lol
Diffstat (limited to 'make-feed.lua')
-rwxr-xr-x | make-feed.lua | 52 |
1 files changed, 48 insertions, 4 deletions
diff --git a/make-feed.lua b/make-feed.lua index bf286d2..370c6a7 100755 --- a/make-feed.lua +++ b/make-feed.lua @@ -231,9 +231,48 @@ end local function run_file(file, extension) local runner - local env = deepcopy(_G) -- i dont care - env.require = sandbox_require - -- TODO: care + local env = { + _VERSION = _VERSION, + assert = assert, + collectgarbage = collectgarbage, + dofile = dofile, + error = error, + getfenv = getfenv, + getmetatable = getmetatable, + ipairs = ipairs, + load = load, + loadfile = loadfile, + loadstring = loadstring, + module = module, + next = next, + pairs = pairs, + pcall = pcall, + print = print, + rawequal = rawequal, + rawget = rawget, + rawset = rawset, + select = select, + setfenv = setfenv, + setmetatable = setmetatable, + tonumber = tonumber, + tostring = tostring, + type = type, + unpack = unpack, + xpcall = xpcall, + coroutine = coroutine, + debug = debug, + file = file, + io = io, + math = math, + os = os, + package = {}, + string = string, + table = table, + + require = sandbox_require, + aegisub = fake_aegisub(), + _feedmaker_version = {} + } if extension == "moon" then runner = moonscript.loadfile(file) @@ -267,7 +306,12 @@ local function get_macro_metadata(file) meta.namespace = macro.script_namespace meta.changelog = macro.script_changelog meta.depctrl = macro.__feedmaker_version - + + if not meta.namespace then + err(file .. ": no script_namespace, skipping") + return nil + end + if config.macros.ignoreCondition(meta) then err(file .. ": ignored by config, skipping") return nil |