@acepaste/ingress 0.0.0-stage → 0.7.0
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/LICENSE +105 -0
- package/README.md +15 -2
- package/dist/src/acepaste-alphabet.d.ts +26 -0
- package/dist/src/acepaste-alphabet.js +47 -0
- package/dist/src/acquire.d.ts +24 -0
- package/dist/src/acquire.js +146 -0
- package/dist/src/adapters.d.ts +30 -0
- package/dist/src/adapters.js +160 -0
- package/dist/src/character.d.ts +22 -0
- package/dist/src/character.js +291 -0
- package/dist/src/cli.d.ts +2 -0
- package/dist/src/cli.js +63 -0
- package/dist/src/color.d.ts +26 -0
- package/dist/src/color.js +111 -0
- package/dist/src/engine.d.ts +108 -0
- package/dist/src/engine.js +612 -0
- package/dist/src/evidence.d.ts +21 -0
- package/dist/src/evidence.js +77 -0
- package/dist/src/index.d.ts +26 -0
- package/dist/src/index.js +19 -0
- package/dist/src/meaning.d.ts +28 -0
- package/dist/src/meaning.js +226 -0
- package/dist/src/netpolicy.d.ts +34 -0
- package/dist/src/netpolicy.js +122 -0
- package/dist/src/normalize.d.ts +34 -0
- package/dist/src/normalize.js +204 -0
- package/dist/src/policyfile.d.ts +2 -0
- package/dist/src/policyfile.js +50 -0
- package/dist/src/sandbox.d.ts +45 -0
- package/dist/src/sandbox.js +231 -0
- package/dist/src/script.d.ts +23 -0
- package/dist/src/script.js +220 -0
- package/dist/src/secrets.d.ts +24 -0
- package/dist/src/secrets.js +192 -0
- package/dist/src/supplychain.d.ts +24 -0
- package/dist/src/supplychain.js +182 -0
- package/dist/src/taint.d.ts +37 -0
- package/dist/src/taint.js +39 -0
- package/dist/src/types.d.ts +176 -0
- package/dist/src/types.js +25 -0
- package/dist/src/visibility.d.ts +41 -0
- package/dist/src/visibility.js +424 -0
- package/package.json +64 -4
|
@@ -0,0 +1,291 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Character pass (AcePaste lineage).
|
|
3
|
+
*
|
|
4
|
+
* The hostile-invisible alphabet is ported verbatim from the production
|
|
5
|
+
* AcePaste cleaner (see acepaste-alphabet.ts), so the gate strips exactly
|
|
6
|
+
* what the web tool and the Chrome extension strip. On top of that shared
|
|
7
|
+
* set, the gate adds script-aware exceptions: zero-width joiners inside
|
|
8
|
+
* emoji sequences and Indic/Arabic text, zero-width non-joiners in complex
|
|
9
|
+
* scripts, and bidirectional marks (not overrides or isolates) inside
|
|
10
|
+
* right-to-left runs are legitimate and left in place; and it adds the
|
|
11
|
+
* decode-and-rescan behavior the gate needs that the cleaner does not.
|
|
12
|
+
*/
|
|
13
|
+
import { decodePayloads } from "./normalize.js";
|
|
14
|
+
export { countHostileInvisibles } from "./acepaste-alphabet.js";
|
|
15
|
+
const TAG_RANGE = /[\u{E0000}-\u{E007F}]/gu;
|
|
16
|
+
// AcePaste basic-plane invisibles minus the code points with dedicated handling below
|
|
17
|
+
// (ZWJ/ZWNJ script-aware, LRM/RLM bidi-mark-aware, bidi overrides, variation selectors).
|
|
18
|
+
const ZERO_WIDTH = /[\u00AD\u034F\u061C\u115F\u1160\u17B4\u17B5\u180E\u200B\u2060-\u206F\u2800\u3164\uFEFF\uFFA0]/g;
|
|
19
|
+
const ZWJ = "";
|
|
20
|
+
const ZWNJ = "";
|
|
21
|
+
const BIDI_OVERRIDE_ISOLATE = /[--]/g; // embeddings, overrides, isolates: never legitimate in plain text intake
|
|
22
|
+
const BIDI_MARKS = /[]/g; // LRM, RLM, ALM: legitimate in RTL text
|
|
23
|
+
const VARIATION_SELECTORS = /[︀-️]|[\u{E0100}-\u{E01EF}]/gu;
|
|
24
|
+
const EMOJI_ADJ = /\p{Extended_Pictographic}|[\u{1F3FB}-\u{1F3FF}]|️/u;
|
|
25
|
+
const INDIC_OR_ARABIC = /[-ۿݐ-ݿࢠ-ࣿऀ-က-႟ក-]/u;
|
|
26
|
+
const RTL_SCRIPT = /[--ۿݐ-ݿࢠ-ࣿיִ-﷿ﹰ-]/u;
|
|
27
|
+
// Minimal confusable table: Cyrillic/Greek letters that render like Latin.
|
|
28
|
+
const CONFUSABLE = {
|
|
29
|
+
"а": "a", "е": "e", "о": "o", "р": "p", "с": "c", "у": "y", "х": "x",
|
|
30
|
+
"і": "i", "ј": "j", "һ": "h", "ԁ": "d", "ԛ": "q", "ѕ": "s",
|
|
31
|
+
"Α": "A", "Β": "B", "Ε": "E", "Η": "H", "Ι": "I", "Κ": "K", "Μ": "M",
|
|
32
|
+
"Ν": "N", "Ο": "O", "Ρ": "P", "Τ": "T", "Υ": "Y", "Χ": "X", "ο": "o",
|
|
33
|
+
"А": "A", "В": "B", "Е": "E", "К": "K", "М": "M", "Н": "H", "О": "O",
|
|
34
|
+
"Р": "P", "С": "C", "Т": "T", "Х": "X",
|
|
35
|
+
};
|
|
36
|
+
function excerptAround(text, idx, span = 40) {
|
|
37
|
+
return text.slice(Math.max(0, idx - span), idx + span).replace(/[\p{Cf}\p{Mn}]/gu, "�");
|
|
38
|
+
}
|
|
39
|
+
export function scanCharacters(text) {
|
|
40
|
+
const findings = [];
|
|
41
|
+
const decodedPayloads = [];
|
|
42
|
+
let cleaned = text;
|
|
43
|
+
// 0. Lone surrogates: never legitimate; replace so downstream re-encoding cannot mangle them
|
|
44
|
+
const lone = cleaned.match(/[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?<![\uD800-\uDBFF])[\uDC00-\uDFFF]/g);
|
|
45
|
+
if (lone)
|
|
46
|
+
cleaned = cleaned.replace(/[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?<![\uD800-\uDBFF])[\uDC00-\uDFFF]/g, "\uFFFD");
|
|
47
|
+
// 1. Unicode tag characters: the flagship vector. Decode what they spell.
|
|
48
|
+
const tags = [...text.matchAll(TAG_RANGE)];
|
|
49
|
+
if (tags.length) {
|
|
50
|
+
const spelled = tags
|
|
51
|
+
.map((m) => {
|
|
52
|
+
const cp = m[0].codePointAt(0);
|
|
53
|
+
return cp >= 0xe0020 && cp <= 0xe007e ? String.fromCodePoint(cp - 0xe0000) : "";
|
|
54
|
+
})
|
|
55
|
+
.join("");
|
|
56
|
+
findings.push({
|
|
57
|
+
pass: "character",
|
|
58
|
+
kind: "unicode.tag_characters",
|
|
59
|
+
confidence: 0.98,
|
|
60
|
+
severity: 0.95,
|
|
61
|
+
message: `${tags.length} Unicode Plane 14 tag characters spelling hidden ASCII`,
|
|
62
|
+
excerpt: spelled.slice(0, 200),
|
|
63
|
+
location: `offset ${tags[0].index}`,
|
|
64
|
+
action: "neutralized",
|
|
65
|
+
});
|
|
66
|
+
if (spelled.trim())
|
|
67
|
+
decodedPayloads.push(spelled);
|
|
68
|
+
cleaned = cleaned.replace(TAG_RANGE, "");
|
|
69
|
+
}
|
|
70
|
+
// 2. Bidirectional overrides and isolates: never legitimate here.
|
|
71
|
+
const bidi = [...cleaned.matchAll(BIDI_OVERRIDE_ISOLATE)];
|
|
72
|
+
if (bidi.length) {
|
|
73
|
+
findings.push({
|
|
74
|
+
pass: "character",
|
|
75
|
+
kind: "unicode.bidi_control",
|
|
76
|
+
confidence: 0.9,
|
|
77
|
+
severity: 0.7,
|
|
78
|
+
message: `${bidi.length} bidirectional override/isolate controls (Trojan Source class)`,
|
|
79
|
+
excerpt: excerptAround(cleaned, bidi[0].index),
|
|
80
|
+
location: `offset ${bidi[0].index}`,
|
|
81
|
+
action: "neutralized",
|
|
82
|
+
});
|
|
83
|
+
cleaned = cleaned.replace(BIDI_OVERRIDE_ISOLATE, "");
|
|
84
|
+
}
|
|
85
|
+
// bidi marks outside any right-to-left run are suspicious; inside one they are normal
|
|
86
|
+
const marks = [...cleaned.matchAll(BIDI_MARKS)];
|
|
87
|
+
const strayMarks = marks.filter((m) => !RTL_SCRIPT.test(cleaned.slice(Math.max(0, m.index - 24), m.index + 24)));
|
|
88
|
+
if (strayMarks.length >= 3) {
|
|
89
|
+
findings.push({
|
|
90
|
+
pass: "character",
|
|
91
|
+
kind: "unicode.bidi_control",
|
|
92
|
+
confidence: 0.6,
|
|
93
|
+
severity: 0.4,
|
|
94
|
+
message: `${strayMarks.length} bidirectional marks outside any right-to-left text`,
|
|
95
|
+
location: `offset ${strayMarks[0].index}`,
|
|
96
|
+
action: "neutralized",
|
|
97
|
+
});
|
|
98
|
+
for (const m of strayMarks.reverse())
|
|
99
|
+
cleaned = cleaned.slice(0, m.index) + cleaned.slice(m.index + 1);
|
|
100
|
+
}
|
|
101
|
+
// 3. Zero-width characters, script-aware.
|
|
102
|
+
const zw = [...cleaned.matchAll(ZERO_WIDTH)];
|
|
103
|
+
const joinerStray = [];
|
|
104
|
+
for (let i = 0; i < cleaned.length; i++) {
|
|
105
|
+
const ch = cleaned[i];
|
|
106
|
+
if (ch !== ZWJ && ch !== ZWNJ)
|
|
107
|
+
continue;
|
|
108
|
+
const prev = cleaned.slice(Math.max(0, i - 2), i);
|
|
109
|
+
const next = cleaned.slice(i + 1, i + 3);
|
|
110
|
+
const emojiCtx = ch === ZWJ && (EMOJI_ADJ.test(prev) || EMOJI_ADJ.test(next));
|
|
111
|
+
const complexScriptCtx = INDIC_OR_ARABIC.test(prev) || INDIC_OR_ARABIC.test(next);
|
|
112
|
+
if (!emojiCtx && !complexScriptCtx)
|
|
113
|
+
joinerStray.push(i);
|
|
114
|
+
}
|
|
115
|
+
const total = zw.length + joinerStray.length;
|
|
116
|
+
if (total > 0) {
|
|
117
|
+
// density matters: a couple is a copy-paste artifact; dozens is a channel
|
|
118
|
+
const density = total / Math.max(1, cleaned.length);
|
|
119
|
+
const confidence = Math.min(0.97, 0.35 + Math.min(total, 40) / 50 + density * 50);
|
|
120
|
+
findings.push({
|
|
121
|
+
pass: "character",
|
|
122
|
+
kind: "unicode.zero_width",
|
|
123
|
+
confidence,
|
|
124
|
+
severity: total >= 8 ? 0.8 : 0.3,
|
|
125
|
+
message: `${total} zero-width characters outside emoji or complex-script context`,
|
|
126
|
+
excerpt: excerptAround(cleaned, zw[0]?.index ?? joinerStray[0]),
|
|
127
|
+
location: `offset ${zw[0]?.index ?? joinerStray[0]}`,
|
|
128
|
+
action: "neutralized",
|
|
129
|
+
});
|
|
130
|
+
// decode binary-channel smuggling (ZWSP/ZWNJ as bits) when dense
|
|
131
|
+
if (total >= 16) {
|
|
132
|
+
const bits = [...cleaned].filter((c) => c === "" || c === "").map((c) => (c === "" ? "0" : "1")).join("");
|
|
133
|
+
if (bits.length >= 16) {
|
|
134
|
+
let out = "";
|
|
135
|
+
for (let i = 0; i + 8 <= bits.length; i += 8)
|
|
136
|
+
out += String.fromCharCode(parseInt(bits.slice(i, i + 8), 2));
|
|
137
|
+
if (/^[\x20-\x7E\s]+$/.test(out))
|
|
138
|
+
decodedPayloads.push(out);
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
// single pass removal: indices in joinerStray refer to the string before any removal
|
|
142
|
+
const drop = new Set(joinerStray);
|
|
143
|
+
let out = "";
|
|
144
|
+
for (let i = 0; i < cleaned.length; i++) {
|
|
145
|
+
const ch = cleaned[i];
|
|
146
|
+
if (drop.has(i))
|
|
147
|
+
continue;
|
|
148
|
+
if (/[\u00AD\u034F\u061C\u115F\u1160\u17B4\u17B5\u180E\u200B\u2060-\u206F\u2800\u3164\uFEFF\uFFA0]/.test(ch))
|
|
149
|
+
continue;
|
|
150
|
+
out += ch;
|
|
151
|
+
}
|
|
152
|
+
cleaned = out;
|
|
153
|
+
}
|
|
154
|
+
// 3b. Whitespace channels (AcePaste FORMATTING_RE lineage). Unicode has a dozen spaces that render identically
|
|
155
|
+
// (en, em, thin, hair, figure, punctuation, narrow no-break, medium mathematical, ideographic) plus line and
|
|
156
|
+
// paragraph separators. One or two are typography; many, interleaved with ordinary spaces in Latin text, are a
|
|
157
|
+
// channel: the choice of space at each word gap carries a bit, which no human reader can see.
|
|
158
|
+
{
|
|
159
|
+
const ODD = /[\u2000-\u200A\u2028\u2029\u202F\u205F]/g;
|
|
160
|
+
// only look-alike spaces in a word gap count; typography is excluded: French spacing before ; : ! ? and inside « »,
|
|
161
|
+
// thousands separators between digits, and indentation (a space next to a line break or another space)
|
|
162
|
+
const odd = [...cleaned.matchAll(ODD)].filter((m) => {
|
|
163
|
+
const i = m.index, prev = cleaned[i - 1] ?? "", next = cleaned[i + 1] ?? "";
|
|
164
|
+
if (!prev || !next || /\s/.test(prev) || /\s/.test(next))
|
|
165
|
+
return false;
|
|
166
|
+
// a word-gap channel sits between letters; typeset maths, ranges and units put fine spaces next to symbols and digits
|
|
167
|
+
if (!/\p{L}/u.test(prev) || !/\p{L}/u.test(next))
|
|
168
|
+
return false;
|
|
169
|
+
if (/[;:!?»%€]/.test(next) || prev === "«")
|
|
170
|
+
return false;
|
|
171
|
+
if (/\d/.test(prev) && /\d/.test(next))
|
|
172
|
+
return false;
|
|
173
|
+
return true;
|
|
174
|
+
});
|
|
175
|
+
const cjk = /[\u3040-\u30FF\u3400-\u9FFF\uAC00-\uD7AF]/.test(cleaned);
|
|
176
|
+
const ideographic = cjk ? 0 : (cleaned.match(/\u3000/g) ?? []).length;
|
|
177
|
+
const n = odd.length + ideographic;
|
|
178
|
+
const kinds = new Set([...odd.map((m) => m[0]), ...(ideographic ? ["\u3000"] : [])]);
|
|
179
|
+
const asciiGaps = (cleaned.match(/(?<=\S) (?=\S)/g) ?? []).length;
|
|
180
|
+
if (n >= 8 && (kinds.size >= 2 || asciiGaps >= 4)) {
|
|
181
|
+
findings.push({
|
|
182
|
+
pass: "character", kind: "unicode.whitespace_channel",
|
|
183
|
+
confidence: Math.min(0.95, 0.5 + n / 60), severity: n >= 16 ? 0.75 : 0.45,
|
|
184
|
+
message: `${n} look-alike Unicode spaces (${kinds.size} kinds) mixed into ordinary word gaps: the choice of space can carry hidden bits`,
|
|
185
|
+
excerpt: excerptAround(cleaned, odd[0]?.index ?? 0), location: `offset ${odd[0]?.index ?? 0}`, action: "neutralized",
|
|
186
|
+
});
|
|
187
|
+
// decode: every word gap is a bit (ordinary space = 0, any look-alike = 1), read as 8-bit ASCII
|
|
188
|
+
const gaps = [...cleaned.matchAll(/(?<=\S)([ \u2000-\u200A\u202F\u205F\u3000])(?=\S)/g)].map((m) => (m[1] === " " ? "0" : "1")).join("");
|
|
189
|
+
for (const bits of [gaps, gaps.replace(/[01]/g, (b) => (b === "0" ? "1" : "0"))]) {
|
|
190
|
+
let out = "";
|
|
191
|
+
for (let i = 0; i + 8 <= bits.length; i += 8)
|
|
192
|
+
out += String.fromCharCode(parseInt(bits.slice(i, i + 8), 2));
|
|
193
|
+
if (out.length >= 4 && /^[\x20-\x7E]+$/.test(out) && /[a-z]{3}/i.test(out)) {
|
|
194
|
+
decodedPayloads.push(out);
|
|
195
|
+
break;
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
cleaned = cleaned.replace(ODD, " ").replace(cjk ? /$^/ : /\u3000/g, " ");
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
// 4. Variation-selector smuggling: runs of selectors not attached to a base that takes them.
|
|
202
|
+
const vsRuns = [...cleaned.matchAll(/(?:[︀-️]|[\u{E0100}-\u{E01EF}]){4,}/gu)];
|
|
203
|
+
if (vsRuns.length) {
|
|
204
|
+
const n = vsRuns.reduce((a, m) => a + [...m[0]].length, 0);
|
|
205
|
+
const bytes = vsRuns.flatMap((m) => [...m[0]].map((c) => {
|
|
206
|
+
const cp = c.codePointAt(0);
|
|
207
|
+
return cp <= 0xfe0f ? cp - 0xfe00 : cp - 0xe0100 + 16;
|
|
208
|
+
}));
|
|
209
|
+
const decoded = bytes.filter((b) => b >= 0x20 && b < 0x7f).slice(0, 100000).map((b) => String.fromCharCode(b)).join("");
|
|
210
|
+
findings.push({
|
|
211
|
+
pass: "character",
|
|
212
|
+
kind: "unicode.variation_selector_smuggling",
|
|
213
|
+
confidence: 0.92,
|
|
214
|
+
severity: 0.9,
|
|
215
|
+
message: `${n} chained variation selectors encoding ${bytes.length} bytes`,
|
|
216
|
+
excerpt: decoded.slice(0, 120),
|
|
217
|
+
location: `offset ${vsRuns[0].index}`,
|
|
218
|
+
action: "neutralized",
|
|
219
|
+
});
|
|
220
|
+
if (decoded.trim())
|
|
221
|
+
decodedPayloads.push(decoded);
|
|
222
|
+
cleaned = cleaned.replace(/(?:[︀-️]|[\u{E0100}-\u{E01EF}]){4,}/gu, "");
|
|
223
|
+
}
|
|
224
|
+
// 5. Mixed-script words: Latin letters sharing a word with letters of another script. Legitimate text does this rarely
|
|
225
|
+
// (brand names, transliteration glosses); injection spelled with look-alikes does it in every keyword.
|
|
226
|
+
const words = cleaned.match(/[\p{L}\p{M}]{3,}/gu) ?? [];
|
|
227
|
+
let confusableWords = 0;
|
|
228
|
+
let sample = "";
|
|
229
|
+
for (const w of words) {
|
|
230
|
+
const hasLatin = /\p{Script=Latin}/u.test(w);
|
|
231
|
+
if (!hasLatin)
|
|
232
|
+
continue;
|
|
233
|
+
const hasOther = /[^\p{Script=Latin}\p{Script=Common}\p{Script=Inherited}]/u.test(w);
|
|
234
|
+
if (hasOther) {
|
|
235
|
+
confusableWords++;
|
|
236
|
+
if (!sample)
|
|
237
|
+
sample = w;
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
if (confusableWords > 0) {
|
|
241
|
+
findings.push({
|
|
242
|
+
pass: "character",
|
|
243
|
+
kind: "unicode.mixed_script_confusable",
|
|
244
|
+
confidence: Math.min(0.9, 0.4 + confusableWords * 0.1),
|
|
245
|
+
severity: 0.5,
|
|
246
|
+
message: `${confusableWords} words mixing Latin with look-alike Cyrillic/Greek letters`,
|
|
247
|
+
excerpt: sample,
|
|
248
|
+
action: "neutralized",
|
|
249
|
+
});
|
|
250
|
+
cleaned = cleaned.replace(/[\p{L}\p{M}]{3,}/gu, (w) => /\p{Script=Latin}/u.test(w) ? [...w].map((c) => CONFUSABLE[c] ?? c).join("") : w);
|
|
251
|
+
}
|
|
252
|
+
// 5b. Full-width and mathematical alphanumeric look-alikes: ignore, 𝗶𝗴𝗻𝗼𝗿𝗲. Humans read them fine; tokenizers and keyword filters do not.
|
|
253
|
+
const fwRuns = cleaned.match(/[\uFF21-\uFF3A\uFF41-\uFF5A]{3,}|[\u{1D400}-\u{1D7FF}]{3,}|[\u24B6-\u24E9\u{1F130}-\u{1F189}]{3,}/gu) ?? [];
|
|
254
|
+
if (fwRuns.length) {
|
|
255
|
+
const folded = (t) => t.normalize("NFKC");
|
|
256
|
+
findings.push({
|
|
257
|
+
pass: "character", kind: "unicode.fullwidth_or_math_lookalike",
|
|
258
|
+
confidence: Math.min(0.85, 0.35 + fwRuns.length * 0.1), severity: 0.5,
|
|
259
|
+
message: `${fwRuns.length} runs of full-width, mathematical or enclosed letters standing in for Latin`,
|
|
260
|
+
excerpt: fwRuns.slice(0, 3).map(folded).join(" "), action: "neutralized",
|
|
261
|
+
});
|
|
262
|
+
cleaned = cleaned.replace(/[\uFF21-\uFF3A\uFF41-\uFF5A]+|[\u{1D400}-\u{1D7FF}]+|[\u24B6-\u24E9\u{1F130}-\u{1F189}]+/gu, (r) => r.normalize("NFKC"));
|
|
263
|
+
}
|
|
264
|
+
// 5c. Combining-mark floods (zalgo): more than 4 combining marks on one base is never legitimate text
|
|
265
|
+
const floods = cleaned.match(/[\p{M}]{5,}/gu) ?? [];
|
|
266
|
+
if (floods.length) {
|
|
267
|
+
findings.push({
|
|
268
|
+
pass: "character", kind: "unicode.combining_flood",
|
|
269
|
+
confidence: Math.min(0.9, 0.5 + floods.length * 0.1), severity: 0.4,
|
|
270
|
+
message: `${floods.length} combining-mark floods (${Math.max(...floods.map((f) => [...f].length))} marks on one base)`,
|
|
271
|
+
action: "neutralized",
|
|
272
|
+
});
|
|
273
|
+
cleaned = cleaned.replace(/([^\p{M}])[\p{M}]{5,}/gu, "$1");
|
|
274
|
+
}
|
|
275
|
+
// 6. Encoded payloads: base64 (incl. short and whitespace-split), base64url, base32, hex, char codes, binary, \u escapes.
|
|
276
|
+
const decoded = decodePayloads(cleaned);
|
|
277
|
+
for (const d of decoded)
|
|
278
|
+
decodedPayloads.push(d.text);
|
|
279
|
+
if (decoded.length) {
|
|
280
|
+
findings.push({
|
|
281
|
+
pass: "character",
|
|
282
|
+
kind: "unicode.encoded_payload",
|
|
283
|
+
confidence: 0.5,
|
|
284
|
+
severity: 0.4,
|
|
285
|
+
message: `${decoded.length} encoded blobs (${[...new Set(decoded.map((d) => d.scheme))].join(", ")}) decoded to readable text; rescanned by meaning pass`,
|
|
286
|
+
excerpt: decoded[0].text.slice(0, 120),
|
|
287
|
+
action: "none",
|
|
288
|
+
});
|
|
289
|
+
}
|
|
290
|
+
return { cleaned, findings, decodedPayloads };
|
|
291
|
+
}
|
package/dist/src/cli.js
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* ingress <url> gate a URL
|
|
4
|
+
* ingress --text < file gate text/HTML/markdown/JSON on stdin
|
|
5
|
+
* ingress --json ... emit the full result as JSON
|
|
6
|
+
* ingress --override ... deliver a suspect page the human asked for
|
|
7
|
+
* ingress --sandbox=always|escalate|off
|
|
8
|
+
* ingress --policy=file.json
|
|
9
|
+
* ingress --verify < receipt.json verify a receipt's digest and signature (INGRESS_VERIFY_PUBLIC_KEY=file.pem for ECDSA, INGRESS_SIGNING_KEY for HMAC)
|
|
10
|
+
* ingress --keygen print a new ECDSA P-256 key pair for receipt signing
|
|
11
|
+
*/
|
|
12
|
+
import { readFileSync } from "node:fs";
|
|
13
|
+
import { IngressEngine } from "./engine.js";
|
|
14
|
+
import { loadPolicyFile } from "./policyfile.js";
|
|
15
|
+
const args = process.argv.slice(2);
|
|
16
|
+
const flag = (n) => args.includes(`--${n}`);
|
|
17
|
+
const opt = (n) => args.find((a) => a.startsWith(`--${n}=`))?.split("=")[1];
|
|
18
|
+
const url = args.find((a) => /^https?:\/\//.test(a));
|
|
19
|
+
async function main() {
|
|
20
|
+
const chunksIn = async () => { const c = []; for await (const x of process.stdin)
|
|
21
|
+
c.push(x); return Buffer.concat(c).toString("utf8"); };
|
|
22
|
+
if (flag("keygen")) {
|
|
23
|
+
const k = IngressEngine.generateSigningKeys();
|
|
24
|
+
console.log(`# keyId ${k.keyId}\n# private key: keep secret; set INGRESS_SIGNING_PRIVATE_KEY_FILE to its path\n${k.privateKeyPem}\n# public key: publish; anyone can verify receipts with it\n${k.publicKeyPem}`);
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
if (flag("verify")) {
|
|
28
|
+
const r = JSON.parse(await chunksIn());
|
|
29
|
+
const pub = process.env.INGRESS_VERIFY_PUBLIC_KEY;
|
|
30
|
+
const key = r.signatureAlg === "ecdsa-p256-sha256" ? (pub && !pub.includes("BEGIN") ? readFileSync(pub, "utf8") : pub) : process.env.INGRESS_SIGNING_KEY;
|
|
31
|
+
console.log(JSON.stringify(IngressEngine.verifyReceipt(r, key), null, 2));
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
const cfg = opt("policy") ? loadPolicyFile(opt("policy")) : {};
|
|
35
|
+
if (flag("no-cloaking"))
|
|
36
|
+
cfg.cloakingCheck = false;
|
|
37
|
+
const sb = opt("sandbox");
|
|
38
|
+
if (sb === "always" || sb === "escalate" || sb === "off")
|
|
39
|
+
cfg.sandbox = sb;
|
|
40
|
+
if (process.env.INGRESS_SIGNING_KEY)
|
|
41
|
+
cfg.signingKey = process.env.INGRESS_SIGNING_KEY;
|
|
42
|
+
const pk = process.env.INGRESS_SIGNING_PRIVATE_KEY_FILE ? readFileSync(process.env.INGRESS_SIGNING_PRIVATE_KEY_FILE, "utf8") : process.env.INGRESS_SIGNING_PRIVATE_KEY;
|
|
43
|
+
if (pk)
|
|
44
|
+
cfg.signingPrivateKey = pk;
|
|
45
|
+
const engine = new IngressEngine(cfg);
|
|
46
|
+
const override = flag("override");
|
|
47
|
+
let result;
|
|
48
|
+
if (flag("text"))
|
|
49
|
+
result = await engine.scan(await chunksIn(), { override });
|
|
50
|
+
else if (url)
|
|
51
|
+
result = await engine.fetch(url, { override });
|
|
52
|
+
else {
|
|
53
|
+
console.error("usage: ingress <url> | ingress --text < file [--json] [--no-cloaking] [--override] [--sandbox=always|escalate|off] [--policy=file.json] | ingress --verify < receipt.json");
|
|
54
|
+
process.exit(2);
|
|
55
|
+
}
|
|
56
|
+
if (flag("json")) {
|
|
57
|
+
console.log(JSON.stringify(result, null, 2));
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
console.log(result.envelope);
|
|
61
|
+
console.error(`\n[timings] ${Object.entries(result.timings).map(([k, v]) => `${k}=${v.toFixed(1)}ms`).join(" ")}`);
|
|
62
|
+
}
|
|
63
|
+
main().catch((e) => { console.error(e); process.exit(1); });
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Colour parsing and contrast, for same-colour hiding (white on white, black
|
|
3
|
+
* on black, #fefefe on #fff, "snow" on "white"). Contrast is the WCAG 2
|
|
4
|
+
* ratio: 1 means identical, 21 is black on white. Text at or below the
|
|
5
|
+
* threshold is unreadable to a sighted human and is labeled hidden.
|
|
6
|
+
*/
|
|
7
|
+
export interface RGBA {
|
|
8
|
+
r: number;
|
|
9
|
+
g: number;
|
|
10
|
+
b: number;
|
|
11
|
+
a: number;
|
|
12
|
+
}
|
|
13
|
+
/** at or below this ratio text is treated as invisible against its background (WCAG body-text minimum is 4.5) */
|
|
14
|
+
export declare const INVISIBLE_CONTRAST = 1.25;
|
|
15
|
+
/** Parse a CSS colour value. Returns null for values that cannot be resolved statically (var(), currentcolor, gradients). */
|
|
16
|
+
export declare function parseColor(input: string): RGBA | null;
|
|
17
|
+
/** Composite `top` over an opaque `bottom`. */
|
|
18
|
+
export declare function blend(top: RGBA, bottom: RGBA): RGBA;
|
|
19
|
+
/** WCAG contrast ratio of text colour `fg` (alpha composited) over opaque `bg`. */
|
|
20
|
+
export declare function contrastRatio(fg: RGBA, bg: RGBA): number;
|
|
21
|
+
/** Pull colour declarations out of a style string. `bg` is null when the background is an image or gradient (unknown). */
|
|
22
|
+
export declare function colorsFromStyle(style: string): {
|
|
23
|
+
fg?: RGBA | null;
|
|
24
|
+
bg?: RGBA | null;
|
|
25
|
+
fill?: RGBA | null;
|
|
26
|
+
};
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Colour parsing and contrast, for same-colour hiding (white on white, black
|
|
3
|
+
* on black, #fefefe on #fff, "snow" on "white"). Contrast is the WCAG 2
|
|
4
|
+
* ratio: 1 means identical, 21 is black on white. Text at or below the
|
|
5
|
+
* threshold is unreadable to a sighted human and is labeled hidden.
|
|
6
|
+
*/
|
|
7
|
+
/** at or below this ratio text is treated as invisible against its background (WCAG body-text minimum is 4.5) */
|
|
8
|
+
export const INVISIBLE_CONTRAST = 1.25;
|
|
9
|
+
const NAMED = {
|
|
10
|
+
aliceblue: "f0f8ff", antiquewhite: "faebd7", aqua: "00ffff", aquamarine: "7fffd4", azure: "f0ffff", beige: "f5f5dc", bisque: "ffe4c4", black: "000000", blanchedalmond: "ffebcd", blue: "0000ff", blueviolet: "8a2be2", brown: "a52a2a", burlywood: "deb887", cadetblue: "5f9ea0", chartreuse: "7fff00", chocolate: "d2691e", coral: "ff7f50", cornflowerblue: "6495ed", cornsilk: "fff8dc", crimson: "dc143c", cyan: "00ffff", darkblue: "00008b", darkcyan: "008b8b", darkgoldenrod: "b8860b", darkgray: "a9a9a9", darkgreen: "006400", darkgrey: "a9a9a9", darkkhaki: "bdb76b", darkmagenta: "8b008b", darkolivegreen: "556b2f", darkorange: "ff8c00", darkorchid: "9932cc", darkred: "8b0000", darksalmon: "e9967a", darkseagreen: "8fbc8f", darkslateblue: "483d8b", darkslategray: "2f4f4f", darkslategrey: "2f4f4f", darkturquoise: "00ced1", darkviolet: "9400d3", deeppink: "ff1493", deepskyblue: "00bfff", dimgray: "696969", dimgrey: "696969", dodgerblue: "1e90ff", firebrick: "b22222", floralwhite: "fffaf0", forestgreen: "228b22", fuchsia: "ff00ff", gainsboro: "dcdcdc", ghostwhite: "f8f8ff", gold: "ffd700", goldenrod: "daa520", gray: "808080", green: "008000", greenyellow: "adff2f", grey: "808080", honeydew: "f0fff0", hotpink: "ff69b4", indianred: "cd5c5c", indigo: "4b0082", ivory: "fffff0", khaki: "f0e68c", lavender: "e6e6fa", lavenderblush: "fff0f5", lawngreen: "7cfc00", lemonchiffon: "fffacd", lightblue: "add8e6", lightcoral: "f08080", lightcyan: "e0ffff", lightgoldenrodyellow: "fafad2", lightgray: "d3d3d3", lightgreen: "90ee90", lightgrey: "d3d3d3", lightpink: "ffb6c1", lightsalmon: "ffa07a", lightseagreen: "20b2aa", lightskyblue: "87cefa", lightslategray: "778899", lightslategrey: "778899", lightsteelblue: "b0c4de", lightyellow: "ffffe0", lime: "00ff00", limegreen: "32cd32", linen: "faf0e6", magenta: "ff00ff", maroon: "800000", mediumaquamarine: "66cdaa", mediumblue: "0000cd", mediumorchid: "ba55d3", mediumpurple: "9370db", mediumseagreen: "3cb371", mediumslateblue: "7b68ee", mediumspringgreen: "00fa9a", mediumturquoise: "48d1cc", mediumvioletred: "c71585", midnightblue: "191970", mintcream: "f5fffa", mistyrose: "ffe4e1", moccasin: "ffe4b5", navajowhite: "ffdead", navy: "000080", oldlace: "fdf5e6", olive: "808000", olivedrab: "6b8e23", orange: "ffa500", orangered: "ff4500", orchid: "da70d6", palegoldenrod: "eee8aa", palegreen: "98fb98", paleturquoise: "afeeee", palevioletred: "db7093", papayawhip: "ffefd5", peachpuff: "ffdab9", peru: "cd853f", pink: "ffc0cb", plum: "dda0dd", powderblue: "b0e0e6", purple: "800080", rebeccapurple: "663399", red: "ff0000", rosybrown: "bc8f8f", royalblue: "4169e1", saddlebrown: "8b4513", salmon: "fa8072", sandybrown: "f4a460", seagreen: "2e8b57", seashell: "fff5ee", sienna: "a0522d", silver: "c0c0c0", skyblue: "87ceeb", slateblue: "6a5acd", slategray: "708090", slategrey: "708090", snow: "fffafa", springgreen: "00ff7f", steelblue: "4682b4", tan: "d2b48c", teal: "008080", thistle: "d8bfd8", tomato: "ff6347", turquoise: "40e0d0", violet: "ee82ee", wheat: "f5deb3", white: "ffffff", whitesmoke: "f5f5f5", yellow: "ffff00", yellowgreen: "9acd32",
|
|
11
|
+
};
|
|
12
|
+
function hex(h) {
|
|
13
|
+
if (!/^[0-9a-f]+$/i.test(h))
|
|
14
|
+
return null;
|
|
15
|
+
if (h.length === 3 || h.length === 4)
|
|
16
|
+
h = [...h].map((c) => c + c).join("");
|
|
17
|
+
if (h.length !== 6 && h.length !== 8)
|
|
18
|
+
return null;
|
|
19
|
+
const n = (i) => parseInt(h.slice(i, i + 2), 16);
|
|
20
|
+
return { r: n(0), g: n(2), b: n(4), a: h.length === 8 ? n(6) / 255 : 1 };
|
|
21
|
+
}
|
|
22
|
+
function num(v, max) {
|
|
23
|
+
v = v.trim();
|
|
24
|
+
return v.endsWith("%") ? (parseFloat(v) / 100) * max : parseFloat(v);
|
|
25
|
+
}
|
|
26
|
+
function hslToRgb(h, s, l) {
|
|
27
|
+
h = ((h % 360) + 360) % 360;
|
|
28
|
+
s /= 100;
|
|
29
|
+
l /= 100;
|
|
30
|
+
const k = (n) => (n + h / 30) % 12;
|
|
31
|
+
const a = s * Math.min(l, 1 - l);
|
|
32
|
+
const f = (n) => l - a * Math.max(-1, Math.min(k(n) - 3, Math.min(9 - k(n), 1)));
|
|
33
|
+
return [f(0) * 255, f(8) * 255, f(4) * 255];
|
|
34
|
+
}
|
|
35
|
+
/** Parse a CSS colour value. Returns null for values that cannot be resolved statically (var(), currentcolor, gradients). */
|
|
36
|
+
export function parseColor(input) {
|
|
37
|
+
const v = input.trim().toLowerCase().replace(/\s*!important$/, "");
|
|
38
|
+
if (!v)
|
|
39
|
+
return null;
|
|
40
|
+
if (v === "transparent")
|
|
41
|
+
return { r: 0, g: 0, b: 0, a: 0 };
|
|
42
|
+
if (v.startsWith("#"))
|
|
43
|
+
return hex(v.slice(1));
|
|
44
|
+
if (NAMED[v])
|
|
45
|
+
return hex(NAMED[v]);
|
|
46
|
+
const fn = /^(rgba?|hsla?)\(([^)]*)\)$/.exec(v);
|
|
47
|
+
if (!fn)
|
|
48
|
+
return null;
|
|
49
|
+
const parts = fn[2].replace(/\//g, " ").split(/[\s,]+/).filter(Boolean);
|
|
50
|
+
if (parts.length < 3 || parts.some((p) => p.includes("var(")))
|
|
51
|
+
return null;
|
|
52
|
+
const alpha = parts[3] !== undefined ? num(parts[3], 1) : 1;
|
|
53
|
+
if (fn[1].startsWith("rgb")) {
|
|
54
|
+
const [r, g, b] = parts.slice(0, 3).map((p) => num(p, 255));
|
|
55
|
+
return [r, g, b, alpha].some(Number.isNaN) ? null : { r, g, b, a: alpha };
|
|
56
|
+
}
|
|
57
|
+
const [r, g, b] = hslToRgb(parseFloat(parts[0]), parseFloat(parts[1]), parseFloat(parts[2]));
|
|
58
|
+
return [r, g, b, alpha].some(Number.isNaN) ? null : { r, g, b, a: alpha };
|
|
59
|
+
}
|
|
60
|
+
/** Composite `top` over an opaque `bottom`. */
|
|
61
|
+
export function blend(top, bottom) {
|
|
62
|
+
const a = Math.max(0, Math.min(1, top.a));
|
|
63
|
+
return { r: top.r * a + bottom.r * (1 - a), g: top.g * a + bottom.g * (1 - a), b: top.b * a + bottom.b * (1 - a), a: 1 };
|
|
64
|
+
}
|
|
65
|
+
function luminance(c) {
|
|
66
|
+
const ch = (x) => { const s = Math.max(0, Math.min(255, x)) / 255; return s <= 0.03928 ? s / 12.92 : ((s + 0.055) / 1.055) ** 2.4; };
|
|
67
|
+
return 0.2126 * ch(c.r) + 0.7152 * ch(c.g) + 0.0722 * ch(c.b);
|
|
68
|
+
}
|
|
69
|
+
/** WCAG contrast ratio of text colour `fg` (alpha composited) over opaque `bg`. */
|
|
70
|
+
export function contrastRatio(fg, bg) {
|
|
71
|
+
const f = blend(fg, bg);
|
|
72
|
+
const [hi, lo] = [luminance(f), luminance(bg)].sort((x, y) => y - x);
|
|
73
|
+
return (hi + 0.05) / (lo + 0.05);
|
|
74
|
+
}
|
|
75
|
+
/** Pull colour declarations out of a style string. `bg` is null when the background is an image or gradient (unknown). */
|
|
76
|
+
export function colorsFromStyle(style) {
|
|
77
|
+
const out = {};
|
|
78
|
+
for (const decl of style.split(";")) {
|
|
79
|
+
const i = decl.indexOf(":");
|
|
80
|
+
if (i < 0)
|
|
81
|
+
continue;
|
|
82
|
+
const prop = decl.slice(0, i).trim().toLowerCase();
|
|
83
|
+
const val = decl.slice(i + 1).trim();
|
|
84
|
+
if (prop === "color")
|
|
85
|
+
out.fg = parseColor(val);
|
|
86
|
+
else if (prop === "-webkit-text-fill-color")
|
|
87
|
+
out.fill = parseColor(val);
|
|
88
|
+
else if (prop === "background-color")
|
|
89
|
+
out.bg = parseColor(val);
|
|
90
|
+
else if (prop === "background") {
|
|
91
|
+
if (/url\(|gradient\(|var\(|image-set\(/i.test(val)) {
|
|
92
|
+
out.bg = null;
|
|
93
|
+
continue;
|
|
94
|
+
}
|
|
95
|
+
// the shorthand's colour is any token that parses as one
|
|
96
|
+
let found;
|
|
97
|
+
for (const tok of val.match(/#[0-9a-f]{3,8}\b|(?:rgba?|hsla?)\([^)]*\)|[a-z]+/gi) ?? []) {
|
|
98
|
+
const c = parseColor(tok);
|
|
99
|
+
if (c) {
|
|
100
|
+
found = c;
|
|
101
|
+
break;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
if (found)
|
|
105
|
+
out.bg = found;
|
|
106
|
+
}
|
|
107
|
+
else if (prop === "background-image" && !/^none$/i.test(val))
|
|
108
|
+
out.bg = null;
|
|
109
|
+
}
|
|
110
|
+
return out;
|
|
111
|
+
}
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Engine: runs the passes, scores, decides a tier, builds the envelope and
|
|
3
|
+
* the taint receipt.
|
|
4
|
+
*
|
|
5
|
+
* Verdict policy (ratified 2026-10-01, amended same day: suspect does not
|
|
6
|
+
* pass text):
|
|
7
|
+
* clean -> pass with receipt
|
|
8
|
+
* suspect -> refuse. The model receives the classification, the source and
|
|
9
|
+
* the receipt, and is told the human may override. With
|
|
10
|
+
* { override: true } the neutralized text is delivered instead.
|
|
11
|
+
* hostile -> refuse. Not overridable at runtime. Logged.
|
|
12
|
+
*/
|
|
13
|
+
import { type KeyObject } from "node:crypto";
|
|
14
|
+
import { type FetchLike } from "./acquire.js";
|
|
15
|
+
import { runSandbox } from "./sandbox.js";
|
|
16
|
+
import { type Finding, type IngressConfig, type IngressResult, type TaintReceipt, type Tier } from "./types.js";
|
|
17
|
+
export interface IngressOptions {
|
|
18
|
+
/** human explicitly asked for a suspect page anyway; delivers neutralized text. Never applies to hostile. */
|
|
19
|
+
override?: boolean;
|
|
20
|
+
}
|
|
21
|
+
export interface EngineDeps {
|
|
22
|
+
fetchImpl?: FetchLike;
|
|
23
|
+
/** DNS resolver override (tests, or DNS-over-HTTPS in production) */
|
|
24
|
+
resolver?: (host: string) => Promise<string[]>;
|
|
25
|
+
now?: () => Date;
|
|
26
|
+
/** attack log sink; default is stderr JSON lines */
|
|
27
|
+
log?: (entry: Record<string, unknown>) => void;
|
|
28
|
+
/** sandbox runner override (tests) */
|
|
29
|
+
sandboxImpl?: typeof runSandbox;
|
|
30
|
+
}
|
|
31
|
+
export declare class IngressEngine {
|
|
32
|
+
readonly config: IngressConfig;
|
|
33
|
+
private cache;
|
|
34
|
+
private deps;
|
|
35
|
+
private lastReceiptDigest;
|
|
36
|
+
constructor(config?: Partial<IngressConfig>, deps?: EngineDeps);
|
|
37
|
+
/** Gate a URL: policy check, acquire (twice when cloaking check is on), analyze, decide. */
|
|
38
|
+
fetch(url: string, opts?: IngressOptions): Promise<IngressResult>;
|
|
39
|
+
/** Gate text or HTML already in hand (paste, tool result, file). */
|
|
40
|
+
scan(content: string, opts?: IngressOptions & {
|
|
41
|
+
url?: string;
|
|
42
|
+
isHtml?: boolean;
|
|
43
|
+
contentType?: string;
|
|
44
|
+
}): Promise<IngressResult>;
|
|
45
|
+
/** Any analysis failure is a refusal, never a pass: the gate fails closed. */
|
|
46
|
+
private guarded;
|
|
47
|
+
/** Cheap structural pre-check: pathological nesting makes the HTML parser super-linear. Refuse before parsing. */
|
|
48
|
+
private structuralAbuse;
|
|
49
|
+
private analyze;
|
|
50
|
+
private fetchStylesheets;
|
|
51
|
+
private domainRule;
|
|
52
|
+
private refuse;
|
|
53
|
+
private refuseOnAcquire;
|
|
54
|
+
private receipt;
|
|
55
|
+
private signerCache?;
|
|
56
|
+
private signer;
|
|
57
|
+
/** The PEM public key that verifies this engine's receipts (ECDSA only). Publish it; it cannot sign. */
|
|
58
|
+
publicKey(): {
|
|
59
|
+
alg: "ecdsa-p256-sha256";
|
|
60
|
+
keyId: string;
|
|
61
|
+
publicKeyPem: string;
|
|
62
|
+
} | null;
|
|
63
|
+
static keyIdOf(pub: KeyObject): string;
|
|
64
|
+
/** Generate an ECDSA P-256 key pair for receipt signing. Keep the private key secret; publish the public key. */
|
|
65
|
+
static generateSigningKeys(): {
|
|
66
|
+
privateKeyPem: string;
|
|
67
|
+
publicKeyPem: string;
|
|
68
|
+
keyId: string;
|
|
69
|
+
};
|
|
70
|
+
/**
|
|
71
|
+
* Verify a receipt's digest and, when a key is given, its signature.
|
|
72
|
+
* Pass a PEM public key for ECDSA receipts, or the shared secret for HMAC receipts.
|
|
73
|
+
*/
|
|
74
|
+
static verifyReceipt(receipt: TaintReceipt, key?: string): {
|
|
75
|
+
digestOk: boolean;
|
|
76
|
+
signatureOk: boolean | null;
|
|
77
|
+
signatureAlg?: string;
|
|
78
|
+
keyId?: string;
|
|
79
|
+
};
|
|
80
|
+
private cacheKey;
|
|
81
|
+
private cacheGet;
|
|
82
|
+
private cacheSet;
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Score aggregation.
|
|
86
|
+
* - findings are grouped by kind; repeats of one kind add a logarithmic
|
|
87
|
+
* bonus rather than compounding (twelve screen-reader labels are one
|
|
88
|
+
* fact, not twelve attacks)
|
|
89
|
+
* - noisy-OR across kinds
|
|
90
|
+
* - hidden text that carries no instruction shape is informational: it is
|
|
91
|
+
* not delivered anyway, so visibility-only evidence is capped below the
|
|
92
|
+
* hostile line
|
|
93
|
+
* - co-occurrence of hidden-text and meaning findings, cloaking, and
|
|
94
|
+
* webdriver-keyed divergence each add a bonus
|
|
95
|
+
*/
|
|
96
|
+
export declare function aggregate(findings: Finding[]): number;
|
|
97
|
+
/**
|
|
98
|
+
* Spotlighting-style envelope. Random boundary so content cannot forge the
|
|
99
|
+
* closing marker. The model is told, in one line, how to treat the content.
|
|
100
|
+
*/
|
|
101
|
+
export declare function buildEnvelope(source: string, tier: Tier, delivered: string, findings: Finding[], receipt: TaintReceipt, overridden?: boolean): string;
|
|
102
|
+
/**
|
|
103
|
+
* Attack log entry: the most useful material for the public feed and for
|
|
104
|
+
* incident review. Carries the decoded payloads and excerpts (what the
|
|
105
|
+
* attacker wrote), the hosts the content tried to reach, and the attacking
|
|
106
|
+
* source host. Never carries the customer's own fetch context beyond the URL.
|
|
107
|
+
*/
|
|
108
|
+
export declare function buildLogEntry(url: string, tier: Tier, score: number, findings: Finding[], decodedPayloads: readonly string[], receipt: TaintReceipt, overridden: boolean): Record<string, unknown>;
|