Skip to content

Commit

Permalink
Release v1.2.9 (#33)
Browse files Browse the repository at this point in the history
- Fix crash in mech_mx code, caused by undefined variable if no valid
MXs are found #32
- Add new `spf_record_include_match` property to allow for additional
filtering
- deps: bump versions to latest
  • Loading branch information
msimerson authored Nov 19, 2024
1 parent b290862 commit 92acfed
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 13 deletions.
2 changes: 0 additions & 2 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ on:
branches: [master]
pull_request:
branches: [master]
schedule:
- cron: '18 7 * * 4'

jobs:
codeql:
Expand Down
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,11 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/).

### Unreleased

- fix: undefined variable in mech_mx if no valid MX found
### [1.2.9] - 2024-11-19

- fix: undefined variable exception when no MX is found, #32
- add: new spf_record_include_match property to allow for additional filtering
- deps: bump versions to latest

### [1.2.8] - 2024-10-07

Expand Down Expand Up @@ -95,3 +98,4 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/).
[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
[1.2.9]: https://github.com/haraka/haraka-plugin-spf/releases/tag/v1.2.9
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">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>) |
| :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------: | :--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------: | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------: | :-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------: | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------: |
| <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">15</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">4</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">2</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/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>
9 changes: 6 additions & 3 deletions lib/spf.js
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,10 @@ class SPF {
switch (result) {
case this.SPF_PASS:
// Store matching "include" mechanisms
this.spf_record_include_match = { ...this.spf_record_include_match, ...recurse.spf_record_include_match }
this.spf_record_include_match = {
...this.spf_record_include_match,
...recurse.spf_record_include_match,
}
this.spf_record_include_match[domain] = recurse.spf_record
return this.SPF_PASS
case this.SPF_FAIL:
Expand Down Expand Up @@ -512,7 +515,7 @@ class SPF {
resolve_method = 'resolve6'
}

let addrs = [];
let addrs = []
try {
addrs = await dns[resolve_method](mx)
} catch (err) {
Expand All @@ -527,7 +530,7 @@ class SPF {
}

this.log_debug(`mech_mx: mx=${mx} addresses=${addrs?.join(',')}`)
addresses = addrs ? addrs.concat(addresses) : [];
addresses = addrs ? addrs.concat(addresses) : []
}

if (!addresses.length) return this.SPF_NONE
Expand Down
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "haraka-plugin-spf",
"version": "1.2.8",
"version": "1.2.9",
"description": "Sender Policy Framework (SPF) plugin for Haraka",
"main": "index.js",
"files": [
Expand Down Expand Up @@ -40,12 +40,12 @@
},
"dependencies": {
"haraka-dsn": "^1.1.0",
"haraka-net-utils": "^1.7.0",
"haraka-net-utils": "^1.7.1",
"ipaddr.js": "^2.2.0",
"nopt": "^7.2.1"
"nopt": "^8.0.0"
},
"devDependencies": {
"@haraka/eslint-config": "^1.1.5",
"haraka-test-fixtures": "^1.3.7"
"haraka-test-fixtures": "^1.3.8"
}
}
5 changes: 4 additions & 1 deletion test/spf.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,9 @@ describe('SPF', function () {
this.timeout = 3000
this.SPF.count = 0
await this.SPF.check_host('130.211.0.1', 'google.com')
assert.ok(this.SPF.spf_record_include_match?.['_netblocks3.google.com'], 'expected include not found')
assert.ok(
this.SPF.spf_record_include_match?.['_netblocks3.google.com'],
'expected include not found',
)
})
})

0 comments on commit 92acfed

Please sign in to comment.