Skip to content

feat: prefer secure connections in server discovery fallback#281

Open
dongfengweixiao wants to merge 1 commit into
Enough-Software:mainfrom
dongfengweixiao:main
Open

feat: prefer secure connections in server discovery fallback#281
dongfengweixiao wants to merge 1 commit into
Enough-Software:mainfrom
dongfengweixiao:main

Conversation

@dongfengweixiao

Copy link
Copy Markdown

When discovering mail server settings, prefer secure (TLS) connections over non-secure ones for IMAP, POP, and SMTP protocols. Previously the code selected the first ready connection regardless of security status, which could result in preferring a plaintext connection even when a secure alternative was available.

bug log:

┌───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
│ #0   AppLifecycle.build (package:enough_mail_app/src/app_lifecycle/provider.dart:40:12)
│ #1   NotifierProviderImpl.runNotifierBuild (package:riverpod/src/notifier/base.dart:166:38)
├┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄
│ 🐛 emitting non-ignored state: AppLifecycleState.resumed
└───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
discover settings for user@example.com
Discover: trying https://autoconfig.example.com/mail/config-v1.1.xml?emailaddress=user@example.com
┌───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
│ #0   EnoughMailApp.build.<anonymous closure> (package:enough_mail_app/src/app.dart:49:14)
│ #1   __AppLifecycleStateState.didChangeAppLifecycleState (package:flutter_hooks/src/widgets_binding_observer.dart:59:26)
├┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄
│ 🐛 raw AppLifecycleState changed from AppLifecycleState.resumed to AppLifecycleState.inactive
└───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
┌───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
│ #0   AppLifecycle.build (package:enough_mail_app/src/app_lifecycle/provider.dart:40:12)
│ #1   NotifierProviderImpl.runNotifierBuild (package:riverpod/src/notifier/base.dart:166:38)
├┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄
│ 🐛 emitting non-ignored state: AppLifecycleState.inactive
└───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
Discover: trying http://autoconfig.example.com/mail/config-v1.1.xml?emailaddress=user@example.com
mxDomain for [example.com] is [example.org]
Discover: trying https://autoconfig.example.org/mail/config-v1.1.xml?emailaddress=user@example.com
┌───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
│ #0   EnoughMailApp.build.<anonymous closure> (package:enough_mail_app/src/app.dart:49:14)
│ #1   __AppLifecycleStateState.didChangeAppLifecycleState (package:flutter_hooks/src/widgets_binding_observer.dart:59:26)
├┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄
│ 🐛 raw AppLifecycleState changed from AppLifecycleState.inactive to AppLifecycleState.resumed
└───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
┌───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
│ #0   AppLifecycle.build (package:enough_mail_app/src/app_lifecycle/provider.dart:40:12)
│ #1   NotifierProviderImpl.runNotifierBuild (package:riverpod/src/notifier/base.dart:166:38)
├┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄
│ 🐛 emitting non-ignored state: AppLifecycleState.resumed
└───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
Discover: trying http://autoconfig.example.org/mail/config-v1.1.xml?emailaddress=user@example.com
Discover: trying https://autoconfig.thunderbird.net/v1.1/example.com
Discover: trying https://autoconfig.thunderbird.net/v1.1/example.org
success at mail.example.org:143
success at mail.example.org:110
success at mail.example.com:110
success at mail.example.com:143
failed at imap.example.com:993
failed at imap.example.com:143
failed at imap.example.com:995
failed at imap.example.com:110
success at pop.example.org:143
success at pop.example.org:110
success at smtp.example.org:587
success at smtp.example.org:25
failed at out.example.com:465
failed at out.example.com:587
failed at out.example.com:25
failed at imap.example.org:993
failed at imap.example.org:143
failed at imap.example.org:995
failed at imap.example.org:110
failed at out.example.org:465
failed at out.example.org:587
failed at out.example.org:25
failed at mail.example.com:993
failed at pop.example.org:995
failed at smtp.example.org:465
success at mail.example.org:993
failed at mail.example.com:995
failed at pop.example.org:993
success at mail.example.org:995
failed at in.example.com:993
failed at in.example.com:143
failed at in.example.com:995
failed at in.example.com:110
failed at pop.example.com:993
failed at pop.example.com:143
failed at pop.example.com:995
failed at pop.example.com:110
failed at smtp.example.com:465
failed at smtp.example.com:587
failed at smtp.example.com:25
failed at in.example.org:993
failed at in.example.org:143
failed at in.example.org:995
failed at in.example.org:110

found mail server for example.com:
incoming: mail.example.com:143 (ServerType.imap)
outgoing: smtp.example.org:587 (ServerType.smtp)
done discovering settings: example.com

When discovering mail server settings, prefer secure (TLS) connections
over non-secure ones for IMAP, POP, and SMTP protocols. Previously the
code selected the first ready connection regardless of security status,
which could result in preferring a plaintext connection even when a
secure alternative was available.

Signed-off-by: Dee HY <dongfengweixiao@hotmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant