unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#43094: [PATCH] org-crypt.el: Fix encrypt/decrypt in presence of arbitrary drawers
@ 2020-08-28 21:35 Trevor Murphy via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2020-09-06  8:07 ` Bastien
  0 siblings, 1 reply; 2+ messages in thread
From: Trevor Murphy via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2020-08-28 21:35 UTC (permalink / raw)
  To: 43094

[-- Attachment #1: Type: text/plain, Size: 890 bytes --]

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


[-- Attachment #2: 0001-org-crypt.el-Fix-encrypt-decrypt-in-presence-of-arbi.patch --]
[-- Type: text/plain, Size: 1371 bytes --]

From a501d4a5ebe629263cffb89e0a09b5a1cfe5c9f0 Mon Sep 17 00:00:00 2001
From: Trevor Murphy <trevormurphy@google.com>
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


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* bug#43094: [PATCH] org-crypt.el: Fix encrypt/decrypt in presence of arbitrary drawers
  2020-08-28 21:35 bug#43094: [PATCH] org-crypt.el: Fix encrypt/decrypt in presence of arbitrary drawers Trevor Murphy via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2020-09-06  8:07 ` Bastien
  0 siblings, 0 replies; 2+ messages in thread
From: Bastien @ 2020-09-06  8:07 UTC (permalink / raw)
  To: 43094; +Cc: Trevor Murphy, 43094-done

Hi Trevor,

thanks for the patch.  I applied it on Org master branch as 1170e39be,
the fix will be in 9.3.8 and 9.4.

Best,

-- 
 Bastien





^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-09-06  8:07 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-28 21:35 bug#43094: [PATCH] org-crypt.el: Fix encrypt/decrypt in presence of arbitrary drawers Trevor Murphy via Bug reports for GNU Emacs, the Swiss army knife of text editors
2020-09-06  8:07 ` Bastien

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).