From 878718fa7617bc9b18d51c66f50823f2299d8d9d Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Mon, 18 May 2026 08:01:20 +0800 Subject: [PATCH] vim-patch:9.2.0496: [security]: Code Injection in cucumber filetype plugin Problem: [security]: Code Injection in cucumber filetype plugin (Christopher Lusk) Solution: Use rubys Regexp.new() with the untrusted pattern Github Security Advisory: https://github.com/vim/vim/security/advisories/GHSA-4473-94jm-w5x9 https://github.com/vim/vim/commit/a65a52d684bc58535ad28a4ae824d22e76399934 Co-authored-by: Christian Brabandt --- runtime/ftplugin/cucumber.vim | 5 ++++- test/old/testdir/test_filetype.vim | 30 ++++++++++++++++++++++++++++++ 2 files changed, 34 insertions(+), 1 deletion(-) diff --git a/runtime/ftplugin/cucumber.vim b/runtime/ftplugin/cucumber.vim index f4848d1c60..9723898d15 100644 --- a/runtime/ftplugin/cucumber.vim +++ b/runtime/ftplugin/cucumber.vim @@ -2,6 +2,8 @@ " Language: Cucumber " Maintainer: Tim Pope " Last Change: 2016 Aug 29 +" 2026 May 26 by Vim Project: prevent Code Injection +" https://github.com/vim/vim/security/advisories/GHSA-4473-94jm-w5x9 " Only do this when not done yet for this buffer if (exists("b:did_ftplugin")) @@ -96,7 +98,8 @@ function! s:stepmatch(receiver,target) catch endtry if has("ruby") && pattern !~ '\\\@ s:steps -> s:stepmatch on every discovered step, + " including the malicious one. Suppress preview and error messages. + silent! normal [d + call assert_false(filereadable(marker), 'Ruby injection executed') + bwipe! + filetype plugin off +endfunc + " vim: shiftwidth=2 sts=2 expandtab