From: Tomi Ollila Date: Sun, 1 Feb 2015 21:40:52 +0000 (+0200) Subject: Re: [PATCH] emacs: Add a defcustom that specifies regexp for blocked remote images. X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=21efadbb09c20fc9fee520eb77c5684f4060dff0;p=notmuch-archives.git Re: [PATCH] emacs: Add a defcustom that specifies regexp for blocked remote images. --- diff --git a/7b/9045f89baf5978a5848f126d45585f7e5282ed b/7b/9045f89baf5978a5848f126d45585f7e5282ed new file mode 100644 index 000000000..d103d684b --- /dev/null +++ b/7b/9045f89baf5978a5848f126d45585f7e5282ed @@ -0,0 +1,128 @@ +Return-Path: +X-Original-To: notmuch@notmuchmail.org +Delivered-To: notmuch@notmuchmail.org +Received: from localhost (localhost [127.0.0.1]) + by olra.theworths.org (Postfix) with ESMTP id 2F5A9431FC2 + for ; Sun, 1 Feb 2015 13:41:22 -0800 (PST) +X-Virus-Scanned: Debian amavisd-new at olra.theworths.org +X-Spam-Flag: NO +X-Spam-Score: 2.438 +X-Spam-Level: ** +X-Spam-Status: No, score=2.438 tagged_above=-999 required=5 + tests=[DNS_FROM_AHBL_RHSBL=2.438] autolearn=disabled +Received: from olra.theworths.org ([127.0.0.1]) + by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) + with ESMTP id 8MOyhAOGzPPi for ; + Sun, 1 Feb 2015 13:41:19 -0800 (PST) +Received: from guru.guru-group.fi (guru.guru-group.fi [46.183.73.34]) + by olra.theworths.org (Postfix) with ESMTP id D90FB431FC0 + for ; Sun, 1 Feb 2015 13:41:18 -0800 (PST) +Received: from guru.guru-group.fi (localhost [IPv6:::1]) + by guru.guru-group.fi (Postfix) with ESMTP id 3164810004A; + Sun, 1 Feb 2015 23:40:53 +0200 (EET) +From: Tomi Ollila +To: Jinwoo Lee , notmuch@notmuchmail.org +Subject: Re: [PATCH] emacs: Add a defcustom that specifies regexp for + blocked remote images. +In-Reply-To: <1422567352-32647-1-git-send-email-jinwoo68@gmail.com> +References: <1422567352-32647-1-git-send-email-jinwoo68@gmail.com> +User-Agent: Notmuch/0.19+53~gb45d2f9 (http://notmuchmail.org) Emacs/24.3.1 + (x86_64-unknown-linux-gnu) +X-Face: HhBM'cA~ +MIME-Version: 1.0 +Content-Type: text/plain +X-BeenThere: notmuch@notmuchmail.org +X-Mailman-Version: 2.1.13 +Precedence: list +List-Id: "Use and development of the notmuch mail system." + +List-Unsubscribe: , + +List-Archive: +List-Post: +List-Help: +List-Subscribe: , + +X-List-Received-Date: Sun, 01 Feb 2015 21:41:22 -0000 + +On Thu, Jan 29 2015, Jinwoo Lee wrote: + +> It's default value is ".", meaning all remote images will be blocked +> by default. +> +> --- +> This time setting gnus-blocked-images from the correct place. +> --- +> emacs/notmuch-show.el | 23 ++++++++++++++++++----- +> 1 file changed, 18 insertions(+), 5 deletions(-) +> +> diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el +> index 66350d4..6f38e0c 100644 +> --- a/emacs/notmuch-show.el +> +++ b/emacs/notmuch-show.el +> @@ -136,6 +136,11 @@ indentation." +> :type 'boolean +> :group 'notmuch-show) +> +> +(defcustom notmuch-show-text/html-blocked-images "." +> + "Remote images that have URLs matching this regexp will be blocked." +> + :type '(choice (const nil) regexp) +> + :group 'notmuch-show) +> + +> (defvar notmuch-show-thread-id nil) +> (make-variable-buffer-local 'notmuch-show-thread-id) +> (put 'notmuch-show-thread-id 'permanent-local t) +> @@ -798,16 +803,24 @@ will return nil if the CID is unknown or cannot be retrieved." +> ;; URL-decode it (see RFC 2392). +> (let ((cid (url-unhex-string url))) +> (first (notmuch-show--get-cid-content cid))))) +> - ;; Block all external images to prevent privacy leaks and +> - ;; potential attacks. FIXME: If we block an image, offer a +> - ;; button to load external images. +> - (shr-blocked-images ".")) +> + ;; By default, block all external images to prevent privacy +> + ;; leaks and potential attacks. FIXME: If we block an image, +> + ;; offer a button to load external images. + +This comment looks little weird; maybe the "Block all external images to +prevent privacy leaks and potential attacks." part could be moved to +the defcustom part and leave the FIXME part here + +> + (shr-blocked-images notmuch-show-text/html-blocked-images)) +> (shr-insert-document dom) +> t)) +> +> (defun notmuch-show-insert-part-*/* (msg part content-type nth depth button) +> ;; This handler _must_ succeed - it is the handler of last resort. +> - (notmuch-mm-display-part-inline msg part content-type notmuch-show-process-crypto) +> + +> + ;; By default, block all external images to prevent privacy leaks +> + ;; and potential attacks. FIXME: If we block an image, offer a +> + ;; button to load external images. +> + ;; Note that GNUS-BLOCKED-IMAGES is effective only when +> + ;; MM-TEXT-HTML-RENDERER is 'gnus-w3m. + +This last statement should be dropped unless we know for sure that this +is exact -- and rest (sans FIXME) can go to the defcustom... + +... and to me, it looks like this is not the most suitable place for this +setting; easiest is to drop it into notmuch-show-insert-part-text/html +so it is in the same context as the shr. Alternative is to put it to +the earlier place in insert-part handling (or later, +i.e. notmuch-mm-display-part-inline ) + +> + (let ((gnus-blocked-images notmuch-show-text/html-blocked-images)) +> + (notmuch-mm-display-part-inline msg part content-type +> + notmuch-show-process-crypto)) +> t) + +Tomi + +> +> ;; Functions for determining how to handle MIME parts. +> -- +> 2.2.2