mailauth 4.4.1 → 4.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/bimi/index.js +12 -1
- package/lib/mta-sts.js +12 -1
- package/package.json +2 -2
package/lib/bimi/index.js
CHANGED
|
@@ -14,6 +14,8 @@ const http = require('http');
|
|
|
14
14
|
const { vmc } = require('@postalsys/vmc');
|
|
15
15
|
const { validateSvg } = require('./validate-svg');
|
|
16
16
|
|
|
17
|
+
const HTTP_REQUEST_TIMEOUT = 15 * 1000;
|
|
18
|
+
|
|
17
19
|
const lookup = async data => {
|
|
18
20
|
let { dmarc, headers, resolver, bimiWithAlignedDkim } = data;
|
|
19
21
|
let headerRows = (headers && headers.parsed) || [];
|
|
@@ -197,7 +199,9 @@ const downloadPromise = (url, cachedFile) => {
|
|
|
197
199
|
port: 443,
|
|
198
200
|
path: parsedUrl.pathname,
|
|
199
201
|
method: 'GET',
|
|
200
|
-
rejectUnauthorized: true
|
|
202
|
+
rejectUnauthorized: true,
|
|
203
|
+
|
|
204
|
+
timeout: HTTP_REQUEST_TIMEOUT
|
|
201
205
|
};
|
|
202
206
|
|
|
203
207
|
return new Promise((resolve, reject) => {
|
|
@@ -240,6 +244,13 @@ const downloadPromise = (url, cachedFile) => {
|
|
|
240
244
|
res.on('error', err => reject(err));
|
|
241
245
|
});
|
|
242
246
|
|
|
247
|
+
req.on('timeout', () => {
|
|
248
|
+
req.destroy(); // cancel request
|
|
249
|
+
let error = new Error(`Request timeout for ${parsedUrl.href}`);
|
|
250
|
+
error.code = 'HTTP_SOCKET_TIMEOUT';
|
|
251
|
+
reject(error);
|
|
252
|
+
});
|
|
253
|
+
|
|
243
254
|
req.on('error', err => {
|
|
244
255
|
reject(err);
|
|
245
256
|
});
|
package/lib/mta-sts.js
CHANGED
|
@@ -5,6 +5,8 @@ const dns = require('dns');
|
|
|
5
5
|
const parseDkimHeaders = require('./parse-dkim-headers');
|
|
6
6
|
const https = require('https');
|
|
7
7
|
|
|
8
|
+
const HTTP_REQUEST_TIMEOUT = 15 * 1000;
|
|
9
|
+
|
|
8
10
|
/**
|
|
9
11
|
* Resolve MTA-STS policy ID
|
|
10
12
|
* @param {String} address Either email address or a domain name
|
|
@@ -247,7 +249,9 @@ const fetchPolicy = async (domain, opts) => {
|
|
|
247
249
|
port: 443,
|
|
248
250
|
path,
|
|
249
251
|
method: 'GET',
|
|
250
|
-
rejectUnauthorized: true
|
|
252
|
+
rejectUnauthorized: true,
|
|
253
|
+
|
|
254
|
+
timeout: HTTP_REQUEST_TIMEOUT
|
|
251
255
|
};
|
|
252
256
|
|
|
253
257
|
let data = await new Promise((resolve, reject) => {
|
|
@@ -273,6 +277,13 @@ const fetchPolicy = async (domain, opts) => {
|
|
|
273
277
|
res.on('error', err => reject(err));
|
|
274
278
|
});
|
|
275
279
|
|
|
280
|
+
req.on('timeout', () => {
|
|
281
|
+
req.destroy(); // cancel request
|
|
282
|
+
let error = new Error(`Request timeout for https://${servername}${path}`);
|
|
283
|
+
error.code = 'HTTP_SOCKET_TIMEOUT';
|
|
284
|
+
reject(error);
|
|
285
|
+
});
|
|
286
|
+
|
|
276
287
|
req.on('error', err => {
|
|
277
288
|
reject(err);
|
|
278
289
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mailauth",
|
|
3
|
-
"version": "4.4.
|
|
3
|
+
"version": "4.4.2",
|
|
4
4
|
"description": "Email authentication library for Node.js",
|
|
5
5
|
"main": "lib/mailauth.js",
|
|
6
6
|
"scripts": {
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"chai": "4.3.7",
|
|
36
36
|
"eslint": "8.45.0",
|
|
37
37
|
"eslint-config-nodemailer": "1.2.0",
|
|
38
|
-
"eslint-config-prettier": "8.
|
|
38
|
+
"eslint-config-prettier": "8.9.0",
|
|
39
39
|
"js-yaml": "4.1.0",
|
|
40
40
|
"license-report": "6.4.0",
|
|
41
41
|
"marked": "0.7.0",
|