From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp12.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id 4C0aFMq3XGPoDAEAbAwnHQ (envelope-from ) for ; Sat, 29 Oct 2022 07:19:06 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp12.migadu.com with LMTPS id KDsBFMq3XGODNgAAauVa8A (envelope-from ) for ; Sat, 29 Oct 2022 07:19:06 +0200 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 089A28003 for ; Sat, 29 Oct 2022 07:19:06 +0200 (CEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ooeES-00083k-D3; Sat, 29 Oct 2022 01:18:08 -0400 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 1ood8d-0003Ni-79 for emacs-orgmode@gnu.org; Sat, 29 Oct 2022 00:08:04 -0400 Received: from mout02.posteo.de ([185.67.36.66]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oocMa-0005zA-Hq for emacs-orgmode@gnu.org; Fri, 28 Oct 2022 23:18:26 -0400 Received: from submission (posteo.de [185.67.36.169]) by mout02.posteo.de (Postfix) with ESMTPS id 7231F240101 for ; Sat, 29 Oct 2022 05:18:21 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1667013502; bh=+L8pB+qdurx39ziSUM9PMpUIIeXGV/g63lNvAC2zJYY=; h=From:To:Cc:Subject:Date:From; b=pIQ8/xqNkGKVlWw8LL1HWTxOZ7yinavfYQ4laYoHZ8XqiVe5+IFWC9sGidVWzF5Vn RsIqAhEiMPbBfGOZOVDW1C/PaFKpS+RiikwDT5TsAx2YqlR1Bpv/+hYfMAMAPislpp YyeO/3coCj9qSDaTwN4XyE0CgRkzLjeX4JUVUwk4RKDNjNhX37PV2KxZ6Z5t65ubcw T38vfe98ZM9nsqh07l4/0K07j0uFb05jZNNb+b/RGCOM/YuwuBlaubao0Lhhk5l4mA i+oUgrMhkugZbDeMCLLfPUZqnVXV0liPGbJ/SpmLvRwXOl1DJKj3v1tgR1PVb2Qb/d PHnmim1lQsYRg== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4Mzl3w2hfHz6tmQ; Sat, 29 Oct 2022 05:18:20 +0200 (CEST) From: Ihor Radchenko To: Max Nikulin Cc: emacs-orgmode@gnu.org Subject: Re: [PATCH] Re: [BUG][Security] begin_src :var evaluated before the prompt to confirm execution In-Reply-To: References: <87ilk4myev.fsf@localhost> Date: Sat, 29 Oct 2022 03:19:03 +0000 Message-ID: <8735b7l3ko.fsf@localhost> MIME-Version: 1.0 Content-Type: text/plain Received-SPF: pass client-ip=185.67.36.66; envelope-from=yantar92@posteo.net; helo=mout02.posteo.de X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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_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: , Sender: "Emacs-orgmode" Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org X-Migadu-Flow: FLOW_IN X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1667020746; 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=35GdVyzch3jTR1yANs3NlMaZLgwyNiagZQsIGBxCFyU=; b=EOTweW/iCAFTmlxXLA5S1QJPrOYDrRQ7uRc1EKsPkWCJYLDicPA+rgQdCKpjrXVocJScTy TQ2IA5Yp7X+yvzaqeYBTEgZTQOVZN6u/5O19nunnosS5ztyRs+WsOQIFdfrLQqOOKff/vt LQc1s73feNqle94IBXgVP2R4x0pk8B/1+ocidO0cBergTqRkWGRoR281L4xAVCrUfef60W KluuyNiTF8I9y3xscV1qA0B25X+eq08ZCZW+XsycUse2+sGvX8ewdcf5cdqL7I/mSJgdbJ n5+fCs5fRH3NuhD6tG21dPHYGYKaBJGBcf2NjA+/Ila56xxUQ9aHBtBpWFZLHQ== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1667020746; a=rsa-sha256; cv=none; b=QpnxqqiQ72xKf+PFR9LCTi8R7Jf4ENElSAk5X+cVDhhHoqpc+LNOsAFYvx0YinSAvrtFxP IshRkFjNXab0cpou9oU6sFxVYtCiuyHoym8+nuBw7P0/hETP33tnx5QqUxW4lWouIWJb9S neRBfQHla4mGuvETOuaVcTx/uJkeM+Kj2q33B7nvjWTKtg9TOxJXLRxuiQFNG6zRnib0VX uqQB+E4sdxeGfS61QN+Z5RQEXoRGIMG221j0YxLWwARPsQGONEKGD0ZyKuZAkrBTAy+yYf B6cRGkwIZtmGhS5dH2dFJ6ldWaYgqh1qBl9/AKqAjnLBuVSpNi6b40DhmYt6RA== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b="pIQ8/xqN"; dmarc=pass (policy=none) header.from=posteo.net; 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" X-Migadu-Spam-Score: -3.43 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b="pIQ8/xqN"; dmarc=pass (policy=none) header.from=posteo.net; 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" X-Migadu-Queue-Id: 089A28003 X-Spam-Score: -3.43 X-Migadu-Scanner: scn1.migadu.com X-TUID: Y7GSVBpuvt6m Max Nikulin writes: > On 28/10/2022 10:15, Ihor Radchenko wrote: >> >> See the attached tentative patch. >> I tried to balance between annoying users with query and not evaluating >> unsafe code: '-quoted lists and symbols are still evaluated without >> prompt. >> >> Let me know if you see any potential issues. > > If I got it right, it prompt user for every variable. I believed that > single prompt is enough for both header arguments and body evaluation. > Maybe I missed some issue with dependent code blocks. If I remember > correctly, each block causes a prompt and I am not going to dispute such > behavior. Unsure if early prompt may increase user confusion since some > blocks will be evaluated not immediately after related prompt but > perhaps after some delay to confirm dependent code. You are right that a separate prompt will be shown for each eval form, even when multiple :var assignments are present in the header arguments. I could try to patch the higher-level function that is causing the "pwned" in your example, but I figured that org-babel-read is actually used in many more places and thus similar issue could occur in different scenarios. Displaying prompt in org-babel-read is the safest approach I managed to come up with. What can help here is the feature request about bulk-yes/bulk-no code prompts: https://list.orgmode.org/orgmode/l-mfSe5KD9g7LPdD7qHPtqtjBD45DK8OeOqO6ybMWqoXG-oEQAFjlW1V1N1NtJQBWM_A4CeGT_92rpSKF7Aq0KRzsNmMZfAJnAbyVWeCjoA=@protonmail.ch/ -- Ihor Radchenko // yantar92, Org mode contributor, Learn more about Org mode at . Support Org development at , or support my work at