diff options
author | Christian Brabandt <cb@256bit.org> | 2023-09-06 20:41:25 +0200 |
---|---|---|
committer | Christian Brabandt <cb@256bit.org> | 2023-09-06 20:41:25 +0200 |
commit | f7ac0ef5098856bedca26e7073594a407c05636f (patch) | |
tree | 236332bc827a84d5b5f70eedc96a00a30e0b9813 /runtime/ftplugin/awk.vim | |
parent | 1689e847ff3b43723c247be36d84f03fce2a66d6 (diff) |
runtime: don't execute external commands when loading ftplugins
This is a followup to 816fbcc262687b81fc46f82f7bbeb1453addfe0c (patch
9.0.1833: [security] runtime file fixes)
It basically disables that external commands are run on loading of the
filetype plugin, **unless** the user has set the `g:plugin_exec = 1`
global variable in their configuration or for a specific filetype the
variable g:<filetype>_exec=1.
There are a few more plugins, that may execute system commands like
debchangelog, gitcommit, sh, racket, zsh, ps1 but those do at least
do not run those commands by default during loading of the filetype plugin
(there the command is mostly run as convenience for auto-completion or
to provide documentation lookup).
closes: #13034
Signed-off-by: Christian Brabandt <cb@256bit.org>
Co-authored-by: Tim Pope <vim@tpope.org>
Diffstat (limited to 'runtime/ftplugin/awk.vim')
-rw-r--r-- | runtime/ftplugin/awk.vim | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/runtime/ftplugin/awk.vim b/runtime/ftplugin/awk.vim index 1bca3ad3cf..785088ff9b 100644 --- a/runtime/ftplugin/awk.vim +++ b/runtime/ftplugin/awk.vim @@ -37,11 +37,14 @@ if exists("g:awk_is_gawk") let b:undo_ftplugin .= " | setl fp<" endif - let path = system("gawk 'BEGIN { printf ENVIRON[\"AWKPATH\"] }'") - let path = substitute(path, '^\.\=:\|:\.\=$\|:\.\=:', ',,', 'g') " POSIX cwd - let path = substitute(path, ':', ',', 'g') + " Disabled by default for security reasons. + if get(g:, 'awk_exec', get(g:, 'plugin_exec', 0)) + let path = system("gawk 'BEGIN { printf ENVIRON[\"AWKPATH\"] }'") + let path = substitute(path, '^\.\=:\|:\.\=$\|:\.\=:', ',,', 'g') " POSIX cwd + let path = substitute(path, ':', ',', 'g') - let &l:path = path + let &l:path = path + endif let b:undo_ftplugin .= " | setl inc< path<" endif |