From 64a15d3fd6f33f4dd87a72368176add3bc9605db Mon Sep 17 00:00:00 2001 From: Matt Simerson Date: Fri, 10 Jan 2025 13:12:08 -0800 Subject: [PATCH] deps(eslint): update to v9 (#3433) - deps(eslint): update to v9 - docs(plugins/\*.md): use \# to indicate heading levels - deps(various): bump to latest --- .eslintrc.yaml | 11 --------- Changes.md | 4 +++- docs/plugins/aliases.md | 10 ++++----- docs/plugins/block_me.md | 6 ++--- docs/plugins/data.signatures.md | 6 ++--- docs/plugins/early_talker.md | 6 ++--- docs/plugins/mail_from.is_resolvable.md | 6 ++--- docs/plugins/max_unrecognized_commands.md | 6 ++--- docs/plugins/prevent_credential_leaks.md | 7 ++---- docs/plugins/process_title.md | 3 +-- docs/plugins/rcpt_to.in_host_list.md | 3 +-- docs/plugins/rcpt_to.max_count.md | 12 ++-------- docs/plugins/record_envelope_addresses.md | 9 +++----- docs/plugins/reseed_rng.md | 3 +-- docs/plugins/tarpit.md | 17 ++++++-------- docs/plugins/toobusy.md | 6 ++--- docs/plugins/xclient.md | 3 +-- eslint.config.mjs | 27 +++++++++++++++++++++++ package.json | 16 +++++++------- 19 files changed, 72 insertions(+), 89 deletions(-) delete mode 100644 .eslintrc.yaml create mode 100644 eslint.config.mjs diff --git a/.eslintrc.yaml b/.eslintrc.yaml deleted file mode 100644 index d211815cb..000000000 --- a/.eslintrc.yaml +++ /dev/null @@ -1,11 +0,0 @@ -env: - es6: true - node: true - es2022: true - -extends: ['@haraka'] - -rules: - prefer-template: 'warn' - no-unneeded-ternary: 1 - no-unused-vars: 0 diff --git a/Changes.md b/Changes.md index d84930ae9..ad975c176 100644 --- a/Changes.md +++ b/Changes.md @@ -4,6 +4,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/). ### Unreleased +- deps(eslint): update to v9 +- docs(plugins/\*.md): use \# to indicate heading levels - deps(various): bump to latest versions - fix(outbound): in outbound hook_delivered, when mx.exchange contains an IP, use mx.from_dns @@ -688,7 +690,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/). - plugins/spf #2266 - plugins/toobusy #2186 - plugins/xclient #2159 - - rfc1869 #2159 + - rfc1869 #2160 - smtp_client #2129, #2208 - tests/host_pool #2159 - use es6 destructuring (#2075) in: diff --git a/docs/plugins/aliases.md b/docs/plugins/aliases.md index 177b44e41..ddf7e19d2 100644 --- a/docs/plugins/aliases.md +++ b/docs/plugins/aliases.md @@ -1,5 +1,4 @@ -aliases -======= +# aliases This plugin allows one to configure aliases that may perform an action or change the RCPT address in a number of ways. All aliases are specified in @@ -12,8 +11,7 @@ that run on hook_rcpt WARNING: DO NOT USE THIS PLUGIN WITH queue/smtp\_proxy. -Configuration -------------- +## Configuration * aliases @@ -135,8 +133,8 @@ Configuration aliases on a single domain that map to other local parts at the same domain. -Example Configuration ---------------------- +### Example Configuration + { "test1" : { "action" : "drop" }, "test2" : { "action" : "drop" }, diff --git a/docs/plugins/block_me.md b/docs/plugins/block_me.md index 882448f9d..c5df375c8 100644 --- a/docs/plugins/block_me.md +++ b/docs/plugins/block_me.md @@ -1,5 +1,4 @@ -block\_me -======== +# block\_me This plugin allows you to configure an address which mail sent to will be parsed for a From: address in the body of the message, and will add that @@ -10,8 +9,7 @@ particular mailbox to block them in the future. Note that this is a system-wide block, and not per-user. Be careful with this. -Configuration -------------- +## Configuration * `config/block_me.recipient` - a file containing the address to email to get something blocked. For example: **spam@domain.com**. diff --git a/docs/plugins/data.signatures.md b/docs/plugins/data.signatures.md index f2e411335..841bdbfe3 100644 --- a/docs/plugins/data.signatures.md +++ b/docs/plugins/data.signatures.md @@ -1,12 +1,10 @@ -data.signatures -=============== +# data.signatures This plugin allows you to add string signatures to a configuration file and have this plugin scan the body text of an email for those strings. Mails matching these signatures will be blocked. -Configuration -------------- +## Configuration * data.signatures diff --git a/docs/plugins/early_talker.md b/docs/plugins/early_talker.md index 1ba7f8cab..2f00625b6 100644 --- a/docs/plugins/early_talker.md +++ b/docs/plugins/early_talker.md @@ -1,5 +1,4 @@ -early\_talker -============ +# early\_talker Early talkers are violators of the SMTP specification, which require that clients must wait for certain responses before sending the next command. @@ -10,8 +9,7 @@ and after the DATA command for Haraka to detect if it talks early. If an early talker is detected at connection or DATA, then a DENY is returned with the message 'You talk too soon'. -Configuration -------------- +## Configuration The config file early\_talker.ini has two options: diff --git a/docs/plugins/mail_from.is_resolvable.md b/docs/plugins/mail_from.is_resolvable.md index c07fc0d14..7f5618596 100644 --- a/docs/plugins/mail_from.is_resolvable.md +++ b/docs/plugins/mail_from.is_resolvable.md @@ -1,11 +1,9 @@ -mail\_from.is\_resolvable -======================= +# mail\_from.is\_resolvable This plugin checks that the domain used in MAIL FROM is resolvable to an MX record. -Configuration -------------- +## Configuration This plugin uses the INI-style file format and accepts the following options: diff --git a/docs/plugins/max_unrecognized_commands.md b/docs/plugins/max_unrecognized_commands.md index 559f3e015..32c4cab1e 100644 --- a/docs/plugins/max_unrecognized_commands.md +++ b/docs/plugins/max_unrecognized_commands.md @@ -1,5 +1,4 @@ -max\_unrecognized\_commands -========================= +# max\_unrecognized\_commands This plugin places a maximum limit on the number of unrecognized commands allowed before recognising that the connection is bad. @@ -13,8 +12,7 @@ runs after any plugins that use the unrecognized_command hook to implement other SMTP verbs and extensions (such as the auth/* plugins), otherwise commands valid for these plugins will be counted as unknown by this plugin. -Configuration -------------- +## Configuration * max\_unrecognized\_commands diff --git a/docs/plugins/prevent_credential_leaks.md b/docs/plugins/prevent_credential_leaks.md index 5d0694b6a..0f1021ffd 100644 --- a/docs/plugins/prevent_credential_leaks.md +++ b/docs/plugins/prevent_credential_leaks.md @@ -1,5 +1,4 @@ -prevent\_credential\_leaks -======== +# prevent\_credential\_leaks This plugin prevents an authenticated user (via SMTP AUTH) from sending their username and password out in a message (e.g. like replying to a @@ -16,9 +15,7 @@ Note that if the username is qualified e.g. user@domain.com - then the plugin will search for both `user` and `user@domain.com` for maximum effectiveness. - -Configuration -------------- +## Configuration No configuration is required. Simply add the plugin to your `config/plugins` file. It should be added before any other plugins that run on hook_data_post diff --git a/docs/plugins/process_title.md b/docs/plugins/process_title.md index 3a6ef1450..5c1a479c3 100644 --- a/docs/plugins/process_title.md +++ b/docs/plugins/process_title.md @@ -1,5 +1,4 @@ -process\_title -============= +# process\_title This plugin causes the process title seen by the UNIX 'ps' command to be modified from this: diff --git a/docs/plugins/rcpt_to.in_host_list.md b/docs/plugins/rcpt_to.in_host_list.md index 2870d635d..a6e33e2ae 100644 --- a/docs/plugins/rcpt_to.in_host_list.md +++ b/docs/plugins/rcpt_to.in_host_list.md @@ -1,5 +1,4 @@ -rcpt\_to.in\_host\_list -===================== +# rcpt\_to.in\_host\_list This plugin is the mainstay of an inbound Haraka server. It should list the domains that are local to the host. Mails that have RCPT TO not matching diff --git a/docs/plugins/rcpt_to.max_count.md b/docs/plugins/rcpt_to.max_count.md index a53b2c13f..fc96045be 100644 --- a/docs/plugins/rcpt_to.max_count.md +++ b/docs/plugins/rcpt_to.max_count.md @@ -1,11 +1,3 @@ -rcpt\_to.max\_count -================= +# rcpt\_to.max\_count -This plugin sets a maximum limit on RCPT TOs. Violators will be disconnected. - -Configuration -------------- - -* rcpt\_to.max\_count - - The maximum number of recipients. Default: 40. +The functionality of this plugin was integrated in to [haraka-plugin-limit](https://github.com/haraka/haraka-plugin-limit). diff --git a/docs/plugins/record_envelope_addresses.md b/docs/plugins/record_envelope_addresses.md index cc2a7f0b3..50be4cc3c 100644 --- a/docs/plugins/record_envelope_addresses.md +++ b/docs/plugins/record_envelope_addresses.md @@ -1,5 +1,4 @@ -record\_envelope\_addresses -========================= +# record\_envelope\_addresses This plugin adds two new header lines. @@ -10,14 +9,12 @@ It is useful if you need to know the exact addresses used to send an email, e.g. the email was sent to you as BCC or if it is a newsletter. In both cases the recipient address is normally not recorded in the headers. -Caveats -------- +## Caveats If you enable this plugin you may introduce a possible information leak, i.e. disclosure of BCC recipients. So you never want to use this on an outgoing mail server and maybe also not if this server is used as a relay. -Configuration -------------- +## Configuration This plugin has no configuration. diff --git a/docs/plugins/reseed_rng.md b/docs/plugins/reseed_rng.md index 6df046be9..cf8cbb0af 100644 --- a/docs/plugins/reseed_rng.md +++ b/docs/plugins/reseed_rng.md @@ -1,5 +1,4 @@ -reseed\_rng -========== +# reseed\_rng The V8 that ships with node 0.4.x uses an unsophisticated method of seeding its random number generator- it simply uses the current time diff --git a/docs/plugins/tarpit.md b/docs/plugins/tarpit.md index 1d3fe4c55..73e5732b9 100644 --- a/docs/plugins/tarpit.md +++ b/docs/plugins/tarpit.md @@ -1,5 +1,4 @@ -tarpit -====== +# tarpit This plugin is designed to introduce deliberate delays on the response of every hook in order to slow down a connection. It has no @@ -10,8 +9,8 @@ that accept recipients or that return OK) but must be loaded *after* any plugins that wish to use it. -Usage --------------- +## Usage + To use this plugin in another plugin set: connection.notes.tarpit = ; @@ -21,8 +20,7 @@ or connection.transaction.notes.tarpit = ; -Configuration --------------- +## Configuration The configuration file for tarpit is config/tarpit.ini. @@ -34,8 +32,7 @@ The configuration file for tarpit is config/tarpit.ini. hooks\_to\_delay=connect,helo,ehlo,mail,rcpt,data,data\_post,queue,unrecognized\_command,vrfy,noop,rset,quit -Plugin Timeout --------------- +## Plugin Timeout config/tarpit.timeout (Default: 0) @@ -51,7 +48,7 @@ The solution is to set the contents of config/tarpit.timeout to zero or **seconds to delay** + 1. -Logging --------------- +## Logging + When tarpitting a command it will log 'tarpitting response for Ns' to the INFO facility where N is the number of seconds. diff --git a/docs/plugins/toobusy.md b/docs/plugins/toobusy.md index 2c898a134..0b2a92323 100644 --- a/docs/plugins/toobusy.md +++ b/docs/plugins/toobusy.md @@ -1,5 +1,4 @@ -toobusy -======= +# toobusy This plugin will stop Haraka accepting new connections when the event loop latency is too high. @@ -12,8 +11,7 @@ To use this plugin you have to install the 'toobusy-js' module by running This plugin should be listed at the top of your config/plugins file so that it runs before any other plugin that hooks lookup\_rdns. -Configuration -------------- +## Configuration If you wish to override the default maxLag value of 70ms then add the desired value to config/toobusy.maxlag. This can be set and changed at runtime and diff --git a/docs/plugins/xclient.md b/docs/plugins/xclient.md index 934c4018d..40d69415f 100644 --- a/docs/plugins/xclient.md +++ b/docs/plugins/xclient.md @@ -1,5 +1,4 @@ -xclient -======= +# xclient Implements the [XCLIENT](http://www.postfix.org/XCLIENT_README.html) protocol. diff --git a/eslint.config.mjs b/eslint.config.mjs new file mode 100644 index 000000000..8aa4046a4 --- /dev/null +++ b/eslint.config.mjs @@ -0,0 +1,27 @@ +import globals from "globals"; +import path from "node:path"; +import { fileURLToPath } from "node:url"; +import js from "@eslint/js"; +import { FlatCompat } from "@eslint/eslintrc"; + +const __filename = fileURLToPath(import.meta.url); +const __dirname = path.dirname(__filename); +const compat = new FlatCompat({ + baseDirectory: __dirname, + recommendedConfig: js.configs.recommended, + allConfig: js.configs.all +}); + +export default [...compat.extends("@haraka"), { + languageOptions: { + globals: { + ...globals.node, + }, + }, + + rules: { + "prefer-template": "warn", + "no-unneeded-ternary": 1, + "no-unused-vars": 0, + }, +}]; \ No newline at end of file diff --git a/package.json b/package.json index aa31ae59d..c4fea388d 100644 --- a/package.json +++ b/package.json @@ -24,7 +24,7 @@ "address-rfc2822": "^2.2.2", "async": "^3.2.6", "daemon": "~1.1.0", - "haraka-config": "^1.4.1", + "haraka-config": "^1.4.2", "haraka-constants": "^1.0.7", "haraka-dsn": "^1.1.0", "haraka-email-message": "^1.2.4", @@ -33,7 +33,7 @@ "haraka-notes": "^1.1.0", "haraka-plugin-redis": "^2.0.8", "haraka-results": "^2.2.4", - "haraka-tld": "^1.2.2", + "haraka-tld": "^1.2.3", "haraka-utils": "^1.1.3", "ipaddr.js": "~2.2.0", "node-gyp": "^11.0.0", @@ -69,19 +69,19 @@ "haraka-plugin-messagesniffer": "^1.0.0", "haraka-plugin-p0f": "^1.0.9", "haraka-plugin-qmail-deliverable": "^1.2.3", - "haraka-plugin-recipient-routes": "^1.2.0", + "haraka-plugin-recipient-routes": "^1.2.1", "haraka-plugin-relay": "^1.0.0", "haraka-plugin-rspamd": "^1.3.1", - "haraka-plugin-spamassassin": "^1.0.0", + "haraka-plugin-spamassassin": "^1.0.1", "haraka-plugin-spf": "1.2.9", "haraka-plugin-syslog": "^1.0.6", - "haraka-plugin-uribl": "^1.0.8", + "haraka-plugin-uribl": "^1.0.9", "haraka-plugin-watch": "^2.0.6", "ocsp": "~1.2.0", "tmp": "~0.2.3" }, "devDependencies": { - "@haraka/eslint-config": "^1.1.5", + "@haraka/eslint-config": "^2.0.2", "haraka-test-fixtures": "^1.3.8", "mocha": "^11.1.0", "mock-require": "^3.0.3", @@ -97,8 +97,8 @@ }, "scripts": { "format:NYET": "npm run prettier:fix && npm run lint:fix", - "lint": "npx eslint@^8 *.js outbound plugins plugins/*/*.js test test/*/*.js test/*/*/*.js bin/haraka", - "lint:fix": "npx eslint@^8 --fix *.js outbound plugins plugins/*/*.js test test/*/*.js test/*/*/*.js bin/haraka", + "lint": "npx eslint *.js outbound plugins plugins/*/*.js test test/*/*.js test/*/*/*.js bin/haraka", + "lint:fix": "npx eslint --fix *.js outbound plugins plugins/*/*.js test test/*/*.js test/*/*/*.js bin/haraka", "prettier": "npx prettier . --check", "prettier:fix": "npx prettier . --write --log-level=warn", "test": "npx mocha --exit --timeout=4000 test test/outbound test/plugins/auth test/plugins/queue test/plugins",