emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Off-topic: *.gpg files and EasyPG
@ 2011-12-30 14:26 Ramon Diaz-Uriarte
  0 siblings, 0 replies; only message in thread
From: Ramon Diaz-Uriarte @ 2011-12-30 14:26 UTC (permalink / raw)
  To: Emacs-orgmode


Dear All,

Apologies if this is totally off-topic, but I think many people use
org-mode + EasyPG to encrypt *.org.gpg files, and I could not think of a
more knowledgeable list than this one ;-).



* Summary:

  If an encrypted buffer is killed right when it is being opened (when you
  just typed the password), the contents of the encrypted buffer are left,
  as plain text, in other buffer(s).



* Details:

  I routinely use org mode with EasyPG. Yesterday, after realizing that
  sometimes I leave a gpg buffer open for longer than I should, I figured
  I'd set a timer so that any buffers that end with *.gpg are killed
  periodically.


  This seems to work OK, except if the buffer is killed right at the
  moment when it is being visited; i.e., right after you have entered the
  password.


  If that happens, the contents of the encrypted file are left, as plain
  text, in one of the other buffers (often *Scratch* or *Messages*, if
  those exist, or some other buffer, and oftentimes one which is not
  currently visible).



** Reproducible example

1.    I have the following code in my .emacs:
-----------
;; from 
;; http://stackoverflow.com/questions/5097561/killing-buffers-whose-names-start-with-a-particular-string

(require 'cl)

(defun is-killable-buffer (buffer)
  (let ((name (buffer-name buffer)))
    (string-match ".*\\.gpg$" name)))

(defun kill-killable-buffers ()
  (loop for buffer being the buffers
        do (and (is-killable-buffer buffer) (kill-buffer buffer))))

(run-at-time t 120 'kill-killable-buffers)
-------------

2. Now, create a *.gpg file, put something in there, and save it so symmetric encryption is used.


3. Change the interval when kill-killable-buffers runs. Set it at 1:

(run-at-time t 1 'kill-killable-buffers)

and evaluate the expression.


4. Try to visit the gpg file. As soon as you enter the password, the
buffer is killed. So you never see it being opened. You do see the message

Wrong type argument: stringp, nil

But the contents, as decrypted, plain text, will be left in one of your
other buffers; might be *Messages* or *Scratch* or *ESS* if you have it,
but it could also be any other buffer you are visiting. 

If the contents end in another buffer you are visiting (say, buffer
"abc.txt"), and you do not notice what happened, when you save abc.txt
all the contents of the encrypted file end up in a plain text file.



** Questions.

1. Is this the way it should be? In particular, dumping the unencrypted
content on another, "normal" buffer, seems worrisome.


2. Suppose the contents end up in *Scratch* or *Messages*. How serious a
problem is this? Of course, if anybody has physical access to the machine
while you are not there that is a problem. But I understand that the
content of those buffers is never saved? And it cannot be accessed
remotely?


The reason for question 2. is that if those are not worrisome, then it
might make sense to use the approach of having a timer to kill the gpg
buffers periodically, and have it run in an emacs process that is
dedicated, exclusively, to opening the gpg file(s).




Best,



-- 
Ramon Diaz-Uriarte
Department of Biochemistry, Lab B-25.
Facultad de Medicina (UAM)
Arzobispo Morcillo, 4
28029 Madrid
Spain

Phone: +34-91-497-2412

Email: rdiaz02@gmail.com
       ramon.diaz@iib.uam.es

http://ligarto.org/rdiaz

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2011-12-30 14:27 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-12-30 14:26 Off-topic: *.gpg files and EasyPG Ramon Diaz-Uriarte

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

	https://git.savannah.gnu.org/cgit/emacs/org-mode.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).