From 406161751b055c932e6e90eb60f8abdc4c1401ea Mon Sep 17 00:00:00 2001 From: claudix Date: Wed, 13 Mar 2024 17:18:06 +0100 Subject: [PATCH] Added option "allow_string_rep", which enables using string.rep() from the sandbox --- sandbox.lua | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sandbox.lua b/sandbox.lua index ce345f8..6b5edd1 100644 --- a/sandbox.lua +++ b/sandbox.lua @@ -161,7 +161,9 @@ function sandbox.protect(code, options) sethook(timeout, "", quota) end - string.rep = nil -- luacheck: no global + if not options.allow_string_rep then + string.rep = nil -- luacheck: no global + end local t = table.pack(pcall(f, ...))