haraka / haraka-plugin-rspamd

Rspamd plugin for Haraka
https://www.npmjs.com/package/haraka-plugin-rspamd
MIT License
15 stars 14 forks source link

TypeError: Cannot read properties of undefined (reading 'replace') #29

Closed pvagner closed 2 years ago

pvagner commented 2 years ago

system info

Haraka | Haraka.js — Version: 2.8.28 --- | :--- Node | v18.10.0 OS | Linux vps 5.10.117 #1-vpsAdminOS SMP Sat May 21 14:03:07 UTC 2022 x86_64 GNU/Linux openssl | OpenSSL 1.1.1q 5 Jul 2022

Expected behavior

Mail should pass through no matter what headers are added.

Observed behavior

Since rspamd v 3.3 many of messages generate error when adding email headers after checking the messages with rspamd. This plugin is no longer usable when it's configured to add headers. This is the log I'm getting:

Oct 07 12:14:22 vps node[1642317]: [CRIT] [-] [core] TypeError: Cannot read properties of undefined (reading 'replace')
Oct 07 12:14:22 vps node[1642317]: [CRIT] [-] [core]     at Header.add_end (/usr/lib/node_modules/Haraka/mailheader.js:152:23)
Oct 07 12:14:22 vps node[1642317]: [CRIT] [-] [core]     at Transaction.add_header (/usr/lib/node_modules/Haraka/transaction.js:212:21)
Oct 07 12:14:22 vps node[1642317]: [CRIT] [-] [core]     at /usr/lib/node_modules/Haraka/node_modules/haraka-plugin-rspamd/index.js:193:40
Oct 07 12:14:22 vps node[1642317]: [CRIT] [-] [core]     at Array.forEach (<anonymous>)
Oct 07 12:14:22 vps node[1642317]: [CRIT] [-] [core]     at exports.do_milter_headers (/usr/lib/node_modules/Haraka/node_modules/haraka-plugin-rspamd/index.js:188:46)
Oct 07 12:14:22 vps node[1642317]: [CRIT] [-] [core]     at IncomingMessage.<anonymous> (/usr/lib/node_modules/Haraka/node_modules/haraka-plugin-rspamd/index.js:257:24)
Oct 07 12:14:22 vps node[1642317]: [CRIT] [-] [core]     at IncomingMessage.emit (node:events:525:35)
Oct 07 12:14:22 vps node[1642317]: [CRIT] [-] [core]     at endReadableNT (node:internal/streams/readable:1359:12)
Oct 07 12:14:22 vps node[1642317]: [CRIT] [-] [core]     at process.processTicksAndRejections (node:internal/process/task_queues:82:21)

Steps to reproduce

Configure in rspand.ini add_headers=always

Send your self an email and watch the logs.

I find this critical and I haven't managed to make a fix my-self.