Skip to content

Commit 810fb1e

Browse files
Copilotbytemain
andauthored
Address remaining mirror validation polish
Agent-Logs-Url: https://github.com/version-fox/vfox-python/sessions/0837af3b-3d14-4944-9bf1-7484f202c39e Co-authored-by: bytemain <13938334+bytemain@users.noreply.github.com>
1 parent 7c93a43 commit 810fb1e

1 file changed

Lines changed: 19 additions & 5 deletions

File tree

lib/util.lua

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,9 @@ local function shellQuote(value)
231231
if string.find(value, "[\r\n%z]") then
232232
error("Path contains unsupported control character: " .. value)
233233
end
234+
if string.find(value, "%.%.") then
235+
error("Path contains unsupported traversal segment: " .. value)
236+
end
234237
if string.find(value, "[^%w%._%-%+/\\:]") then
235238
error("Path contains unsupported shell character: " .. value)
236239
end
@@ -313,11 +316,18 @@ local function runtimeLibc(osType)
313316
print("Warning: Could not run ldd while detecting libc")
314317
end
315318

316-
local muslCheck = io.popen("find /lib /usr/lib -name 'libc.musl-*.so.*' -print -quit 2>/dev/null")
317-
if muslCheck then
318-
local output = muslCheck:read("*a") or ""
319-
muslCheck:close()
320-
if output ~= "" then
319+
local muslLibs = {
320+
"/lib/ld-musl-x86_64.so.1",
321+
"/lib/ld-musl-aarch64.so.1",
322+
"/lib/ld-musl-armhf.so.1",
323+
"/usr/lib/libc.musl-x86_64.so.1",
324+
"/usr/lib/libc.musl-aarch64.so.1",
325+
"/usr/lib/libc.musl-armhf.so.1"
326+
}
327+
for _, muslLib in ipairs(muslLibs) do
328+
local file = io.open(muslLib, "r")
329+
if file then
330+
file:close()
321331
return "musl"
322332
end
323333
end
@@ -499,6 +509,10 @@ function uvBuildInstall(ctx)
499509
end
500510

501511
print("Extracting Python uv-build archive...")
512+
local tarStatus = os.execute("tar --version > /dev/null 2>&1")
513+
if tarStatus ~= 0 then
514+
error("Failed to extract uv-build archive because tar is not available")
515+
end
502516
local status = os.execute("tar -xf " .. shellQuote(archivePath) .. " --strip-components=1 -C " .. shellQuote(path))
503517
if status ~= 0 then
504518
error("Failed to extract uv-build archive. Status: " .. status .. ". Ensure tar is available, the archive is valid, and disk permissions/space are sufficient")

0 commit comments

Comments
 (0)