diff options
author | Dylan Baker <dylan@pnwbakers.com> | 2018-03-12 15:25:29 -0700 |
---|---|---|
committer | Dylan Baker <dylan@pnwbakers.com> | 2018-03-12 15:25:29 -0700 |
commit | aadba603f877536ed0a1b0e12ede527baec98475 (patch) | |
tree | 85c89800cd093a8e1fa292a9e647368167060227 /alot/commands/envelope.py | |
parent | 9e2cd32ab0b7a1906c2cf47f594a70fcaf901502 (diff) |
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
Diffstat (limited to 'alot/commands/envelope.py')
-rw-r--r-- | alot/commands/envelope.py | 14 |
1 files changed, 14 insertions, 0 deletions
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() |