From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp12.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms9.migadu.com with LMTPS id MMSoCDRcDGQHBgEASxT56A (envelope-from ) for ; Sat, 11 Mar 2023 11:47:16 +0100 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp12.migadu.com with LMTPS id eCBuCDRcDGTZOgAAauVa8A (envelope-from ) for ; Sat, 11 Mar 2023 11:47:16 +0100 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 DB3B7FC57 for ; Sat, 11 Mar 2023 11:47:15 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pawk9-0007Ai-Vt; Sat, 11 Mar 2023 05:46:30 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pawk7-0007Aa-PL for emacs-orgmode@gnu.org; Sat, 11 Mar 2023 05:46:27 -0500 Received: from mout01.posteo.de ([185.67.36.65]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pawk5-00009m-O7 for emacs-orgmode@gnu.org; Sat, 11 Mar 2023 05:46:27 -0500 Received: from submission (posteo.de [185.67.36.169]) by mout01.posteo.de (Postfix) with ESMTPS id 7D80A2401A2 for ; Sat, 11 Mar 2023 11:46:23 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1678531583; bh=gKtYzurqHmnAbMrVcpdH6Qayyrlud249+rWzayyQHNw=; h=From:To:Cc:Subject:Date:From; b=RGNRMabCSdRqrQKtzxjXiSoZjHYeeAZMveBfs8mz9bQTXsn1MOELXY3wXqi0Itp7M U/0bFuCfCYAAmfXgZmgyrFtygmzqq0ji9Xp2rg0GKPOuzSzdV4Reu27dw8y5lC2kfw Skpfs3DwcGGkv5MfKL4KhEYZssgXZGjblSTZT+uHqh/orDdQH76fSg3cgDh1HW30l5 hyIaj8VXcY4H5oMq/SaIJrvbtp4VxukvUBHQDSly5LsjUUSAPgBQiMu8Ar1v/th2i5 NaA0VlqGVKySXOwJmrkxsPLmldifQ4D8W6ysMH5kjb4mvf9voS2oeQ9gGIDex0az/y fq5xVzJccCAgA== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4PYfjT1ymRz6tnj; Sat, 11 Mar 2023 11:46:21 +0100 (CET) From: Ihor Radchenko To: lux Cc: Max Nikulin , emacs-orgmode@gnu.org Subject: Re: [PATCH] Fix ob-latex.el command injection vulnerability. In-Reply-To: References: <87v8jzjj1p.fsf@localhost> <047b7367-c98f-e531-b3e9-bc50b6b098e5@gmail.com> <871qlyqfm0.fsf@localhost> Date: Sat, 11 Mar 2023 10:47:52 +0000 Message-ID: <87wn3nwomf.fsf@localhost> MIME-Version: 1.0 Content-Type: text/plain Received-SPF: pass client-ip=185.67.36.65; envelope-from=yantar92@posteo.net; helo=mout01.posteo.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: emacs-orgmode-bounces+larch=yhetil.org@gnu.org X-Migadu-Country: US X-Migadu-Flow: FLOW_IN ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b=RGNRMabC; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org"; dmarc=pass (policy=none) header.from=posteo.net ARC-Seal: i=1; s=key1; d=yhetil.org; t=1678531635; a=rsa-sha256; cv=none; b=bNiT/2+gEu8PEz7JLdfXUbSOs6OJ7alBcSNc6ckqBBgu/v6Dvymhdn38mfFCAAcrvy7eKh y7LVmDRHYArG7gzANn5Pk0K6MV3DTCQAm8S5ZRnJDsyL35oovWR4vr3s25LJPhpfyibD7O 9a/KeJC1Xw6oiWTLO5yAadXHPdMbWmpmOB38kDmtwGfnWGaoTV/TFYxA8sf7g2oXR5OGrS uhzfPjhIRmTJxn7x9T/cy/pO9cgqkKmCRR+ae8u22nDxb3o7mCcAAEGr7+HC1MZps1DcMV B10948JxzkyZOup26QGnV1k8te0y6JtcgRWeGSkjg4StKvjE58BxThahWRXvQQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1678531635; 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:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=4qy3wBBJiOOCnOXKva9Hpn7laq+Eg0gVz8WK7Ue8LDg=; b=snJCl6UukgTi9YXpGosswULVLTIf1PIsiGqpz1uaua45vweOd2fUOXR+BwJr/sR73TI2/p lcyiKJrqLKBo/kBCGB/Bd4gd88lIOfnNlGnlQKWAho9xldhwwBfuSKMskxWeyCzYquLa5o 3MdI78+Kf51/3xOHD6htm2tVdhp8bBGgwrkocts5R+BQgVgfHtBh55mQuMv2agHriSr7Ff QKPQPpWtRJIo/qvSmlKADkSNWoGmFXno2/TV+e1T5v6VjB9+WkCLmSALDCoF2dSy0LTVwA 66b2DFZ7YB4qm8YXhEbh17m2eHl0HstEEjIvRS1trPlE+C9YweXLDpDmIPR73g== X-Migadu-Spam-Score: -6.20 X-Spam-Score: -6.20 X-Migadu-Queue-Id: DB3B7FC57 X-Migadu-Scanner: scn1.migadu.com Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b=RGNRMabC; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org"; dmarc=pass (policy=none) header.from=posteo.net X-TUID: gGwHZOs3+NLJ lux writes: >> However, for example, (shell-quote-argument "-enhance -strip") will >> return "-enhance\\ -strip", which is not what we want. >> >> Similar problem with other instances of `shell-command' in Org where >> header args supply command line arguments. Like in :cmdline. >> > > I think there is only a need to deal with the problem of `\\ ', for > example: > > (string-replace "\\ " " " (shell-quote-argument im-in-options)) No. Quoting will also affect '"' and other '\'. We must not try to be smart here. It will miss edge cases and be fragile in general. > Any better suggestions? Thanks. I am afraid that we cannot make things universally safe here without breaking changes. The best way will be treating :cmd and similar header args as unsafe and include them into the planned safety prompt system we discussed in https://orgmode.org/list/87edsd5o89.fsf@localhost -- Ihor Radchenko // yantar92, Org mode contributor, Learn more about Org mode at . Support Org development at , or support my work at