Re: [PATCH] emacs: Add a defcustom that specifies regexp for blocked remote images.
[notmuch-archives.git] / 79 / ef621bc7282d79959453bb70b1eb79460785ec
1 Return-Path: <tomi.ollila@iki.fi>\r
2 X-Original-To: notmuch@notmuchmail.org\r
3 Delivered-To: notmuch@notmuchmail.org\r
4 Received: from localhost (localhost [127.0.0.1])\r
5         by olra.theworths.org (Postfix) with ESMTP id 6F7FF431FC3\r
6         for <notmuch@notmuchmail.org>; Sun,  1 Feb 2015 13:43:13 -0800 (PST)\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
8 X-Spam-Flag: NO\r
9 X-Spam-Score: 2.438\r
10 X-Spam-Level: **\r
11 X-Spam-Status: No, score=2.438 tagged_above=-999 required=5\r
12         tests=[DNS_FROM_AHBL_RHSBL=2.438] autolearn=disabled\r
13 Received: from olra.theworths.org ([127.0.0.1])\r
14         by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
15         with ESMTP id FP5+FLjgOCyU for <notmuch@notmuchmail.org>;\r
16         Sun,  1 Feb 2015 13:43:11 -0800 (PST)\r
17 Received: from guru.guru-group.fi (guru.guru-group.fi [46.183.73.34])\r
18         by olra.theworths.org (Postfix) with ESMTP id E0C58431FC2\r
19         for <notmuch@notmuchmail.org>; Sun,  1 Feb 2015 13:43:10 -0800 (PST)\r
20 Received: from guru.guru-group.fi (localhost [IPv6:::1])\r
21         by guru.guru-group.fi (Postfix) with ESMTP id 7415510004A;\r
22         Sun,  1 Feb 2015 23:42:49 +0200 (EET)\r
23 From: Tomi Ollila <tomi.ollila@iki.fi>\r
24 To: David Edmondson <dme@dme.org>, Jinwoo Lee <jinwoo68@gmail.com>,\r
25         notmuch@notmuchmail.org\r
26 Subject: Re: [PATCH] emacs: Add a defcustom that specifies regexp\r
27         for     blocked remote images.\r
28 In-Reply-To: <cunlhkhe2l3.fsf@fenchurch.hh.sledj.net>\r
29 References: <1422567352-32647-1-git-send-email-jinwoo68@gmail.com>\r
30         <cunlhkhe2l3.fsf@fenchurch.hh.sledj.net>\r
31 User-Agent: Notmuch/0.19+53~gb45d2f9 (http://notmuchmail.org) Emacs/24.3.1\r
32         (x86_64-unknown-linux-gnu)\r
33 X-Face: HhBM'cA~<r"^Xv\KRN0P{vn'Y"Kd;zg_y3S[4)KSN~s?O\"QPoL\r
34         $[Xv_BD:i/F$WiEWax}R(MPS`^UaptOGD`*/=@\1lKoVa9tnrg0TW?"r7aRtgk[F\r
35         !)g;OY^,BjTbr)Np:%c_o'jj,Z\r
36 Date: Sun, 01 Feb 2015 23:42:48 +0200\r
37 Message-ID: <m2y4ohtijr.fsf@guru.guru-group.fi>\r
38 MIME-Version: 1.0\r
39 Content-Type: text/plain; charset=utf-8\r
40 Content-Transfer-Encoding: quoted-printable\r
41 X-BeenThere: notmuch@notmuchmail.org\r
42 X-Mailman-Version: 2.1.13\r
43 Precedence: list\r
44 List-Id: "Use and development of the notmuch mail system."\r
45         <notmuch.notmuchmail.org>\r
46 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
47         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
48 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
49 List-Post: <mailto:notmuch@notmuchmail.org>\r
50 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
51 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
52         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
53 X-List-Received-Date: Sun, 01 Feb 2015 21:43:13 -0000\r
54 \r
55 On Sun, Feb 01 2015, David Edmondson <dme@dme.org> wrote:\r
56 \r
57 > On Thu, Jan 29 2015, Jinwoo Lee wrote:\r
58 >> It's default value is ".", meaning all remote images will be blocked\r
59 >> by default.\r
60 >>\r
61 >> ---\r
62 >> This time setting gnus-blocked-images from the correct place.\r
63 >\r
64 > Looks good - it is better than the code currently in the repository,\r
65 > even if it doesn=E2=80=99t address every possible case that we have discu=\r
66 ssed.\r
67 \r
68 That I can agree with :D\r
69 \r
70 Tomi\r
71 \r
72 >\r
73 >> ---\r
74 >>  emacs/notmuch-show.el | 23 ++++++++++++++++++-----\r
75 >>  1 file changed, 18 insertions(+), 5 deletions(-)\r
76 >>\r
77 >> diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el\r
78 >> index 66350d4..6f38e0c 100644\r
79 >> --- a/emacs/notmuch-show.el\r
80 >> +++ b/emacs/notmuch-show.el\r
81 >> @@ -136,6 +136,11 @@ indentation."\r
82 >>    :type 'boolean\r
83 >>    :group 'notmuch-show)\r
84 >>=20=20\r
85 >> +(defcustom notmuch-show-text/html-blocked-images "."\r
86 >> +  "Remote images that have URLs matching this regexp will be blocked."\r
87 >> +  :type '(choice (const nil) regexp)\r
88 >> +  :group 'notmuch-show)\r
89 >> +\r
90 >>  (defvar notmuch-show-thread-id nil)\r
91 >>  (make-variable-buffer-local 'notmuch-show-thread-id)\r
92 >>  (put 'notmuch-show-thread-id 'permanent-local t)\r
93 >> @@ -798,16 +803,24 @@ will return nil if the CID is unknown or cannot be=\r
94  retrieved."\r
95 >>         ;; URL-decode it (see RFC 2392).\r
96 >>         (let ((cid (url-unhex-string url)))\r
97 >>           (first (notmuch-show--get-cid-content cid)))))\r
98 >> -    ;; Block all external images to prevent privacy leaks and\r
99 >> -    ;; potential attacks.  FIXME: If we block an image, offer a\r
100 >> -    ;; button to load external images.\r
101 >> -    (shr-blocked-images "."))\r
102 >> +    ;; By default, block all external images to prevent privacy\r
103 >> +    ;; leaks and potential attacks.  FIXME: If we block an image,\r
104 >> +    ;; offer a button to load external images.\r
105 >> +    (shr-blocked-images notmuch-show-text/html-blocked-images))\r
106 >>      (shr-insert-document dom)\r
107 >>      t))\r
108 >>=20=20\r
109 >>  (defun notmuch-show-insert-part-*/* (msg part content-type nth depth bu=\r
110 tton)\r
111 >>    ;; This handler _must_ succeed - it is the handler of last resort.\r
112 >> -  (notmuch-mm-display-part-inline msg part content-type notmuch-show-pr=\r
113 ocess-crypto)\r
114 >> +\r
115 >> +  ;; By default, block all external images to prevent privacy leaks\r
116 >> +  ;; and potential attacks.  FIXME: If we block an image, offer a\r
117 >> +  ;; button to load external images.\r
118 >> +  ;; Note that GNUS-BLOCKED-IMAGES is effective only when\r
119 >> +  ;; MM-TEXT-HTML-RENDERER is 'gnus-w3m.\r
120 >> +  (let ((gnus-blocked-images notmuch-show-text/html-blocked-images))\r
121 >> +    (notmuch-mm-display-part-inline msg part content-type\r
122 >> +                                notmuch-show-process-crypto))\r
123 >>    t)\r
124 >>=20=20\r
125 >>  ;; Functions for determining how to handle MIME parts.\r
126 >> --=20\r
127 >> 2.2.2\r
128 >>\r
129 >> _______________________________________________\r
130 >> notmuch mailing list\r
131 >> notmuch@notmuchmail.org\r
132 >> http://notmuchmail.org/mailman/listinfo/notmuch\r
133 > _______________________________________________\r
134 > notmuch mailing list\r
135 > notmuch@notmuchmail.org\r
136 > http://notmuchmail.org/mailman/listinfo/notmuch\r