Validate archive entries and stage inside the pack root
- 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:
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user