Skip to content

Commit

Permalink
fix: fixed typos and missing arg bugs for MX
Browse files Browse the repository at this point in the history
  • Loading branch information
titanism committed Dec 8, 2024
1 parent c3fc980 commit a10fd32
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
3 changes: 1 addition & 2 deletions helpers/get-attributes.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ async function getAttributes(headers, session, resolver, isAligned = false) {
session.originalFromAddressRootDomain
];

// TODO: this is null it seems
const replyTo = [
// check the Reply-To header
...replyToAddresses.map((addr) => checkSRS(addr.address).toLowerCase()),
Expand Down Expand Up @@ -95,7 +94,7 @@ async function getAttributes(headers, session, resolver, isAligned = false) {
// if any Reply-To has SPF pass (or) DKIM alignment then push _all_ of the addresses
//
let hasAlignedReplyTo = false;
for (const sender of replyToAddresses) {
for (const sender of replyTo) {
if (
session?.signingDomains?.size > 0 &&
(session.signingDomains.has(
Expand Down
8 changes: 6 additions & 2 deletions helpers/is-arbitrary.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const REGEX_PASSWORD_MALWARE_INFECTED_VIDEO = new RE2(

// TODO: remove yum here and wrap these with spaces or something
const REGEX_SYSADMIN_SUBJECT = new RE2(
/docker|system events|monit alert|cron|yum|exim|backup|logwatch|unattended-upgrades/im
/docker|graylog|digest|event notification|event alert|system events|monit alert|cron|yum|sendmail|exim|backup|logwatch|unattended-upgrades/im
);

/*
Expand Down Expand Up @@ -216,7 +216,11 @@ function isArbitrary(session, headers, bodyStr) {
// therefore we check for those cases with a simple regular expression against the Subject line
// and if the SPF policy was not strictly failing, then it's probably a legitimate message
//
if (!session.hasSameHostnameAsFrom && !session.hadAlignedAndPassingDKIM) {
if (
!session.hasSameHostnameAsFrom &&
!session.hadAlignedAndPassingDKIM &&
!session.isAllowlisted
) {
const hasSameRcptToAsFrom = session.envelope.rcptTo.some(
(to) =>
parseRootDomain(parseHostFromDomainOrAddress(checkSRS(to.address))) ===
Expand Down
2 changes: 1 addition & 1 deletion helpers/on-data-mx.js
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@ async function processBounces(headers, bounces, session, sealedMessage) {
// (note that we keep track of bounces we sent via fingerprint in order to prevent dups on SMTP retries)
//
await pMapSeries(uniqueBounces, (bounce) =>
sendBounce.call(this, bounce, headers, sealedMessage)
sendBounce.call(this, bounce, headers, session, sealedMessage)
);
} catch (err) {
logger.warn(err, { session });
Expand Down

0 comments on commit a10fd32

Please sign in to comment.