summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoranonym <anonym@riseup.net>2019-02-27 10:59:33 +0100
committeranonym <anonym@riseup.net>2019-02-27 16:29:07 +0100
commit619c17e0dc3d1cbfdf3859b18c9e71ec00694f9c (patch)
tree84fc056369cfbf4feda7f027e5984cdc28af5e59
parent262f0bc5f69a57d9dc07e0e4ee9ff3d5528a450a (diff)
Add pref for whether to accept plaintext protocols during autoconfiguration.secure_account_creation-66.0_b1
Let's make it possible for security-focused distributions (and extensions like TorBirdy) to prevent insecure configurations to ever be displayed to users; for other users there is a warning explaining the consequences of accepting a non-SSL configuration.
-rw-r--r--comm/mail/components/accountcreation/content/guessConfig.js3
-rw-r--r--comm/mail/components/accountcreation/content/readFromXML.js10
-rw-r--r--comm/mailnews/mailnews.js6
3 files changed, 19 insertions, 0 deletions
diff --git a/comm/mail/components/accountcreation/content/guessConfig.js b/comm/mail/components/accountcreation/content/guessConfig.js
index 81c0e61..e194e58 100644
--- a/comm/mail/components/accountcreation/content/guessConfig.js
+++ b/comm/mail/components/accountcreation/content/guessConfig.js
@@ -385,6 +385,7 @@ HostDetector.prototype = {
{ "imap": IMAP, "pop3": POP, "smtp": SMTP }, UNKNOWN);
if (!port)
port = UNKNOWN;
+ var ssl_only = Services.prefs.getBoolPref("mailnews.auto_config.ssl_only_mail_servers");
var ssl = ConvertSocketTypeToSSL(socketType);
this._cancel = false;
this._log.info("doing auto detect for protocol " + protocol +
@@ -406,6 +407,8 @@ HostDetector.prototype = {
let hostEntries = this._portsToTry(hostname, protocol, ssl, port);
for (let j = 0; j < hostEntries.length; j++) {
let hostTry = hostEntries[j]; // from getHostEntry()
+ if (ssl_only && hostTry.ssl == NONE)
+ continue;
hostTry.hostname = hostname;
hostTry.status = kNotTried;
hostTry.desc = hostTry.hostname + ":" + hostTry.port +
diff --git a/comm/mail/components/accountcreation/content/readFromXML.js b/comm/mail/components/accountcreation/content/readFromXML.js
index ca54ff4..793ff10 100644
--- a/comm/mail/components/accountcreation/content/readFromXML.js
+++ b/comm/mail/components/accountcreation/content/readFromXML.js
@@ -29,6 +29,8 @@ function readFromXML(clientConfigXML) {
}
var allow_oauth2 =
Services.prefs.getBoolPref("mailnews.auto_config.account_constraints.allow_oauth2");
+ var ssl_only =
+ Services.prefs.getBoolPref("mailnews.auto_config.ssl_only_mail_servers");
var exception;
if (typeof(clientConfigXML) != "object" ||
!("clientConfig" in clientConfigXML) ||
@@ -88,6 +90,10 @@ function readFromXML(clientConfigXML) {
throw exception ? exception : "need proper <socketType> in XML";
exception = null;
+ if (ssl_only && iO.socketType == 1) {
+ continue;
+ }
+
for (let iXauth of array_or_undef(iX.$authentication)) {
try {
iO.auth = sanitize.translate(iXauth,
@@ -168,6 +174,10 @@ function readFromXML(clientConfigXML) {
throw exception ? exception : "need proper <socketType> in XML";
exception = null;
+ if (ssl_only && oO.socketType == 1) {
+ continue;
+ }
+
for (let oXauth of array_or_undef(oX.$authentication)) {
try {
oO.auth = sanitize.translate(oXauth,
diff --git a/comm/mailnews/mailnews.js b/comm/mailnews/mailnews.js
index 7f2d235..e703b47 100644
--- a/comm/mailnews/mailnews.js
+++ b/comm/mailnews/mailnews.js
@@ -925,6 +925,12 @@ pref("mailnews.auto_config.guess.enabled", true);
pref("mailnews.auto_config.guess.timeout", 10);
// Whether we allow fetched configurations using OAuth2.
pref("mailnews.auto_config.account_constraints.allow_oauth2", true);
+// Whether we allow fetched account configurations that employs
+// non-SSL/TLS protocols. With this option set, insecure
+// configurations are never presented to the user; with this option
+// unset, users picking an insecure configuration will get a warning
+// and have to opt-in.
+pref("mailnews.auto_config.ssl_only_mail_servers", false);
// Work around bug 1454325 by disabling mimetype mungling in XmlHttpRequest
pref("dom.xhr.standard_content_type_normalization", false);