spamscanner 7.0.7 → 7.0.9
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/arf.cjs +1 -1
- package/dist/cjs/arf.cjs.map +2 -2
- package/dist/cjs/index.cjs +77 -29
- package/dist/cjs/index.cjs.map +3 -3
- package/dist/esm/arf.js +1 -1
- package/dist/esm/arf.js.map +2 -2
- package/dist/esm/cli.js +72 -25
- package/dist/esm/cli.js.map +3 -3
- package/dist/esm/index.js +74 -26
- package/dist/esm/index.js.map +3 -3
- package/dist/types/index.d.ts +13 -3
- package/dist/types/parse.d.ts +12 -1
- package/dist/types/tokenizer.d.ts +3 -2
- package/package.json +1 -1
package/dist/types/index.d.ts
CHANGED
|
@@ -72,13 +72,16 @@ export class SpamScanner {
|
|
|
72
72
|
* a header field ("Name: value", or an mbox "From " line) is read as the
|
|
73
73
|
* body of a message with no header, so its text is the input; other
|
|
74
74
|
* input mailparser cannot read gives a message with no text. Other errors
|
|
75
|
-
* are thrown.
|
|
75
|
+
* are thrown. `error` is the parser's limit the message exceeds, so that
|
|
76
|
+
* only its first parts were read (as scan() reports it, see parseError),
|
|
77
|
+
* or null.
|
|
76
78
|
* @param {Buffer|string|Uint8Array|AsyncIterable} source
|
|
77
|
-
* @returns {Promise<{raw: Buffer, mail: object}>}
|
|
79
|
+
* @returns {Promise<{raw: Buffer, mail: object, error: string|null}>}
|
|
78
80
|
*/
|
|
79
81
|
parse(source: Buffer | string | Uint8Array | AsyncIterable<any>): Promise<{
|
|
80
82
|
raw: Buffer;
|
|
81
83
|
mail: object;
|
|
84
|
+
error: string | null;
|
|
82
85
|
}>;
|
|
83
86
|
/**
|
|
84
87
|
* Classifier features of a parsed message.
|
|
@@ -471,6 +474,13 @@ export type ScanDetails = {
|
|
|
471
474
|
filename: string;
|
|
472
475
|
reason: string;
|
|
473
476
|
}>;
|
|
477
|
+
/**
|
|
478
|
+
* - attached messages not opened, past the limits attached messages are read within (nested more than 3 deep, more than 100 attachments in them, or more than 25 MB of them), whose attachments were not inspected: not scored, as forwarded messages can be nested so
|
|
479
|
+
*/
|
|
480
|
+
unopenedAttachments: Array<{
|
|
481
|
+
filename: string;
|
|
482
|
+
reason: string;
|
|
483
|
+
}>;
|
|
474
484
|
/**
|
|
475
485
|
* - whether text beyond phishing.maxLength was not read for links
|
|
476
486
|
*/
|
|
@@ -509,7 +519,7 @@ import { ReputationChecker } from './reputation.js';
|
|
|
509
519
|
import { LLMClassifier } from './llm.js';
|
|
510
520
|
import { Buffer } from 'node:buffer';
|
|
511
521
|
import { getFeatures } from './tokenizer.js';
|
|
512
|
-
export { getFeatures, segmentWords } from "./tokenizer.js";
|
|
522
|
+
export { getFeatures, segmentWords, unwrapLink } from "./tokenizer.js";
|
|
513
523
|
export { LLMClassifier, PROVIDERS } from "./llm.js";
|
|
514
524
|
export { DEFAULT_SCORES, scoreResults } from "./score.js";
|
|
515
525
|
export { spamHeaders, rewriteMessage } from "./headers.js";
|
package/dist/types/parse.d.ts
CHANGED
|
@@ -19,6 +19,17 @@ export function boundedForAuth(raw: Buffer): {
|
|
|
19
19
|
raw: Buffer;
|
|
20
20
|
fromCut: boolean;
|
|
21
21
|
};
|
|
22
|
+
/**
|
|
23
|
+
* Whether an attachment is an attached message: message/rfc822, or
|
|
24
|
+
* message/global (RFC 6532, the same with UTF-8 in its header), by type or
|
|
25
|
+
* by file name (.eml, .u8msg).
|
|
26
|
+
* @param {{contentType?: string, filename?: string}} attachment - as mailparser gives it
|
|
27
|
+
* @returns {boolean}
|
|
28
|
+
*/
|
|
29
|
+
export function isAttachedMessage(attachment: {
|
|
30
|
+
contentType?: string;
|
|
31
|
+
filename?: string;
|
|
32
|
+
}): boolean;
|
|
22
33
|
/**
|
|
23
34
|
* The simpleParser of mailparser on a message it can finish (see finishable),
|
|
24
35
|
* settled within `timeout`: a parse that has not settled by then is stopped
|
|
@@ -95,7 +106,7 @@ export function parseWithin(raw: Buffer, parse?: (raw: Buffer, options: {
|
|
|
95
106
|
* @param {(raw: Buffer) => Promise<object>} [parse] - for tests
|
|
96
107
|
* @returns {Promise<Array<object>>}
|
|
97
108
|
*/
|
|
98
|
-
export function expandAttachments(attachments?: Array<object>, errors?: string[], parse?: (raw: Buffer) => Promise<object
|
|
109
|
+
export function expandAttachments(attachments?: Array<object>, errors?: string[], parse?: (raw: Buffer) => Promise<object>, unopened?: any[]): Promise<Array<object>>;
|
|
99
110
|
/**
|
|
100
111
|
* DKIM-Signature fields mailauth reads of a message (see boundedForAuth): it
|
|
101
112
|
* checks every signature, hashing the body once for each body length (l=)
|
|
@@ -9,8 +9,9 @@
|
|
|
9
9
|
export function characterClass(ranges: number[][], flags?: string): RegExp;
|
|
10
10
|
/**
|
|
11
11
|
* The address a link goes to, as a URL: through a security gateway, the
|
|
12
|
-
* address it goes on to (see gatewayTarget), as many as
|
|
13
|
-
* one another
|
|
12
|
+
* address it goes on to (see gatewayTarget), as many as MAX_GATEWAYS
|
|
13
|
+
* wrapped in one another (past them, the gateway link it got to); or null for
|
|
14
|
+
* an address that is no URL.
|
|
14
15
|
* @param {string} address
|
|
15
16
|
* @returns {URL|null}
|
|
16
17
|
*/
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "spamscanner",
|
|
3
3
|
"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.",
|
|
4
|
-
"version": "7.0.
|
|
4
|
+
"version": "7.0.9",
|
|
5
5
|
"author": "Forward Email (https://forwardemail.net)",
|
|
6
6
|
"bin": {
|
|
7
7
|
"spamscanner": "./dist/esm/cli.js"
|