-
Notifications
You must be signed in to change notification settings - Fork 130
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: fixed trash check, added spam check for common spam pattern
- Loading branch information
Showing
3 changed files
with
41 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,6 +16,8 @@ const logger = require('#helpers/logger'); | |
const parseHostFromDomainOrAddress = require('#helpers/parse-host-from-domain-or-address'); | ||
const parseRootDomain = require('#helpers/parse-root-domain'); | ||
|
||
const REGEX_WARMUP = new RE2(/ \|(?: [a-zA-Z\d]{7,}){2}$/); | ||
|
||
const REGEX_BLOCKED_PHRASES = new RE2( | ||
/recorded you|you've been hacked|account is hacked|personal data has leaked/im | ||
); | ||
|
@@ -272,6 +274,15 @@ function isArbitrary(session, headers) { | |
// (and the From is [email protected] and the To is [email protected], but the Reply-To needs to be different) | ||
// (otherwise the spammer/attacker would never get the response to the email) | ||
// | ||
|
||
// | ||
// NOTE: it appears that IP warmup or spoofing is occurring where the pattern is: | ||
// `Subject: Some Phrase Here | 72X8FMN 2MAX439` | ||
// 72X8FMN 9RR6V1T | ||
// ^ 7 chars ^ 7 chars (A-Z 0-9) | ||
if (subject && REGEX_WARMUP.test(subject)) { | ||
throw new SMTPError('Spam', { responseCode: 421 }); | ||
} | ||
} | ||
|
||
module.exports = isArbitrary; |