Merge #62713: vim/neovim: Backports fix for ACE

(cherry picked from commit 0d62805dbf)
The patch is fairly simple and the vulnerability seems important.
This commit is contained in:
Andreas Rammhold
2019-06-05 11:31:23 +02:00
committed by Vladimír Čunát
parent 14ab6e4d4a
commit 9e5afbee96
3 changed files with 47 additions and 1 deletions

View File

@@ -1,4 +1,4 @@
{ stdenv, fetchFromGitHub, cmake, gettext, msgpack, libtermkey, libiconv
{ stdenv, fetchFromGitHub, fetchpatch, cmake, gettext, msgpack, libtermkey, libiconv
, libuv, luaPackages, ncurses, pkgconfig
, unibilium, xsel, gperf
, libvterm-neovim
@@ -20,6 +20,15 @@ let
sha256 = "19jy9nr2ffscli6wsysqkdvqvh7sgkkwhzkw3yypfrvg4pj9rl56";
};
patches = [
# Arbitrary code execution fix
# https://github.com/numirias/security/blob/cf4f74e0c6c6e4bbd6b59823aa1b85fa913e26eb/doc/2019-06-04_ace-vim-neovim.md
(fetchpatch {
url = "https://github.com/neovim/neovim/pull/10082.patch";
sha256 = "0g4knlpaabbq6acqgqm765b1knqv981nk2gf84fmknqnv4sgbsq2";
})
];
enableParallelBuilding = true;
buildInputs = [

View File

@@ -0,0 +1,31 @@
From 53575521406739cf20bbe4e384d88e7dca11f040 Mon Sep 17 00:00:00 2001
From: Bram Moolenaar <Bram@vim.org>
Date: Wed, 22 May 2019 22:38:25 +0200
Subject: [PATCH] patch 8.1.1365: source command doesn't check for the sandbox
Problem: Source command doesn't check for the sandbox. (Armin Razmjou)
Solution: Check for the sandbox when sourcing a file.
---
src/getchar.c | 6 ++++++
src/testdir/test_source.vim | 9 +++++++++
src/version.c | 2 ++
3 files changed, 17 insertions(+)
diff --git a/src/getchar.c b/src/getchar.c
index 9379a6a8d4..debad7efd2 100644
--- a/src/getchar.c
+++ b/src/getchar.c
@@ -1407,6 +1407,12 @@ openscript(
emsg(_(e_nesting));
return;
}
+
+ // Disallow sourcing a file in the sandbox, the commands would be executed
+ // later, possibly outside of the sandbox.
+ if (check_secure())
+ return;
+
#ifdef FEAT_EVAL
if (ignore_script)
/* Not reading from script, also don't open one. Warning message? */
diff --git a/src/testdir/test_source.vim b/src/testdir/test_source.vim

View File

@@ -21,6 +21,12 @@ stdenv.mkDerivation rec {
buildInputs = [ ncurses ]
++ stdenv.lib.optionals stdenv.hostPlatform.isDarwin [ Carbon Cocoa ];
patches = [
# Arbitrary code execution fix
# https://github.com/numirias/security/blob/cf4f74e0c6c6e4bbd6b59823aa1b85fa913e26eb/doc/2019-06-04_ace-vim-neovim.md
./0001-source-command-doesnt-check-for-the-sandbox-5357552.patch
];
configureFlags = [
"--enable-multibyte"
"--enable-nls"