]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 9.2.0576: popup_create() not blocked in secure/sandbox v9.2.0576
authorChristian Brabandt <cb@256bit.org>
Sun, 31 May 2026 20:00:14 +0000 (20:00 +0000)
committerChristian Brabandt <cb@256bit.org>
Sun, 31 May 2026 20:00:14 +0000 (20:00 +0000)
Problem:  popup_create() is not gated by check_secure(), unlike the
          similar deferred-callback registrars timer_start() and
          feedkeys().  A popup created with a 'time' and 'callback' (or with
          close/filter callbacks) registers code that runs after the secure/sandbox
          context has been left, which is inconsistent with how
          timer_start() and feedkeys() handle the same situation.
Solution: Call check_secure() at the top of popup_create(), matching the
          timer_start()/feedkeys() pattern.

closes: #20400

Signed-off-by: Christian Brabandt <cb@256bit.org>
src/popupwin.c
src/testdir/test_popup.vim
src/version.c

index 624e20c61395c80662ef7ff56b1538957cc7e21b..87ea44de501a30fd2fd10f428fff4f8682738cb3 100644 (file)
@@ -2864,6 +2864,9 @@ popup_create(typval_T *argvars, typval_T *rettv, create_type_T type)
     dict_T     *d = NULL;
     int                i;
 
+    if (check_secure())
+       return NULL;
+
     if (argvars != NULL)
     {
        if (in_vim9script()
index cf9cbe166eea877ba67948abd6d82b20eb66d4b0..32b2801888ab65339121b3e355683a2db64c845e 100644 (file)
@@ -2632,4 +2632,8 @@ func Test_popup_opacity_move_after_close()
   call StopVimInTerminal(buf)
 endfunc
 
+func Test_popup_create_sandbox()
+  call assert_fails('sandbox call popup_create("hello", {})', 'E48:')
+endfunc
+
 " vim: shiftwidth=2 sts=2 expandtab
index e1dd6429bfe22b9106502740143808275495722e..dab821ad6488dbcd075a4c8fe1b69b9cc40d9e6f 100644 (file)
@@ -729,6 +729,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    576,
 /**/
     575,
 /**/