aboutsummaryrefslogtreecommitdiff
path: root/runtime/lua/vim/secure.lua
diff options
context:
space:
mode:
authorJustin M. Keyes <justinkz@gmail.com>2026-05-20 15:27:43 -0400
committerGitHub <noreply@github.com>2026-05-20 15:27:43 -0400
commit799cbfff855c72282a54646f3e5e1b71b0da223c (patch)
tree3b111b2346bbf55ca0531dd0c8f75a78314406e3 /runtime/lua/vim/secure.lua
parent24e00f2844bc30c1b7f9fd5f05de80a35d39b1d7 (diff)
downloadrneovim-799cbfff855c72282a54646f3e5e1b71b0da223c.tar.gz
rneovim-799cbfff855c72282a54646f3e5e1b71b0da223c.tar.bz2
rneovim-799cbfff855c72282a54646f3e5e1b71b0da223c.zip
fix(vim.secure): read() command injection vulnerability #39918
Problem: Malicious filename can execute code because of ":" cmdline expansion. Solution: Use `fnameescape()`. fix https://github.com/neovim/neovim/issues/39914
Diffstat (limited to 'runtime/lua/vim/secure.lua')
-rw-r--r--runtime/lua/vim/secure.lua2
1 files changed, 1 insertions, 1 deletions
diff --git a/runtime/lua/vim/secure.lua b/runtime/lua/vim/secure.lua
index 63cf4a8776..de744ed008 100644
--- a/runtime/lua/vim/secure.lua
+++ b/runtime/lua/vim/secure.lua
@@ -151,7 +151,7 @@ function M.read(path)
return nil
elseif result == 2 then
-- View
- vim.cmd('sview ' .. fullpath)
+ vim.cmd(('sview %s'):format(vim.fn.fnameescape(fullpath)))
return nil
elseif result == 3 then
-- Deny