From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Trevor Murphy via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#43094: [PATCH] org-crypt.el: Fix encrypt/decrypt in presence of arbitrary drawers Date: Fri, 28 Aug 2020 14:35:09 -0700 Message-ID: Reply-To: Trevor Murphy Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="31790"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: mu4e 1.4.6; emacs 26.3 To: 43094@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri Aug 28 23:36:22 2020 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kBm2n-00088G-4q for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 28 Aug 2020 23:36:21 +0200 Original-Received: from localhost ([::1]:49824 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kBm2m-00022f-64 for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 28 Aug 2020 17:36:20 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:37776) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kBm2U-00021d-M0 for bug-gnu-emacs@gnu.org; Fri, 28 Aug 2020 17:36:04 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:36031) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kBm2U-0002t7-C4 for bug-gnu-emacs@gnu.org; Fri, 28 Aug 2020 17:36:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1kBm2U-0001Hz-8x for bug-gnu-emacs@gnu.org; Fri, 28 Aug 2020 17:36:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Trevor Murphy Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 28 Aug 2020 21:36:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 43094 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.15986505184900 (code B ref -1); Fri, 28 Aug 2020 21:36:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 28 Aug 2020 21:35:18 +0000 Original-Received: from localhost ([127.0.0.1]:47576 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kBm1m-0001Gw-2W for submit@debbugs.gnu.org; Fri, 28 Aug 2020 17:35:18 -0400 Original-Received: from lists.gnu.org ([209.51.188.17]:56938) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kBm1k-0001Gp-FR for submit@debbugs.gnu.org; Fri, 28 Aug 2020 17:35:17 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:37722) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kBm1k-0001aI-7J for bug-gnu-emacs@gnu.org; Fri, 28 Aug 2020 17:35:16 -0400 Original-Received: from mail-pl1-x642.google.com ([2607:f8b0:4864:20::642]:41062) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kBm1i-0002eS-7O for bug-gnu-emacs@gnu.org; Fri, 28 Aug 2020 17:35:15 -0400 Original-Received: by mail-pl1-x642.google.com with SMTP id 10so261270plg.8 for ; Fri, 28 Aug 2020 14:35:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=user-agent:from:to:subject:message-id:date:mime-version; bh=kDNPuBuVK14s73AQa+ro/dDy1kY28As+q9rCI2mWy1E=; b=JsSRKEKSr6Du+lYEfKW1FdrV0+v7e4Yrz9z5Hq0D6nt+ggdYxSq9yEzYvuo/IiaWZd PqJ7abTiByuCQycGNAp4r4XJmr2AqdL9jDUwF06/O5H5qa1oD7pPSwmmdqPcfLlam+K7 c3cbBmqSoU0zpMfyH/RZlEBRZq7XCb0xkDD0KfF7WKGLbicDNb32ZQLIdZS6re0V4EuM mlpxi4GYpUGgENZEAOp/xoN+/LjnAWOu7PfzIig2OdBIpxOprbzkyMyAKEZ/gbZ0gcp5 O9cNsfxuk2aWIQY7TuWyGzNalkul0RMGSKWUsIa1KjyS+zFTDlbP+uKIG5pfMD5tyrgb kc0w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:user-agent:from:to:subject:message-id:date :mime-version; bh=kDNPuBuVK14s73AQa+ro/dDy1kY28As+q9rCI2mWy1E=; b=Q8jTaVMFprATpifzc2EKvsFtclVfromMXE+2krrsVozifI9013wAhAnz7HhvhGPnKb +EIDRGVHB+qz2w7kChDxhx48vZFap8Op+yfmCMSgiCBQJKRbZ2cms5VC365c0LrGGTn/ Aonv45Ol1+x4KFAw9j/H+fzl5A30a6TOKMyhPH2uk8NSYnxUwy7QKbwiLNi5iC2+EUEx ybQP7KOOMwoUrl1rCtGD46O3Ohq+xAiui/Bi5P4y+1qH6VEFixXyTTxECf1W+SHJSfgc /+PXwV7Qmp8Iis5THGXMIS/a4DkgHSEai3e1Qg5AaY9QPqy8z58eVGklpdqA68RgNDl5 EJfA== X-Gm-Message-State: AOAM532R+XOaM7U31DkNqIILL0wvNtOlavwEErmN4BbaW9hhZ2DnivB7 WvNPPtYjt1S9VMJ7Mjt8gdBsx1AGR+7/RWIo X-Google-Smtp-Source: ABdhPJxG6v9qhpBDdpPm2CG2XoEdbY4V82V0SlPKxeWbVwtLpOJHm7B2H524V5xJTbkM0p3RDCApMQ== X-Received: by 2002:a17:90b:3891:: with SMTP id mu17mr786193pjb.160.1598650510616; Fri, 28 Aug 2020 14:35:10 -0700 (PDT) Original-Received: from trevormurphy-glaptop2 ([2601:1c1:8a80:1620::2342]) by smtp.gmail.com with ESMTPSA id i69sm363030pfe.131.2020.08.28.14.35.09 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 28 Aug 2020 14:35:09 -0700 (PDT) Received-SPF: pass client-ip=2607:f8b0:4864:20::642; envelope-from=trevormurphy@google.com; helo=mail-pl1-x642.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -175 X-Spam_score: -17.6 X-Spam_bar: ----------------- X-Spam_report: (-17.6 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_MED=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, ENV_AND_HDR_SPF_MATCH=-0.5, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, USER_IN_DEF_DKIM_WL=-7.5, USER_IN_DEF_SPF_WL=-7.5 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:186625 Archived-At: --=-=-= Content-Type: text/plain; format=flowed Hey, all. At https://ag91.github.io/blog/2020/08/28/org-crypt-and-logbook-how-they-can-work-together-for-a-secure-agenda/ a user described a problem where they: 1. encrypted an Org headline's contents 2. rescheduled the headline information, triggering a log note, triggering a new LOGBOOK drawer 3. attempted to decrypt the headline's contents with no success (`org-decrypt-entry' left the encrypted contents unchanged) In my follow up testing, I found that if a user calls `org-encrypt-entry' on a headline with a logbook, the logbook is encrypted (and hence any further logging activity will create a new logbook, triggering the bug above). Seems the problem is that encrypt / decrypt both use `org-end-of-meta-data' to skip to the headline contents, but they do not pass the `full' argument to skip *all* meta data. Tinychange patch attached. -- Trevor Murphy --=-=-= Content-Type: text/plain Content-Disposition: attachment; filename=0001-org-crypt.el-Fix-encrypt-decrypt-in-presence-of-arbi.patch Content-Description: 0001-org-crypt.el-Fix-encrypt-decrypt-in-presence-of-arbi.patch >From a501d4a5ebe629263cffb89e0a09b5a1cfe5c9f0 Mon Sep 17 00:00:00 2001 From: Trevor Murphy Date: Fri, 28 Aug 2020 13:42:38 -0700 Subject: [PATCH] org-crypt.el: Fix encrypt/decrypt in presence of arbitrary drawers * lisp/org/org-crypt.el (org-encrypt-entry, org-decrypt-entry): Skip _all_ meta data before looking for PGP content. TINYCHANGE --- lisp/org/org-crypt.el | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lisp/org/org-crypt.el b/lisp/org/org-crypt.el index 4b46a3145f..6f6b41047c 100644 --- a/lisp/org/org-crypt.el +++ b/lisp/org/org-crypt.el @@ -174,7 +174,7 @@ See `org-crypt-disable-auto-save'." (org-back-to-heading t) (setq-local epg-context (epg-make-context nil t t)) (let ((start-heading (point))) - (org-end-of-meta-data) + (org-end-of-meta-data t) (unless (looking-at-p "-----BEGIN PGP MESSAGE-----") (let ((folded (org-invisible-p)) (crypt-key (org-crypt-key-for-heading)) @@ -205,7 +205,7 @@ See `org-crypt-disable-auto-save'." (save-excursion (outline-end-of-heading) (org-invisible-p)))) - (org-end-of-meta-data) + (org-end-of-meta-data t) (when (looking-at "-----BEGIN PGP MESSAGE-----") (org-crypt-check-auto-save) (setq-local epg-context (epg-make-context nil t t)) -- 2.28.0.402.g5ffc5be6b7-goog --=-=-=--