From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0 ([2001:41d0:2:bcc0::]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id 2MHhJC9Hf2AjRAAAgWs5BA (envelope-from ) for ; Tue, 20 Apr 2021 23:27:11 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0 with LMTPS id UF+eIC9Hf2D/UwAA1q6Kng (envelope-from ) for ; Tue, 20 Apr 2021 21:27:11 +0000 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id DC39827736 for ; Tue, 20 Apr 2021 23:27:10 +0200 (CEST) Received: from localhost ([::1]:44320 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lYxtl-0006uu-Ka for larch@yhetil.org; Tue, 20 Apr 2021 17:27:09 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:48016) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lYxte-0006un-Sc for bug-guix@gnu.org; Tue, 20 Apr 2021 17:27:02 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:44689) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lYxte-0002rS-L7 for bug-guix@gnu.org; Tue, 20 Apr 2021 17:27:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1lYxte-0005JU-FL for bug-guix@gnu.org; Tue, 20 Apr 2021 17:27:02 -0400 X-Loop: help-debbugs@gnu.org Subject: bug#47576: [security] ibus-daemon launches ungrafted subprocesses Resent-From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: bug-guix@gnu.org Resent-Date: Tue, 20 Apr 2021 21:27:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 47576 X-GNU-PR-Package: guix X-GNU-PR-Keywords: security To: Ricardo Wurmus Received: via spool by 47576-submit@debbugs.gnu.org id=B47576.161895398820377 (code B ref 47576); Tue, 20 Apr 2021 21:27:02 +0000 Received: (at 47576) by debbugs.gnu.org; 20 Apr 2021 21:26:28 +0000 Received: from localhost ([127.0.0.1]:56234 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lYxt2-0005IX-Kg for submit@debbugs.gnu.org; Tue, 20 Apr 2021 17:26:28 -0400 Received: from eggs.gnu.org ([209.51.188.92]:35196) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lYxt1-0005IL-Mq for 47576@debbugs.gnu.org; Tue, 20 Apr 2021 17:26:24 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:43150) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lYxsu-0002X2-TZ; Tue, 20 Apr 2021 17:26:18 -0400 Received: from [2a01:e0a:1d:7270:af76:b9b:ca24:c465] (port=51904 helo=ribbon) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1lYxsu-0004S9-A9; Tue, 20 Apr 2021 17:26:16 -0400 From: Ludovic =?UTF-8?Q?Court=C3=A8s?= References: <87pmzcdljm.fsf@netris.org> <87v98hko0z.fsf@elephly.net> X-URL: http://www.fdn.fr/~lcourtes/ X-Revolutionary-Date: 1 =?UTF-8?Q?Flor=C3=A9al?= an 229 de la =?UTF-8?Q?R=C3=A9volution?= X-PGP-Key-ID: 0x090B11993D9AEBB5 X-PGP-Key: http://www.fdn.fr/~lcourtes/ludovic.asc X-PGP-Fingerprint: 3CE4 6455 8A84 FDC6 9DB4 0CFB 090B 1199 3D9A EBB5 X-OS: x86_64-pc-linux-gnu Date: Tue, 20 Apr 2021 23:26:14 +0200 In-Reply-To: <87v98hko0z.fsf@elephly.net> (Ricardo Wurmus's message of "Tue, 20 Apr 2021 16:51:08 +0200") Message-ID: <8735vkabrd.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-guix@gnu.org List-Id: Bug reports for GNU Guix List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: 47576@debbugs.gnu.org Errors-To: bug-guix-bounces+larch=yhetil.org@gnu.org Sender: "bug-Guix" X-Migadu-Flow: FLOW_IN ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1618954031; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:resent-cc:resent-from:resent-sender: resent-message-id:in-reply-to:in-reply-to:references:references: list-id:list-help:list-unsubscribe:list-subscribe:list-post; bh=wOP+r9iF/En7qxxxG+t4LIZdD5jv3KjVRKXnrBIB3x8=; b=FQshz2w3K5mb4KUpBjzKEKGzvrkamWCes0vNaqch/cVTOBtB+AsONygLyXcYyQ8BJz5+Rh qk7uqeavbyHWt4r3hxOE08wWp7q4LuW6P6BU21JWXmcLv9ilfEegXtSnge+Fn7a6alY1oK nqR+G45GIOcQ6XKTPyx1YOlXPBqAZrIAtoBFGvQDUtW3K4zoyCPZsQ6mL85XkAm6UTjmAE GHXqgU/uGuwYNXn1mHckbuaqMtnttTwzS4QkYOzNeHo13fJF1dwPSA+tC9WygZzVcBU8QA wf5bjUbn0EbSINWi+IJZORUYFvAFq0S9OkXsE4ovPMTofcg4f2qDWCBcqHIGvA== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1618954031; a=rsa-sha256; cv=none; b=fNDGwsc90OE+SZ8FW+4eAkOezC1kX1N3dlS2Fy4AjX9tdMuQbJQP/pLC8ayC6ip9XRh03Z 6ppdmxAyh5ZAOsbBIykPJwYtkuosy6KeZuzgo5gOWGJIS4xud7Z3Ldghi7f7fNeb1wlyWl 1t02HbTqLQNeKmWD5/XlBGl3Jbe1wUUaHvZ0hdWjlbZ1udv5uUdzv/+HOaKvPp6T0mn+xe YTdhHmSRIaq3vbPf5I/B/FYMwvYrOCW4zJPMexjfNXTUxUCPya/igumRrYEq0Kk/Zn98Aa xXI0abzeqBt2wc2KygTY2mAgtmXKfd27l0FfI3OKk/4SpEWn8oaqjSpl4YjGHQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=none; spf=pass (aspmx1.migadu.com: domain of bug-guix-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=bug-guix-bounces@gnu.org X-Migadu-Spam-Score: -2.94 Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=pass (policy=none) header.from=gnu.org; spf=pass (aspmx1.migadu.com: domain of bug-guix-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=bug-guix-bounces@gnu.org X-Migadu-Queue-Id: DC39827736 X-Spam-Score: -2.94 X-Migadu-Scanner: scn0.migadu.com X-TUID: uFInkW4Gh/hU --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Ricardo Wurmus skribis: > Ludo, the patch looks good to me. However, many ibus input methods > are not provided by the ibus package itself, so for ibus-anthy or > ibus-libpinyin we would need a different mechanism. Right. > Would it make sense to introduce another environment variable > (e.g. GUIX_IBUS_COMPONENTS_PATH) that specifies a search path on=20 > which components are looked up? I feel that this partially defeats > the purpose of having a cache, so perhaps this is nonsensical. That makes sense to me. Attached is a variant of the previous patch that supports GUIX_IBUS_COMPONENTS_DIRECTORY (not PATH because=E2=80=A6 it=E2=80=99s comp= licated). It would be set to $HOME/.guix-profile/libexec. We then need to modify the XML files of ibus-anthy, ibus-libpinyin, etc. so that their tags use relative file names. Thoughts? Ludo=E2=80=99. PS: IBus still builds with the patch, but that=E2=80=99s all I can say. :-) --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=ibus.patch Content-Description: the patch diff --git a/conf/dconf/dconf.xml.in b/conf/dconf/dconf.xml.in index 4205cb0..538f500 100644 --- a/conf/dconf/dconf.xml.in +++ b/conf/dconf/dconf.xml.in @@ -3,7 +3,7 @@ org.freedesktop.IBus.Config Dconf Config Component - @libexecdir@/ibus-dconf + ibus-dconf @VERSION@ Daiki Ueno <ueno@unixuser.org> GPL diff --git a/conf/memconf/memconf.xml.in b/conf/memconf/memconf.xml.in index d6ea690..9f51bcc 100644 --- a/conf/memconf/memconf.xml.in +++ b/conf/memconf/memconf.xml.in @@ -2,7 +2,7 @@ org.freedesktop.IBus.Config On-memory Config Component - @libexecdir@/ibus-memconf + ibus-memconf @VERSION@ Peng Huang <shawn.p.huang@gmail.com>, modified by the Chromium OS Authors GPL diff --git a/engine/simple.xml.in b/engine/simple.xml.in index fc1541e..47cbea1 100644 --- a/engine/simple.xml.in +++ b/engine/simple.xml.in @@ -2,7 +2,7 @@ org.freedesktop.IBus.Simple A table based simple engine - @libexecdir@/ibus-engine-simple + ibus-engine-simple @VERSION@ Peng Huang <shawn.p.huang@gmail.com> GPL diff --git a/src/Makefile.am b/src/Makefile.am index a8e3d07..2c461ee 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -49,6 +49,7 @@ AM_CPPFLAGS = \ @GLIB2_CFLAGS@ \ @GOBJECT2_CFLAGS@ \ @GIO2_CFLAGS@ \ + -DLIBEXECDIR=\"$(libexecdir)\" \ -DIBUS_CACHE_DIR=\""$(localstatedir)/cache/ibus"\" \ -DIBUS_DATA_DIR=\"$(pkgdatadir)\" \ -DIBUS_DISABLE_DEPRECATION_WARNINGS \ diff --git a/src/Makefile.in b/src/Makefile.in index 2a9c2ab..c3dfd87 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -613,6 +613,7 @@ CLEANFILES = $(am__append_2) $(BUILT_SOURCES) stamp-ibusmarshalers.h \ # C preprocessor flags AM_CPPFLAGS = -DG_LOG_DOMAIN=\"IBUS\" @GLIB2_CFLAGS@ @GOBJECT2_CFLAGS@ \ @GIO2_CFLAGS@ \ + -DLIBEXECDIR=\"$(libexecdir)\" \ -DIBUS_CACHE_DIR=\""$(localstatedir)/cache/ibus"\" \ -DIBUS_DATA_DIR=\"$(pkgdatadir)\" \ -DIBUS_DISABLE_DEPRECATION_WARNINGS -DIBUS_COMPILATION \ diff --git a/src/ibuscomponent.c b/src/ibuscomponent.c index 9837f47..ca875bd 100644 --- a/src/ibuscomponent.c +++ b/src/ibuscomponent.c @@ -613,16 +613,45 @@ ibus_component_parse_engines (IBusComponent *component, } if (exec != NULL) { - gchar *output = NULL; - if (g_spawn_command_line_sync (exec, &output, NULL, NULL, NULL)) { - engines_node = ibus_xml_parse_buffer (output); - g_free (output); - - if (engines_node) { - if (g_strcmp0 (engines_node->name, "engines") == 0) { - node = engines_node; + gint argc; + gchar **argv; + + if (g_shell_parse_argv (exec, &argc, &argv, NULL)) { + gchar *output = NULL; + gchar *program = argv[0]; + + if (program[0] != '/') { + /* PROGRAM is a relative file name, so assume it's the name + of an executable in LIBEXECDIR or + $GUIX_IBUS_COMPONENTS_DIRECTORY and expand it. */ + const gchar *directory; + gchar *absolute; + + directory = g_getenv ("GUIX_IBUS_COMPONENTS_DIRECTORY") ?: LIBEXECDIR; + absolute = g_malloc (strlen (directory) + strlen (program) + 2); + strcpy (absolute, directory); + strcat (absolute, "/"); + strcat (absolute, program); + + g_free (program); + argv[0] = absolute; + } + + if (g_spawn_sync (NULL, argv, NULL, + G_SPAWN_DEFAULT, NULL, NULL, + &output, NULL, /* stdout, stderr */ + NULL, NULL)) { + engines_node = ibus_xml_parse_buffer (output); + g_free (output); + + if (engines_node) { + if (g_strcmp0 (engines_node->name, "engines") == 0) { + node = engines_node; + } } } + + g_strfreev (argv); } } diff --git a/ui/gtk3/gtkextension.xml.in b/ui/gtk3/gtkextension.xml.in index b8157c9..fc945ab 100644 --- a/ui/gtk3/gtkextension.xml.in +++ b/ui/gtk3/gtkextension.xml.in @@ -3,7 +3,7 @@ org.freedesktop.IBus.Panel.Extension Gtk Panel Extension Component - @libexecdir@/ibus-extension-gtk3 + ibus-extension-gtk3 @VERSION@ Takao Fujiwara <takao.fujiwara1@gmail.com> GPL diff --git a/ui/gtk3/gtkpanel.xml.in b/ui/gtk3/gtkpanel.xml.in index b61f400..2175b93 100644 --- a/ui/gtk3/gtkpanel.xml.in +++ b/ui/gtk3/gtkpanel.xml.in @@ -3,7 +3,7 @@ org.freedesktop.IBus.Panel Gtk Panel Component - @libexecdir@/ibus-ui-gtk3 + ibus-ui-gtk3 @VERSION@ Peng Huang <shawn.p.huang@gmail.com> GPL --=-=-=--