mirror of
https://github.com/Foundry376/Mailspring.git
synced 2025-09-08 13:44:53 +08:00
[iso-core] Allow self-signed certificates in IMAP connections to non-major providers
Summary: Unfortunately, many IMAP hosts outside the major ones do not have certificates issued by a certificate authority, and it is very confusing to folks to have their account auth not work. This patch relaxes our certificate requirements for IMAP hosts outside the major providers. It's cool that node 6 has secure TLS settings by default! Fixes: T7673 Test Plan: manual Reviewers: mark, juan Reviewed By: juan Differential Revision: https://phab.nylas.com/D3771
This commit is contained in:
parent
d0bbb1663e
commit
6f25c1de34
2 changed files with 21 additions and 8 deletions
|
@ -5,6 +5,7 @@
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"imap": "0.8.18",
|
"imap": "0.8.18",
|
||||||
|
"imap-provider-settings": "nylas/imap-provider-settings",
|
||||||
"joi": "8.4.2",
|
"joi": "8.4.2",
|
||||||
"nodemailer": "2.5.0",
|
"nodemailer": "2.5.0",
|
||||||
"promise-props": "1.0.0",
|
"promise-props": "1.0.0",
|
||||||
|
|
|
@ -1,16 +1,25 @@
|
||||||
const Imap = require('imap');
|
import Imap from 'imap';
|
||||||
const _ = require('underscore');
|
import _ from 'underscore';
|
||||||
const xoauth2 = require('xoauth2');
|
import xoauth2 from 'xoauth2';
|
||||||
const EventEmitter = require('events');
|
import EventEmitter from 'events';
|
||||||
|
|
||||||
const PromiseUtils = require('./promise-utils')
|
import CommonProviderSettings from 'imap-provider-settings';
|
||||||
const IMAPBox = require('./imap-box');
|
|
||||||
const {
|
import PromiseUtils from './promise-utils';
|
||||||
|
import IMAPBox from './imap-box';
|
||||||
|
|
||||||
|
import {
|
||||||
convertImapError,
|
convertImapError,
|
||||||
IMAPConnectionTimeoutError,
|
IMAPConnectionTimeoutError,
|
||||||
IMAPConnectionNotReadyError,
|
IMAPConnectionNotReadyError,
|
||||||
IMAPConnectionEndedError,
|
IMAPConnectionEndedError,
|
||||||
} = require('./imap-errors');
|
} from './imap-errors';
|
||||||
|
|
||||||
|
const MAJOR_IMAP_PROVIDER_HOSTS = Object.keys(CommonProviderSettings).reduce(
|
||||||
|
(hostnameSet, key) => {
|
||||||
|
hostnameSet.add(CommonProviderSettings[key].imap_host);
|
||||||
|
return hostnameSet;
|
||||||
|
}, new Set())
|
||||||
|
|
||||||
const Capabilities = {
|
const Capabilities = {
|
||||||
Gmail: 'X-GM-EXT-1',
|
Gmail: 'X-GM-EXT-1',
|
||||||
|
@ -87,6 +96,9 @@ class IMAPConnection extends EventEmitter {
|
||||||
socketTimeout: this._settings.socketTimeout || SOCKET_TIMEOUT_MS,
|
socketTimeout: this._settings.socketTimeout || SOCKET_TIMEOUT_MS,
|
||||||
authTimeout: this._settings.authTimeout || AUTH_TIMEOUT_MS,
|
authTimeout: this._settings.authTimeout || AUTH_TIMEOUT_MS,
|
||||||
}
|
}
|
||||||
|
if (!MAJOR_IMAP_PROVIDER_HOSTS.has(result.host)) {
|
||||||
|
result.tlsOptions = { rejectUnauthorized: false };
|
||||||
|
}
|
||||||
|
|
||||||
if (process.env.NYLAS_DEBUG) {
|
if (process.env.NYLAS_DEBUG) {
|
||||||
result.debug = console.log;
|
result.debug = console.log;
|
Loading…
Add table
Reference in a new issue