File tree 3 files changed +17
-0
lines changed
3 files changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -1407,6 +1407,12 @@ openscript(
14071407 emsg (_ (e_nesting ));
14081408 return ;
14091409 }
1410+
1411+ // Disallow sourcing a file in the sandbox, the commands would be executed
1412+ // later, possibly outside of the sandbox.
1413+ if (check_secure ())
1414+ return ;
1415+
14101416#ifdef FEAT_EVAL
14111417 if (ignore_script )
14121418 /* Not reading from script, also don't open one. Warning message? */
Original file line number Diff line number Diff line change @@ -36,3 +36,12 @@ func Test_source_cmd()
3636 au ! SourcePre
3737 au ! SourcePost
3838endfunc
39+
40+ func Test_source_sandbox ()
41+ new
42+ call writefile ([" Ohello\<Esc> " ], ' Xsourcehello' )
43+ source ! Xsourcehello | echo
44+ call assert_equal (' hello' , getline (1 ))
45+ call assert_fails (' sandbox source! Xsourcehello' , ' E48:' )
46+ bwipe!
47+ endfunc
Original file line number Diff line number Diff line change @@ -767,6 +767,8 @@ static char *(features[]) =
767767
768768static int included_patches [] =
769769{ /* Add new patch number below this line */
770+ /**/
771+ 1365 ,
770772/**/
771773 1364 ,
772774/**/
You can’t perform that action at this time.
0 commit comments