@acepaste/ingress 0.9.23 → 0.9.24
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/src/engine.d.ts +5 -0
- package/dist/src/engine.js +71 -9
- package/dist/src/served.d.ts +3 -0
- package/dist/src/served.js +36 -0
- package/dist/src/types.d.ts +2 -2
- package/dist/src/types.js +2 -2
- package/package.json +1 -1
package/dist/src/engine.d.ts
CHANGED
|
@@ -126,6 +126,11 @@ export declare class IngressEngine {
|
|
|
126
126
|
private analyze;
|
|
127
127
|
private fetchStylesheets;
|
|
128
128
|
private domainRule;
|
|
129
|
+
/**
|
|
130
|
+
* What the text only the AI fetcher received reads like: the kinds of instruction or attack shape found in it,
|
|
131
|
+
* empty when it is ordinary prose. It is judged as hidden text is, since no person sees it.
|
|
132
|
+
*/
|
|
133
|
+
private agentOnlyShape;
|
|
129
134
|
private refuse;
|
|
130
135
|
private refuseOnAcquire;
|
|
131
136
|
private pickAgentUserAgent;
|
package/dist/src/engine.js
CHANGED
|
@@ -27,7 +27,7 @@ import { detectImageFormat } from "./image-meta.js";
|
|
|
27
27
|
import { inspectAudio } from "./audio.js";
|
|
28
28
|
const MAX_IMAGE_BYTES = 50_000_000;
|
|
29
29
|
const MAX_AUDIO_BYTES = 200_000_000;
|
|
30
|
-
import { servedWords, compareServed } from "./served.js";
|
|
30
|
+
import { servedWords, compareServed, passagesOnlyIn, looksLikeInterstitial } from "./served.js";
|
|
31
31
|
import { scanClassifier } from "./classifier.js";
|
|
32
32
|
import { runSandbox } from "./sandbox.js";
|
|
33
33
|
import { DEFAULT_CONFIG, ENGINE_VERSION, RULESET_VERSION, TRUST_SUSPECT_FACTOR, } from "./types.js";
|
|
@@ -171,7 +171,9 @@ export class IngressEngine {
|
|
|
171
171
|
url, finalUrl: agentRes.finalUrl, redirectChain: agentRes.redirectChain, raw: agentRes.body, kind,
|
|
172
172
|
humanRaw: humanRes?.body, humanContentType: humanRes?.contentType, externalRules, externalColorRules, timings, t0, override: !!opts.override, extraFindings: findings, rule,
|
|
173
173
|
}));
|
|
174
|
-
|
|
174
|
+
// a stand-in page (a challenge, a block notice) is a passing state of the site, like any failed fetch: not cached
|
|
175
|
+
if (result.tier !== "unreachable")
|
|
176
|
+
this.cacheSet(url, opts, result);
|
|
175
177
|
return result;
|
|
176
178
|
}
|
|
177
179
|
/** Gate text or HTML already in hand (paste, tool result, file). */
|
|
@@ -400,16 +402,61 @@ export class IngressEngine {
|
|
|
400
402
|
// block of it is (the usual cloaking move: the real page plus a passage only the AI receives)
|
|
401
403
|
const wholesale = cmp.agentWords >= 30 && cmp.agentOnlyShare > 0.4 && cmp.agentOnlyWords >= 15;
|
|
402
404
|
const block = cmp.agentOnlyWords >= 25 && cmp.agentOnlyShare >= 0.15 && cmp.longestAgentOnlyRun >= 12;
|
|
405
|
+
let compared = true;
|
|
403
406
|
if (wholesale || block) {
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
407
|
+
// A different page is not yet an attack (0.9.24). Sites hand non-browsers a bot challenge, a block
|
|
408
|
+
// notice, a lighter layout or an empty result, and a search page answered with "prove you are human"
|
|
409
|
+
// was refused as hostile. What decides is what the part only the AI fetcher got says: read it the way
|
|
410
|
+
// hidden text is read, because no person sees it.
|
|
411
|
+
const told = wholesale ? this.agentOnlyShape(visibleText, humanText) : [];
|
|
412
|
+
if (wholesale && !told.length && looksLikeInterstitial(visibleText)) {
|
|
413
|
+
// a stand-in page is not the page: nothing to deliver, nothing to compare, and not an attack
|
|
414
|
+
return this.refuse(a.url, [...a.extraFindings, {
|
|
415
|
+
pass: "acquire", kind: "acquire.unreachable", confidence: 0, severity: 0,
|
|
416
|
+
message: `the site gave the AI fetcher a challenge, block or error page instead of the page a browser gets (${cmp.agentWords} words, ${(cmp.agentOnlyShare * 100).toFixed(0)}% of them not on the browser's page)`,
|
|
417
|
+
action: "none",
|
|
418
|
+
}], timings, a.t0, a.kind, "unreachable");
|
|
419
|
+
}
|
|
420
|
+
const pct = `${(cmp.agentOnlyShare * 100).toFixed(0)}% of the words served to an AI fetcher do not appear on the page served to a browser`;
|
|
421
|
+
const blockConfidence = Math.min(0.6, 0.3 + cmp.agentOnlyShare / 2);
|
|
422
|
+
if (wholesale && !told.length && looksLikeInterstitial(humanText)) {
|
|
423
|
+
// The other way round: the browser-fingerprint fetch was the one given a stand-in, so there is no
|
|
424
|
+
// browser copy to compare with. Like a failed browser fetch, that is a gap, not evidence. (Had the
|
|
425
|
+
// agent's page carried instructions the stand-in lacks, the branch below would have taken it.)
|
|
426
|
+
findings.push({ pass: "acquire", kind: "acquire.cloaking_check_incomplete", confidence: 0, severity: 0, message: `cloaking check incomplete: the browser-fingerprint fetch was given a challenge, block or error page (${servedWords(humanText).length} words), so there was no browser copy to compare with`, action: "none" });
|
|
427
|
+
compared = false;
|
|
428
|
+
}
|
|
429
|
+
else if (wholesale && told.length) {
|
|
430
|
+
findings.push({
|
|
431
|
+
pass: "cloaking", kind: "cloaking.agent_targeted_divergence",
|
|
432
|
+
confidence: Math.min(0.95, 0.5 + (cmp.agentOnlyShare - 0.4)), severity: 0.9,
|
|
433
|
+
message: `${pct}; the part only the AI fetcher got reads as instructions (${told.join(", ")})`,
|
|
434
|
+
excerpt: `agent-only words: ${cmp.sample}`, action: "none",
|
|
435
|
+
});
|
|
436
|
+
}
|
|
437
|
+
else if (block) {
|
|
438
|
+
// the real page plus a passage only the AI receives: scored as before, which on its own is suspect
|
|
439
|
+
findings.push({
|
|
440
|
+
pass: "cloaking", kind: "cloaking.agent_targeted_divergence",
|
|
441
|
+
confidence: blockConfidence, severity: 0.9,
|
|
442
|
+
message: wholesale ? `${pct}; the part only the AI fetcher got does not read as instructions` : pct,
|
|
443
|
+
excerpt: `agent-only words: ${cmp.sample}`, action: "none",
|
|
444
|
+
});
|
|
445
|
+
}
|
|
446
|
+
else {
|
|
447
|
+
// a different page that tells the agent to do nothing: a person should look, but it is not refused outright
|
|
448
|
+
findings.push({
|
|
449
|
+
pass: "cloaking", kind: "cloaking.agent_targeted_divergence",
|
|
450
|
+
confidence: Math.min(0.95, 0.5 + (cmp.agentOnlyShare - 0.4)), severity: 0.5,
|
|
451
|
+
message: `${pct}; the part only the AI fetcher got does not read as instructions`,
|
|
452
|
+
excerpt: `agent-only words: ${cmp.sample}`, action: "none",
|
|
453
|
+
});
|
|
454
|
+
}
|
|
410
455
|
}
|
|
411
456
|
timings.cloaking = performance.now() - tc;
|
|
412
|
-
|
|
457
|
+
// without a browser copy the comparison answered nothing: page scripts that predict cloaking still count
|
|
458
|
+
if (compared)
|
|
459
|
+
passesRun.push("cloaking");
|
|
413
460
|
}
|
|
414
461
|
// character pass
|
|
415
462
|
const tch = performance.now();
|
|
@@ -579,6 +626,21 @@ export class IngressEngine {
|
|
|
579
626
|
return p.startsWith(".") ? host === p.slice(1) || host.endsWith(p) : host === p;
|
|
580
627
|
});
|
|
581
628
|
}
|
|
629
|
+
/**
|
|
630
|
+
* What the text only the AI fetcher received reads like: the kinds of instruction or attack shape found in it,
|
|
631
|
+
* empty when it is ordinary prose. It is judged as hidden text is, since no person sees it.
|
|
632
|
+
*/
|
|
633
|
+
agentOnlyShape(agentText, humanText) {
|
|
634
|
+
const only = passagesOnlyIn(agentText, humanText, 3).join("\n");
|
|
635
|
+
if (!only.trim())
|
|
636
|
+
return [];
|
|
637
|
+
const probe = [{ text: scanCharacters(only).cleaned, visibility: "concealed", path: "cloaking/agent-only" }];
|
|
638
|
+
const found = [
|
|
639
|
+
...scanMeaning({ kind: "text", segments: probe, decodedPayloads: [] }),
|
|
640
|
+
...(this.config.classifier ? scanClassifier({ visible: "", segments: probe, kind: "text" }) : []),
|
|
641
|
+
].filter((f) => f.confidence * f.severity >= 0.25);
|
|
642
|
+
return [...new Set(found.map((f) => f.kind))];
|
|
643
|
+
}
|
|
582
644
|
refuse(url, findings, timings, t0, kind, tier = "hostile", quarantine = false) {
|
|
583
645
|
attachEvidence(findings, sha256(""));
|
|
584
646
|
const score = tier === "hostile" ? 1 : 0;
|
package/dist/src/served.d.ts
CHANGED
|
@@ -13,6 +13,9 @@ export declare function compareServed(agentText: string, humanText: string): {
|
|
|
13
13
|
longestAgentOnlyRun: number;
|
|
14
14
|
sample: string;
|
|
15
15
|
};
|
|
16
|
+
/** a page with more words than this is content, whatever it says about robots */
|
|
17
|
+
export declare const INTERSTITIAL_MAX_WORDS = 150;
|
|
18
|
+
export declare function looksLikeInterstitial(text: string): boolean;
|
|
16
19
|
/**
|
|
17
20
|
* The passages of `text` that `reference` does not contain: runs of at least `minRun` words in a row that
|
|
18
21
|
* appear nowhere in the reference. Returned as the original text of each run, for scanning.
|
package/dist/src/served.js
CHANGED
|
@@ -27,6 +27,42 @@ export function compareServed(agentText, humanText) {
|
|
|
27
27
|
const sample = only.filter((w) => (sampleSeen.has(w) ? false : (sampleSeen.add(w), true))).slice(0, 30).join(" ");
|
|
28
28
|
return { agentWords: A.length, agentOnlyWords: only.length, agentOnlyShare: A.length ? only.length / A.length : 0, longestAgentOnlyRun, sample };
|
|
29
29
|
}
|
|
30
|
+
/**
|
|
31
|
+
* A page that stands in for the page: a bot challenge, a block or rate-limit notice, an error page, a "turn on
|
|
32
|
+
* JavaScript" stub. Sites hand these to anything that does not look like a browser. Recognised by being short
|
|
33
|
+
* and saying what such pages say; no site is named here.
|
|
34
|
+
*/
|
|
35
|
+
const INTERSTITIAL = new RegExp([
|
|
36
|
+
String.raw `\bcaptcha\b`,
|
|
37
|
+
String.raw `\b(?:are you|you are|you're|i am|i'm) (?:a |not a )?(?:human|robot)\b`,
|
|
38
|
+
String.raw `\bnot a robot\b`,
|
|
39
|
+
String.raw `\bverif(?:y|ying|ication)\b[^.]{0,40}\bhuman\b`,
|
|
40
|
+
String.raw `\b(?:made|sent) by a human\b`,
|
|
41
|
+
String.raw `\bcomplete (?:the|this) (?:following )?(?:challenge|puzzle)\b`,
|
|
42
|
+
String.raw `\bsecurity (?:check|challenge)\b`,
|
|
43
|
+
String.raw `\bchecking (?:your|the) browser\b`,
|
|
44
|
+
String.raw `\bjust a moment\b`,
|
|
45
|
+
String.raw `\bunusual (?:traffic|activity)\b`,
|
|
46
|
+
String.raw `\bautomated (?:queries|requests|access|traffic)\b`,
|
|
47
|
+
String.raw `\bbots? (?:use|detected|detection)\b`,
|
|
48
|
+
String.raw `\baccess (?:is |has been |to this (?:page|site) (?:is |has been ))?(?:denied|forbidden|restricted|blocked)\b`,
|
|
49
|
+
String.raw `\b(?:you have|you've) been blocked\b`,
|
|
50
|
+
String.raw `\brequest (?:was |has been )?blocked\b`,
|
|
51
|
+
String.raw `\btoo many requests\b`,
|
|
52
|
+
String.raw `\brate limit(?:ed)?\b`,
|
|
53
|
+
String.raw `\btry again later\b`,
|
|
54
|
+
String.raw `\b(?:temporarily|currently) unavailable\b`,
|
|
55
|
+
String.raw `\b(?:page|site) (?:not found|can(?:'|no)t be (?:found|reached))\b`,
|
|
56
|
+
String.raw `\bsomething went wrong\b`,
|
|
57
|
+
String.raw `\ban error (?:has )?occurred\b`,
|
|
58
|
+
String.raw `\b(?:enable|requires?|turn on) (?:javascript|cookies)\b`,
|
|
59
|
+
String.raw `\bjavascript is (?:required|disabled|not enabled)\b`,
|
|
60
|
+
].join("|"), "i");
|
|
61
|
+
/** a page with more words than this is content, whatever it says about robots */
|
|
62
|
+
export const INTERSTITIAL_MAX_WORDS = 150;
|
|
63
|
+
export function looksLikeInterstitial(text) {
|
|
64
|
+
return servedWords(text).length <= INTERSTITIAL_MAX_WORDS && INTERSTITIAL.test(text.replace(/\s+/g, " "));
|
|
65
|
+
}
|
|
30
66
|
/**
|
|
31
67
|
* The passages of `text` that `reference` does not contain: runs of at least `minRun` words in a row that
|
|
32
68
|
* appear nowhere in the reference. Returned as the original text of each run, for scanning.
|
package/dist/src/types.d.ts
CHANGED
|
@@ -5,9 +5,9 @@
|
|
|
5
5
|
* at the same source would not see is suspect by default.
|
|
6
6
|
*/
|
|
7
7
|
import type { NetPolicy } from "./netpolicy.js";
|
|
8
|
-
export declare const ENGINE_VERSION = "0.9.
|
|
8
|
+
export declare const ENGINE_VERSION = "0.9.24";
|
|
9
9
|
/** bump whenever a detector's behavior changes; receipts carry it so verdicts are reproducible */
|
|
10
|
-
export declare const RULESET_VERSION = "2026.11.19-
|
|
10
|
+
export declare const RULESET_VERSION = "2026.11.19-2";
|
|
11
11
|
/**
|
|
12
12
|
* clean: delivered. suspect: refused, overridable. hostile: refused, not overridable.
|
|
13
13
|
* unreachable: nothing could be fetched or read (network error, timeout, redirect loop,
|
package/dist/src/types.js
CHANGED
|
@@ -4,9 +4,9 @@
|
|
|
4
4
|
* Governing principle: anything the model would receive that a human looking
|
|
5
5
|
* at the same source would not see is suspect by default.
|
|
6
6
|
*/
|
|
7
|
-
export const ENGINE_VERSION = "0.9.
|
|
7
|
+
export const ENGINE_VERSION = "0.9.24";
|
|
8
8
|
/** bump whenever a detector's behavior changes; receipts carry it so verdicts are reproducible */
|
|
9
|
-
export const RULESET_VERSION = "2026.11.19-
|
|
9
|
+
export const RULESET_VERSION = "2026.11.19-2";
|
|
10
10
|
export const CONTENT_KINDS = ["html", "markdown", "json", "text", "javascript", "log", "email", "calendar", "message", "notification", "nearby", "automation", "captions", "image", "audio"];
|
|
11
11
|
/** Read a content kind and source from untyped input (an HTTP body, tool arguments). Unknown values are dropped, never guessed. */
|
|
12
12
|
export function parseScanHints(o) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@acepaste/ingress",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.24",
|
|
4
4
|
"description": "AcePaste Ingress engine: acquire, visibility, character, script, supply-chain, sandbox, meaning, verdict, envelope, receipts.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/src/index.js",
|