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
+22
View File
@@ -74,6 +74,28 @@ describe('url escape hatch', function()
assert_eq('https://h/x.zip', resolved.url)
assert_eq('x.zip', resolved.filename)
end)
it('still applies the registry auth headers', function()
vim.env.VIMPACK_TEST_TOKEN = 'sekret'
local resolved = assert(
registry.resolve(
{ name = 'x', version = '1', url = 'https://h/x.zip' },
{ auth = { env = 'VIMPACK_TEST_TOKEN' } }
)
)
assert_eq('Bearer sekret', resolved.headers.Authorization)
vim.env.VIMPACK_TEST_TOKEN = nil
end)
it('propagates an auth failure instead of downloading unauthenticated', function()
vim.env.VIMPACK_TEST_TOKEN = nil
local resolved, err = registry.resolve(
{ name = 'x', version = '1', url = 'https://h/x.zip' },
{ auth = { env = 'VIMPACK_TEST_TOKEN' } }
)
assert_nil(resolved)
assert_match('VIMPACK_TEST_TOKEN', err)
end)
end)
describe('auth headers', function()