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
+19
View File
@@ -140,4 +140,23 @@ describe('config', function()
assert_nil(cfg)
assert_match('no registry', err)
end)
it('keeps a well-formed dir_name override', function()
local cfg = assert(config.normalize({
registry = reg,
plugins = { { name = 'oil.nvim', version = '2.11.0', dir_name = 'oil' } },
}))
assert_eq('oil', cfg.plugins[1].dir_name)
end)
it('rejects a dir_name that is not a single path component', function()
for _, bad in ipairs({ '../evil', '/abs', 'a/b', '..', '.', '' }) do
local cfg, err = config.normalize({
registry = reg,
plugins = { { name = 'a', version = '1', dir_name = bad } },
})
assert_nil(cfg, 'dir_name ' .. vim.inspect(bad) .. ' should be rejected')
assert_match('dir_name', err)
end
end)
end)