From 8da2885b3d9dffe971eed01c2911352efa8825e2 Mon Sep 17 00:00:00 2001 From: Matt Simerson Date: Wed, 2 Oct 2024 09:25:01 -0700 Subject: [PATCH 1/4] deps: update versions to latest - style: remove "plugin" where not needed --- index.js | 24 +++++++++--------------- package.json | 11 ++++++++--- 2 files changed, 17 insertions(+), 18 deletions(-) diff --git a/index.js b/index.js index ea0ee77..3cb93bc 100644 --- a/index.js +++ b/index.js @@ -10,20 +10,16 @@ const { dkimVerify } = require('mailauth/lib/dkim/verify'); const { bimi } = require('mailauth/lib/bimi'); exports.register = function () { - const plugin = this; - - plugin.load_config(); + this.load_config(); - plugin.resolver = async (name, rr) => await dns.promises.resolve(name, rr); + this.resolver = async (name, rr) => await dns.promises.resolve(name, rr); - plugin.register_hook('helo', 'mailauth_helo'); - plugin.register_hook('ehlo', 'mailauth_helo'); + this.register_hook('helo', 'mailauth_helo'); + this.register_hook('ehlo', 'mailauth_helo'); }; exports.load_config = function () { - const plugin = this; - - plugin.cfg = plugin.config.get('mailauth.yaml', {}, () => this.load_config()); + this.cfg = this.config.get('mailauth.yaml', {}, () => this.load_config()); }; exports.mailauth_helo = function (next, connection, helo) { @@ -32,24 +28,22 @@ exports.mailauth_helo = function (next, connection, helo) { }; exports.mailauth_add_result = function (txn, key, domain, result) { - const plugin = this; - const resultName = `${key}[${domain}]`; switch (result) { case 'pass': - txn.results.add(plugin, { pass: resultName }); + txn.results.add(this, { pass: resultName }); break; case 'fail': - txn.results.add(plugin, { fail: resultName }); + txn.results.add(this, { fail: resultName }); break; case 'neutral': case 'policy': - txn.results.add(plugin, { skip: resultName }); + txn.results.add(this, { skip: resultName }); break; case 'permerror': case 'temperror': - txn.results.add(plugin, { fail: resultName }); + txn.results.add(this, { fail: resultName }); break; case 'none': default: diff --git a/package.json b/package.json index 30b3f42..e0ca6df 100644 --- a/package.json +++ b/package.json @@ -1,11 +1,16 @@ { "name": "haraka-plugin-mailauth", - "version": "1.1.0", + "version": "1.1.1", "description": "SPF, DKIM, DMARC, ARC, BIMI validator for Haraka", "main": "index.js", + "files": [ + "config" + ], "scripts": { "test": "echo \"Error: no test specified\" && exit 1", - "update": "rm -rf node_modules package-lock.json && ncu -u && npm install" + "update": "rm -rf node_modules package-lock.json && ncu -u && npm install", + "versions": "npx dependency-version-checker check", + "versions:fix": "npx dependency-version-checker update" }, "keywords": [ "SPF", @@ -27,7 +32,7 @@ }, "license": "MIT", "dependencies": { - "mailauth": "4.6.5" + "mailauth": "4.7.2" }, "devDependencies": { "eslint-config-nodemailer": "1.2.0", From 3cdff3df09ff457f411d772b4447e846d6753f9d Mon Sep 17 00:00:00 2001 From: Matt Simerson Date: Wed, 2 Oct 2024 09:35:35 -0700 Subject: [PATCH 2/4] fix(checkSpf): use modern paths to connection attributes --- index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/index.js b/index.js index 3cb93bc..4285ab6 100644 --- a/index.js +++ b/index.js @@ -69,8 +69,8 @@ exports.hook_mail = function (next, connection, params) { checkSpf({ resolver: plugin.resolver, - ip: connection.remote_ip, // SMTP client IP - helo: connection.notes.mailauth_helo, // EHLO/HELO hostname + ip: connection.remote.ip, // SMTP client IP + helo: connection.hello.host, // EHLO/HELO hostname sender, // MAIL FROM address mta: connection.local.host, // MX hostname maxResolveCount: plugin.cfg.dns?.maxLookups From ea4f76d4c285d4b8e1174a3fc10cb6da4c913bb5 Mon Sep 17 00:00:00 2001 From: Matt Simerson Date: Wed, 2 Oct 2024 09:49:26 -0700 Subject: [PATCH 3/4] revert versions --- package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index e0ca6df..f13f531 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "haraka-plugin-mailauth", - "version": "1.1.1", + "version": "1.1.0", "description": "SPF, DKIM, DMARC, ARC, BIMI validator for Haraka", "main": "index.js", "files": [ @@ -32,7 +32,7 @@ }, "license": "MIT", "dependencies": { - "mailauth": "4.7.2" + "mailauth": "4.6.5" }, "devDependencies": { "eslint-config-nodemailer": "1.2.0", From bbf0067e5e7afed20ec21a73511b1e2b70b3c4b8 Mon Sep 17 00:00:00 2001 From: Matt Simerson Date: Wed, 2 Oct 2024 09:51:10 -0700 Subject: [PATCH 4/4] revert a little more --- package.json | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/package.json b/package.json index f13f531..156acbf 100644 --- a/package.json +++ b/package.json @@ -8,9 +8,7 @@ ], "scripts": { "test": "echo \"Error: no test specified\" && exit 1", - "update": "rm -rf node_modules package-lock.json && ncu -u && npm install", - "versions": "npx dependency-version-checker check", - "versions:fix": "npx dependency-version-checker update" + "update": "rm -rf node_modules package-lock.json && ncu -u && npm install" }, "keywords": [ "SPF",