From 929d094ecd6984cc2a1047f8f8ce651dedc113ad Mon Sep 17 00:00:00 2001 From: NickOvt Date: Thu, 22 Aug 2024 10:48:33 +0300 Subject: [PATCH] fix(messageIdHeader-replace): ZMS-166 MessageID header safe replace (#18) --- index.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/index.js b/index.js index 9e01e28..bfbe797 100644 --- a/index.js +++ b/index.js @@ -157,6 +157,7 @@ module.exports.init = async app => { const transhost = (envelope.transhost || '').replace('[', '').replace(']', '') || originhost; const subject = messageinfo.subject || 'no subject'; + const messageIdHeaderVal = allHeadersParsed['Message-ID']?.replace('<', '').replace('>', ''); // Call Zilter with required params try { @@ -190,7 +191,7 @@ module.exports.init = async app => { _from: envelope.from, _header_from: allHeadersParsed.From, _header_to: allHeadersParsed.To, - _message_id: allHeadersParsed['Message-ID'].replace('<', '').replace('>', ''), + _message_id: messageIdHeaderVal, _subject: subject, level: 5, _zilter_error: 'Unauthorized error 401', @@ -210,7 +211,7 @@ module.exports.init = async app => { _from: envelope.from, _header_from: allHeadersParsed.From, _header_to: allHeadersParsed.To, - _message_id: allHeadersParsed['Message-ID'].replace('<', '').replace('>', ''), + _message_id: messageIdHeaderVal, _subject: subject, level: 5, _passed: 'N', @@ -227,7 +228,7 @@ module.exports.init = async app => { _from: envelope.from, _header_from: allHeadersParsed.From, _header_to: allHeadersParsed.To, - _message_id: allHeadersParsed['Message-ID'].replace('<', '').replace('>', ''), + _message_id: messageIdHeaderVal, _subject: subject, level: 5, _passed: 'Y', @@ -244,7 +245,7 @@ module.exports.init = async app => { _from: envelope.from, _header_from: allHeadersParsed.From, _header_to: allHeadersParsed.To, - _message_id: allHeadersParsed['Message-ID'].replace('<', '').replace('>', ''), + _message_id: messageIdHeaderVal, _subject: subject, level: 5, _zilter_error: err.message,