spamscanner 7.0.7 → 7.0.8

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.
@@ -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";
@@ -95,7 +95,7 @@ export function parseWithin(raw: Buffer, parse?: (raw: Buffer, options: {
95
95
  * @param {(raw: Buffer) => Promise<object>} [parse] - for tests
96
96
  * @returns {Promise<Array<object>>}
97
97
  */
98
- export function expandAttachments(attachments?: Array<object>, errors?: string[], parse?: (raw: Buffer) => Promise<object>): Promise<Array<object>>;
98
+ export function expandAttachments(attachments?: Array<object>, errors?: string[], parse?: (raw: Buffer) => Promise<object>, unopened?: any[]): Promise<Array<object>>;
99
99
  /**
100
100
  * DKIM-Signature fields mailauth reads of a message (see boundedForAuth): it
101
101
  * checks every signature, hashing the body once for each body length (l=)
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.7",
4
+ "version": "7.0.8",
5
5
  "author": "Forward Email (https://forwardemail.net)",
6
6
  "bin": {
7
7
  "spamscanner": "./dist/esm/cli.js"