spamscanner 7.0.2 → 7.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/index.cjs +9 -6
- package/dist/cjs/index.cjs.map +2 -2
- package/dist/esm/cli.js +9 -6
- package/dist/esm/cli.js.map +2 -2
- package/dist/esm/index.js +9 -6
- package/dist/esm/index.js.map +2 -2
- package/dist/standalone/cli.cjs +4 -4
- package/dist/types/index.d.ts +1 -0
- package/package.json +1 -1
package/dist/esm/index.js
CHANGED
|
@@ -1794,7 +1794,7 @@ function sniff(buffer) {
|
|
|
1794
1794
|
const at = (offset, bytes) => buffer.length >= offset + bytes.length && bytes.every((byte, i) => buffer[offset + i] === byte);
|
|
1795
1795
|
const ascii = (offset, text) => at(offset, [...Buffer.from(text, "latin1")]);
|
|
1796
1796
|
const result = (type, executable = false) => ({ type, executable, archive: ARCHIVE_TYPES.has(type) });
|
|
1797
|
-
if (ascii(0, "MZ")) {
|
|
1797
|
+
if (ascii(0, "MZ") && buffer.length >= 64 && at(buffer.readUInt32LE(60), [80, 69, 0, 0])) {
|
|
1798
1798
|
return result("exe", true);
|
|
1799
1799
|
}
|
|
1800
1800
|
if (at(0, [127, 69, 76, 70])) {
|
|
@@ -1980,10 +1980,11 @@ function inspectAttachments(attachments = []) {
|
|
|
1980
1980
|
if (parts.length >= 3 && EXECUTABLE_EXTENSIONS.has(extension) && DOCUMENT_EXTENSIONS.has(parts.at(-2))) {
|
|
1981
1981
|
add("double_extension", `Attachment "${name}" has a document extension followed by a program extension`, { extension });
|
|
1982
1982
|
}
|
|
1983
|
-
|
|
1983
|
+
const byName = EXECUTABLE_EXTENSIONS.has(extension) && !MACRO_EXTENSIONS.has(extension);
|
|
1984
|
+
if (detected?.executable && (detected.type !== "script" || !byName)) {
|
|
1985
|
+
add(extension && !EXECUTABLE_EXTENSIONS.has(extension) ? "disguised_executable" : "executable", `Attachment "${name}" contains a program (${detected.type})${extension && extension !== detected.type ? ` but is named .${extension}` : ""}`, { extension: detected.type });
|
|
1986
|
+
} else if (byName) {
|
|
1984
1987
|
add("executable", `Attachment "${name}" is a file type that runs code (.${extension})`, { extension });
|
|
1985
|
-
} else if (detected?.executable) {
|
|
1986
|
-
add(extension && !EXECUTABLE_EXTENSIONS.has(extension) ? "disguised_executable" : "executable", `Attachment "${name}" contains a program (${detected.type})${extension ? ` but is named .${extension}` : ""}`, { extension: detected.type });
|
|
1987
1988
|
}
|
|
1988
1989
|
if (!content) {
|
|
1989
1990
|
if (MACRO_EXTENSIONS.has(extension)) {
|
|
@@ -4847,7 +4848,7 @@ function scoreResults(results = {}, options = {}) {
|
|
|
4847
4848
|
var package_default = {
|
|
4848
4849
|
name: "spamscanner",
|
|
4849
4850
|
description: "Spam, phishing and malware filter for email in any language: a trainable classifier, link and attachment checks, SPF/DKIM/DMARC, and an optional AI second opinion from any LLM, including local Ollama models. Works as a library, CLI, Postfix milter or HTTP API.",
|
|
4850
|
-
version: "7.0.
|
|
4851
|
+
version: "7.0.3",
|
|
4851
4852
|
author: "Forward Email (https://forwardemail.net)",
|
|
4852
4853
|
bin: {
|
|
4853
4854
|
spamscanner: "./dist/esm/cli.js"
|
|
@@ -6526,7 +6527,7 @@ var SpamScanner = class {
|
|
|
6526
6527
|
message: `Link domain ${value} is listed in ${zone}`
|
|
6527
6528
|
}));
|
|
6528
6529
|
}
|
|
6529
|
-
return { phishing, homographs };
|
|
6530
|
+
return { phishing, homographs, uncheckedHosts: seenHosts.size - checked.length };
|
|
6530
6531
|
}
|
|
6531
6532
|
async scanViruses(mail, config) {
|
|
6532
6533
|
const settings = config.clamav === true ? {} : config.clamav;
|
|
@@ -6713,6 +6714,8 @@ ${typeof mail.text === "string" ? mail.text : ""}`, { maxLength: config.maxLengt
|
|
|
6713
6714
|
// Grouped as in earlier versions.
|
|
6714
6715
|
executables: attachments.filter((item) => ["executable", "disguised_executable", "double_extension", "rtl_override", "executable_in_archive"].includes(item.type)),
|
|
6715
6716
|
macros: attachments.filter((item) => ["macro", "pdf_active", "rtf_object"].includes(item.type)),
|
|
6717
|
+
// Link hosts beyond phishing.maxHosts, which were not looked up.
|
|
6718
|
+
uncheckedHosts: links.uncheckedHosts,
|
|
6716
6719
|
idnHomographAttack: {
|
|
6717
6720
|
detected: links.homographs.length > 0,
|
|
6718
6721
|
domains: links.homographs,
|