deltachat / deltachat-ios

Email-based instant messaging for iOS.
GNU General Public License v3.0
314 stars 49 forks source link

support `mailto:` links inside html messages #1724

Closed r10s closed 1 year ago

r10s commented 1 year ago

this is needed for bots, however, also useful in general.

cyBerta commented 1 year ago

I've been using the testWebxdc and generally, mailto: links are supported. However we always ask the user if we want to create a chat with >contact<. If a chat with the contact already exists, that one will be reused, if not the chat will be created. Not sure what the expectation is here: do we need to adapt the alert, asking to write to >contact< instead of asking to create a chat if that already exists? Or do we want just always allow to send messages to a contact if a chat already exists with it and only ask to create a chat if there's no one yet existing?

@Simon-Laux @r10s Has there been other bugs reported related to mailto: links in webxdc? Like lack of support for mutiple reciepients or so? Is that sth. we want to support at all?

r10s commented 1 year ago

afair, this is not about webxdc but just about normal html-mails.

cyBerta commented 1 year ago

ok, right, this is only implemented for webxdc right now. Thanks.

cyBerta commented 1 year ago

Shall we (a) always show the alert asking to create a chat with >contact< just as we do it right now, (b) ask to write to a contact (new string involved) in case a chat already exists, or (c) omit the alert in that case?

cyBerta commented 1 year ago

since I already added a comment in the code about it: what about tel://?

r10s commented 1 year ago

i think, we do not need an alert at all.

this is what we are doing on desktop (just tested) and android (iirc).

so, i suggest to remove the alert for the bubbles and do not add it for the html-view.

since I already added a comment in the code about it: what about tel://?

would be great if that works in html-view the same way as for bubbles. however, as this part is not needed for bots, this is also less important. but if we can do that while on that area, that'd be great, sure.

cyBerta commented 1 year ago

I now remember why we added the alert: it was ment as a countermeasure against phishing attempts. The mailto links can be "forged", by e.g. showing a different address than the actual one that the user is going to write to. The Alert parses the link and shows the email address which will be used as receiver.

Having that in mind I think (c) would be a better compromise. The user has to accept the address only once and only if the contact is not already part of the known contacts.

r10s commented 1 year ago

The mailto links can be "forged", by e.g. showing a different address than the actual one that the user is going to write to

but how can a mailto link be forged in the bubbles?

for the new html-view, this may be an issue, but not sure for the existing bubbles where the shown plaintext is what is opened. but even if a different link is opened: the real address will be shown in the chat, not sure if the user would read an additional alert more carefully.

but yes, to move forward, maybe do to the same as in bubbles, so show the existing dialog.

cyBerta commented 1 year ago

but how can a mailto link be forged in the bubbles?

That cannot be done. DC will only use the displayed text, not the underlying email address that might be different from what is shown. The forgery is only related to html emails and thus the change I've implemented here is also only focussing on Webviews.