Skip to content

Commit

Permalink
fix: disable spamscanner until v7 released
Browse files Browse the repository at this point in the history
  • Loading branch information
titanism committed Dec 7, 2024
1 parent 86ad862 commit db0015f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 13 deletions.
15 changes: 11 additions & 4 deletions helpers/on-data-mx.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,8 @@ const { isIP } = require('node:net');
// https://github.com/nodemailer/smtp-server/issues/177

// TODO: block these file attachments in spam scanner
// .ade, .adp, .apk, .appx, .appxbundle, .bat, .cab, .chm, .cmd, .com, .cpl, .diagcab, .diagcfg, .diagpack, .dll, .dmg, .ex, .ex_, .exe, .hta, .img, .ins, .iso, .isp, .jar, .jnlp, .js, .jse, .lib, .lnk, .mde, .msc, .msi, .msix, .msixbundle, .msp, .mst, .nsh, .pif, .ps1, .scr, .sct, .shb, .sys, .vb, .vbe, .vbs, .vhd, .vxd, .wsc, .wsf, .wsh, .xll
// (.7z?, .z?)
const SpamScanner = require('spamscanner');
// .z, .ade, .adp, .apk, .appx, .appxbundle, .bat, .cab, .chm, .cmd, .com, .cpl, .diagcab, .diagcfg, .diagpack, .dll, .dmg, .ex, .ex_, .exe, .hta, .img, .ins, .iso, .isp, .jar, .jnlp, .js, .jse, .lib, .lnk, .mde, .msc, .msi, .msix, .msixbundle, .msp, .mst, .nsh, .pif, .ps1, .scr, .sct, .shb, .sys, .vb, .vbe, .vbs, .vhd, .vxd, .wsc, .wsf, .wsh, .xll
// const SpamScanner = require('spamscanner');

// TODO: integrate ASN check and reputation check into spam scanner

Expand Down Expand Up @@ -83,6 +82,8 @@ const HOSTNAME = os.hostname();

const srs = new SRS(config.srs);

/*
// TODO: re-enable spam scanner once v7 released
const scanner = new SpamScanner({
logger,
clamscan: config.env === 'test',
Expand All @@ -97,6 +98,7 @@ const scanner = new SpamScanner({
size: Math.floor(bytes('0.5GB') / 253)
}
});
*/

async function sendBounce(bounce, headers, session, sealedMessage) {
try {
Expand Down Expand Up @@ -1301,13 +1303,16 @@ async function onDataMX(raw, session, headers, body) {
if (silentBanned) return;
}

/*
// TODO: re-enable spam scanner once v7 released
const scan = await scanner.scan(raw);
// arbitrary tests (e.g. EICAR) always should throw
if (_.isArray(scan?.results?.arbitrary) && !_.isEmpty(scan.results.arbitrary))
throw new SMTPError(scan.results.arbitrary.join(' '), {
responseCode: 554
});
*/

//
// NOTE: however the other spamscanner tests including these should be on a per-domain basis
Expand All @@ -1326,7 +1331,9 @@ async function onDataMX(raw, session, headers, body) {
await updateMXHeaders(session, headers, body);

// this is the core logic that determines where to forward and deliver emails to
const data = await getRecipients.call(this, session, scan);
// TODO: re-enable spam scanner once v7 released
// const data = await getRecipients.call(this, session, scan);
const data = await getRecipients.call(this, session);

// return early if necessary (e.g. all recipients were silent banned)
if (
Expand Down
9 changes: 0 additions & 9 deletions mx-server.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,6 @@ const MAX_BYTES = bytes(env.SMTP_MESSAGE_MAX_SIZE);
// and replace with catch (err) for onData to detect and store counter
// based off err.name detected or if it was combined then err.errors

// TODO: we probably should disable spam scanner
// TODO: we probably should disable spam scanner
// TODO: we probably should disable spam scanner
// TODO: we probably should disable spam scanner
// TODO: we probably should disable spam scanner
// TODO: we probably should disable spam scanner
// TODO: we probably should disable spam scanner
// TODO: we probably should disable spam scanner
// TODO: we probably should disable spam scanner
class MX {
constructor(options = {}) {
this.client = options.client;
Expand Down

0 comments on commit db0015f

Please sign in to comment.