From aadba603f877536ed0a1b0e12ede527baec98475 Mon Sep 17 00:00:00 2001 From: Dylan Baker Date: Mon, 12 Mar 2018 15:25:29 -0700 Subject: envelope: Update encryption keys when CC, To, or From is changed Currently the encryption keys will only be updated when they are toggled, which means that if you change a Cc or To then the keys encrypted to might be wrong, either too many keys will be encrypted to, or not enough, or just the wrong ones. This patches fixes this by calling set_encrypt whenever the 'To', 'Cc', or 'From' headers are changed by set or unset. Fixes #1227 --- alot/commands/envelope.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'alot/commands/envelope.py') diff --git a/alot/commands/envelope.py b/alot/commands/envelope.py index 0aa95cf2..54601422 100644 --- a/alot/commands/envelope.py +++ b/alot/commands/envelope.py @@ -418,12 +418,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() @@ -439,8 +446,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() -- cgit v1.2.3