From 6714994608720226f58bcdd3647a4e4eab42509e Mon Sep 17 00:00:00 2001 From: Matt Simerson Date: Thu, 6 Feb 2025 21:06:44 -0800 Subject: [PATCH 1/5] results: tidying up duplicate data - results.hits: deleted, alias for score - results.status: deleted, alias for flag - results.flag: change from Yes/No to boolean --- CHANGELOG.md | 4 ++++ README.md | 1 - index.js | 10 +++------- 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 77802d2..7e6f667 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/). ### Unreleased +- results.flag: change from Yes/No to boolean +- results.hits: deleted, alias for score +- results.status: deleted, alias for flag + ### [1.0.2] - 2025-01-26 - prettier: move config into package.json diff --git a/README.md b/README.md index 2fcf78b..08b3a33 100644 --- a/README.md +++ b/README.md @@ -178,7 +178,6 @@ Other headers options you might find interesting or useful are: add_header all DCC _DCCB_: _DCCR_ add_header all Tests _TESTS_ -## USAGE diff --git a/index.js b/index.js index a624fb2..b96bd08 100644 --- a/index.js +++ b/index.js @@ -82,11 +82,9 @@ exports.hook_data_post = function (next, connection) { /Spam: (True|False) ; (-?\d+\.\d) \/ (-?\d+\.\d)/, ) if (matches) { - spamd_response.flag = matches[1] + spamd_response.flag = matches[1] === 'True' spamd_response.score = matches[2] - spamd_response.hits = matches[2] // backwards compat spamd_response.reqd = matches[3] - spamd_response.flag = spamd_response.flag === 'True' ? 'Yes' : 'No' } } else { state = 'headers' @@ -131,7 +129,6 @@ exports.hook_data_post = function (next, connection) { txn.notes.spamassassin = spamd_response connection.results.add(this, { time: (Date.now() - start) / 1000, - hits: spamd_response.hits, flag: spamd_response.flag, }) @@ -197,7 +194,7 @@ exports.munge_subject = function (conn, score) { } exports.do_header_updates = function (conn, spamd_response) { - if (spamd_response.flag === 'Yes') { + if (spamd_response.flag) { // X-Spam-Flag is added by SpamAssassin conn.transaction.remove_header('precedence') conn.transaction.add_header('Precedence', 'junk') @@ -342,7 +339,7 @@ exports.log_results = function (conn, spamd_response) { : cfg.reject_threshold const human_text = - `status=${spamd_response.flag}` + + `status=${spamd_response.flag ? 'Yes' : 'No'}` + `, score=${spamd_response.score}` + `, required=${spamd_response.reqd}` + `, reject=${reject_threshold}` + @@ -350,7 +347,6 @@ exports.log_results = function (conn, spamd_response) { conn.transaction.results.add(this, { human: human_text, - status: spamd_response.flag, score: parseFloat(spamd_response.score), required: parseFloat(spamd_response.reqd), reject: reject_threshold, From 52c2539eaa66b416c0c19121cb554a473d8b0501 Mon Sep 17 00:00:00 2001 From: Matt Simerson Date: Thu, 6 Feb 2025 21:20:23 -0800 Subject: [PATCH 2/5] doc(CONTRIBUTORS): updated --- .release | 2 +- CONTRIBUTORS.md | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.release b/.release index 0493593..7307651 160000 --- a/.release +++ b/.release @@ -1 +1 @@ -Subproject commit 0493593b975a438b3214ad30c49062af5bd57f55 +Subproject commit 73076513e83c2057a32515831b638771c15b1d83 diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index fe3f644..762a747 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -2,8 +2,8 @@ This handcrafted artisinal software is brought to you by: -|
msimerson (3) | -| :--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------: | +|
msimerson (4)| +| :---: | this file is generated by [.release](https://github.com/msimerson/.release). Contribute to this project to get your GitHub profile included here. From 75e40e951e458185bd196fae199000a87fe2ba86 Mon Sep 17 00:00:00 2001 From: Matt Simerson Date: Thu, 6 Feb 2025 21:21:13 -0800 Subject: [PATCH 3/5] update --- CHANGELOG.md | 8 ++++++-- package.json | 4 ++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7e6f667..560943f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,9 +4,12 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/). ### Unreleased -- results.flag: change from Yes/No to boolean +### [1.0.3] - 2025-02-06 + +- results: tidying up duplicate data - results.hits: deleted, alias for score - results.status: deleted, alias for flag +- results.flag: change from Yes/No to boolean ### [1.0.2] - 2025-01-26 @@ -20,6 +23,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/). - repackaged from haraka/Haraka -[1.0.1]: https://github.com/haraka/haraka-plugin-spamassassin/releases/tag/v1.0.1 +[1.0.1]: https://github.com/haraka/haraka-plugin-spamassassin/releases/tag/1.0.1 [1.0.2]: https://github.com/haraka/haraka-plugin-spamassassin/releases/tag/v1.0.2 [1.0.0]: https://github.com/haraka/haraka-plugin-spamassassin/releases/tag/1.0.0 +[1.0.3]: https://github.com/haraka/haraka-plugin-spamassassin/releases/tag/v1.0.3 diff --git a/package.json b/package.json index 8719645..4e0e6d0 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "haraka-plugin-spamassassin", - "version": "1.0.2", + "version": "1.0.3", "description": "Haraka plugin that scans messages with SpamAssassin", "main": "index.js", "files": [ @@ -45,4 +45,4 @@ "singleQuote": true, "semi": false } -} +} \ No newline at end of file From 8f27f7ebdbc4b5b314ea7fd2d8c9b5e5820a892c Mon Sep 17 00:00:00 2001 From: Matt Simerson Date: Thu, 6 Feb 2025 21:21:54 -0800 Subject: [PATCH 4/5] update --- package.json | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index 4e0e6d0..fe14f41 100644 --- a/package.json +++ b/package.json @@ -33,16 +33,16 @@ }, "homepage": "https://github.com/haraka/haraka-plugin-spamassassin#readme", "dependencies": { - "haraka-net-utils": "^1.7.1", - "haraka-utils": "^1.1.3" + "haraka-net-utils": "^1.7.2", + "haraka-utils": "^1.1.4" }, "devDependencies": { "@haraka/eslint-config": "^2.0.2", - "address-rfc2821": "^2.1.2", - "haraka-test-fixtures": "1.3.8" + "address-rfc2821": "^2.1.3", + "haraka-test-fixtures": "1.3.9" }, "prettier": { "singleQuote": true, "semi": false } -} \ No newline at end of file +} From 1a8f0c04e2053acd1b9e5a22a207c843212253ef Mon Sep 17 00:00:00 2001 From: Matt Simerson Date: Thu, 6 Feb 2025 21:21:57 -0800 Subject: [PATCH 5/5] chore: format --- CONTRIBUTORS.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index 762a747..ac94d0e 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -2,8 +2,8 @@ This handcrafted artisinal software is brought to you by: -|
msimerson (4)| -| :---: | +|
msimerson (4) | +| :--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------: | this file is generated by [.release](https://github.com/msimerson/.release). Contribute to this project to get your GitHub profile included here.