-
-
Notifications
You must be signed in to change notification settings - Fork 85
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
fix: Create new Peerstate for unencrypted message with already known Autocrypt key, but a new address #5269
Conversation
Could you rebase it and test with #5274 merged? vc-request cannot do AEAP because it is not encrypted. It was only encrypted due to a bug. |
It still doesn't work. Apparently AEAP doesn't happen, but a Peerstate isn't created for the new address and that should be fixed. So, instead of looking at the SecureJoin message type, we should check if the message is encrypted. |
Finally i think that relying on encryption here is not right. |
dfadffb
to
9ea7e74
Compare
47332cf
to
8b8e957
Compare
I still don't understand why vc-request is special. What if it is a vg-request? What if first message coming from a new address uses existing key, will it also fail to create peerstate? @adbenitez has scanned a QR code and sent vc-request's, but if just a "hello!" text message is sent, will it fail the same way? |
I thought it's a good heuristic because vc-request means that it's a new contact, not the existing one changed its address. But not only vc-request means that, you're right. We should check if a message is encrypted. And do AEAP only if the message is encrypted + signed with a verified key. Otherwise a new peerstate must be created, but we must make sure that this doesn't break the possibility of a further AEAP because this may be an attack if the message isn't signed.
It won't work the same way.
Yes.
Almost. The difference is that Alice will answer unencrypted because a new peerstate isn't created. But anyway this is wrong. So, the solution is either do AEAP or create a new peerstate, there is no third option. |
8b8e957
to
4ef9394
Compare
2767b18
to
007dcd3
Compare
007dcd3
to
c72d668
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Phew, quite a complicated-to-fix bug, thanks for digging in!
Off-topic
FWIW right now both AEAP and DKIM-checking don't really seem to be worth the complexity, maybe we can make it work nicely or maybe we can think about removing it. Nothing for now, though.
For context, AEAP was an NLnet-funded project, but it turned out to be harder to implement securely than thought. DKIM-checking was one of the attempts to implement it securely.
With AEAP it is unclear what should happen if we have two contacts with the same key in a verified group and then someone writes to this group with the same key from a third address. Do we remove all contacts and replace with a single one? Currently I think Delta Chat will only AEAP-port one of them arbitrarily selected. |
Yes, but not arbitrarily selected -- the recently appeared one. Anyway this looks strange, yes. But i decided not to change this right now. Probably removing all old contacts should be done, need to think a little of it and fix in a separate PR. |
c72d668
to
d75b337
Compare
d75b337
to
3ef4994
Compare
3ef4994
to
97fff68
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ta-Daaaaa, one bug less!
97fff68
to
7be7feb
Compare
…Autocrypt key, but a new address An unencrypted message with already known Autocrypt key, but sent from another address, means that it's rather a new contact sharing the same key than the existing one changed its address, otherwise it would already have our key to encrypt.
There's the `UNIQUE (acpeerstates.addr)` constraint since db v94.
7be7feb
to
106cf59
Compare
Finally i think that in such a case it's better not to port any contact at all. We don't know which one to port. If we port both (i.e. replace them with the new one), then it's a question why they both exist before (probably because the key is shared). Sharing a key isn't a common scenario, if we want AEAP to work in this case too, we better add an additional attribute to the Autocrypt header, smth like So, for now i suggest to avoid doing AEAP if the key is shared. |
See commit messages.
This is aimed to solve the @adbenitez's problem with sharing the same key by several accounts.