Skip to content

Commit

Permalink
Release v1.2.7 (#29)
Browse files Browse the repository at this point in the history
- 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
  • Loading branch information
msimerson authored Aug 14, 2024
1 parent 11b03db commit f624ba2
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 22 deletions.
2 changes: 1 addition & 1 deletion .release
Submodule .release updated 4 files
+4 −3 README.md
+9 −4 contributors.js
+8 −1 finish.sh
+26 −15 submit.sh
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
4 changes: 2 additions & 2 deletions CONTRIBUTORS.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

This handcrafted artisinal software is brought to you by:

| <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>) |
| :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------: | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------: | :-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------: | :--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------: | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------: |
| <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>) |
| :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------: | :--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------: | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------: | :-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------: | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------: |

<sub>this file is maintained by [.release](https://github.com/msimerson/.release)</sub>
2 changes: 2 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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

Expand Down
18 changes: 6 additions & 12 deletions lib/spf.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -525,31 +525,25 @@ 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) {
// CIDR match type
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(
Expand Down
12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
@@ -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": [
Expand Down Expand Up @@ -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"
}
}
2 changes: 1 addition & 1 deletion test/spf.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 () {
Expand Down

0 comments on commit f624ba2

Please sign in to comment.