summaryrefslogtreecommitdiff
path: root/alot/commands
diff options
context:
space:
mode:
authorPatrick Totzke <patricktotzke@gmail.com>2018-06-19 22:48:03 +0100
committerGitHub <noreply@github.com>2018-06-19 22:48:03 +0100
commitc30afc72150e30770da6fc1e5f6e68dce2b9a6bb (patch)
tree6e574a7f79b97c444f8a684ac17da0d45863025e /alot/commands
parentc86623d9c7daaa2f9a832135a11870a0d91110a3 (diff)
parentaadba603f877536ed0a1b0e12ede527baec98475 (diff)
Merge pull request #1228 from dcbaker/auto-encrypt-new
envelope: Update encryption keys when CC, To, or From is changed
Diffstat (limited to 'alot/commands')
-rw-r--r--alot/commands/envelope.py14
-rw-r--r--alot/commands/utils.py2
2 files changed, 15 insertions, 1 deletions
diff --git a/alot/commands/envelope.py b/alot/commands/envelope.py
index cbff2808..535ce06c 100644
--- a/alot/commands/envelope.py
+++ b/alot/commands/envelope.py
@@ -416,12 +416,19 @@ class SetCommand(Command):
self.reset = not append
Command.__init__(self, **kwargs)
+ @inlineCallbacks
def apply(self, ui):
envelope = ui.current_buffer.envelope
if self.reset:
if self.key in envelope:
del envelope[self.key]
envelope.add(self.key, self.value)
+ # FIXME: handle BCC as well
+ # Currently we don't handle bcc because it creates a side channel leak,
+ # as the key of the person BCC'd will be available to other recievers,
+ # defeating the purpose of BCCing them
+ if self.key.lower() in ['to', 'from', 'cc']:
+ yield utils.set_encrypt(ui, ui.current_buffer.envelope)
ui.current_buffer.rebuild()
@@ -437,8 +444,15 @@ class UnsetCommand(Command):
self.key = key
Command.__init__(self, **kwargs)
+ @inlineCallbacks
def apply(self, ui):
del ui.current_buffer.envelope[self.key]
+ # FIXME: handle BCC as well
+ # Currently we don't handle bcc because it creates a side channel leak,
+ # as the key of the person BCC'd will be available to other recievers,
+ # defeating the purpose of BCCing them
+ if self.key.lower() in ['to', 'from', 'cc']:
+ yield utils.set_encrypt(ui, ui.current_buffer.envelope)
ui.current_buffer.rebuild()
diff --git a/alot/commands/utils.py b/alot/commands/utils.py
index 2e6b64e6..891f8e37 100644
--- a/alot/commands/utils.py
+++ b/alot/commands/utils.py
@@ -44,7 +44,7 @@ def set_encrypt(ui, envelope, block_error=False, signed_only=False):
keys = yield _get_keys(ui, encrypt_keys, block_error=block_error,
signed_only=signed_only)
if keys:
- envelope.encrypt_keys.update(keys)
+ envelope.encrypt_keys = keys
envelope.encrypt = True
if 'From' in envelope.headers: