haraka-plugin-karma 2.5.1 → 2.5.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (4) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/README.md +14 -14
  3. package/index.js +16 -4
  4. package/package.json +10 -8
package/CHANGELOG.md CHANGED
@@ -4,6 +4,17 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/).
4
4
 
5
5
  ### Unreleased
6
6
 
7
+ ### [2.5.3] - 2026-11-21
8
+
9
+ - fix: skip AUTH lines the auth plugin handles (#75)
10
+ - fix: don't record AUTH credentials in results
11
+ - doc: fix links to other plugins and docs (#74)
12
+
13
+ ### [2.5.2] - 2026-06-07
14
+
15
+ - fix: update redis hmSet -> hSet
16
+ - test: refactored against test-fixtures 1.7.0 (#72)
17
+
7
18
  ### [2.5.1] - 2026-05-24
8
19
 
9
20
  - fix: guard pubsub JSON.parse and validate payload shape in check_result
@@ -195,3 +206,5 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/).
195
206
  [2.4.1]: https://github.com/haraka/haraka-plugin-karma/releases/tag/v2.4.1
196
207
  [2.5.0]: https://github.com/haraka/haraka-plugin-karma/releases/tag/v2.5.0
197
208
  [2.5.1]: https://github.com/haraka/haraka-plugin-karma/releases/tag/v2.5.1
209
+ [2.5.2]: https://github.com/haraka/haraka-plugin-karma/releases/tag/v2.5.2
210
+ [2.5.3]: https://github.com/haraka/haraka-plugin-karma/releases/tag/v2.5.3
package/README.md CHANGED
@@ -1,9 +1,7 @@
1
- [![Build Status][ci-img]][ci-url]
2
- [![Code Climate][clim-img]][clim-url]
3
- [![Code Coverage][cov-img]][cov-url]
4
-
5
1
  # Karma - A heuristics based reputation engine for the Haraka MTA
6
2
 
3
+ [![Test][ci-img]][ci-url] [![Cover][cov-img]][cov-url] [![Qlty][qlty-img]][qlty-url]
4
+
7
5
  Karma is a heuristic scoring engine that uses connection metadata and other Haraka plugin data as inputs. Connections scoring in excess of specified thresholds are rewarded or [penalized](#penalties) in proportionate ways.
8
6
 
9
7
  ## Description
@@ -186,17 +184,19 @@ Karma is most effective at filtering mail delivered by bots and rogue servers.
186
184
  Spam delivered by servers with good reputations normally pass karma's checks.
187
185
  Expect to use karma _with_ content filters.
188
186
 
189
- [p0f-url]: /manual/plugins/connect.p0f.html
190
- [geoip-url]: https://github.com/haraka/haraka-plugin-geoip
191
- [dnsbl-url]: /manual/plugins/dnsbl.html
192
- [fcrdns-url]: http://haraka.github.io/manual/plugins/connect.fcrdns.html
193
- [uribl-url]: http://haraka.github.io/manual/plugins/data.uribl.html
194
- [sa-url]: http://haraka.github.io/manual/plugins/spamassassin.html
195
- [snf-url]: http://haraka.github.io/manual/plugins/messagesniffer.html
196
- [results-url]: http://haraka.github.io/manual/Results.html
187
+ <!-- leave these buried at the bottom of the document -->
188
+
197
189
  [ci-img]: https://github.com/haraka/haraka-plugin-karma/actions/workflows/ci.yml/badge.svg
198
190
  [ci-url]: https://github.com/haraka/haraka-plugin-karma/actions/workflows/ci.yml
199
191
  [cov-img]: https://codecov.io/github/haraka/haraka-plugin-karma/coverage.svg
200
192
  [cov-url]: https://codecov.io/github/haraka/haraka-plugin-karma
201
- [clim-img]: https://qlty.sh/gh/haraka/projects/haraka-plugin-karma/maintainability.svg
202
- [clim-url]: https://qlty.sh/gh/haraka/projects/haraka-plugin-karma
193
+ [qlty-img]: https://qlty.sh/gh/haraka/projects/haraka-plugin-karma/maintainability.svg
194
+ [qlty-url]: https://qlty.sh/gh/haraka/projects/haraka-plugin-karma
195
+ [p0f-url]: https://github.com/haraka/haraka-plugin-p0f
196
+ [geoip-url]: https://github.com/haraka/haraka-plugin-geoip
197
+ [dnsbl-url]: https://github.com/haraka/haraka-plugin-dns-list
198
+ [fcrdns-url]: https://github.com/haraka/haraka-plugin-fcrdns
199
+ [uribl-url]: https://github.com/haraka/haraka-plugin-uribl
200
+ [sa-url]: https://github.com/haraka/haraka-plugin-spamassassin
201
+ [snf-url]: https://github.com/haraka/haraka-plugin-messagesniffer
202
+ [results-url]: https://haraka.github.io/core/Results/
package/index.js CHANGED
@@ -578,14 +578,26 @@ exports.hook_reset_transaction = function (next, connection) {
578
578
  exports.hook_unrecognized_command = function (next, connection, params) {
579
579
  if (this.should_we_skip(connection)) return next()
580
580
 
581
+ const verb = params[0].toUpperCase()
582
+
581
583
  // in case karma is in config/plugins before tls
582
- if (params[0].toUpperCase() === 'STARTTLS') return next()
584
+ if (verb === 'STARTTLS') return next()
583
585
 
584
586
  // in case karma is in config/plugins before AUTH plugin(s)
585
587
  if (connection.notes.authenticating) return next()
586
588
 
589
+ let cmd = params
590
+ if (verb === 'AUTH') {
591
+ const method = params[1]?.split(/\s+/)[0] ?? ''
592
+ // auth_base sets notes.authenticating only after it accepts this first line
593
+ if (connection.notes.allowed_auth_methods?.includes(method.toUpperCase()))
594
+ return next()
595
+ // drop the initial response, it holds the credentials
596
+ cmd = [params[0], method]
597
+ }
598
+
587
599
  connection.results.incr(this, { score: -1 })
588
- connection.results.add(this, { fail: `cmd:(${params})` })
600
+ connection.results.add(this, { fail: `cmd:(${cmd})` })
589
601
 
590
602
  return this.should_we_deny(next, connection, 'unrecognized_command')
591
603
  }
@@ -1042,7 +1054,7 @@ exports.init_ip = async function (dbkey, rip, expire) {
1042
1054
  if (!this.db) return
1043
1055
  await this.db
1044
1056
  .multi()
1045
- .hmSet(dbkey, { bad: 0, good: 0, connections: 1 })
1057
+ .hSet(dbkey, { bad: 0, good: 0, connections: 1 })
1046
1058
  .expire(dbkey, expire)
1047
1059
  .exec()
1048
1060
  }
@@ -1059,7 +1071,7 @@ exports.init_asn = function (asnkey, expire) {
1059
1071
  if (!this.db) return
1060
1072
  this.db
1061
1073
  .multi()
1062
- .hmSet(asnkey, { bad: 0, good: 0, connections: 1 })
1074
+ .hSet(asnkey, { bad: 0, good: 0, connections: 1 })
1063
1075
  .expire(asnkey, expire * 2) // keep ASN longer
1064
1076
  .exec()
1065
1077
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "haraka-plugin-karma",
3
- "version": "2.5.1",
3
+ "version": "2.5.3",
4
4
  "description": "A heuristics scoring and reputation engine for SMTP connections",
5
5
  "main": "index.js",
6
6
  "files": [
@@ -8,15 +8,17 @@
8
8
  "config"
9
9
  ],
10
10
  "scripts": {
11
+ "prepare": "git rev-parse --git-dir >/dev/null 2>&1 && git config core.hooksPath .githooks || true",
11
12
  "clean": "rm -rf node_modules package-lock.json",
12
13
  "format": "npm run prettier:fix && npm run lint:fix",
13
14
  "lint": "npx eslint *.js test",
14
15
  "lint:fix": "npx eslint *.js test --fix",
15
16
  "prettier": "npx prettier . --check",
16
17
  "prettier:fix": "npx prettier . --write --log-level=warn",
18
+ "qlty": "qlty smells --all",
17
19
  "test": "node --test",
18
- "test:coverage": "node --test --experimental-test-coverage --test-coverage-exclude=package.json --test-coverage-exclude=test/*.js",
19
- "test:coverage:lcov": "mkdir -p coverage && node --test --experimental-test-coverage --test-reporter=lcov --test-reporter-destination=coverage/lcov.info test/*.js",
20
+ "test:coverage": "node --test --experimental-test-coverage --test-coverage-include=index.js",
21
+ "test:coverage:lcov": "mkdir -p coverage && node --test --experimental-test-coverage --test-coverage-include=index.js --test-reporter=lcov --test-reporter-destination=coverage/lcov.info test/*.js",
20
22
  "versions": "npx npm-dep-mgr check",
21
23
  "versions:fix": "npx npm-dep-mgr update"
22
24
  },
@@ -34,13 +36,13 @@
34
36
  },
35
37
  "homepage": "https://github.com/haraka/haraka-plugin-karma#readme",
36
38
  "dependencies": {
37
- "haraka-constants": "^1.0.7",
38
- "haraka-plugin-redis": "^2.0.11"
39
+ "haraka-constants": "^1.0.8",
40
+ "haraka-plugin-redis": "^2.1.1"
39
41
  },
40
42
  "devDependencies": {
41
- "@haraka/email-address": "^3.1.2",
42
- "@haraka/eslint-config": "^2.0.4",
43
- "haraka-test-fixtures": "^1.4.3"
43
+ "@haraka/email-address": "^3.1.7",
44
+ "@haraka/eslint-config": "^3.0.1",
45
+ "haraka-test-fixtures": "^1.7.2"
44
46
  },
45
47
  "prettier": {
46
48
  "singleQuote": true,