Skip to content

Commit f624ba2

Browse files
authored
Release v1.2.7 (#29)
- test: in index.js, unref the timers so the test suite exits - chore: bump dep versions Checklist: - [x] docs updated - [X] tests updated - [x] Changes.md updated
1 parent 11b03db commit f624ba2

File tree

7 files changed

+24
-22
lines changed

7 files changed

+24
-22
lines changed

.release

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/).
44

55
### Unreleased
66

7+
### [1.2.7] - 2024-08-14
8+
9+
- test: in index.js, unref timers, so test suite exits
10+
- chore: bump dep versions
11+
712
### [1.2.6] - 2024-08-14
813

914
- mech_mx: fix incorrect evaluation of MX addresses
@@ -82,3 +87,4 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/).
8287
[1.2.3]: https://github.com/haraka/haraka-plugin-spf/releases/tag/1.2.3
8388
[1.2.4]: https://github.com/haraka/haraka-plugin-spf/releases/tag/v1.2.4
8489
[1.2.5]: https://github.com/haraka/haraka-plugin-spf/releases/tag/v1.2.5
90+
[1.2.7]: https://github.com/haraka/haraka-plugin-spf/releases/tag/v1.2.7

CONTRIBUTORS.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
This handcrafted artisinal software is brought to you by:
44

5-
| <img height="80" src="https://avatars.githubusercontent.com/u/261635?v=4"><br><a href="https://github.com/msimerson">msimerson</a> (<a href="https://github.com/haraka/haraka-plugin-spf/commits?author=msimerson">13</a>) | <img height="80" src="https://avatars.githubusercontent.com/u/82041?v=4"><br><a href="https://github.com/gramakri">gramakri</a> (<a href="https://github.com/haraka/haraka-plugin-spf/commits?author=gramakri">1</a>) | <img height="80" src="https://avatars.githubusercontent.com/u/918201?v=4"><br><a href="https://github.com/DoobleD">DoobleD</a> (<a href="https://github.com/haraka/haraka-plugin-spf/commits?author=DoobleD">1</a>) | <img height="80" src="https://avatars.githubusercontent.com/u/550490?v=4"><br><a href="https://github.com/smfreegard">smfreegard</a> (<a href="https://github.com/haraka/haraka-plugin-spf/commits?author=smfreegard">1</a>) | <img height="80" src="https://avatars.githubusercontent.com/u/8930018?v=4"><br><a href="https://github.com/ne4t0">ne4t0</a> (<a href="https://github.com/haraka/haraka-plugin-spf/commits?author=ne4t0">1</a>) |
6-
| :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------: | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------: | :-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------: | :--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------: | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------: |
5+
| <img height="80" src="https://avatars.githubusercontent.com/u/261635?v=4"><br><a href="https://github.com/msimerson">msimerson</a> (<a href="https://github.com/haraka/haraka-plugin-spf/commits?author=msimerson">14</a>) | <img height="80" src="https://avatars.githubusercontent.com/u/550490?v=4"><br><a href="https://github.com/smfreegard">smfreegard</a> (<a href="https://github.com/haraka/haraka-plugin-spf/commits?author=smfreegard">3</a>) | <img height="80" src="https://avatars.githubusercontent.com/u/82041?v=4"><br><a href="https://github.com/gramakri">gramakri</a> (<a href="https://github.com/haraka/haraka-plugin-spf/commits?author=gramakri">1</a>) | <img height="80" src="https://avatars.githubusercontent.com/u/918201?v=4"><br><a href="https://github.com/DoobleD">DoobleD</a> (<a href="https://github.com/haraka/haraka-plugin-spf/commits?author=DoobleD">1</a>) | <img height="80" src="https://avatars.githubusercontent.com/u/8930018?v=4"><br><a href="https://github.com/ne4t0">ne4t0</a> (<a href="https://github.com/haraka/haraka-plugin-spf/commits?author=ne4t0">1</a>) |
6+
| :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------: | :--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------: | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------: | :-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------: | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------: |
77

88
<sub>this file is maintained by [.release](https://github.com/msimerson/.release)</sub>

index.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@ exports.helo_spf = async function (next, connection, helo) {
118118
connection.loginfo(plugin, 'timeout')
119119
next()
120120
}, plugin.cfg.lookup_timeout * 1000)
121+
timer.unref()
121122

122123
try {
123124
const result = await spf.check_host(connection.remote.ip, helo, null)
@@ -203,6 +204,7 @@ exports.hook_mail = async function (next, connection, params) {
203204
connection.loginfo(plugin, 'timeout')
204205
next()
205206
}, plugin.cfg.lookup_timeout * 1000)
207+
timer.unref()
206208

207209
spf.helo = connection.hello?.host
208210

lib/spf.js

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ class SPF {
4040
this.mech_ip6 = this.mech_ip
4141

4242
// Used for tests only
43-
this._found_mx_addrs = [];
43+
this._found_mx_addrs = []
4444
}
4545

4646
const_translate(value) {
@@ -493,7 +493,7 @@ class SPF {
493493
// RFC 4408 Section 10.1
494494
if (mxes.length > this.LIMIT) return this.SPF_PERMERROR
495495

496-
let cidr;
496+
let cidr
497497
for (const element of mxes) {
498498
const mx = element.exchange
499499
// Calculate which IP method to use
@@ -525,31 +525,25 @@ class SPF {
525525
}
526526

527527
if (!addresses.length) return this.SPF_NONE
528-
this._found_mx_addrs = addresses;
528+
this._found_mx_addrs = addresses
529529

530530
// All queries run; see if our IP matches
531531
if (cidr) {
532532
// CIDR match type
533533
for (const address of addresses) {
534534
const range = ipaddr.parse(address)
535535
if (this.ipaddr.match(range, cidr)) {
536-
this.log_debug(
537-
`mech_mx: ${this.ip} => ${address}/${cidr}: MATCH!`,
538-
)
536+
this.log_debug(`mech_mx: ${this.ip} => ${address}/${cidr}: MATCH!`)
539537
return this.return_const(qualifier)
540538
} else {
541-
this.log_debug(
542-
`mech_mx: ${this.ip} => ${address}/${cidr}: NO MATCH`,
543-
)
539+
this.log_debug(`mech_mx: ${this.ip} => ${address}/${cidr}: NO MATCH`)
544540
}
545541
}
546542
// No matches
547543
return this.SPF_NONE
548544
} else {
549545
if (addresses.includes(this.ip)) {
550-
this.log_debug(
551-
`mech_mx: ${this.ip} => ${addresses.join(',')}: MATCH!`,
552-
)
546+
this.log_debug(`mech_mx: ${this.ip} => ${addresses.join(',')}: MATCH!`)
553547
return this.return_const(qualifier)
554548
} else {
555549
this.log_debug(

package.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "haraka-plugin-spf",
3-
"version": "1.2.6",
3+
"version": "1.2.7",
44
"description": "Sender Policy Framework (SPF) plugin for Haraka",
55
"main": "index.js",
66
"files": [
@@ -39,13 +39,13 @@
3939
"spf": "./bin/spf"
4040
},
4141
"dependencies": {
42-
"haraka-dsn": "^1.0.5",
43-
"haraka-net-utils": "^1.6.0",
44-
"ipaddr.js": "^2.1.0",
45-
"nopt": "^7.2.0"
42+
"haraka-dsn": "^1.1.0",
43+
"haraka-net-utils": "^1.7.0",
44+
"ipaddr.js": "^2.2.0",
45+
"nopt": "^7.2.1"
4646
},
4747
"devDependencies": {
48-
"@haraka/eslint-config": "^1.1.3",
48+
"@haraka/eslint-config": "^1.1.5",
4949
"haraka-test-fixtures": "^1.3.7"
5050
}
5151
}

test/spf.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ describe('SPF', function () {
5959
this.SPF.ip_ver = 'ipv4'
6060

6161
await this.SPF.mech_mx()
62-
assert.equal((this.SPF._found_mx_addrs.length > 1), true)
62+
assert.equal(this.SPF._found_mx_addrs.length > 1, true)
6363
})
6464

6565
it('check_host, gmail.com, fail', async function () {

0 commit comments

Comments
 (0)