From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp12.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id GOLfDMzvsmIqYgEAbAwnHQ (envelope-from ) for ; Wed, 22 Jun 2022 12:32:44 +0200 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp12.migadu.com with LMTPS id kDeQDMzvsmITAgAAauVa8A (envelope-from ) for ; Wed, 22 Jun 2022 12:32:44 +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 C89BC29B38 for ; Wed, 22 Jun 2022 12:32:43 +0200 (CEST) Received: from localhost ([::1]:37442 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o3xf8-0000tn-3G for larch@yhetil.org; Wed, 22 Jun 2022 06:32:42 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41760) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o3xHm-0008Qz-AF for emacs-orgmode@gnu.org; Wed, 22 Jun 2022 06:08:37 -0400 Received: from mail-pj1-x1034.google.com ([2607:f8b0:4864:20::1034]:44837) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1o3xHd-0006sn-U9 for emacs-orgmode@gnu.org; Wed, 22 Jun 2022 06:08:30 -0400 Received: by mail-pj1-x1034.google.com with SMTP id h34-20020a17090a29a500b001eb01527d9eso15448038pjd.3 for ; Wed, 22 Jun 2022 03:08:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:references:user-agent:in-reply-to :message-id:mime-version; bh=WAktpxVg16NaKrqSmFbiT/oC7IwmT8Ka9o8AANc17XQ=; b=GD6l/yG34X0aW/KDwD/t4SJARscXwGVtWx/S2UWxk0ZwJzz4uYr2yRlQ4oRcxV+xIg qDPw1roLtdsduiN0mLqgnwpjS3V0OhqRKOnQaDF3zteNakGGO0YAyQ3rK6aByIhzJ9w2 5QUwMVvL029QweVd5YOcmn0BxdiKzGSXyJns6tIs9yRpRE//bi0tMV2uB13t0EuJ1906 9fjK5ZzRLa6vYp9nm/862npynfIaZvb9JCG+xOv9pU5p8IVdAx2Ragrr70BcAxUXQT3e +eUzyGilPLAvWzBPl9SPjMqVYylgfPDj49oUT9+ntj8JLnqyWXiGFRHZweqHqQAwwfcC kJWQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:references:user-agent :in-reply-to:message-id:mime-version; bh=WAktpxVg16NaKrqSmFbiT/oC7IwmT8Ka9o8AANc17XQ=; b=Qv4uOQFMm1uqFXf6MTuyckr1qtJyR8Qme6PlTsq9V/5CjiFiVbOA/n+9jprKW6MwVW wTH9O8pUslJZj3YSez6Vs0vzZMZKbGVdchi5e2UsCEvowvkiN55tsAmLxhZDy8UScd1v O/tmtzefGkmXuqsriMhqFi8h+tXUBJiCU+CUhQUqz8lf/lQE2e0RZvGRdmntMqtoYBzB 4habZAgVHohJfZqizsC+Sg5n5hmXhnyIfCoDECKP1+QD1loZ5d0GyFXSyOiSf/Rvj/TW KD1ku8gFNC4OU4Y1AI3HL2+K2bTnYxYDPxIwQp4uYFkbQRhwRzBOVKbNfdQd0qa5f+XO xKJg== X-Gm-Message-State: AJIora/Uz9pH4zv7gqNYE7w3IBOpfe2uQ4y1qy+wLq/nT7pusUXsifNF rkYCJ3dgNE0tbMHOduQAync= X-Google-Smtp-Source: AGRyM1u+I/aQH5Kq6PCF/LTk1DT7QgnruNo1ltxIIVYHhvJFNhK/5rO4l9sajGEpC0OnMDMx3g8PIw== X-Received: by 2002:a17:902:900c:b0:16a:4521:10fd with SMTP id a12-20020a170902900c00b0016a452110fdmr3793593plp.75.1655892504373; Wed, 22 Jun 2022 03:08:24 -0700 (PDT) Received: from localhost (2403-580e-91f7--124.ip6.aussiebb.net. [2403:580e:91f7::124]) by smtp.gmail.com with ESMTPSA id z3-20020aa791c3000000b0052515a79b78sm8114109pfa.189.2022.06.22.03.08.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Jun 2022 03:08:24 -0700 (PDT) From: Timothy To: Max Nikulin Cc: emacs-orgmode@gnu.org Subject: Re: [PATCH] New remote resource download policy Date: Wed, 22 Jun 2022 18:01:30 +0800 References: <87mteiq6ou.fsf@gmail.com> User-agent: mu4e 1.6.11; emacs 28.0.92 In-reply-to: Message-ID: <87pmj1nh7v.fsf@gmail.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Received-SPF: pass client-ip=2607:f8b0:4864:20::1034; envelope-from=tecosaur@gmail.com; helo=mail-pj1-x1034.google.com 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, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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" X-Migadu-Flow: FLOW_IN X-Migadu-To: larch@yhetil.org X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1655893963; 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=WAktpxVg16NaKrqSmFbiT/oC7IwmT8Ka9o8AANc17XQ=; b=ue8lXSkJgru/p2WX7Q7dvstQrqiIS5lj9gETKLSS05KbLOrtiS3aM1wK5CW0NSL+c4XUIH BosX6+M3jTDlS7ibJkiikNUpsVBwnqmBpjpUT1pGZU8/XXaBqOfNMSjLObJL7dozEyfnIs hWVZg6tb8fD/T734p7GU0UiILC7JROv126gPVCFsxiaof/hTnoMU3+3EPvE2gUtv5Ib64J 0zOcRQKNL9eg7ualEADV4fWPvBaA0ExQRBfzH7VA+cIEeLJxj3N1m9SKX0GJ/ywSlpfSXl CqeZY7YxqlHY3xD1IpevphCBx/DBk1Pdt4U9mHlR9lVesZYjWB6uhuQLH2PLFw== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1655893963; a=rsa-sha256; cv=none; b=SPy0bFUAKcNqJ9p8sYLWn+1PtFGHIzEVgEDnXxmPeNdCUnC403M3NxFcEwJkM9JJaimZ/j 6llsiyzD2Zv5qtHkCKpYvrDEh2HQa8GcOBDkxWnn1lb6nehtuiFe7sUcE6dM7dZQeRpQdg /qqYnqSnzkWSp2918SxbsWxOE9UdUsVoT8VMb/1pTV5Eq5TqoLP+6Gw/ZlGStMcEPkAgDd cG2uBWN+VIfZj3Sp5WPeofPp/+S0dBBKZh/3C7+A1iDo8hZEOSy7aOC43ZeG2VP68u1hTI ISDjxcXV+b8abIIhQFdjSIfmK2ssExh0Eh3XyvTP9Wx6fYCZwgyqC3BhhoCRCQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20210112 header.b="GD6l/yG3"; dmarc=pass (policy=none) header.from=gmail.com; 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: -4.76 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20210112 header.b="GD6l/yG3"; dmarc=pass (policy=none) header.from=gmail.com; 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: C89BC29B38 X-Spam-Score: -4.76 X-Migadu-Scanner: scn0.migadu.com X-TUID: aEh/Urk9kK+Q --=-=-= Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi Max, >> =E2=80=94 a/lisp/org-attach.el >> +++ b/lisp/org-attach.el >> @@ -525,7 +525,11 @@ (defun org-attach-attach (file &optional visit-dir = method) >> [snip] >> + (if (or (not noninteractive) (org=E2=80=93should-fetch-remote-r= esource-p file)) > > I am confused by (not noninteractive). Does it mean that interactive call= is > enough to bypass protection? It may have sense it at this step there is no > ambiguity what resources is fetched. On the other hand I am unsure concer= ning a > case when `org-attach-attach=E2=80=99 is a part of a larger command. The idea here is that when this is done interactively the user will be awar= e of the URL this is being applied to, and so it isn=E2=80=99t a risk. Let me kn= ow if this assumption doesn=E2=80=99t hold. >> +(defcustom org-download-remote-resources =E2=80=99prompt > > The name sounds like some function. Mmm. I could add `-policy' to that variable name perhaps. >> +(defun org=E2=80=93confirm-resource-safe (uri) >> + =E2=80=9CAsk the user if URI should be considered safe, returning non= -nil if so.=E2=80=9D >> + (unless noninteractive >> + (let ((buf (get-buffer-create =E2=80=9C*Org Remote Resource*=E2= =80=9D))) > > I see your intention to add something fancy to the dialog. May `org-mks= =E2=80=99 be > reused instead to avoid proliferation variants of rather similar UI code? Well, the thing here is that I=E2=80=99m explicitly trying to mimic the file-local-variable dialog, and since a general form isn=E2=80=99t exposed = by Emacs, a little bit of proliferation seems like the best option to me. >> + ;; Set up the contents of the *Local Variables* buffer. > > I am in doubts concerning =E2=80=9Conce=E2=80=9D. I tried =E2=80=9Cy=E2= =80=9D in a file having to =E2=80=9C#+include:=E2=80=9D > of the same file. I did not get question for second include. I did not get > prompt for this file anymore at all, even during next export. I modified = the > remote file, but stale content appeared during export. So the file was re= ally > downloaded once, but it is hardly in agreement with my expectations. Beha= vior is > unrelated to this patch, concerning wording I am not sure, but I have no a > better variant. Ok, that is not the intended behaviour. I=E2=80=99ll see if I can work out = what=E2=80=99s going on here. Oh, and I should change that comment to =E2=80=9CSet up the conten= ts of the *Org Remote Resource* buffer.=E2=80=9D. >> + (propertize =E2=80=9Cn=E2=80=9D =E2=80=99face =E2=80= =99error) >> + =E2=80=9C to skip this resource.=E2=80=9D) > > From =E2=80=9Cskip=E2=80=9D I do not expect aborting of export. Hmm, the =E2=80=9Cskip=E2=80=9D action isn=E2=80=99t determined by the =E2= =80=9Cis it safe=E2=80=9D functions, but some wording that doesn=E2=80=99t sound completely safe at least would be good. > I have an idea but unsure if it should be implemented. Consider > `org-remote-resources-policy=E2=80=99 custom variable that is a list of p= airs > (url-regexp . policy) for fine grain tuning instead of 2 variables. The p= rice is > more complicated structure, so higher chance of user error. My initial reaction is that this feels like overkill. All the best, Timothy --=-=-=--