From: Jinwoo Lee Date: Sat, 31 Jan 2015 00:10:12 +0000 (+1600) 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=03fcfa1cd4d353612d67c1895db5465db6078b2d;p=notmuch-archives.git Re: [PATCH] emacs: Add a defcustom that specifies regexp for blocked remote images. --- diff --git a/37/7c518301ad96ac8385ebab42e66c448937c8cb b/37/7c518301ad96ac8385ebab42e66c448937c8cb new file mode 100644 index 000000000..21180cfa7 --- /dev/null +++ b/37/7c518301ad96ac8385ebab42e66c448937c8cb @@ -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 2B216431FAE + for ; Fri, 30 Jan 2015 16:10:21 -0800 (PST) +X-Virus-Scanned: Debian amavisd-new at olra.theworths.org +X-Spam-Flag: NO +X-Spam-Score: 2.639 +X-Spam-Level: ** +X-Spam-Status: No, score=2.639 tagged_above=-999 required=5 + tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, + DNS_FROM_AHBL_RHSBL=2.438, FREEMAIL_ENVFROM_END_DIGIT=1, + FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7] 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 xzD+f9eHoth8 for ; + Fri, 30 Jan 2015 16:10:18 -0800 (PST) +Received: from mail-ie0-f170.google.com (mail-ie0-f170.google.com + [209.85.223.170]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) + (No client certificate requested) + by olra.theworths.org (Postfix) with ESMTPS id 3CFE8431FC4 + for ; Fri, 30 Jan 2015 16:10:18 -0800 (PST) +Received: by mail-ie0-f170.google.com with SMTP id y20so7087526ier.1 + for ; Fri, 30 Jan 2015 16:10:15 -0800 (PST) +DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; + h=from:to:subject:in-reply-to:references:user-agent:date:message-id + :mime-version:content-type; + bh=lkBbgu9UR/07YPbe6Kh2SYksFFtiYb7o8rb4pDDfFv0=; + b=0FnIW7BFnSJdcT5oec6Se3uVi9r6/xtq3nL7qtwtbXU4G//zJwd9998uPSwIaUrm45 + elZHN6hWg50kmpSHUT7HR14PR+tPPgh0IHEnjnSU5AjEY96g9AWUa28xx891kkws9rNp + NkaaPLjxXfJLMxm1E9k0F69NWs0ePbBjoNN+b7aFw9Gw6OqZb+g+3yWlrJoG7UO7ajwY + V5a6I1XTwrPNc10PKfUXWykPtoUDtAf5LNWzvJUWcwX9m54ymuyhGoBDoaaa35lX6Mf0 + Nxz2x8fFnb1rpx5vDMEMuemGRsEexJsS6l8+JAQs7O+sn04g0Fl57XfqL3dlvZxKLUQq + jY7A== +X-Received: by 10.50.111.168 with SMTP id ij8mr95774igb.43.1422663015695; + Fri, 30 Jan 2015 16:10:15 -0800 (PST) +Received: from localhost ([2620:0:1000:407c:4567:58c3:e7ba:87a3]) + by mx.google.com with ESMTPSA id qr1sm2024572igb.18.2015.01.30.16.10.14 + for + (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); + Fri, 30 Jan 2015 16:10:15 -0800 (PST) +From: Jinwoo Lee +To: 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.18.1 (http://notmuchmail.org) Emacs/24.4.1 + (x86_64-apple-darwin13.2.0) +Date: Fri, 30 Jan 2015 16:10:12 -0800 +Message-ID: +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: Sat, 31 Jan 2015 00:10:21 -0000 + +Can someone take a look please? + +On Thu, Jan 29, 2015 at 01:35 PM, 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. +> + (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