Add sanitize for the lua copy function

This commit is contained in:
FusionPBX
2026-03-22 03:34:26 +00:00
committed by GitHub
parent 0a63841e5a
commit 92ea4dc8db

View File

@@ -1,5 +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 .. "]", "")
if (package.config:sub(1,1) == "/") then
--unix
cmd = [[cp "]] .. src .. [[" "]] .. dst .. [["]];