diff --git a/.release b/.release index 36bb27a..afb1db8 160000 --- a/.release +++ b/.release @@ -1 +1 @@ -Subproject commit 36bb27a93862517943e04f24fd67b0df2da6cbbe +Subproject commit afb1db801607dda5e859f39b600f0dd0111e4651 diff --git a/CHANGELOG.md b/CHANGELOG.md index 2a77b3d..3f78ae8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,11 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/). ### Unreleased +### [1.2.7] - 2024-08-14 + +- test: in index.js, unref timers, so test suite exits +- chore: bump dep versions + ### [1.2.6] - 2024-08-14 - mech_mx: fix incorrect evaluation of MX addresses @@ -82,3 +87,4 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/). [1.2.3]: https://github.com/haraka/haraka-plugin-spf/releases/tag/1.2.3 [1.2.4]: https://github.com/haraka/haraka-plugin-spf/releases/tag/v1.2.4 [1.2.5]: https://github.com/haraka/haraka-plugin-spf/releases/tag/v1.2.5 +[1.2.7]: https://github.com/haraka/haraka-plugin-spf/releases/tag/v1.2.7 diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index 037f735..b63b5df 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -2,7 +2,7 @@ This handcrafted artisinal software is brought to you by: -|
msimerson (13) |
gramakri (1) |
DoobleD (1) |
smfreegard (1) |
ne4t0 (1) | -| :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------: | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------: | :-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------: | :--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------: | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------: | +|
msimerson (14) |
smfreegard (3) |
gramakri (1) |
DoobleD (1) |
ne4t0 (1) | +| :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------: | :--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------: | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------: | :-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------: | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------: | this file is maintained by [.release](https://github.com/msimerson/.release) diff --git a/index.js b/index.js index 0edf96d..baa70ef 100644 --- a/index.js +++ b/index.js @@ -118,6 +118,7 @@ exports.helo_spf = async function (next, connection, helo) { connection.loginfo(plugin, 'timeout') next() }, plugin.cfg.lookup_timeout * 1000) + timer.unref() try { const result = await spf.check_host(connection.remote.ip, helo, null) @@ -203,6 +204,7 @@ exports.hook_mail = async function (next, connection, params) { connection.loginfo(plugin, 'timeout') next() }, plugin.cfg.lookup_timeout * 1000) + timer.unref() spf.helo = connection.hello?.host diff --git a/lib/spf.js b/lib/spf.js index 1540493..f466571 100644 --- a/lib/spf.js +++ b/lib/spf.js @@ -40,7 +40,7 @@ class SPF { this.mech_ip6 = this.mech_ip // Used for tests only - this._found_mx_addrs = []; + this._found_mx_addrs = [] } const_translate(value) { @@ -493,7 +493,7 @@ class SPF { // RFC 4408 Section 10.1 if (mxes.length > this.LIMIT) return this.SPF_PERMERROR - let cidr; + let cidr for (const element of mxes) { const mx = element.exchange // Calculate which IP method to use @@ -525,7 +525,7 @@ class SPF { } if (!addresses.length) return this.SPF_NONE - this._found_mx_addrs = addresses; + this._found_mx_addrs = addresses // All queries run; see if our IP matches if (cidr) { @@ -533,23 +533,17 @@ class SPF { for (const address of addresses) { const range = ipaddr.parse(address) if (this.ipaddr.match(range, cidr)) { - this.log_debug( - `mech_mx: ${this.ip} => ${address}/${cidr}: MATCH!`, - ) + this.log_debug(`mech_mx: ${this.ip} => ${address}/${cidr}: MATCH!`) return this.return_const(qualifier) } else { - this.log_debug( - `mech_mx: ${this.ip} => ${address}/${cidr}: NO MATCH`, - ) + this.log_debug(`mech_mx: ${this.ip} => ${address}/${cidr}: NO MATCH`) } } // No matches return this.SPF_NONE } else { if (addresses.includes(this.ip)) { - this.log_debug( - `mech_mx: ${this.ip} => ${addresses.join(',')}: MATCH!`, - ) + this.log_debug(`mech_mx: ${this.ip} => ${addresses.join(',')}: MATCH!`) return this.return_const(qualifier) } else { this.log_debug( diff --git a/package.json b/package.json index 92cdb79..fac504a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "haraka-plugin-spf", - "version": "1.2.6", + "version": "1.2.7", "description": "Sender Policy Framework (SPF) plugin for Haraka", "main": "index.js", "files": [ @@ -39,13 +39,13 @@ "spf": "./bin/spf" }, "dependencies": { - "haraka-dsn": "^1.0.5", - "haraka-net-utils": "^1.6.0", - "ipaddr.js": "^2.1.0", - "nopt": "^7.2.0" + "haraka-dsn": "^1.1.0", + "haraka-net-utils": "^1.7.0", + "ipaddr.js": "^2.2.0", + "nopt": "^7.2.1" }, "devDependencies": { - "@haraka/eslint-config": "^1.1.3", + "@haraka/eslint-config": "^1.1.5", "haraka-test-fixtures": "^1.3.7" } } diff --git a/test/spf.js b/test/spf.js index 4a24e07..fe2450d 100644 --- a/test/spf.js +++ b/test/spf.js @@ -59,7 +59,7 @@ describe('SPF', function () { this.SPF.ip_ver = 'ipv4' await this.SPF.mech_mx() - assert.equal((this.SPF._found_mx_addrs.length > 1), true) + assert.equal(this.SPF._found_mx_addrs.length > 1, true) }) it('check_host, gmail.com, fail', async function () {