Skip to content

Commit b36f8d9

Browse files
committed
fix: switched DKIM verification packages due to user reported issues
1 parent 7606f3a commit b36f8d9

File tree

6 files changed

+7
-17
lines changed

6 files changed

+7
-17
lines changed

.env.defaults

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
NODE_ENV=development
2-
SECURE=false
32
IS_SILENT=false
43
SMTP_PORT=25
54
SMTP_SSL_KEY_PATH=

.env.schema

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
NODE_ENV=
2-
SECURE=
32
IS_SILENT=
43
SMTP_PORT=
54
SMTP_SSL_KEY_PATH=

ecosystem.json

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
"instances": "max",
99
"env_production": {
1010
"NODE_ENV": "production",
11-
"IS_SILENT": true,
1211
"SMTP_PORT": "3025"
1312
}
1413
},
@@ -20,7 +19,6 @@
2019
"instances": "max",
2120
"env_production": {
2221
"NODE_ENV": "production",
23-
"IS_SILENT": true,
2422
"SMTP_PORT": "3465"
2523
}
2624
},
@@ -32,7 +30,6 @@
3230
"instances": "max",
3331
"env_production": {
3432
"NODE_ENV": "production",
35-
"IS_SILENT": true,
3633
"SMTP_PORT": "3587"
3734
}
3835
}

index.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ const _ = require('lodash');
1111
const addressParser = require('nodemailer/lib/addressparser');
1212
const arrayJoinConjunction = require('array-join-conjunction');
1313
const bytes = require('bytes');
14-
const dkimVerify = require('python-dkim-verify');
14+
const NodeDKIM = require('dkim');
1515
const dmarcParse = require('dmarc-parse');
1616
const dnsbl = require('dnsbl');
1717
const domains = require('disposable-email-domains');
@@ -31,6 +31,8 @@ const { oneLine } = require('common-tags');
3131

3232
let mailUtilities = require('mailin/lib/mailUtilities.js');
3333

34+
const verifyDKIM = util.promisify(NodeDKIM.verify).bind(NodeDKIM);
35+
3436
const {
3537
CustomError,
3638
MessageSplitter,
@@ -811,8 +813,10 @@ class ForwardEmail {
811813

812814
async validateDKIM(raw) {
813815
try {
814-
const result = await dkimVerify(raw);
815-
return result;
816+
const result = await verifyDKIM(raw);
817+
return (
818+
result && result.length > 0 && result.every(record => record.verified)
819+
);
816820
} catch (err) {
817821
logger.error(err);
818822
err.responseCode = 421;

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@
4949
"parse-domain": "^2.3.4",
5050
"pino": "^5.14.0",
5151
"punycode": "^2.1.1",
52-
"python-dkim-verify": "^0.0.3",
5352
"python-spfcheck2": "^0.0.4",
5453
"ratelimiter": "^3.4.0",
5554
"signale": "^1.4.0",

yarn.lock

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7421,14 +7421,6 @@ punycode@^2.1.0, punycode@^2.1.1:
74217421
resolved "https://registry.yarnpkg.com/punycode/-/punycode-2.1.1.tgz#b58b010ac40c22c5657616c8d2c2c02c7bf479ec"
74227422
integrity sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==
74237423

7424-
python-dkim-verify@^0.0.3:
7425-
version "0.0.3"
7426-
resolved "https://registry.yarnpkg.com/python-dkim-verify/-/python-dkim-verify-0.0.3.tgz#f4be4838e37ca68f57c85916eabbcc30e408ca8e"
7427-
integrity sha512-CO7wHtQ4tztZ9qfR40NyRUqGwlHbyV4Pj9iYVKTeHz32zijZQDp3ZmM5f+Xx9KO8nv6qTEcP81kBqU1VoH3d6w==
7428-
dependencies:
7429-
semver "^6.3.0"
7430-
shelljs "^0.8.3"
7431-
74327424
python-spfcheck2@^0.0.4:
74337425
version "0.0.4"
74347426
resolved "https://registry.yarnpkg.com/python-spfcheck2/-/python-spfcheck2-0.0.4.tgz#06b33c1105eb744ab955b63fee1927924c475f00"

0 commit comments

Comments
 (0)