spamscanner 7.0.6 → 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.
- package/dist/cjs/arf.cjs.map +1 -1
- package/dist/cjs/index.cjs +197 -45
- package/dist/cjs/index.cjs.map +3 -3
- package/dist/esm/arf.js.map +1 -1
- package/dist/esm/cli.js +184 -33
- package/dist/esm/cli.js.map +3 -3
- package/dist/esm/index.js +186 -34
- package/dist/esm/index.js.map +3 -3
- package/dist/types/dnsbl.d.ts +19 -3
- package/dist/types/index.d.ts +13 -3
- package/dist/types/parse.d.ts +1 -1
- package/dist/types/tokenizer.d.ts +2 -1
- package/package.json +1 -1
package/dist/types/dnsbl.d.ts
CHANGED
|
@@ -1,4 +1,19 @@
|
|
|
1
1
|
export function isLookupName(name: any): boolean;
|
|
2
|
+
/**
|
|
3
|
+
* The name a link host is looked up as. The URL parser keeps characters no
|
|
4
|
+
* host name has ("!", ",", "{", "~" and more, also from "%2C") and empty or
|
|
5
|
+
* long labels; such a name cannot be looked up, but Cloudflare's resolvers
|
|
6
|
+
* block a name by its parent domains too (and so would a mail client's
|
|
7
|
+
* resolver), so it is looked up as its longest suffix of labels that can be,
|
|
8
|
+
* at most 253 characters: "x!y.evil.example" as "evil.example". Dots it ends
|
|
9
|
+
* with, however many, are left out ("evil.example..." is evil.example), and
|
|
10
|
+
* a name in Unicode is looked up in ASCII. Null when that leaves no label, or
|
|
11
|
+
* only a public suffix ("com", "co.uk", "github.io"), and for an address.
|
|
12
|
+
* In linear time.
|
|
13
|
+
* @param {string} host
|
|
14
|
+
* @returns {string|null}
|
|
15
|
+
*/
|
|
16
|
+
export function lookupName(host: string): string | null;
|
|
2
17
|
/**
|
|
3
18
|
* An IP address as blocklists and allowlists know it: without an IPv6 zone
|
|
4
19
|
* ("fe80::1%eth0"), and an IPv4 address mapped into IPv6 ("::ffff:192.0.2.1",
|
|
@@ -120,9 +135,10 @@ export class DnsChecker {
|
|
|
120
135
|
answers: string[];
|
|
121
136
|
}>>;
|
|
122
137
|
/**
|
|
123
|
-
* Ask Cloudflare's filtering resolvers about host names
|
|
124
|
-
*
|
|
125
|
-
* resolver is "
|
|
138
|
+
* Ask Cloudflare's filtering resolvers about host names, each by the name
|
|
139
|
+
* it is looked up as (see lookupName), once; the findings name it. A name
|
|
140
|
+
* blocked by the malware resolver is "malware"; one blocked only by the
|
|
141
|
+
* family resolver is "adult". The hosts that got no answer (from the malware
|
|
126
142
|
* resolver, or from the family resolver when asked) are listed in the
|
|
127
143
|
* result's (non-enumerable) `unanswered` property.
|
|
128
144
|
* @param {string[]} hosts
|
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
|
@@ -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
|
|
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=)
|
|
@@ -94,8 +94,9 @@ export function obfuscationOf(text: string, options?: {
|
|
|
94
94
|
* @returns {string}
|
|
95
95
|
*/
|
|
96
96
|
export function registrableDomain(host: string): string;
|
|
97
|
-
export function extractLinks(text: any, html: any, { maxLength }?: {
|
|
97
|
+
export function extractLinks(text: any, html: any, { maxLength, bareHosts }?: {
|
|
98
98
|
maxLength?: number;
|
|
99
|
+
bareHosts?: boolean;
|
|
99
100
|
}): any[];
|
|
100
101
|
/**
|
|
101
102
|
* The value of the first href attribute of a tag ("<a ...>"), or null:
|
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.8",
|
|
5
5
|
"author": "Forward Email (https://forwardemail.net)",
|
|
6
6
|
"bin": {
|
|
7
7
|
"spamscanner": "./dist/esm/cli.js"
|