From f70ec48a7c8e04d6c2261b582e461027850b8d45 Mon Sep 17 00:00:00 2001 From: Jinwoo Lee Date: Fri, 30 Jan 2015 09:28:47 +1600 Subject: [PATCH] [PATCH] emacs: Add a defcustom that specifies regexp for blocked remote images. --- 51/b7807b5fb4e42b519d5d4f65490173cf6643fa | 102 ++++++++++++++++++++++ 1 file changed, 102 insertions(+) create mode 100644 51/b7807b5fb4e42b519d5d4f65490173cf6643fa diff --git a/51/b7807b5fb4e42b519d5d4f65490173cf6643fa b/51/b7807b5fb4e42b519d5d4f65490173cf6643fa new file mode 100644 index 000000000..c94e31f7f --- /dev/null +++ b/51/b7807b5fb4e42b519d5d4f65490173cf6643fa @@ -0,0 +1,102 @@ +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 727CA431FC4 + for ; Thu, 29 Jan 2015 09:29:31 -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 p25ToVBO-Ngh for ; + Thu, 29 Jan 2015 09:29:28 -0800 (PST) +Received: from mail-pa0-f43.google.com (mail-pa0-f43.google.com + [209.85.220.43]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) + (No client certificate requested) + by olra.theworths.org (Postfix) with ESMTPS id 52AD3431FBC + for ; Thu, 29 Jan 2015 09:29:28 -0800 (PST) +Received: by mail-pa0-f43.google.com with SMTP id eu11so41571115pac.2 + for ; Thu, 29 Jan 2015 09:29:26 -0800 (PST) +DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; + h=from:to:cc:subject:date:message-id; + bh=uglp0OJ6jlnfbLcgIQDMsRQtUuEggrPxrLIrG5gKPNc=; + b=h26TIH2l8SHntvDp46FQhuNPlDt7etowGkXBzvDmmFjVcmZFuk7QKhMPgXnM/7o7cA + lxGr5YjseMgrrPlS+ew69K8wOtTe8VNsTUFyFRU1XfkKRP31aQeIuNT733zzj4ne9shz + Cpv7Xn1i1bd52XiHa+Lfg7rHNKmduR00uCEIchUWJZC2oKF9808OY5hJV+XQHUd2HMw5 + l3qKsWOfkkUmNG41BfC14C12A4YwQBl+y/Hs9ZShHdal5wwzMNH2GU0pRf06pz1hW0vR + aeRa5NCj3ctVQYjvGVUR+TfJZhBFdIdICM6tI9uJepZiWT8RH4dus+pVNsdcdrX69631 + jmGA== +X-Received: by 10.66.66.196 with SMTP id h4mr2146760pat.127.1422552566215; + Thu, 29 Jan 2015 09:29:26 -0800 (PST) +Received: from jinwoo-macbookair.roam.corp.google.com.net ([24.130.61.213]) + by mx.google.com with ESMTPSA id gk2sm8368014pbc.14.2015.01.29.09.29.24 + (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); + Thu, 29 Jan 2015 09:29:25 -0800 (PST) +From: Jinwoo Lee +To: notmuch@notmuchmail.org +Subject: [PATCH] emacs: Add a defcustom that specifies regexp for blocked + remote images. +Date: Thu, 29 Jan 2015 09:28:47 -0800 +Message-Id: <1422552527-16889-1-git-send-email-jinwoo68@gmail.com> +X-Mailer: git-send-email 2.2.2 +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: Thu, 29 Jan 2015 17:29:31 -0000 + +It's default value is ".", meaning all remote images will be blocked +by default. +--- + emacs/notmuch-show.el | 14 ++++++++++---- + 1 file changed, 10 insertions(+), 4 deletions(-) + +diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el +index 66350d4..cc6aca9 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,10 +803,11 @@ 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) ++ (gnus-blocked-images notmuch-show-text/html-blocked-images)) + (shr-insert-document dom) + t)) + +-- +2.2.2 + -- 2.26.2