Fix the gsub for to limit to allowed characters

This commit is contained in:
FusionPBX
2026-03-31 12:31:58 -06:00
committed by GitHub
parent 0ecd34c4ab
commit 1a915bb21c
@@ -1,8 +1,9 @@
--add the copy function
function copy(src,dst)
--retrieve allowed characters and then use it to sanitize the dir variable
local allowed_chars = os.getenv("ALLOWED_CHARS") or "^%a%d%-%._~/"
dir = dir:gsub("[^" .. allowed_chars .. "]", "")
local allowed_chars = os.getenv("ALLOWED_CHARS") or "^%a%d%-%._~/";
src = src:gsub("[^" .. allowed_chars .. "]", "");
dst = dst:gsub("[^" .. allowed_chars .. "]", "");
if (package.config:sub(1,1) == "/") then
--unix