Validate archive entries and stage inside the pack root
ci/woodpecker/pr/test Pipeline was successful
ci/woodpecker/pr/lint Pipeline was successful
ci/woodpecker/pr/pre-commit Pipeline was successful

- Reject archive members that are absolute, escape via .., are special files, or link outside the destination, before anything is written

- Stage under the pack root so the swap is a same-filesystem rename, with an EXDEV copy fallback; propagate registry auth errors and validate dir_name
This commit is contained in:
2026-09-05 16:32:47 +10:00
parent ae951a9ea6
commit ca55c9dd9f
14 changed files with 544 additions and 35 deletions
+27
View File
@@ -126,6 +126,33 @@ describe('install end to end', function()
assert_match(missing, results[1].err)
end)
it('installs with the cache on a different filesystem from the pack root', function()
local root = tmpdir()
local pack_root = vim.fs.joinpath(root, 'pack')
local other = otherfs_dir(root)
if not other then
return
end
local real_cache_dir = fsmod.cache_dir
fsmod.cache_dir = function()
return vim.fs.joinpath(other, 'vimpack')
end
local archive = make_tarball(root, '1.0.0', 'return 1')
local cfg = assert(config.normalize({
plugins = { { name = 'demo.nvim', version = '1.0.0', url = 'file://' .. archive } },
}))
local data = manifest.empty()
local ok, results = pcall(install, cfg, data, pack_root)
fsmod.cache_dir = real_cache_dir
fsmod.rm_rf(other)
assert_true(ok, tostring(results))
assert_true(results[1].ok, tostring(results[1].err))
assert_eq({ 'return 1' }, vim.fn.readfile(vim.fs.joinpath(pack_root, 'start', 'demo.nvim', 'lua', 'demo.lua')))
end)
it('moves a plugin from start to opt', function()
local root = tmpdir()
local pack_root = vim.fs.joinpath(root, 'pack')