From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by arlo.cworth.org (Postfix) with ESMTP id 4E54F6DE0C51 for ; Mon, 11 Dec 2017 18:52:36 -0800 (PST) X-Virus-Scanned: Debian amavisd-new at cworth.org X-Spam-Flag: NO X-Spam-Score: -0.028 X-Spam-Level: X-Spam-Status: No, score=-0.028 tagged_above=-999 required=5 tests=[AWL=-0.028] autolearn=disabled Received: from arlo.cworth.org ([127.0.0.1]) by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 58njlyVcpmk2 for ; Mon, 11 Dec 2017 18:52:35 -0800 (PST) Received: from che.mayfirst.org (che.mayfirst.org [162.247.75.118]) by arlo.cworth.org (Postfix) with ESMTPS id 638946DE0941 for ; Mon, 11 Dec 2017 18:52:34 -0800 (PST) Received: from fifthhorseman.net (unknown [38.109.115.130]) by che.mayfirst.org (Postfix) with ESMTPSA id 290BDF99F for ; Mon, 11 Dec 2017 21:52:33 -0500 (EST) Received: by fifthhorseman.net (Postfix, from userid 1000) id D9B8820364; Mon, 11 Dec 2017 21:52:27 -0500 (EST) From: Daniel Kahn Gillmor To: Notmuch Mail Subject: notmuch show --decrypt=stash Date: Mon, 11 Dec 2017 21:52:20 -0500 Message-Id: <20171212025225.11854-1-dkg@fifthhorseman.net> X-Mailer: git-send-email 2.15.1 X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.23 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: Tue, 12 Dec 2017 02:52:36 -0000 This series allows "notmuch show" to index the cleartext and stash the session keys of an encrypted message while displaying it. Because it uses a keyword argument to --decrypt for "notmuch show", It needs to be applied *after* the series with the subject: Encourage explicit arguments for --decrypt in "show" and "reply" Background ---------- The cleartext indexing and session-keys series make working with encrypted e-mail significantly easier in notmuch. However, their underlying assumption is that at the time of message ingestion (and "notmuch new" in particular), the user is likely to have access to their long-term secret keys. In practice, many people using GnuPG today have their secret keys locked behind a passphrase, or on a smartcard, and also run "notmuch new" in some sort of scheduled, backgrounded process. The result is that for users with this workflow, GnuPG prompts for their passphrase (or to trigger their smartcard) at unpredictable times, depending on when their mail delivery happens, and on how many encrypted messages they receive. This is both unfriendly and bad for security (we should not train users to approve random prompts for secret key access when nothing they're doing interactively seems to warrant it). Outline ------- For a friendlier experience, some users may prefer incoming encrypted mail to stay in their inbox *without* being decrypted, until they choose to look at it. At the moment that they're looking at it, their MUA is in the foreground and they're interacting with it, so being prompted for their password or smartcard interactively makes sense at that time. This series makes it possible for this interaction to to actually decrypt the message, index it, and stash any session keys the first time the user interacts with the message through "notmuch show". This is not a workflow that every MUA will choose to use (e.g. users whose decryption-capable secret key is already cheaply available without hassling the user at "notmuch new" shouldn't use it), but it is a sensible workflow for some users that notmuch should support. Furthermore, it is a more efficient use of secret key material -- a user that wants to stash session keys of a message, but whose long-term decryption secret key is on a smartcard should only be obliged to trigger the smartcard once per message, ever. Implementation details ---------------------- The most controversial part of this series is that it makes "notmuch show" potentially not a read-only operation on the database. This is a tradeoff that the users of this workflow will need to consider, since they are explicitly asking "notmuch show" to potentially modify their index. Note that i've made this R/O-to-R/W switch fairly coarse. If the user requests --decrypt=stash, then "notmuch show" will operate on a read/write database, regardless of whether the message is actually encrypted. I used this coarse approach because i couldn't figure out a safe way to reopen an existing read-only database in read-write mode. If someone more clever with Xapian than me wants to suggest a way to do this in a more fine-grained fashion, i'd welcome patches or pointers. I welcome review and feedback. --dkg