Re: [PATCH] emacs: Add a defcustom that specifies regexp for blocked remote images.

Subject: Re: [PATCH] emacs: Add a defcustom that specifies regexp for blocked remote images.

Date: Sun, 01 Feb 2015 23:42:48 +0200

To: David Edmondson, Jinwoo Lee, notmuch@notmuchmail.org

Cc:

From: Tomi Ollila


On Sun, Feb 01 2015, David Edmondson <dme@dme.org> wrote:

> 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.
>
> Looks good - it is better than the code currently in the repository,
> even if it doesn’t address every possible case that we have discussed.

That I can agree with :D

Tomi

>
>> ---
>>  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.
>> +	(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.
>> +  (let ((gnus-blocked-images notmuch-show-text/html-blocked-images))
>> +    (notmuch-mm-display-part-inline msg part content-type
>> +				    notmuch-show-process-crypto))
>>    t)
>>  
>>  ;; Functions for determining how to handle MIME parts.
>> -- 
>> 2.2.2
>>
>> _______________________________________________
>> notmuch mailing list
>> notmuch@notmuchmail.org
>> http://notmuchmail.org/mailman/listinfo/notmuch
> _______________________________________________
> notmuch mailing list
> notmuch@notmuchmail.org
> http://notmuchmail.org/mailman/listinfo/notmuch

Thread: