patch 9.2.0608: popup_setoptions()/ch_setoptions() does not check secure mode

Problem:  popup_setoptions()/ch_setoptions() does not check
          secure/restricted mode
Solution: Add missing checks for check_restricted()/check_secure()

closes: #20456

Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
Christian Brabandt
2026-06-09 19:05:18 +00:00
parent beef02a975
commit 60ebdf7e34
5 changed files with 11 additions and 1 deletions
+3
View File
@@ -5927,6 +5927,9 @@ f_ch_setoptions(typval_T *argvars, typval_T *rettv UNUSED)
channel_T *channel;
jobopt_T opt;
if (check_restricted() || check_secure())
return;
if (in_vim9script()
&& (check_for_chan_or_job_arg(argvars, 0) == FAIL
|| check_for_dict_arg(argvars, 1) == FAIL))
+3
View File
@@ -4491,6 +4491,9 @@ f_popup_setoptions(typval_T *argvars, typval_T *rettv UNUSED)
int need_redraw = FALSE;
int need_reposition = FALSE;
if (check_secure())
return;
if (in_vim9script()
&& (check_for_number_arg(argvars, 0) == FAIL
|| check_for_dict_arg(argvars, 1) == FAIL))
+2 -1
View File
@@ -2632,8 +2632,9 @@ func Test_popup_opacity_move_after_close()
call StopVimInTerminal(buf)
endfunc
func Test_popup_create_sandbox()
func Test_popup_sandbox()
call assert_fails('sandbox call popup_create("hello", {})', 'E48:')
call assert_fails('sandbox call popup_setoptions(1, {})', 'E48:')
endfunc
" vim: shiftwidth=2 sts=2 expandtab
+1
View File
@@ -70,6 +70,7 @@ func Test_restricted_mode()
if has('channel')
call assert_fails("call ch_logfile('Xlog')", 'E145:')
call assert_fails("call ch_open('localhost:8765')", 'E145:')
call assert_fails("call ch_setoptions('localhost:8765', {})", 'E145:')
endif
if has('job')
+2
View File
@@ -729,6 +729,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
608,
/**/
607,
/**/