Skip to content

Do not reset peerstate if the message is encrypted and signed with the current autocrypt key #3844

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
link2xt opened this issue Dec 13, 2022 · 3 comments
Assignees
Labels
enhancement New feature or request security

Comments

@link2xt
Copy link
Collaborator

link2xt commented Dec 13, 2022

#3778 allows to establish encrypted chat with Thunderbird by sending a message with an attached key from Thunderbird to Delta Chat. But if Thunderbird user then sends an encrypted and signed message without the attached key, Delta Chat will reset Autocrypt peerstate and send the next message unencrypted.

The proposal is to keep Autocrypt state if the message is Autocrypt-encrypted.

This requires changing mimeparser to postpone updating the peerstate until the message is decrypted, because currently we reset the peerstate immediately when we see that there is no Autocrypt header.

cc @iequidoo @hpk42 @missytake

@link2xt link2xt added enhancement New feature or request security labels Dec 13, 2022
@iequidoo iequidoo self-assigned this Dec 13, 2022
@iequidoo
Copy link
Collaborator

iequidoo commented Dec 13, 2022

The proposal is to keep Autocrypt state if the message is Autocrypt-encrypted.

I believe we should keep the Autocrypt (or encryption) state even if a message is just signed. In the scope of #3778 the encryption is enabled right upon on a receipt of message with a key attachment because in absence of capability of smth like "prefer-encrypt" attribute that's the best we can do (btw, it's worth checking that the message is signed with the attached key). So, i suggest keeping this logic for further communication. Moreover, consider the following scenario:

  • A user sends us a message with a key attachment.
  • And right after that sends another one like "Forgot to say...", just signed but w/o the key attached.

Obviously, we shouldn't reset the encryption state if this happens.

@link2xt
Copy link
Collaborator Author

link2xt commented Dec 13, 2022

Makes sense, also in groups when the user does not have keys of all recipients and can't encrypt because of this, the signature may be an indicator that the user wants to use OpenPGP nevertheless. Whether the message is encrypted or not does not matter then, we can always use the signature as a signal that user has the key and therefore will be able to decrypt our reply.

btw, it's worth checking that the message is signed with the attached key

True, maybe then #3778 logic can be merged with this one so that an attached key is stored as a key with nopreference, but if the message is signed with the current autocrypt key, we set encryption preference to mutual? If the public key is just attached, it does not necessarily mean that the user has a private key, but if the message is signed with this key, then we definitely know that the sender has access to the private key (assuming we only consider simple autocrypt keys, not setups where encryption and signature keys are different which OpenPGP allows).

iequidoo added a commit that referenced this issue Dec 15, 2022
…ted or signed with the current

autocrypt key (#3844)

Note that if the message is encrypted, we don't check whether it's signed with an attached key
currently, otherwise a massive refactoring of the code is needed because for encrypted messages a
signature is checked and discarded first now.
iequidoo added a commit that referenced this issue Dec 15, 2022
…ted or signed with the current

autocrypt key (#3844)

Note that if the message is encrypted, we don't check whether it's signed with an attached key
currently, otherwise a massive refactoring of the code is needed because for encrypted messages a
signature is checked and discarded first now.
iequidoo added a commit that referenced this issue Dec 15, 2022
…ted or signed with the current

autocrypt key (#3844)

Note that if the message is encrypted, we don't check whether it's signed with an attached key
currently, otherwise a massive refactoring of the code is needed because for encrypted messages a
signature is checked and discarded first now.
iequidoo added a commit that referenced this issue Dec 15, 2022
…ted or signed with the current

autocrypt key (#3844)

Note that if the message is encrypted, we don't check whether it's signed with an attached key
currently, otherwise a massive refactoring of the code is needed because for encrypted messages a
signature is checked and discarded first now.
iequidoo added a commit that referenced this issue Dec 17, 2022
…ted or signed with the current

autocrypt key (#3844)

Note that if the message is encrypted, we don't check whether it's signed with an attached key
currently, otherwise a massive refactoring of the code is needed because for encrypted messages a
signature is checked and discarded first now.
iequidoo added a commit that referenced this issue Dec 18, 2022
…ted or signed with the current

autocrypt key (#3844)

Note that if the message is encrypted, we don't check whether it's signed with an attached key
currently, otherwise a massive refactoring of the code is needed because for encrypted messages a
signature is checked and discarded first now.
iequidoo added a commit that referenced this issue Dec 18, 2022
…ted or signed with the current

autocrypt key (#3844)

Note that if the message is encrypted, we don't check whether it's signed with an attached key
currently, otherwise a massive refactoring of the code is needed because for encrypted messages a
signature is checked and discarded first now.
iequidoo added a commit that referenced this issue Dec 19, 2022
…with the known key (#3844)

Note that if the message is encrypted, we don't check whether it's signed with an attached key
currently, otherwise a massive refactoring of the code is needed because for encrypted messages a
signature is checked and discarded first now.
iequidoo added a commit that referenced this issue Dec 19, 2022
…with the known key (#3844)

Note that if the message is encrypted, we don't check whether it's signed with an attached key
currently, otherwise a massive refactoring of the code is needed because for encrypted messages a
signature is checked and discarded first now.
iequidoo added a commit that referenced this issue Dec 19, 2022
…with the known key (#3844)

Note that if the message is encrypted, we don't check whether it's signed with an attached key
currently, otherwise a massive refactoring of the code is needed because for encrypted messages a
signature is checked and discarded first now.
@iequidoo
Copy link
Collaborator

Done, but note that if the message is encrypted, we don't check whether it's signed with an attached key
currently, otherwise a refactoring of the code is needed because for encrypted messages a
signature is checked and discarded first currently. But i think we'll do the refactoring soon so that the code branches for encrypted and unencrypted messages are merged and all cases are covered

iequidoo added a commit that referenced this issue Dec 21, 2022
…ted (#3844)

This way we don't need a separate code path for signatures validation for unencrypted
messages. Also, now we degrade encryption only if there are no valid signatures, so the code for
upgrading encryption back isn't needed.
iequidoo added a commit that referenced this issue Dec 21, 2022
…ted (#3844)

This way we don't need a separate code path for signatures validation for unencrypted
messages. Also, now we degrade encryption only if there are no valid signatures, so the code for
upgrading encryption back isn't needed.
iequidoo added a commit that referenced this issue Dec 21, 2022
…ted (#3844)

This way we don't need a separate code path for signatures validation for unencrypted
messages. Also, now we degrade encryption only if there are no valid signatures, so the code for
upgrading encryption back isn't needed.
iequidoo added a commit that referenced this issue Dec 21, 2022
…ted (#3844)

This way we don't need a separate code path for signatures validation for unencrypted
messages. Also, now we degrade encryption only if there are no valid signatures, so the code for
upgrading encryption back isn't needed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request security
Projects
None yet
Development

No branches or pull requests

2 participants