summaryrefslogtreecommitdiff
path: root/autoload
diff options
context:
space:
mode:
authorw0rp <devw0rp@gmail.com>2018-07-17 21:39:50 +0100
committerw0rp <devw0rp@gmail.com>2018-07-17 21:39:50 +0100
commit5453e0e1a43302226da1d1d753e162af0231f9d3 (patch)
tree4ef7017905bf31573b3b325f9d12bf1ee0d9acc1 /autoload
parent7952ebe77ef3f6d5c98ec155ea8aad46652e7077 (diff)
downloadale-5453e0e1a43302226da1d1d753e162af0231f9d3.zip
Fix #1708 - Don't modify linters or register fixers in the sandbox
Diffstat (limited to 'autoload')
-rw-r--r--autoload/ale/fix/registry.vim3
-rw-r--r--autoload/ale/linter.vim12
2 files changed, 15 insertions, 0 deletions
diff --git a/autoload/ale/fix/registry.vim b/autoload/ale/fix/registry.vim
index 539234c0..e148ecd6 100644
--- a/autoload/ale/fix/registry.vim
+++ b/autoload/ale/fix/registry.vim
@@ -242,6 +242,9 @@ endfunction
" Add a function for fixing problems to the registry.
" (name, func, filetypes, desc, aliases)
function! ale#fix#registry#Add(name, func, filetypes, desc, ...) abort
+ " This command will throw from the sandbox.
+ let &equalprg=&equalprg
+
if type(a:name) != type('')
throw '''name'' must be a String'
endif
diff --git a/autoload/ale/linter.vim b/autoload/ale/linter.vim
index 22e3c5dc..aa602f7e 100644
--- a/autoload/ale/linter.vim
+++ b/autoload/ale/linter.vim
@@ -50,6 +50,9 @@ endfunction
" This is only for tests.
" Do not call this function.
function! ale#linter#GetLintersLoaded() abort
+ " This command will throw from the sandbox.
+ let &equalprg=&equalprg
+
return s:linters
endfunction
@@ -289,6 +292,9 @@ function! ale#linter#PreProcess(filetype, linter) abort
endfunction
function! ale#linter#Define(filetype, linter) abort
+ " This command will throw from the sandbox.
+ let &equalprg=&equalprg
+
if !has_key(s:linters, a:filetype)
let s:linters[a:filetype] = []
endif
@@ -304,6 +310,12 @@ function! ale#linter#PreventLoading(filetype) abort
endfunction
function! ale#linter#GetAll(filetypes) abort
+ " Don't return linters in the sandbox.
+ " Otherwise a sandboxed script could modify them.
+ if ale#util#InSandbox()
+ return []
+ endif
+
let l:combined_linters = []
for l:filetype in a:filetypes