@webdecoy/node 0.19.1 → 0.21.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/dist/chunk-PKHQ5VPQ.mjs +1368 -0
- package/dist/index-GXXXr_mb.d.mts +168 -0
- package/dist/index-GXXXr_mb.d.ts +168 -0
- package/dist/index.d.mts +3 -93
- package/dist/index.d.ts +3 -93
- package/dist/index.js +1279 -60
- package/dist/index.mjs +11 -147
- package/dist/vercel.d.mts +42 -0
- package/dist/vercel.d.ts +42 -0
- package/dist/vercel.js +1418 -0
- package/dist/vercel.mjs +34 -0
- package/package.json +9 -4
package/dist/index.js
CHANGED
|
@@ -27,6 +27,7 @@ __export(index_exports, {
|
|
|
27
27
|
BOT_REGISTRY: () => BOT_REGISTRY,
|
|
28
28
|
BotPolicy: () => BotPolicy,
|
|
29
29
|
BotRule: () => BotRule,
|
|
30
|
+
CLEARANCE_GATE_BUILD: () => ne,
|
|
30
31
|
CLIENT_SESSION_COOKIE: () => CLIENT_SESSION_COOKIE,
|
|
31
32
|
CLIENT_SESSION_HEADER: () => CLIENT_SESSION_HEADER,
|
|
32
33
|
Captcha: () => Captcha,
|
|
@@ -70,6 +71,7 @@ __export(index_exports, {
|
|
|
70
71
|
consoleLogger: () => consoleLogger,
|
|
71
72
|
createAgentVerifier: () => createAgentVerifier,
|
|
72
73
|
createCaptchaEndpoints: () => createCaptchaEndpoints,
|
|
74
|
+
createClearanceGate: () => createClearanceGate,
|
|
73
75
|
createFetchGuard: () => createFetchGuard,
|
|
74
76
|
deriveAndArm: () => deriveAndArm,
|
|
75
77
|
deriveKey: () => deriveKey,
|
|
@@ -91,6 +93,7 @@ __export(index_exports, {
|
|
|
91
93
|
readEdgeVerdict: () => readEdgeVerdict,
|
|
92
94
|
recommend: () => recommend,
|
|
93
95
|
resolveClientIp: () => resolveClientIp,
|
|
96
|
+
resolveGateEnv: () => resolveGateEnv,
|
|
94
97
|
resolveSecret: () => resolveSecret,
|
|
95
98
|
ruleBlockResponse: () => ruleBlockResponse,
|
|
96
99
|
shouldSkipPath: () => shouldSkipPath,
|
|
@@ -1308,7 +1311,7 @@ var TripwireRule = class {
|
|
|
1308
1311
|
}
|
|
1309
1312
|
evaluate(context) {
|
|
1310
1313
|
const path = canonicalizeTripwirePath(context.path);
|
|
1311
|
-
const hit = this.exact.has(path) || this.prefixes.some((prefix) => path.startsWith(prefix)) || this.patterns.some((
|
|
1314
|
+
const hit = this.exact.has(path) || this.prefixes.some((prefix) => path.startsWith(prefix)) || this.patterns.some((re2) => re2.test(path));
|
|
1312
1315
|
if (hit) {
|
|
1313
1316
|
return {
|
|
1314
1317
|
action: this.dryRun ? "ALLOW" : this.action,
|
|
@@ -2116,9 +2119,9 @@ function injectHoneytokenLink(html, linkHtml) {
|
|
|
2116
2119
|
if (!html || html.includes(linkHtml)) return html;
|
|
2117
2120
|
const lower = html.toLowerCase();
|
|
2118
2121
|
for (const close of ["</body>", "</html>"]) {
|
|
2119
|
-
const
|
|
2120
|
-
if (
|
|
2121
|
-
return html.slice(0,
|
|
2122
|
+
const at2 = lower.lastIndexOf(close);
|
|
2123
|
+
if (at2 !== -1) {
|
|
2124
|
+
return html.slice(0, at2) + linkHtml + html.slice(at2);
|
|
2122
2125
|
}
|
|
2123
2126
|
}
|
|
2124
2127
|
return html;
|
|
@@ -2277,7 +2280,7 @@ var MAX_ENTRIES = 500;
|
|
|
2277
2280
|
var header = (headers, name) => {
|
|
2278
2281
|
const v = headers[name] ?? headers[name.toLowerCase()];
|
|
2279
2282
|
if (v !== void 0) return v;
|
|
2280
|
-
for (const [
|
|
2283
|
+
for (const [k2, value] of Object.entries(headers)) if (k2.toLowerCase() === name) return value;
|
|
2281
2284
|
return "";
|
|
2282
2285
|
};
|
|
2283
2286
|
var AIReferralCounter = class {
|
|
@@ -2399,19 +2402,19 @@ var encoder2 = new TextEncoder();
|
|
|
2399
2402
|
async function rsaThumbprint(n, e) {
|
|
2400
2403
|
return digest(`{"e":${JSON.stringify(e)},"kty":"RSA","n":${JSON.stringify(n)}}`);
|
|
2401
2404
|
}
|
|
2402
|
-
async function okpThumbprint(crv,
|
|
2403
|
-
return digest(`{"crv":${JSON.stringify(crv)},"kty":"OKP","x":${JSON.stringify(
|
|
2405
|
+
async function okpThumbprint(crv, x2) {
|
|
2406
|
+
return digest(`{"crv":${JSON.stringify(crv)},"kty":"OKP","x":${JSON.stringify(x2)}}`);
|
|
2404
2407
|
}
|
|
2405
|
-
async function jwkThumbprint(
|
|
2406
|
-
switch (
|
|
2408
|
+
async function jwkThumbprint(k2) {
|
|
2409
|
+
switch (k2.kty) {
|
|
2407
2410
|
case "OKP":
|
|
2408
|
-
if (!
|
|
2409
|
-
return okpThumbprint(
|
|
2411
|
+
if (!k2.crv || !k2.x) throw new Error("thumbprint: OKP JWK missing crv or x");
|
|
2412
|
+
return okpThumbprint(k2.crv, k2.x);
|
|
2410
2413
|
case "RSA":
|
|
2411
|
-
if (!
|
|
2412
|
-
return rsaThumbprint(
|
|
2414
|
+
if (!k2.n || !k2.e) throw new Error("thumbprint: RSA JWK missing n or e");
|
|
2415
|
+
return rsaThumbprint(k2.n, k2.e);
|
|
2413
2416
|
default:
|
|
2414
|
-
throw new Error(`thumbprint: unsupported kty ${JSON.stringify(
|
|
2417
|
+
throw new Error(`thumbprint: unsupported kty ${JSON.stringify(k2.kty)}`);
|
|
2415
2418
|
}
|
|
2416
2419
|
}
|
|
2417
2420
|
async function digest(canonical) {
|
|
@@ -2480,7 +2483,7 @@ var DirectoryCache = class {
|
|
|
2480
2483
|
for (const keys of results) {
|
|
2481
2484
|
if (keys === null) continue;
|
|
2482
2485
|
fetchedAny = true;
|
|
2483
|
-
for (const
|
|
2486
|
+
for (const k2 of keys) next.set(k2.thumbprint, k2.key);
|
|
2484
2487
|
}
|
|
2485
2488
|
if (fetchedAny) {
|
|
2486
2489
|
this.keys = next;
|
|
@@ -2886,10 +2889,10 @@ function dictMemberValue(header2, key) {
|
|
|
2886
2889
|
function parseSignatureInput(value) {
|
|
2887
2890
|
return parseDictionary(value).map((d) => {
|
|
2888
2891
|
if (!d.isList) throw new Error(`Signature-Input member ${d.key} is not an inner list`);
|
|
2889
|
-
const components = d.items.map((
|
|
2890
|
-
if (typeof
|
|
2891
|
-
const keyParam =
|
|
2892
|
-
return { name:
|
|
2892
|
+
const components = d.items.map((it2) => {
|
|
2893
|
+
if (typeof it2.value !== "string") throw new Error("component identifier is not a string");
|
|
2894
|
+
const keyParam = it2.params.get("key");
|
|
2895
|
+
return { name: it2.value, keyParam: typeof keyParam === "string" ? keyParam : void 0 };
|
|
2893
2896
|
});
|
|
2894
2897
|
return { label: d.key, components, params: d.params, raw: d.raw };
|
|
2895
2898
|
});
|
|
@@ -2978,8 +2981,8 @@ function isRequest(input) {
|
|
|
2978
2981
|
}
|
|
2979
2982
|
function toHeaders(record) {
|
|
2980
2983
|
const h = new Headers();
|
|
2981
|
-
for (const [
|
|
2982
|
-
if (v !== void 0 && v !== null) h.set(
|
|
2984
|
+
for (const [k2, v] of Object.entries(record)) {
|
|
2985
|
+
if (v !== void 0 && v !== null) h.set(k2, String(v));
|
|
2983
2986
|
}
|
|
2984
2987
|
return h;
|
|
2985
2988
|
}
|
|
@@ -3008,9 +3011,9 @@ function readEdgeVerdict(headers) {
|
|
|
3008
3011
|
let clearanceRaw;
|
|
3009
3012
|
let classRaw;
|
|
3010
3013
|
for (const key of Object.keys(headers)) {
|
|
3011
|
-
const
|
|
3012
|
-
if (
|
|
3013
|
-
else if (
|
|
3014
|
+
const k2 = key.toLowerCase();
|
|
3015
|
+
if (k2 === EDGE_CLEARANCE_HEADER) clearanceRaw = headers[key];
|
|
3016
|
+
else if (k2 === EDGE_CLASS_HEADER) classRaw = headers[key];
|
|
3014
3017
|
}
|
|
3015
3018
|
const clearance = clearanceRaw?.trim() || void 0;
|
|
3016
3019
|
const cls = normaliseClass(classRaw);
|
|
@@ -3923,6 +3926,1219 @@ function resolveClientIp(options) {
|
|
|
3923
3926
|
return full[0] ?? void 0 ?? singleHeaderFallback() ?? peer;
|
|
3924
3927
|
}
|
|
3925
3928
|
|
|
3929
|
+
// src/clearance/gate.generated.js
|
|
3930
|
+
var k = { "chat.deepseek.com": "DeepSeek", "chat.openai.com": "ChatGPT", "chatgpt.com": "ChatGPT", "claude.ai": "Claude", "copilot.microsoft.com": "Copilot", "deepseek.com": "DeepSeek", "gemini.google.com": "Gemini", "grok.com": "Grok", "kagi.com": "Kagi", "meta.ai": "Meta AI", "perplexity.ai": "Perplexity", "phind.com": "Phind", "www.deepseek.com": "DeepSeek", "www.grok.com": "Grok", "www.kagi.com": "Kagi", "www.meta.ai": "Meta AI", "www.perplexity.ai": "Perplexity", "www.phind.com": "Phind", "www.you.com": "You.com", "you.com": "You.com" };
|
|
3931
|
+
var rt = ["utm_source", "ref", "utm_medium"];
|
|
3932
|
+
var ae = 500;
|
|
3933
|
+
function nt(e, t) {
|
|
3934
|
+
let r = (e ?? "").trim();
|
|
3935
|
+
if (r) try {
|
|
3936
|
+
return k[new URL(r).hostname.toLowerCase()] ?? "";
|
|
3937
|
+
} catch {
|
|
3938
|
+
return "";
|
|
3939
|
+
}
|
|
3940
|
+
let n;
|
|
3941
|
+
try {
|
|
3942
|
+
n = new URL(t);
|
|
3943
|
+
} catch {
|
|
3944
|
+
return "";
|
|
3945
|
+
}
|
|
3946
|
+
for (let o of rt) for (let a of n.searchParams.getAll(o)) {
|
|
3947
|
+
let i = ot(a);
|
|
3948
|
+
if (i) return i;
|
|
3949
|
+
}
|
|
3950
|
+
return "";
|
|
3951
|
+
}
|
|
3952
|
+
var ie = (e) => e.replace(/[ \-_.]/g, "");
|
|
3953
|
+
function ot(e) {
|
|
3954
|
+
let t = e.trim().toLowerCase();
|
|
3955
|
+
if (!t) return "";
|
|
3956
|
+
try {
|
|
3957
|
+
let n = new URL(t).hostname;
|
|
3958
|
+
n && (t = n.toLowerCase());
|
|
3959
|
+
} catch {
|
|
3960
|
+
}
|
|
3961
|
+
if (t = t.replace(/\.$/, ""), k[t]) return k[t];
|
|
3962
|
+
let r = ie(t);
|
|
3963
|
+
for (let [n, o] of Object.entries(k)) if (r === ie(o.toLowerCase()) || r === n.replace(/^www\./, "").replace(/\./g, "")) return o;
|
|
3964
|
+
return "";
|
|
3965
|
+
}
|
|
3966
|
+
function se(e, t) {
|
|
3967
|
+
if (e.method !== "GET") return null;
|
|
3968
|
+
let r = e.headers;
|
|
3969
|
+
if (r.get("sec-fetch-mode") !== "navigate") return null;
|
|
3970
|
+
let n = r.get("sec-fetch-dest");
|
|
3971
|
+
if (n && n !== "document") return null;
|
|
3972
|
+
let o = nt(r.get("referer") ?? "", t.toString());
|
|
3973
|
+
if (!o) return null;
|
|
3974
|
+
let a = t.pathname || "/";
|
|
3975
|
+
return a.length > ae && (a = a.slice(0, ae)), { platform: o, path: a };
|
|
3976
|
+
}
|
|
3977
|
+
var at = "web-bot-auth";
|
|
3978
|
+
async function ce(e, t) {
|
|
3979
|
+
let r = e.headers.get("signature-input"), n = e.headers.get("signature");
|
|
3980
|
+
if (!r && !n) return { status: "none" };
|
|
3981
|
+
if (!r || !n) return { status: "invalid" };
|
|
3982
|
+
if (!t || t.length === 0) return { status: "unknown_key" };
|
|
3983
|
+
let o, a;
|
|
3984
|
+
try {
|
|
3985
|
+
o = gt(r), a = ft(n);
|
|
3986
|
+
} catch {
|
|
3987
|
+
return { status: "invalid" };
|
|
3988
|
+
}
|
|
3989
|
+
let i = false, s = false;
|
|
3990
|
+
for (let c of o) {
|
|
3991
|
+
if (c.params.get("tag") !== at) continue;
|
|
3992
|
+
i = true;
|
|
3993
|
+
let p = a.get(c.label);
|
|
3994
|
+
if (!p) continue;
|
|
3995
|
+
let l = c.params.get("keyid");
|
|
3996
|
+
if (typeof l != "string") continue;
|
|
3997
|
+
let h;
|
|
3998
|
+
try {
|
|
3999
|
+
h = it(e, c);
|
|
4000
|
+
} catch {
|
|
4001
|
+
s || (s = t.some((f) => f.keyid === l));
|
|
4002
|
+
continue;
|
|
4003
|
+
}
|
|
4004
|
+
let d = t.find((f) => {
|
|
4005
|
+
if (f.keyid !== l) return false;
|
|
4006
|
+
try {
|
|
4007
|
+
return le(f.directory) === h;
|
|
4008
|
+
} catch {
|
|
4009
|
+
return false;
|
|
4010
|
+
}
|
|
4011
|
+
});
|
|
4012
|
+
if (!d) continue;
|
|
4013
|
+
s = true;
|
|
4014
|
+
let w = Date.now() / 1e3, b = c.params.get("created"), g = c.params.get("expires");
|
|
4015
|
+
if (typeof b != "number" || typeof g != "number" || w >= g + 10 || w + 10 < b || g <= b || g - b > 1440 * 60 || !c.components.some((f) => f.name === "@authority" || f.name === "@target-uri")) continue;
|
|
4016
|
+
let A;
|
|
4017
|
+
try {
|
|
4018
|
+
A = st(e, c);
|
|
4019
|
+
} catch {
|
|
4020
|
+
continue;
|
|
4021
|
+
}
|
|
4022
|
+
let u = false;
|
|
4023
|
+
try {
|
|
4024
|
+
let f = await crypto.subtle.importKey("raw", de(d.public_key), { name: "Ed25519" }, false, ["verify"]);
|
|
4025
|
+
u = await crypto.subtle.verify({ name: "Ed25519" }, f, p, new TextEncoder().encode(A));
|
|
4026
|
+
} catch {
|
|
4027
|
+
u = false;
|
|
4028
|
+
}
|
|
4029
|
+
if (u) return { status: "verified", name: d.name, category: d.category, keyid: l };
|
|
4030
|
+
}
|
|
4031
|
+
return s ? { status: "invalid" } : i ? { status: "unknown_key" } : { status: "none" };
|
|
4032
|
+
}
|
|
4033
|
+
function it(e, t) {
|
|
4034
|
+
let r = e.headers.get("signature-agent");
|
|
4035
|
+
if (r === null) throw new Error("missing signature-agent");
|
|
4036
|
+
let n = t.components.find((i) => i.name.toLowerCase() === "signature-agent");
|
|
4037
|
+
if (!n) throw new Error("signature-agent is not covered");
|
|
4038
|
+
let o = r.trim(), a;
|
|
4039
|
+
if (o.startsWith('"')) {
|
|
4040
|
+
if (n.keyParam !== void 0) throw new Error("legacy string cannot select a member");
|
|
4041
|
+
let i = new T(o);
|
|
4042
|
+
if (a = pe(i), i.skipSP(), !i.eof()) throw new Error("trailing signature-agent data");
|
|
4043
|
+
} else {
|
|
4044
|
+
if (n.keyParam === void 0) throw new Error("dictionary member is not covered");
|
|
4045
|
+
let i = B(o).find((c) => c.key === n.keyParam), s = i?.items[0]?.value;
|
|
4046
|
+
if (!i || i.isList || i.items.length !== 1 || typeof s != "string") throw new Error("signature-agent member is not a string");
|
|
4047
|
+
a = s;
|
|
4048
|
+
}
|
|
4049
|
+
return le(a);
|
|
4050
|
+
}
|
|
4051
|
+
function le(e) {
|
|
4052
|
+
let t = new URL(e);
|
|
4053
|
+
if (t.protocol !== "https:" || !t.hostname || t.username || t.password) throw new Error("signature-agent must be an https URL");
|
|
4054
|
+
return `https://${H(t)}`;
|
|
4055
|
+
}
|
|
4056
|
+
function st(e, t) {
|
|
4057
|
+
let r = new URL(e.url), n = [];
|
|
4058
|
+
for (let o of t.components) n.push(`${ct(o)}: ${lt(e, r, o)}`);
|
|
4059
|
+
return n.push(`"@signature-params": ${t.raw.trim()}`), n.join(`
|
|
4060
|
+
`);
|
|
4061
|
+
}
|
|
4062
|
+
function ct(e) {
|
|
4063
|
+
let t = `"${e.name.toLowerCase()}"`;
|
|
4064
|
+
return e.keyParam !== void 0 ? `${t};key="${e.keyParam}"` : t;
|
|
4065
|
+
}
|
|
4066
|
+
function lt(e, t, r) {
|
|
4067
|
+
let n = r.name.toLowerCase();
|
|
4068
|
+
if (n === "@authority") return H(t);
|
|
4069
|
+
if (n === "@target-uri") return `${t.protocol}//${H(t)}${t.pathname}${t.search}`;
|
|
4070
|
+
if (n === "signature-agent") {
|
|
4071
|
+
let o = e.headers.get("signature-agent");
|
|
4072
|
+
if (o === null) throw new Error("signature-agent covered but absent");
|
|
4073
|
+
return r.keyParam !== void 0 ? ut(o, r.keyParam) : o.trim().replace(/\s+/g, " ");
|
|
4074
|
+
}
|
|
4075
|
+
throw new Error(`unsupported covered component ${n}`);
|
|
4076
|
+
}
|
|
4077
|
+
function H(e) {
|
|
4078
|
+
let t = e.hostname.toLowerCase(), r = e.port;
|
|
4079
|
+
return !r || e.protocol === "https:" && r === "443" || e.protocol === "http:" && r === "80" ? t : `${t}:${r}`;
|
|
4080
|
+
}
|
|
4081
|
+
function ut(e, t) {
|
|
4082
|
+
let n = B(e).find((o) => o.key === t);
|
|
4083
|
+
if (!n) throw new Error(`signature-agent has no member ${t}`);
|
|
4084
|
+
return n.raw;
|
|
4085
|
+
}
|
|
4086
|
+
function gt(e) {
|
|
4087
|
+
return B(e).map((r) => {
|
|
4088
|
+
if (!r.isList) throw new Error(`Signature-Input member ${r.key} is not an inner list`);
|
|
4089
|
+
let n = r.items.map((o) => {
|
|
4090
|
+
if (typeof o.value != "string") throw new Error("component identifier is not a string");
|
|
4091
|
+
let a = o.params.get("key");
|
|
4092
|
+
return { name: o.value, keyParam: typeof a == "string" ? a : void 0 };
|
|
4093
|
+
});
|
|
4094
|
+
return { label: r.key, components: n, params: r.params, raw: r.raw };
|
|
4095
|
+
});
|
|
4096
|
+
}
|
|
4097
|
+
function ft(e) {
|
|
4098
|
+
let t = B(e), r = /* @__PURE__ */ new Map();
|
|
4099
|
+
for (let n of t) {
|
|
4100
|
+
if (n.isList || n.items.length !== 1) throw new Error(`Signature member ${n.key} is not a byte sequence`);
|
|
4101
|
+
let o = n.items[0].bytes;
|
|
4102
|
+
if (!o) throw new Error(`Signature member ${n.key} is not a byte sequence`);
|
|
4103
|
+
r.set(n.key, o);
|
|
4104
|
+
}
|
|
4105
|
+
return r;
|
|
4106
|
+
}
|
|
4107
|
+
var T = class {
|
|
4108
|
+
constructor(t, r = 0) {
|
|
4109
|
+
this.s = t;
|
|
4110
|
+
this.i = r;
|
|
4111
|
+
}
|
|
4112
|
+
eof() {
|
|
4113
|
+
return this.i >= this.s.length;
|
|
4114
|
+
}
|
|
4115
|
+
peek() {
|
|
4116
|
+
return this.s[this.i];
|
|
4117
|
+
}
|
|
4118
|
+
skipSP() {
|
|
4119
|
+
for (; !this.eof() && (this.peek() === " " || this.peek() === " "); ) this.i++;
|
|
4120
|
+
}
|
|
4121
|
+
};
|
|
4122
|
+
function B(e) {
|
|
4123
|
+
let t = new T(e), r = [];
|
|
4124
|
+
for (t.skipSP(); !t.eof(); ) {
|
|
4125
|
+
let o = { key: ge(t), raw: "", isList: false, items: [], params: /* @__PURE__ */ new Map() };
|
|
4126
|
+
if (!t.eof() && t.peek() === "=") {
|
|
4127
|
+
t.i++;
|
|
4128
|
+
let a = t.i;
|
|
4129
|
+
if (!t.eof() && t.peek() === "(") o.isList = true, pt(t, o);
|
|
4130
|
+
else {
|
|
4131
|
+
let { value: i, params: s, bytes: c } = ue(t);
|
|
4132
|
+
o.items.push({ value: i, params: s, ...c ? { bytes: c } : {} });
|
|
4133
|
+
}
|
|
4134
|
+
o.raw = e.slice(a, t.i);
|
|
4135
|
+
} else o.params = V(t), o.items.push({ value: true, params: /* @__PURE__ */ new Map() });
|
|
4136
|
+
if (r.push(o), t.skipSP(), t.eof()) break;
|
|
4137
|
+
if (t.peek() !== ",") throw new Error(`expected ',' at ${t.i}`);
|
|
4138
|
+
if (t.i++, t.skipSP(), t.eof()) throw new Error("trailing comma");
|
|
4139
|
+
}
|
|
4140
|
+
return r;
|
|
4141
|
+
}
|
|
4142
|
+
function pt(e, t) {
|
|
4143
|
+
for (e.i++; ; ) {
|
|
4144
|
+
if (e.skipSP(), e.eof()) throw new Error("unterminated inner list");
|
|
4145
|
+
if (e.peek() === ")") {
|
|
4146
|
+
e.i++;
|
|
4147
|
+
break;
|
|
4148
|
+
}
|
|
4149
|
+
let { value: r, params: n } = ue(e);
|
|
4150
|
+
if (t.items.push({ value: r, params: n }), e.eof()) throw new Error("unterminated inner list");
|
|
4151
|
+
let o = e.peek();
|
|
4152
|
+
if (o !== " " && o !== ")") throw new Error(`bad inner list at ${e.i}`);
|
|
4153
|
+
}
|
|
4154
|
+
t.params = V(e);
|
|
4155
|
+
}
|
|
4156
|
+
function ue(e) {
|
|
4157
|
+
let { value: t, bytes: r } = fe(e), n = V(e);
|
|
4158
|
+
return { value: t, params: n, bytes: r };
|
|
4159
|
+
}
|
|
4160
|
+
function V(e) {
|
|
4161
|
+
let t = /* @__PURE__ */ new Map();
|
|
4162
|
+
for (; !e.eof() && e.peek() === ";"; ) {
|
|
4163
|
+
e.i++, e.skipSP();
|
|
4164
|
+
let r = ge(e), n = true;
|
|
4165
|
+
if (!e.eof() && e.peek() === "=") {
|
|
4166
|
+
e.i++;
|
|
4167
|
+
let o = fe(e);
|
|
4168
|
+
n = (typeof o.value == "boolean", o.value);
|
|
4169
|
+
}
|
|
4170
|
+
typeof n != "boolean" && t.set(r, n);
|
|
4171
|
+
}
|
|
4172
|
+
return t;
|
|
4173
|
+
}
|
|
4174
|
+
function ge(e) {
|
|
4175
|
+
let t = e.peek();
|
|
4176
|
+
if (!t || !/[a-z*]/.test(t)) throw new Error(`invalid key at ${e.i}`);
|
|
4177
|
+
let r = e.i;
|
|
4178
|
+
for (; !e.eof() && /[a-z0-9_\-.*]/.test(e.peek()); ) e.i++;
|
|
4179
|
+
return e.s.slice(r, e.i);
|
|
4180
|
+
}
|
|
4181
|
+
function fe(e) {
|
|
4182
|
+
let t = e.peek();
|
|
4183
|
+
if (t === '"') return { value: pe(e) };
|
|
4184
|
+
if (t === ":") return { value: "", bytes: dt(e) };
|
|
4185
|
+
if (t === "?") {
|
|
4186
|
+
e.i++;
|
|
4187
|
+
let r = e.peek();
|
|
4188
|
+
if (e.i++, r === "1") return { value: true };
|
|
4189
|
+
if (r === "0") return { value: false };
|
|
4190
|
+
throw new Error("bad boolean");
|
|
4191
|
+
}
|
|
4192
|
+
if (t === "-" || /[0-9]/.test(t)) return { value: ht(e) };
|
|
4193
|
+
if (/[a-zA-Z*]/.test(t)) return { value: mt(e) };
|
|
4194
|
+
throw new Error(`invalid bare item at ${e.i}`);
|
|
4195
|
+
}
|
|
4196
|
+
function pe(e) {
|
|
4197
|
+
e.i++;
|
|
4198
|
+
let t = "";
|
|
4199
|
+
for (; !e.eof(); ) {
|
|
4200
|
+
let r = e.s[e.i++];
|
|
4201
|
+
if (r === '"') return t;
|
|
4202
|
+
if (r === "\\") {
|
|
4203
|
+
let n = e.s[e.i++];
|
|
4204
|
+
if (n !== '"' && n !== "\\") throw new Error("bad escape");
|
|
4205
|
+
t += n;
|
|
4206
|
+
} else {
|
|
4207
|
+
let n = r.charCodeAt(0);
|
|
4208
|
+
if (n < 32 || n > 126) throw new Error("bad char in string");
|
|
4209
|
+
t += r;
|
|
4210
|
+
}
|
|
4211
|
+
}
|
|
4212
|
+
throw new Error("unterminated string");
|
|
4213
|
+
}
|
|
4214
|
+
function dt(e) {
|
|
4215
|
+
e.i++;
|
|
4216
|
+
let t = e.i;
|
|
4217
|
+
for (; !e.eof() && e.peek() !== ":"; ) e.i++;
|
|
4218
|
+
if (e.eof()) throw new Error("unterminated byte sequence");
|
|
4219
|
+
let r = e.s.slice(t, e.i);
|
|
4220
|
+
return e.i++, de(r);
|
|
4221
|
+
}
|
|
4222
|
+
function ht(e) {
|
|
4223
|
+
let t = e.i;
|
|
4224
|
+
for (e.peek() === "-" && e.i++; !e.eof() && /[0-9]/.test(e.peek()); ) e.i++;
|
|
4225
|
+
if (!e.eof() && e.peek() === ".") for (e.i++; !e.eof() && /[0-9]/.test(e.peek()); ) e.i++;
|
|
4226
|
+
return Number(e.s.slice(t, e.i));
|
|
4227
|
+
}
|
|
4228
|
+
function mt(e) {
|
|
4229
|
+
let t = e.i;
|
|
4230
|
+
for (e.i++; !e.eof() && /[a-zA-Z0-9!#$%&'*+\-.^_`|~:/]/.test(e.peek()); ) e.i++;
|
|
4231
|
+
return e.s.slice(t, e.i);
|
|
4232
|
+
}
|
|
4233
|
+
function de(e) {
|
|
4234
|
+
let t = atob(e), r = new Uint8Array(new ArrayBuffer(t.length));
|
|
4235
|
+
for (let n = 0; n < t.length; n++) r[n] = t.charCodeAt(n);
|
|
4236
|
+
return r;
|
|
4237
|
+
}
|
|
4238
|
+
function he(e, t) {
|
|
4239
|
+
return e === "ai_crawlers" ? t.ai_crawlers : e === "search_engines" ? t.search_engines : e === "monitoring" ? t.monitoring : false;
|
|
4240
|
+
}
|
|
4241
|
+
var W = { "attested-human": 2, "human-likely": 1, clean: 0 };
|
|
4242
|
+
function wt(e) {
|
|
4243
|
+
return W[e ?? ""] ?? 0;
|
|
4244
|
+
}
|
|
4245
|
+
function z(e) {
|
|
4246
|
+
return e > 0 ? Object.keys(W).find((t) => W[t] === e) ?? "" : "";
|
|
4247
|
+
}
|
|
4248
|
+
function me(e) {
|
|
4249
|
+
return e = bt(e), e = vt(e), e.toLowerCase();
|
|
4250
|
+
}
|
|
4251
|
+
function bt(e) {
|
|
4252
|
+
for (let t = 0; t < 4; t++) {
|
|
4253
|
+
let r = yt(e);
|
|
4254
|
+
if (r === e) break;
|
|
4255
|
+
e = r;
|
|
4256
|
+
}
|
|
4257
|
+
return e;
|
|
4258
|
+
}
|
|
4259
|
+
function yt(e) {
|
|
4260
|
+
if (!e.includes("%")) return e;
|
|
4261
|
+
let t = "";
|
|
4262
|
+
for (let r = 0; r < e.length; r++) {
|
|
4263
|
+
if (e[r] === "%" && r + 2 < e.length) {
|
|
4264
|
+
let n = we(e.charCodeAt(r + 1)), o = we(e.charCodeAt(r + 2));
|
|
4265
|
+
if (n >= 0 && o >= 0) {
|
|
4266
|
+
let a = n << 4 | o;
|
|
4267
|
+
if (a < 128) {
|
|
4268
|
+
t += String.fromCharCode(a), r += 2;
|
|
4269
|
+
continue;
|
|
4270
|
+
}
|
|
4271
|
+
}
|
|
4272
|
+
}
|
|
4273
|
+
t += e[r];
|
|
4274
|
+
}
|
|
4275
|
+
return t;
|
|
4276
|
+
}
|
|
4277
|
+
function we(e) {
|
|
4278
|
+
return e >= 48 && e <= 57 ? e - 48 : e >= 97 && e <= 102 ? e - 97 + 10 : e >= 65 && e <= 70 ? e - 65 + 10 : -1;
|
|
4279
|
+
}
|
|
4280
|
+
function vt(e) {
|
|
4281
|
+
if (e === "") return e;
|
|
4282
|
+
let t = e.length > 1 && e[e.length - 1] === "/", r = [];
|
|
4283
|
+
for (let o of e.split("/")) if (!(o === "" || o === ".")) {
|
|
4284
|
+
if (o === "..") {
|
|
4285
|
+
r.length > 0 && r.pop();
|
|
4286
|
+
continue;
|
|
4287
|
+
}
|
|
4288
|
+
r.push(o);
|
|
4289
|
+
}
|
|
4290
|
+
let n = "/" + r.join("/");
|
|
4291
|
+
return t && n !== "/" && (n += "/"), n;
|
|
4292
|
+
}
|
|
4293
|
+
function I(e, t) {
|
|
4294
|
+
let r = me(e), n = me(t);
|
|
4295
|
+
if (n.endsWith("/*")) {
|
|
4296
|
+
let o = n.slice(0, -2);
|
|
4297
|
+
return o === "" ? true : r === o || r.startsWith(o + "/");
|
|
4298
|
+
}
|
|
4299
|
+
return r === n;
|
|
4300
|
+
}
|
|
4301
|
+
function O(e) {
|
|
4302
|
+
return e.endsWith("/*") ? e.length - 2 : 1 << 20;
|
|
4303
|
+
}
|
|
4304
|
+
function be(e, t, r) {
|
|
4305
|
+
let n = /* @__PURE__ */ new Map(), o = /* @__PURE__ */ new Set(), a = [], i = [], s = /* @__PURE__ */ new Map(), c = (u, f) => {
|
|
4306
|
+
let v = new Set(u);
|
|
4307
|
+
for (let C of f) for (let _ of s.get(C) ?? []) v.add(_);
|
|
4308
|
+
return v.size === 0 ? void 0 : [...v].sort();
|
|
4309
|
+
}, p = (u, f, v) => v ? { pattern: u, required_trust: f, refused_behaviors: v } : { pattern: u, required_trust: f };
|
|
4310
|
+
for (let u of t) {
|
|
4311
|
+
if (!I(e, u.pattern)) continue;
|
|
4312
|
+
if ((u.exceptions ?? []).some((C) => I(e, C))) {
|
|
4313
|
+
i.push(u.pattern);
|
|
4314
|
+
continue;
|
|
4315
|
+
}
|
|
4316
|
+
let f = n.get(u.pattern);
|
|
4317
|
+
f === void 0 && a.push(u.pattern);
|
|
4318
|
+
let v = wt(u.min_trust);
|
|
4319
|
+
(f === void 0 || v > f) && n.set(u.pattern, v), u.mode !== "monitor" && o.add(u.pattern);
|
|
4320
|
+
for (let C of u.refuse_behaviors ?? []) s.has(u.pattern) || s.set(u.pattern, /* @__PURE__ */ new Set()), s.get(u.pattern)?.add(C);
|
|
4321
|
+
}
|
|
4322
|
+
let l = [];
|
|
4323
|
+
if (a.length === 0) {
|
|
4324
|
+
let u = "";
|
|
4325
|
+
for (let f of i) (u === "" || O(f) > O(u)) && (u = f);
|
|
4326
|
+
return { covering: a, deciding_mode: "", attributed: "", required_trust: "", requirement_source: "", previews: l, excepted_by: u, refused_behaviors: [] };
|
|
4327
|
+
}
|
|
4328
|
+
a.sort((u, f) => O(f) - O(u));
|
|
4329
|
+
let h = r === "monitor", d = a.filter((u) => o.has(u)), w = h ? "monitor" : "enforce";
|
|
4330
|
+
if (d.length === 0) {
|
|
4331
|
+
if (!h) for (let u of a) l.push(p(u, z(n.get(u) ?? 0), c([], [u])));
|
|
4332
|
+
d = a, w = "monitor";
|
|
4333
|
+
}
|
|
4334
|
+
let b = 0, g = "";
|
|
4335
|
+
for (let u of d) {
|
|
4336
|
+
let f = n.get(u) ?? 0;
|
|
4337
|
+
f > b && (b = f, g = u);
|
|
4338
|
+
}
|
|
4339
|
+
let A = c([], d) ?? [];
|
|
4340
|
+
if (w === "enforce") for (let u of a) o.has(u) || l.push(p(u, z(Math.max(b, n.get(u) ?? 0)), c(A, [u])));
|
|
4341
|
+
return { covering: a, deciding_mode: w, attributed: d[0], required_trust: z(b), requirement_source: g, previews: l, excepted_by: "", refused_behaviors: A };
|
|
4342
|
+
}
|
|
4343
|
+
var _t = "other";
|
|
4344
|
+
var xt = { "search engine crawler": "search", "ai search": "search", "ai assistant": "agent", "ai crawler": "training", "page preview": "link_preview", "feed fetcher": "feeds", "monitoring & analytics": "monitoring", "search engine optimization": "seo", security: "security_testing" };
|
|
4345
|
+
function D(e) {
|
|
4346
|
+
let t = e.trim().toLowerCase();
|
|
4347
|
+
return t ? xt[t] ?? _t : "";
|
|
4348
|
+
}
|
|
4349
|
+
function F(e, t) {
|
|
4350
|
+
let r = D(e);
|
|
4351
|
+
return r !== "" && t.includes(r);
|
|
4352
|
+
}
|
|
4353
|
+
var At = { search_engines: ["search engine crawler"], ai_crawlers: ["ai assistant", "ai crawler", "ai search"], monitoring: ["monitoring & analytics"] };
|
|
4354
|
+
function ye(e, t) {
|
|
4355
|
+
let r = At[e];
|
|
4356
|
+
return r ? r.every((n) => F(n, t)) : false;
|
|
4357
|
+
}
|
|
4358
|
+
var Rt = I;
|
|
4359
|
+
function ve(e, t, r) {
|
|
4360
|
+
return e ? t ? t.some((n) => Rt(r, n)) : true : false;
|
|
4361
|
+
}
|
|
4362
|
+
var Ct = "x-wd-service-token";
|
|
4363
|
+
var St = "wd_clearance";
|
|
4364
|
+
function _e(e, t, r = []) {
|
|
4365
|
+
if (e.graded && t && !Ot(e.graded.trust, t)) return { pass: false, label: "insufficient-trust" };
|
|
4366
|
+
if (e.crawler && r.length > 0) {
|
|
4367
|
+
if (e.crawler.behavior && r.includes(e.crawler.behavior)) return { pass: false, label: "crawler-refused" };
|
|
4368
|
+
if (!e.crawler.behavior && e.crawler.exempted) return { pass: false, label: "missing" };
|
|
4369
|
+
}
|
|
4370
|
+
return { pass: e.pass, label: e.label };
|
|
4371
|
+
}
|
|
4372
|
+
async function Ce(e, t, r) {
|
|
4373
|
+
let n = new URL(e.url).pathname, o = be(n, Tt(t), t.mode), a = o.deciding_mode || t.mode, i = await kt(e, t, r, o.covering.length > 0, o.excepted_by !== ""), s = i.behavior ?? "", c = _e(i, o.required_trust, o.refused_behaviors), p = c.label === "excepted" ? o.excepted_by : c.label === "unscoped" ? "" : o.attributed, l = !c.pass && a === "enforce", h = o.previews.map((d) => {
|
|
4374
|
+
let w = _e(i, d.required_trust, d.refused_behaviors ?? []);
|
|
4375
|
+
return { pattern: d.pattern, refused: !w.pass && !l ? w.label : "" };
|
|
4376
|
+
});
|
|
4377
|
+
return { pass: c.pass, label: c.label, pattern: p, mode: a, previews: h, behavior: c.pass ? s : "", crawlerBehavior: i.crawler?.behavior ?? "", referral: se(e, new URL(e.url)), outsideReach: i.outsideReach ?? "" };
|
|
4378
|
+
}
|
|
4379
|
+
async function kt(e, t, r, n, o) {
|
|
4380
|
+
let a = await Et(e, t, r);
|
|
4381
|
+
if (a.grants) return { pass: true, label: "machine" };
|
|
4382
|
+
let i = await Pt(e, t, r, n, o);
|
|
4383
|
+
return a.outsideReach ? { ...i, outsideReach: a.outsideReach } : i;
|
|
4384
|
+
}
|
|
4385
|
+
async function Et(e, t, r) {
|
|
4386
|
+
let n = e.headers.get(Ct);
|
|
4387
|
+
if (!n) return { grants: false, outsideReach: "" };
|
|
4388
|
+
let o = await ke(n, t.keys, r.siteKey);
|
|
4389
|
+
if (!o || o.typ !== "machine" || !o.sub) return { grants: false, outsideReach: "" };
|
|
4390
|
+
if (t.active_credentials.includes(o.sub)) return { grants: true, outsideReach: "" };
|
|
4391
|
+
let a = (t.restricted_credentials ?? []).find((s) => s && s.id === o.sub);
|
|
4392
|
+
if (!a) return { grants: false, outsideReach: "" };
|
|
4393
|
+
let i = new URL(e.url).pathname;
|
|
4394
|
+
return ve(a.here, a.paths, i) ? { grants: true, outsideReach: "" } : { grants: false, outsideReach: o.sub };
|
|
4395
|
+
}
|
|
4396
|
+
async function Pt(e, t, r, n, o) {
|
|
4397
|
+
let a = await r.verifiedBotCategory(e, n) || "", i = a ? { behavior: D(a), exempted: false } : void 0;
|
|
4398
|
+
if (a && It(a, t)) {
|
|
4399
|
+
let l = D(a);
|
|
4400
|
+
return { pass: true, label: "verified-bot", behavior: l, crawler: { behavior: l, exempted: true } };
|
|
4401
|
+
}
|
|
4402
|
+
let s = await ce(e, t.signed_agents);
|
|
4403
|
+
if (s.status === "verified" && Dt(s.category, t)) return { pass: true, label: "signed-agent", behavior: Ae(s.category), crawler: { behavior: Ae(s.category), exempted: true } };
|
|
4404
|
+
if (s.status === "invalid" && n) return { pass: false, label: "agent-impersonation", crawler: i };
|
|
4405
|
+
if (!n) return o ? { pass: true, label: "excepted", crawler: i } : { pass: true, label: "unscoped", crawler: i };
|
|
4406
|
+
let c = q(e.headers.get("cookie") ?? "", St);
|
|
4407
|
+
if (!c) return { pass: false, label: "missing", crawler: i };
|
|
4408
|
+
let p = await ke(c, t.keys, r.siteKey);
|
|
4409
|
+
return !p || (p.typ ?? "") !== "" ? { pass: false, label: "invalid", crawler: i } : t.denied_fps && t.denied_fps.includes(p.fp) ? { pass: false, label: "revoked", crawler: i } : { pass: true, label: "valid", graded: { trust: p.trust }, crawler: i };
|
|
4410
|
+
}
|
|
4411
|
+
function Tt(e) {
|
|
4412
|
+
let t = new Set(e.routes), r = /* @__PURE__ */ new Map();
|
|
4413
|
+
for (let o of e.route_exceptions ?? []) t.has(o.pattern) && Array.isArray(o.except) && r.set(o.pattern, o.except);
|
|
4414
|
+
let n = e.routes.map((o) => ({ pattern: o, exceptions: r.get(o) }));
|
|
4415
|
+
for (let o of e.route_min_trust ?? []) t.has(o.pattern) && n.push({ pattern: o.pattern, min_trust: o.min_trust, exceptions: r.get(o.pattern) });
|
|
4416
|
+
for (let o of e.monitor_routes ?? []) n.push({ pattern: o.pattern, min_trust: o.min_trust, mode: "monitor", exceptions: o.except });
|
|
4417
|
+
for (let o of e.route_refusals ?? []) !Array.isArray(o.refuse_behaviors) || o.refuse_behaviors.length === 0 || (o.mode === "monitor" ? n.push({ pattern: o.pattern, mode: "monitor", refuse_behaviors: o.refuse_behaviors }) : t.has(o.pattern) && n.push({ pattern: o.pattern, exceptions: r.get(o.pattern), refuse_behaviors: o.refuse_behaviors }));
|
|
4418
|
+
return n;
|
|
4419
|
+
}
|
|
4420
|
+
var Bt = { "attested-human": 2, "human-likely": 1, clean: 0 };
|
|
4421
|
+
function xe(e) {
|
|
4422
|
+
return Bt[e ?? ""] ?? 0;
|
|
4423
|
+
}
|
|
4424
|
+
function Ot(e, t) {
|
|
4425
|
+
return xe(e) >= xe(t);
|
|
4426
|
+
}
|
|
4427
|
+
function It(e, t) {
|
|
4428
|
+
let r = t.allow_behaviors;
|
|
4429
|
+
return r ? F(e, r) : Mt(e, t.allow);
|
|
4430
|
+
}
|
|
4431
|
+
function Dt(e, t) {
|
|
4432
|
+
let r = t.allow_behaviors;
|
|
4433
|
+
return r ? ye(e, r) : he(e, t.allow);
|
|
4434
|
+
}
|
|
4435
|
+
function Ae(e) {
|
|
4436
|
+
return e === "search_engines" ? "search" : e === "monitoring" ? "monitoring" : "";
|
|
4437
|
+
}
|
|
4438
|
+
function Mt(e, t) {
|
|
4439
|
+
let r = e.trim().toLowerCase();
|
|
4440
|
+
return !!(t.search_engines && r.includes("search engine crawler") || t.ai_crawlers && r.startsWith("ai ") || t.monitoring && r.includes("monitoring"));
|
|
4441
|
+
}
|
|
4442
|
+
function j(e) {
|
|
4443
|
+
return !e.pass && e.mode === "enforce" && (e.label === "missing" || e.label === "invalid");
|
|
4444
|
+
}
|
|
4445
|
+
function Se(e) {
|
|
4446
|
+
return j(e) ? { ...e, pass: true, label: "outage-pass" } : e;
|
|
4447
|
+
}
|
|
4448
|
+
function q(e, t) {
|
|
4449
|
+
for (let r of e.split(";")) {
|
|
4450
|
+
let n = r.indexOf("=");
|
|
4451
|
+
if (!(n < 0) && r.slice(0, n).trim() === t) return r.slice(n + 1).trim() || null;
|
|
4452
|
+
}
|
|
4453
|
+
return null;
|
|
4454
|
+
}
|
|
4455
|
+
async function ke(e, t, r) {
|
|
4456
|
+
try {
|
|
4457
|
+
let n = e.indexOf(".");
|
|
4458
|
+
if (n < 0) return null;
|
|
4459
|
+
let o = Re(e.slice(0, n)), a = Re(e.slice(n + 1)), i = JSON.parse(new TextDecoder().decode(o)), s = t.find((l) => l.kid === i.kid);
|
|
4460
|
+
if (!s) return null;
|
|
4461
|
+
let c = await crypto.subtle.importKey("raw", Lt(s.public_key), { name: "Ed25519" }, false, ["verify"]);
|
|
4462
|
+
return !await crypto.subtle.verify({ name: "Ed25519" }, c, a, o) || i.tenant !== r || Date.now() / 1e3 >= i.exp ? null : i;
|
|
4463
|
+
} catch {
|
|
4464
|
+
return null;
|
|
4465
|
+
}
|
|
4466
|
+
}
|
|
4467
|
+
function Re(e) {
|
|
4468
|
+
let t = e.replace(/-/g, "+").replace(/_/g, "/") + "=".repeat((4 - e.length % 4) % 4);
|
|
4469
|
+
return Ee(atob(t));
|
|
4470
|
+
}
|
|
4471
|
+
function Lt(e) {
|
|
4472
|
+
return Ee(atob(e));
|
|
4473
|
+
}
|
|
4474
|
+
function Ee(e) {
|
|
4475
|
+
let t = new Uint8Array(new ArrayBuffer(e.length));
|
|
4476
|
+
for (let r = 0; r < e.length; r++) t[r] = e.charCodeAt(r);
|
|
4477
|
+
return t;
|
|
4478
|
+
}
|
|
4479
|
+
var L = "/.well-known/wd-clearance/outage";
|
|
4480
|
+
var J = "wd_outage";
|
|
4481
|
+
var Ut = "wd-outage-v1";
|
|
4482
|
+
var M = null;
|
|
4483
|
+
var E = null;
|
|
4484
|
+
async function Nt(e, t, r, n = fetch) {
|
|
4485
|
+
if (M && r - M.at < 3e4) return M.available;
|
|
4486
|
+
if (E) return E;
|
|
4487
|
+
E = (async () => {
|
|
4488
|
+
let o = false;
|
|
4489
|
+
try {
|
|
4490
|
+
let a = new AbortController(), i = setTimeout(() => a.abort(), 3e3);
|
|
4491
|
+
try {
|
|
4492
|
+
let s = await n(e.replace(/\/+$/, "") + "/api/v1/clearance", { method: "POST", headers: { "content-type": "application/json", "user-agent": "WebDecoy-OutageProbe/1" }, body: JSON.stringify({ aid: t, fp: "wd-outage-probe", scope: "", ua: "WebDecoy-OutageProbe/1" }), signal: a.signal });
|
|
4493
|
+
s.status < 300 && (o = typeof (await s.json())?.granted == "boolean");
|
|
4494
|
+
} finally {
|
|
4495
|
+
clearTimeout(i);
|
|
4496
|
+
}
|
|
4497
|
+
} catch {
|
|
4498
|
+
o = false;
|
|
4499
|
+
}
|
|
4500
|
+
return M = { at: r, available: o }, o;
|
|
4501
|
+
})();
|
|
4502
|
+
try {
|
|
4503
|
+
return await E;
|
|
4504
|
+
} finally {
|
|
4505
|
+
E = null;
|
|
4506
|
+
}
|
|
4507
|
+
}
|
|
4508
|
+
function Pe(e) {
|
|
4509
|
+
let t = "";
|
|
4510
|
+
for (let r of new Uint8Array(e)) t += String.fromCharCode(r);
|
|
4511
|
+
return btoa(t).replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "");
|
|
4512
|
+
}
|
|
4513
|
+
async function Te(e, t) {
|
|
4514
|
+
let r = await crypto.subtle.importKey("raw", new TextEncoder().encode(e), { name: "HMAC", hash: "SHA-256" }, false, ["sign"]);
|
|
4515
|
+
return Pe(await crypto.subtle.sign("HMAC", r, new TextEncoder().encode(t)));
|
|
4516
|
+
}
|
|
4517
|
+
async function Be(e) {
|
|
4518
|
+
return Pe(await crypto.subtle.digest("SHA-256", new TextEncoder().encode(e))).slice(0, 16);
|
|
4519
|
+
}
|
|
4520
|
+
function Oe(e, t, r) {
|
|
4521
|
+
return `${Ut}|${e}|${t}|${r}`;
|
|
4522
|
+
}
|
|
4523
|
+
async function $t(e, t, r, n) {
|
|
4524
|
+
let o = Math.floor(n / 1e3) + 300;
|
|
4525
|
+
return `${o}.${await Te(e, Oe(t, o, await Be(r)))}`;
|
|
4526
|
+
}
|
|
4527
|
+
async function Ie(e, t, r, n, o) {
|
|
4528
|
+
if (!t || !e) return false;
|
|
4529
|
+
let a = e.indexOf(".");
|
|
4530
|
+
if (a <= 0) return false;
|
|
4531
|
+
let i = Number(e.slice(0, a));
|
|
4532
|
+
if (!Number.isInteger(i) || i <= Math.floor(o / 1e3) || i > Math.floor(o / 1e3) + 300) return false;
|
|
4533
|
+
let s = await Te(t, Oe(r, i, await Be(n))), c = e.slice(a + 1);
|
|
4534
|
+
if (c.length !== s.length) return false;
|
|
4535
|
+
let p = 0;
|
|
4536
|
+
for (let l = 0; l < s.length; l++) p |= s.charCodeAt(l) ^ c.charCodeAt(l);
|
|
4537
|
+
return p === 0;
|
|
4538
|
+
}
|
|
4539
|
+
async function De(e, t, r = Date.now(), n = fetch) {
|
|
4540
|
+
let o = (i, s, c = {}) => new Response(JSON.stringify(s), { status: i, headers: { "content-type": "application/json", "cache-control": "no-store", ...c } });
|
|
4541
|
+
if (e.method !== "POST") return o(405, { pass: false });
|
|
4542
|
+
if (!t.sensorKey) return o(503, { pass: false, reason: "unsupported" });
|
|
4543
|
+
if (await Nt(t.apiBase, t.siteKey, r, n)) return o(409, { pass: false, reason: "mint_available" });
|
|
4544
|
+
let a = await $t(t.sensorKey, t.host, e.headers.get("user-agent") ?? "", r);
|
|
4545
|
+
return o(200, { pass: true, expires_in: 300 }, { "set-cookie": `${J}=${a}; Path=/; Secure; SameSite=Lax; HttpOnly; Max-Age=300` });
|
|
4546
|
+
}
|
|
4547
|
+
var Gt = "wdfp1";
|
|
4548
|
+
var Me = `
|
|
4549
|
+
async function wdDeviceFP() {
|
|
4550
|
+
// Canvas: 32-bit rolling hash of the dataURL, matching
|
|
4551
|
+
// EnvironmentalCollector._getCanvasHash in @webdecoy/client. The drawing
|
|
4552
|
+
// parameters below are part of the fingerprint \u2014 changing any of them
|
|
4553
|
+
// changes every fingerprint.
|
|
4554
|
+
var canvas32 = 'na';
|
|
4555
|
+
try {
|
|
4556
|
+
var c = document.createElement('canvas');
|
|
4557
|
+
c.width = 200; c.height = 50;
|
|
4558
|
+
var x = c.getContext('2d');
|
|
4559
|
+
x.textBaseline = 'top'; x.font = '14px Arial';
|
|
4560
|
+
x.fillStyle = '#f60'; x.fillRect(125, 1, 62, 20);
|
|
4561
|
+
x.fillStyle = '#069'; x.fillText('FCaptcha', 2, 15);
|
|
4562
|
+
x.fillStyle = 'rgba(102, 204, 0, 0.7)'; x.fillText('FCaptcha', 4, 17);
|
|
4563
|
+
var dataUrl = c.toDataURL();
|
|
4564
|
+
var h = 0;
|
|
4565
|
+
for (var i = 0; i < dataUrl.length; i++) { h = ((h << 5) - h) + dataUrl.charCodeAt(i); h = h & h; }
|
|
4566
|
+
canvas32 = h.toString(16);
|
|
4567
|
+
} catch (e) { canvas32 = 'na'; }
|
|
4568
|
+
|
|
4569
|
+
var webgl = 'na';
|
|
4570
|
+
try {
|
|
4571
|
+
var gc = document.createElement('canvas');
|
|
4572
|
+
var gl = gc.getContext('webgl') || gc.getContext('experimental-webgl');
|
|
4573
|
+
if (gl) {
|
|
4574
|
+
var dbg = gl.getExtension('WEBGL_debug_renderer_info');
|
|
4575
|
+
var vendor = dbg ? gl.getParameter(dbg.UNMASKED_VENDOR_WEBGL) : 'unknown';
|
|
4576
|
+
var renderer = dbg ? gl.getParameter(dbg.UNMASKED_RENDERER_WEBGL) : 'unknown';
|
|
4577
|
+
webgl = String(renderer) + '~' + String(vendor);
|
|
4578
|
+
}
|
|
4579
|
+
} catch (e) { webgl = 'na'; }
|
|
4580
|
+
|
|
4581
|
+
var tz = 'na';
|
|
4582
|
+
try { tz = Intl.DateTimeFormat().resolvedOptions().timeZone || 'na'; } catch (e) {}
|
|
4583
|
+
|
|
4584
|
+
var raw = ['${Gt}', canvas32, webgl,
|
|
4585
|
+
screen.width + 'x' + screen.height + 'x' + screen.colorDepth,
|
|
4586
|
+
tz, navigator.platform || 'na', navigator.language || 'na'
|
|
4587
|
+
].join('|');
|
|
4588
|
+
var buf = await crypto.subtle.digest('SHA-256', new TextEncoder().encode(raw));
|
|
4589
|
+
var fp = Array.from(new Uint8Array(buf)).map(function (b) {
|
|
4590
|
+
return b.toString(16).padStart(2, '0');
|
|
4591
|
+
}).join('');
|
|
4592
|
+
|
|
4593
|
+
return { fp: fp, canvas32: canvas32, webgl: webgl };
|
|
4594
|
+
}
|
|
4595
|
+
`;
|
|
4596
|
+
function Y(e) {
|
|
4597
|
+
let r = ["missing", "invalid", "insufficient-trust", "revoked", "crawler-refused", "agent-impersonation"].includes(e) ? e : "denied";
|
|
4598
|
+
return { version: 1, reason: r, recoverable: r === "missing" || r === "invalid" || r === "insufficient-trust" };
|
|
4599
|
+
}
|
|
4600
|
+
function Le(e) {
|
|
4601
|
+
let t = Y(e);
|
|
4602
|
+
return { "cache-control": "no-store", "x-wd-clearance": "challenged", "x-wd-challenge": String(t.version), "x-wd-challenge-reason": t.reason, "x-wd-challenge-recoverable": String(t.recoverable) };
|
|
4603
|
+
}
|
|
4604
|
+
var Kt = 6e4;
|
|
4605
|
+
var U = "x-wd-clearance";
|
|
4606
|
+
var Ue = "x-wd-class";
|
|
4607
|
+
var Ne = "__wd_clearance_check";
|
|
4608
|
+
var Q = "/.well-known/wd-clearance/pat";
|
|
4609
|
+
var P = /* @__PURE__ */ new Map();
|
|
4610
|
+
var Ht = 16;
|
|
4611
|
+
var Vt = 3e4;
|
|
4612
|
+
var zt = 3e5;
|
|
4613
|
+
var Z = /* @__PURE__ */ new Map();
|
|
4614
|
+
var X = /* @__PURE__ */ new Map();
|
|
4615
|
+
var Wt = 86400;
|
|
4616
|
+
function $e(e, t) {
|
|
4617
|
+
return `https://wd-config.invalid/${encodeURIComponent(e)}/${encodeURIComponent(t)}`;
|
|
4618
|
+
}
|
|
4619
|
+
function Ge() {
|
|
4620
|
+
try {
|
|
4621
|
+
return globalThis.caches?.default ?? null;
|
|
4622
|
+
} catch {
|
|
4623
|
+
return null;
|
|
4624
|
+
}
|
|
4625
|
+
}
|
|
4626
|
+
async function Ke(e, t) {
|
|
4627
|
+
let r = Ge();
|
|
4628
|
+
if (!r) return null;
|
|
4629
|
+
try {
|
|
4630
|
+
let n = await r.match($e(e, t));
|
|
4631
|
+
return n ? await n.json() : null;
|
|
4632
|
+
} catch {
|
|
4633
|
+
return null;
|
|
4634
|
+
}
|
|
4635
|
+
}
|
|
4636
|
+
async function Ft(e, t, r) {
|
|
4637
|
+
let n = Ge();
|
|
4638
|
+
if (n) try {
|
|
4639
|
+
await n.put($e(e, t), new Response(JSON.stringify(r), { headers: { "content-type": "application/json", "cache-control": `max-age=${Wt}` } }));
|
|
4640
|
+
} catch {
|
|
4641
|
+
}
|
|
4642
|
+
}
|
|
4643
|
+
function jt(e) {
|
|
4644
|
+
let t = e?.headers.get("retry-after"), r = t ? Number(t) : NaN;
|
|
4645
|
+
return Number.isFinite(r) && r > 0 ? Math.min(Math.max(r * 1e3, 5e3), zt) : Vt;
|
|
4646
|
+
}
|
|
4647
|
+
async function He(e, t) {
|
|
4648
|
+
let r = Date.now(), n = t, o = P.get(n);
|
|
4649
|
+
if (o && r - o.at < Kt) return o.config;
|
|
4650
|
+
let a = Z.get(n);
|
|
4651
|
+
if (a !== void 0 && r < a) return o?.config ?? await Ke(e.siteKey, t);
|
|
4652
|
+
let i = X.get(n);
|
|
4653
|
+
if (i) return o?.config ?? i;
|
|
4654
|
+
let s = qt(e, t, n, r, o?.config ?? null);
|
|
4655
|
+
X.set(n, s);
|
|
4656
|
+
try {
|
|
4657
|
+
return await s;
|
|
4658
|
+
} finally {
|
|
4659
|
+
X.delete(n);
|
|
4660
|
+
}
|
|
4661
|
+
}
|
|
4662
|
+
async function qt(e, t, r, n, o) {
|
|
4663
|
+
let a = null;
|
|
4664
|
+
try {
|
|
4665
|
+
let i = `${e.apiBase}/api/v1/clearance/config?aid=${encodeURIComponent(e.siteKey)}`;
|
|
4666
|
+
if (e.propertyId && (i += `&pid=${encodeURIComponent(e.propertyId)}`), t && (i += `&host=${encodeURIComponent(t)}`), a = await fetch(i, { signal: AbortSignal.timeout(3e3) }), a.ok) {
|
|
4667
|
+
let s = await a.json();
|
|
4668
|
+
if (Z.delete(r), P.set(r, { config: s, at: n }), P.size > Ht) {
|
|
4669
|
+
let c = P.keys().next();
|
|
4670
|
+
c.done || P.delete(c.value);
|
|
4671
|
+
}
|
|
4672
|
+
return await Ft(e.siteKey, t, s), s;
|
|
4673
|
+
}
|
|
4674
|
+
} catch {
|
|
4675
|
+
}
|
|
4676
|
+
return Z.set(r, n + jt(a)), o ?? await Ke(e.siteKey, t);
|
|
4677
|
+
}
|
|
4678
|
+
function Ve(e, t, r, n) {
|
|
4679
|
+
return new Response(JSON.stringify({ wd_clearance: true, nonce: e, mode: t, site_key: r, capabilities: n }), { status: 200, headers: { "content-type": "application/json", "cache-control": "no-store", "access-control-allow-origin": "*" } });
|
|
4680
|
+
}
|
|
4681
|
+
var Jt = 3e3;
|
|
4682
|
+
async function ze(e, t) {
|
|
4683
|
+
let r = new URL(e.url).searchParams.get("fp") ?? "", n = `${t}/api/v1/clearance/pat?fp=${encodeURIComponent(r)}`, o = new Headers(), a = e.headers.get("authorization");
|
|
4684
|
+
a && o.set("authorization", a);
|
|
4685
|
+
let i;
|
|
4686
|
+
try {
|
|
4687
|
+
i = await fetch(n, { method: "GET", headers: o, redirect: "manual", signal: AbortSignal.timeout(Jt) });
|
|
4688
|
+
} catch {
|
|
4689
|
+
return new Response(JSON.stringify({ attested: false, reason: "unreachable" }), { status: 200, headers: { "content-type": "application/json", "cache-control": "no-store" } });
|
|
4690
|
+
}
|
|
4691
|
+
let s = new Headers({ "content-type": "application/json", "cache-control": "no-store" }), c = i.headers.get("www-authenticate");
|
|
4692
|
+
return c && s.set("www-authenticate", c), new Response(i.body, { status: i.status, headers: s });
|
|
4693
|
+
}
|
|
4694
|
+
function We(e, t, r, n = "denied") {
|
|
4695
|
+
let o = e.headers.get("accept") ?? "";
|
|
4696
|
+
if (e.method !== "GET" || !o.includes("text/html")) return new Response(JSON.stringify({ error: "clearance required", challenge: Y(n) }), { status: 403, headers: { "content-type": "application/json", ...Le(n) } });
|
|
4697
|
+
let a = Xt(t, r);
|
|
4698
|
+
return new Response(a, { status: 403, headers: { "content-type": "text/html; charset=utf-8", "cache-control": "no-store", [U]: "challenged" } });
|
|
4699
|
+
}
|
|
4700
|
+
var Yt = "https://cdn.webdecoy.com/wordpress/assets/icon-128x128.png";
|
|
4701
|
+
function Xt(e, t) {
|
|
4702
|
+
return `<!doctype html>
|
|
4703
|
+
<html lang="en">
|
|
4704
|
+
<head>
|
|
4705
|
+
<meta charset="utf-8">
|
|
4706
|
+
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
4707
|
+
<title>Checking your browser\u2026</title>
|
|
4708
|
+
<style>
|
|
4709
|
+
body { font-family: system-ui, sans-serif; display: flex; align-items: center;
|
|
4710
|
+
justify-content: center; min-height: 100vh; margin: 0; background: #0b0e14; color: #e6e6e6; }
|
|
4711
|
+
.box { text-align: center; max-width: 24rem; padding: 2rem; }
|
|
4712
|
+
.brand { display: flex; align-items: center; justify-content: center; gap: 0.6rem; margin-bottom: 1.5rem;
|
|
4713
|
+
font-weight: 600; font-size: 1rem; letter-spacing: 0.01em; }
|
|
4714
|
+
.brand img { width: 2.25rem; height: 2.25rem; border-radius: 0.5rem; }
|
|
4715
|
+
.spin { width: 2rem; height: 2rem; margin: 0 auto 1rem; border: 3px solid #2a2f3a;
|
|
4716
|
+
border-top-color: #f90289; border-radius: 50%; animation: r 0.8s linear infinite; }
|
|
4717
|
+
@keyframes r { to { transform: rotate(360deg); } }
|
|
4718
|
+
p { color: #9aa4b2; font-size: 0.9rem; line-height: 1.5; }
|
|
4719
|
+
.foot { margin-top: 2rem; font-size: 0.75rem; color: #6b7280; }
|
|
4720
|
+
.foot a { color: #9aa4b2; text-decoration: none; }
|
|
4721
|
+
</style>
|
|
4722
|
+
</head>
|
|
4723
|
+
<body>
|
|
4724
|
+
<div class="box">
|
|
4725
|
+
<div class="brand"><img src="${Yt}" alt="" width="36" height="36">WebDecoy</div>
|
|
4726
|
+
<div class="spin" id="spin"></div>
|
|
4727
|
+
<h1 style="font-size:1.1rem">Checking your browser</h1>
|
|
4728
|
+
<p id="msg">This takes a moment and happens only once.</p>
|
|
4729
|
+
<p class="foot">This site is protected by <a href="https://webdecoy.com" rel="noopener">WebDecoy</a>.</p>
|
|
4730
|
+
</div>
|
|
4731
|
+
<script>
|
|
4732
|
+
${Me}
|
|
4733
|
+
(async function () {
|
|
4734
|
+
var msg = document.getElementById('msg');
|
|
4735
|
+
try {
|
|
4736
|
+
// CANONICAL device fp, from the single shared source in device-fp.ts.
|
|
4737
|
+
// Returns the fingerprint plus the raw canvas/WebGL signals the integrity
|
|
4738
|
+
// check below also needs, so neither context is built twice.
|
|
4739
|
+
var dfp = await wdDeviceFP();
|
|
4740
|
+
var fp = dfp.fp;
|
|
4741
|
+
var canvas32 = dfp.canvas32;
|
|
4742
|
+
var webgl = dfp.webgl;
|
|
4743
|
+
|
|
4744
|
+
// Browser-integrity signals (#327). Collected in-browser and reported raw \u2014
|
|
4745
|
+
// the server decides. A real browser is internally consistent; a standard
|
|
4746
|
+
// headless/automation environment betrays incoherence it does not spoof by
|
|
4747
|
+
// default (permission vs Notification state, absent navigator.languages,
|
|
4748
|
+
// a Chrome UA with no window.chrome). Coherent signals earn the token a
|
|
4749
|
+
// 'human-likely' grade; anything off falls back to 'clean' (never blocked).
|
|
4750
|
+
var integrity = {
|
|
4751
|
+
webdriver: navigator.webdriver === true,
|
|
4752
|
+
headless_ua: /headless/i.test(navigator.userAgent),
|
|
4753
|
+
no_plugins: !(navigator.plugins && navigator.plugins.length > 0),
|
|
4754
|
+
no_languages: !(navigator.languages && navigator.languages.length > 0),
|
|
4755
|
+
hardware: navigator.hardwareConcurrency || 0,
|
|
4756
|
+
canvas_ok: canvas32 !== 'na',
|
|
4757
|
+
webgl_ok: webgl !== 'na',
|
|
4758
|
+
chrome_ua: /chrome|chromium|crios/i.test(navigator.userAgent),
|
|
4759
|
+
chrome_obj: (typeof window.chrome === 'object' && window.chrome !== null),
|
|
4760
|
+
perm_coherent: true
|
|
4761
|
+
};
|
|
4762
|
+
try {
|
|
4763
|
+
if (navigator.permissions && navigator.permissions.query && typeof Notification !== 'undefined') {
|
|
4764
|
+
var perm = await navigator.permissions.query({ name: 'notifications' });
|
|
4765
|
+
// Classic headless-Chrome tell: Notification.permission is the default
|
|
4766
|
+
// 'default', yet the Permissions API reports 'denied'. A real browser
|
|
4767
|
+
// agrees with itself.
|
|
4768
|
+
if (Notification.permission === 'default' && perm.state === 'denied') integrity.perm_coherent = false;
|
|
4769
|
+
}
|
|
4770
|
+
} catch (e) { /* permissions unsupported \u2014 leave coherent, fail open */ }
|
|
4771
|
+
|
|
4772
|
+
// Device attestation (#329). On a supporting client \u2014 Apple platforms
|
|
4773
|
+
// today \u2014 this endpoint answers 401 with a PrivateToken challenge, the OS
|
|
4774
|
+
// silently obtains a token and retries, and we get back a receipt worth an
|
|
4775
|
+
// 'attested-human' grade. No puzzle, no interaction, nothing to see.
|
|
4776
|
+
//
|
|
4777
|
+
// Everywhere else it fails or 401s and we move on: the absence of
|
|
4778
|
+
// attestation must never cost a visitor anything, because attester
|
|
4779
|
+
// coverage is thin and not their fault.
|
|
4780
|
+
var patReceipt = '';
|
|
4781
|
+
try {
|
|
4782
|
+
// SAME-ORIGIN by way of the validator's proxy. Fetching WebDecoy directly
|
|
4783
|
+
// meant Safari ignored the 401 challenge entirely \u2014 cross-origin
|
|
4784
|
+
// WWW-Authenticate does not trigger its challenge/response handling, so a
|
|
4785
|
+
// token was never requested. credentials stay same-origin so the browser
|
|
4786
|
+
// is permitted to do the auth exchange.
|
|
4787
|
+
var patRes = await fetch(
|
|
4788
|
+
${JSON.stringify(Q)} + '?fp=' + encodeURIComponent(fp),
|
|
4789
|
+
{ credentials: 'same-origin' }
|
|
4790
|
+
);
|
|
4791
|
+
if (patRes.ok) {
|
|
4792
|
+
var patOut = await patRes.json();
|
|
4793
|
+
if (patOut && patOut.attested && patOut.receipt) patReceipt = patOut.receipt;
|
|
4794
|
+
}
|
|
4795
|
+
} catch (e) { /* unsupported or unreachable \u2014 proceed unattested */ }
|
|
4796
|
+
|
|
4797
|
+
var mintBody = JSON.stringify({
|
|
4798
|
+
aid: ${JSON.stringify(t)},
|
|
4799
|
+
fp: fp,
|
|
4800
|
+
scope: '',
|
|
4801
|
+
ua: navigator.userAgent,
|
|
4802
|
+
webdriver: integrity.webdriver,
|
|
4803
|
+
headless: integrity.headless_ua,
|
|
4804
|
+
integrity: integrity,
|
|
4805
|
+
pat_receipt: patReceipt
|
|
4806
|
+
});
|
|
4807
|
+
// Mint, retrying only when WebDecoy could not be reached (#1245): a network
|
|
4808
|
+
// error, a timeout, 429 or 5xx. An ANSWER of "not granted" is a refusal and
|
|
4809
|
+
// is never retried or bypassed.
|
|
4810
|
+
var waits = [0, 1500, 4000];
|
|
4811
|
+
for (var attempt = 0; attempt < waits.length; attempt++) {
|
|
4812
|
+
if (waits[attempt]) await new Promise(function (r) { setTimeout(r, waits[attempt]); });
|
|
4813
|
+
var out = null;
|
|
4814
|
+
try {
|
|
4815
|
+
var ctl = new AbortController();
|
|
4816
|
+
var timer = setTimeout(function () { ctl.abort(); }, 4000);
|
|
4817
|
+
var res = await fetch(${JSON.stringify(e)} + '/api/v1/clearance', {
|
|
4818
|
+
method: 'POST',
|
|
4819
|
+
headers: { 'content-type': 'application/json' },
|
|
4820
|
+
body: mintBody,
|
|
4821
|
+
signal: ctl.signal
|
|
4822
|
+
});
|
|
4823
|
+
clearTimeout(timer);
|
|
4824
|
+
if (res.ok) out = await res.json();
|
|
4825
|
+
} catch (e) { out = null; }
|
|
4826
|
+
if (out && out.granted && out.token) {
|
|
4827
|
+
document.cookie = 'wd_clearance=' + out.token +
|
|
4828
|
+
'; path=/; secure; samesite=lax; max-age=' + (out.expires_in || 1800);
|
|
4829
|
+
location.reload();
|
|
4830
|
+
return;
|
|
4831
|
+
}
|
|
4832
|
+
if (out && out.granted === false) {
|
|
4833
|
+
document.getElementById('spin').style.display = 'none';
|
|
4834
|
+
msg.textContent = 'Verification did not pass. If you believe this is an error, contact the site owner.';
|
|
4835
|
+
return;
|
|
4836
|
+
}
|
|
4837
|
+
}
|
|
4838
|
+
// WebDecoy could not mint at all. The site owner chose to let visitors
|
|
4839
|
+
// through in that case; the validator confirms the outage itself before it
|
|
4840
|
+
// signs a short pass, so this cannot be used while minting works.
|
|
4841
|
+
try {
|
|
4842
|
+
var pass = await fetch(${JSON.stringify(L)}, { method: 'POST', credentials: 'same-origin' });
|
|
4843
|
+
if (pass.ok) {
|
|
4844
|
+
var passOut = await pass.json();
|
|
4845
|
+
if (passOut && passOut.pass) { location.reload(); return; }
|
|
4846
|
+
}
|
|
4847
|
+
} catch (e) { /* fall through to the retry message */ }
|
|
4848
|
+
document.getElementById('spin').style.display = 'none';
|
|
4849
|
+
msg.textContent = 'Verification could not complete. Please retry shortly.';
|
|
4850
|
+
} catch (e) {
|
|
4851
|
+
document.getElementById('spin').style.display = 'none';
|
|
4852
|
+
msg.textContent = 'Verification could not complete. Please retry shortly.';
|
|
4853
|
+
}
|
|
4854
|
+
})();
|
|
4855
|
+
</script>
|
|
4856
|
+
</body>
|
|
4857
|
+
</html>`;
|
|
4858
|
+
}
|
|
4859
|
+
function N(e) {
|
|
4860
|
+
if (typeof e != "string") return "";
|
|
4861
|
+
let t = e.trim().toLowerCase().replace(/:\d+$/, "").replace(/\.$/, "");
|
|
4862
|
+
return t.length > 0 && t.length <= 253 ? t : "";
|
|
4863
|
+
}
|
|
4864
|
+
var Fe = ["route_min_trust", "route_attribution", "monitor_routes", "route_exceptions", "bot_behaviors", "credential_reach", "route_refusals", "crawler_behavior", "ai_referrals"];
|
|
4865
|
+
var ee = 60;
|
|
4866
|
+
var Zt = 500;
|
|
4867
|
+
var Qt = 6e3;
|
|
4868
|
+
var je = 40;
|
|
4869
|
+
var er = 60;
|
|
4870
|
+
var tr = 16;
|
|
4871
|
+
var R = new TextEncoder();
|
|
4872
|
+
var rr = 60;
|
|
4873
|
+
var nr = 24;
|
|
4874
|
+
var or = 3e3;
|
|
4875
|
+
var ar = 2e4;
|
|
4876
|
+
var ir = 1e4;
|
|
4877
|
+
var sr = 16;
|
|
4878
|
+
var x = /* @__PURE__ */ new Map();
|
|
4879
|
+
function cr(e, t, r) {
|
|
4880
|
+
return `${e}|${t}|${r}`;
|
|
4881
|
+
}
|
|
4882
|
+
function qe(e, t, r, n, o = Date.now()) {
|
|
4883
|
+
try {
|
|
4884
|
+
let a = e?.label ?? "", i = e?.mode ?? "", s = e?.pattern ?? "", c = e?.previews ?? [], p = e?.behavior ?? "", l = e?.crawlerBehavior ?? "", h = e?.outsideReach ?? "";
|
|
4885
|
+
if (!a || !r || !r.siteKey || !r.apiBase) return;
|
|
4886
|
+
let d = N(t);
|
|
4887
|
+
if (!d) return;
|
|
4888
|
+
let w = Math.floor(o / 1e3 / ee) * ee, b = cr(w, i, d);
|
|
4889
|
+
for (let [m, y] of x) y.bucketStart !== w && ($(y, r, n), x.delete(m));
|
|
4890
|
+
let g = x.get(b);
|
|
4891
|
+
if (!g) {
|
|
4892
|
+
if (x.size >= sr) for (let [m, y] of x) $(y, r, n), x.delete(m);
|
|
4893
|
+
g = { bucketStart: w, mode: i, host: d, counts: /* @__PURE__ */ new Map(), routes: /* @__PURE__ */ new Map(), previews: /* @__PURE__ */ new Map(), credentials: /* @__PURE__ */ new Map(), referrals: /* @__PURE__ */ new Map(), refusals: [], routeBytes: 0, total: 0 }, x.set(b, g), lr(b, g, r, n, o);
|
|
4894
|
+
}
|
|
4895
|
+
g.counts.set(a, (g.counts.get(a) ?? 0) + 1);
|
|
4896
|
+
let A = typeof s == "string" ? s : "", u = typeof p == "string" ? p : "", f = typeof l == "string" ? l : "", v = `${A}
|
|
4897
|
+
${a}
|
|
4898
|
+
${u}
|
|
4899
|
+
${f}`, C = g.routes.get(v);
|
|
4900
|
+
C ? C.count++ : (g.routes.set(v, { pattern: A, verdict: a, behavior: u, crawlerBehavior: f, count: 1 }), g.routeBytes += R.encode(A).length + R.encode(a).length + R.encode(u).length + R.encode(f).length + je);
|
|
4901
|
+
for (let m of Array.isArray(c) ? c : []) {
|
|
4902
|
+
if (!m || typeof m.pattern != "string" || !m.pattern) continue;
|
|
4903
|
+
let y = g.previews.get(m.pattern);
|
|
4904
|
+
y || (y = { evaluated: 0, refused: /* @__PURE__ */ new Map() }, g.previews.set(m.pattern, y), g.routeBytes += R.encode(m.pattern).length + er), y.evaluated++, typeof m.refused == "string" && m.refused && (y.refused.has(m.refused) || (g.routeBytes += R.encode(m.refused).length + tr), y.refused.set(m.refused, (y.refused.get(m.refused) ?? 0) + 1));
|
|
4905
|
+
}
|
|
4906
|
+
typeof h == "string" && h && g.credentials.set(h, (g.credentials.get(h) ?? 0) + 1);
|
|
4907
|
+
let _ = e?.referral;
|
|
4908
|
+
if (_ && typeof _.platform == "string" && _.platform && typeof _.path == "string") {
|
|
4909
|
+
let m = `${_.platform}
|
|
4910
|
+
${_.path}`, y = g.referrals.get(m);
|
|
4911
|
+
y ? y.count++ : (g.referrals.set(m, { platform: _.platform, path: _.path, count: 1 }), g.routeBytes += R.encode(_.platform).length + R.encode(_.path).length + je);
|
|
4912
|
+
}
|
|
4913
|
+
let S = e?.refusal;
|
|
4914
|
+
S && typeof S.ip == "string" && S.ip && typeof S.path == "string" && S.path.startsWith("/") && (g.refusals.push({ ip: S.ip, path: S.path, at: Math.floor(o / 1e3), verdict: a }), g.routeBytes += rr), g.total++, (g.total >= Zt || g.routeBytes >= Qt) && ($(g, r, n), x.delete(b));
|
|
4915
|
+
} catch {
|
|
4916
|
+
}
|
|
4917
|
+
}
|
|
4918
|
+
function lr(e, t, r, n, o) {
|
|
4919
|
+
try {
|
|
4920
|
+
let a = (t.bucketStart + ee) * 1e3, i = Math.floor(Math.random() * ir), s = Math.max(0, Math.min(a - o + i, ar));
|
|
4921
|
+
n.waitUntil(new Promise((c) => {
|
|
4922
|
+
setTimeout(() => {
|
|
4923
|
+
try {
|
|
4924
|
+
x.get(e) === t && ($(t, r, n), x.delete(e));
|
|
4925
|
+
} catch {
|
|
4926
|
+
}
|
|
4927
|
+
c();
|
|
4928
|
+
}, s);
|
|
4929
|
+
}));
|
|
4930
|
+
} catch {
|
|
4931
|
+
}
|
|
4932
|
+
}
|
|
4933
|
+
function $(e, t, r) {
|
|
4934
|
+
try {
|
|
4935
|
+
if (e.total <= 0 || e.counts.size === 0) return;
|
|
4936
|
+
let n = {};
|
|
4937
|
+
for (let [l, h] of e.counts) n[l] = h;
|
|
4938
|
+
let o = [];
|
|
4939
|
+
for (let l of e.routes.values()) {
|
|
4940
|
+
let h = { pattern: l.pattern, verdict: l.verdict, count: l.count };
|
|
4941
|
+
l.behavior && (h.behavior = l.behavior), l.crawlerBehavior && (h.crawler_behavior = l.crawlerBehavior), o.push(h);
|
|
4942
|
+
}
|
|
4943
|
+
let a = { organization_id: t.siteKey, bucket_start: e.bucketStart, mode: e.mode, counts: n, route_counts: o, report_id: crypto.randomUUID() };
|
|
4944
|
+
if (e.previews.size > 0) {
|
|
4945
|
+
let l = [];
|
|
4946
|
+
for (let [h, d] of e.previews) {
|
|
4947
|
+
let w = {};
|
|
4948
|
+
for (let [b, g] of d.refused) w[b] = g;
|
|
4949
|
+
l.push({ pattern: h, evaluated: d.evaluated, additional_refusals: w });
|
|
4950
|
+
}
|
|
4951
|
+
a.previews = l;
|
|
4952
|
+
}
|
|
4953
|
+
if (e.credentials.size > 0) {
|
|
4954
|
+
let l = [];
|
|
4955
|
+
for (let [h, d] of e.credentials) l.push({ credential_id: h, outside_reach: d });
|
|
4956
|
+
a.credential_presentations = l;
|
|
4957
|
+
}
|
|
4958
|
+
e.referrals.size > 0 && (a.ai_referrals = [...e.referrals.values()].map((l) => ({ platform: l.platform, path: l.path, count: l.count }))), t.propertyId && (a.property_id = t.propertyId), a.host = e.host, t.bundleVersion && (a.reporter_version = t.bundleVersion);
|
|
4959
|
+
let i = !!(t.scannerId && t.sensorKey);
|
|
4960
|
+
i && (a.scanner_id = t.scannerId), a.capabilities = t.capabilities ?? Fe;
|
|
4961
|
+
let s = i ? e.refusals : [], c = () => fr(t.apiBase, JSON.stringify(a), i ? t.sensorKey : void 0), p = s.length === 0 ? c() : gr(t.siteKey, s).then((l) => {
|
|
4962
|
+
a.refusals = l;
|
|
4963
|
+
}).catch(() => {
|
|
4964
|
+
}).then(c);
|
|
4965
|
+
r.waitUntil(p.then(() => {
|
|
4966
|
+
}, () => {
|
|
4967
|
+
}));
|
|
4968
|
+
} catch {
|
|
4969
|
+
}
|
|
4970
|
+
}
|
|
4971
|
+
async function ur(e, t, r) {
|
|
4972
|
+
let n = await crypto.subtle.digest("SHA-256", R.encode(`${e.toLowerCase()}|${t}|${r}`)), o = "";
|
|
4973
|
+
for (let a of new Uint8Array(n)) o += a.toString(16).padStart(2, "0");
|
|
4974
|
+
return o.slice(0, nr);
|
|
4975
|
+
}
|
|
4976
|
+
async function gr(e, t) {
|
|
4977
|
+
let r = [];
|
|
4978
|
+
for (let n of t) r.push({ k: await ur(e, n.ip, n.path), t: n.at, v: n.verdict });
|
|
4979
|
+
return r;
|
|
4980
|
+
}
|
|
4981
|
+
async function fr(e, t, r) {
|
|
4982
|
+
let n = new AbortController(), o = setTimeout(() => n.abort(), or), a = { "content-type": "application/json" };
|
|
4983
|
+
r && (a["x-wd-sensor-key"] = r);
|
|
4984
|
+
try {
|
|
4985
|
+
await fetch(e.replace(/\/+$/, "") + "/api/v1/clearance/telemetry", { method: "POST", headers: a, body: t, signal: n.signal });
|
|
4986
|
+
} finally {
|
|
4987
|
+
clearTimeout(o);
|
|
4988
|
+
}
|
|
4989
|
+
}
|
|
4990
|
+
var G = ["route_min_trust", "route_attribution", "monitor_routes", "route_exceptions", "bot_behaviors", "credential_reach", "bot_verification_rdns", "crawler_behavior", "ai_referrals"];
|
|
4991
|
+
var pr = [{ category: "search_engines", suffixes: [".googlebot.com", ".google.com", ".search.msn.com", ".crawl.yahoo.net", ".applebot.apple.com", ".yandex.com", ".yandex.net", ".yandex.ru", ".crawl.baidu.com", ".crawl.baidu.jp"] }];
|
|
4992
|
+
function dr(e, t) {
|
|
4993
|
+
let r = e.toLowerCase().replace(/\.$/, "");
|
|
4994
|
+
for (let n of pr) if (t[n.category]) {
|
|
4995
|
+
for (let o of n.suffixes) if (r.endsWith(o)) return n.category;
|
|
4996
|
+
}
|
|
4997
|
+
return null;
|
|
4998
|
+
}
|
|
4999
|
+
var K = /* @__PURE__ */ new Map();
|
|
5000
|
+
var hr = 36e5;
|
|
5001
|
+
var mr = 5e3;
|
|
5002
|
+
async function Je(e, t, r, n) {
|
|
5003
|
+
let o = K.get(e);
|
|
5004
|
+
if (o && n - o.at < hr) return o.category;
|
|
5005
|
+
let a = null;
|
|
5006
|
+
try {
|
|
5007
|
+
let i = await r.reverse(e);
|
|
5008
|
+
for (let s of i) {
|
|
5009
|
+
let c = dr(s, t);
|
|
5010
|
+
if (c && await wr(s, e, r)) {
|
|
5011
|
+
a = c;
|
|
5012
|
+
break;
|
|
5013
|
+
}
|
|
5014
|
+
}
|
|
5015
|
+
} catch {
|
|
5016
|
+
a = null;
|
|
5017
|
+
}
|
|
5018
|
+
return K.size >= mr && K.clear(), K.set(e, { category: a, at: n }), a;
|
|
5019
|
+
}
|
|
5020
|
+
async function wr(e, t, r) {
|
|
5021
|
+
let n = e.replace(/\.$/, ""), o = t.includes(":") ? [r.resolve6(n)] : [r.resolve4(n)];
|
|
5022
|
+
try {
|
|
5023
|
+
return (await Promise.all(o)).flat().some((i) => i === t);
|
|
5024
|
+
} catch {
|
|
5025
|
+
return false;
|
|
5026
|
+
}
|
|
5027
|
+
}
|
|
5028
|
+
var Ye = [["reflectionbot", "Reflectionbot", "reflectionbot", "crawler"], ["gptbot", "GPTBot", "gptbot", "crawler"], ["claudebot", "ClaudeBot", "claudebot", "crawler"], ["anthropic-ai", "Anthropic", "anthropic", "crawler"], ["claude-web", "Claude-Web", "claude-web", "crawler"], ["ccbot", "CCBot", "ccbot", "crawler"], ["google-extended", "Google-Extended", "google-extended", "crawler"], ["bytespider", "ByteSpider", "bytespider", "crawler"], ["amazonbot", "Amazonbot", "amazonbot", "crawler"], ["facebookbot", "FacebookBot", "facebookbot", "crawler"], ["meta-externalagent", "Meta-ExternalAgent", "meta-externalagent", "crawler"], ["cohere-ai", "Cohere", "cohere-ai", "crawler"], ["cohere", "Cohere", "cohere-ai", "crawler"], ["applebot-extended", "Applebot-Extended", "applebot-extended", "crawler"], ["youbot", "YouBot", "youbot", "crawler"], ["mistralbot", "MistralBot", "mistral", "crawler"], ["gemini", "Gemini", "gemini", "crawler"], ["ai2bot", "AI2Bot", "ai2bot", "crawler"], ["deepseek", "DeepSeek", "deepseek", "crawler"], ["qwen", "Qwen", "qwen", "crawler"], ["webzio", "Webz.io", "webzio", "crawler"], ["sentibot", "Sentibot", "sentibot", "crawler"], ["omgili", "Omgili", "omgili", "crawler"], ["img2dataset", "img2dataset", "img2dataset", "crawler"], ["timpibot", "Timpibot", "timpibot", "crawler"], ["velenpublicwebcrawler", "VelenPublicWebCrawler", "velenpublicwebcrawler", "crawler"], ["isscyberriskcrawler", "ISSCyberRiskCrawler", "isscyberriskcrawler", "crawler"], ["friendlycrawler", "FriendlyCrawler", "friendlycrawler", "crawler"], ["duckassistbot", "DuckAssistBot", "duckassistbot", "crawler"], ["sofyabot", "SofyaBot", "sofyabot", "crawler"], ["xai-searchbot", "xAI-SearchBot", "xai-searchbot", "crawler"], ["linkupbot", "LinkupBot", "linkupbot", "crawler"], ["perplexitybot", "PerplexityBot", "perplexitybot", "crawler"], ["claude-searchbot", "Claude-SearchBot", "claude-searchbot", "crawler"], ["oai-searchbot", "OAI-SearchBot", "oai-searchbot", "crawler"], ["searchgpt", "SearchGPT", "searchgpt", "crawler"], ["phind", "Phind", "phind", "crawler"], ["kagi", "Kagi", "kagi", "crawler"], ["exa.ai", "Exa", "exa", "crawler"], ["exabot", "Exa", "exa", "crawler"], ["metaphor", "Metaphor", "metaphor", "crawler"], ["tavily", "Tavily", "tavily", "crawler"], ["bravesearch", "BraveSearch", "brave-search", "crawler"], ["neevabot", "NeevaBot", "neeva", "crawler"], ["operator", "Operator", "operator", "crawler"], ["claude-user", "Claude-User", "claude-user", "crawler"], ["gemini-user", "Gemini-User", "gemini-user", "crawler"], ["googleagent-mariner", "GoogleAgent-Mariner", "googleagent-mariner", "crawler"], ["mariner", "GoogleAgent-Mariner", "googleagent-mariner", "crawler"], ["amazonbuyforme", "AmazonBuyForMe", "amazon-buyforme", "crawler"], ["buyforme", "AmazonBuyForMe", "amazon-buyforme", "crawler"], ["browser-use", "Browser-Use", "browser-use", "crawler"], ["stagehand", "Stagehand", "stagehand", "crawler"], ["multion", "MultiOn", "multion", "crawler"], ["iboubot", "IbouBot", "iboubot", "crawler"], ["googlebot", "Googlebot", "googlebot", "crawler"], ["google-inspectiontool", "Google-InspectionTool", "google-inspectiontool", "crawler"], ["bingbot", "Bingbot", "bingbot", "crawler"], ["msnbot", "MSNBot", "msnbot", "crawler"], ["yandexbot", "YandexBot", "yandexbot", "crawler"], ["baiduspider", "Baiduspider", "baiduspider", "crawler"], ["duckduckbot", "DuckDuckBot", "duckduckbot", "crawler"], ["applebot", "Applebot", "applebot", "crawler"], ["sogou", "Sogou Spider", "sogou", "crawler"], ["qwantify", "Qwantify", "qwantify", "crawler"], ["naver", "Naver", "naver", "crawler"], ["yeti", "Naver", "naver", "crawler"], ["seznambot", "SeznamBot", "seznam", "crawler"], ["ecosia", "Ecosia", "ecosia", "crawler"], ["mojeekbot", "MojeekBot", "mojeek", "crawler"], ["slurp", "Yahoo! Slurp", "yahoo-slurp", "crawler"], ["ahrefsbot", "AhrefsBot", "ahrefsbot", "crawler"], ["ahrefs", "AhrefsBot", "ahrefsbot", "crawler"], ["semrushbot", "SemrushBot", "semrushbot", "crawler"], ["semrush", "SemrushBot", "semrushbot", "crawler"], ["mj12bot", "MJ12bot", "mj12bot", "crawler"], ["dotbot", "DotBot", "dotbot", "crawler"], ["rogerbot", "Rogerbot", "rogerbot", "crawler"], ["screaming frog", "Screaming Frog", "screaming-frog", "crawler"], ["sitebulb", "Sitebulb", "sitebulb", "crawler"], ["deepcrawl", "DeepCrawl", "deepcrawl", "crawler"], ["oncrawl", "OnCrawl", "oncrawl", "crawler"], ["botify", "Botify", "botify", "crawler"], ["contentking", "ContentKing", "contentking", "crawler"], ["sistrix", "SISTRIX", "sistrix", "crawler"], ["serpstat", "Serpstat", "serpstat", "crawler"], ["spyfu", "SpyFu", "spyfu", "crawler"], ["nessus", "Nessus", "nessus", "crawler"], ["qualys", "Qualys", "qualys", "crawler"], ["shodan", "Shodan", "shodan", "crawler"], ["censys", "Censys", "censys", "crawler"], ["nmap", "Nmap", "nmap", "crawler"], ["zap/", "OWASP ZAP", "zap", "crawler"], ["burp", "Burp Suite", "burp", "crawler"], ["nikto", "Nikto", "nikto", "crawler"], ["nuclei", "Nuclei", "nuclei", "crawler"], ["acunetix", "Acunetix", "acunetix", "crawler"], ["netsparker", "Netsparker", "netsparker", "crawler"], ["detectify", "Detectify", "detectify", "crawler"], ["intruder", "Intruder", "intruder", "crawler"], ["python-requests", "Python-Requests", "python-requests", "tool"], ["python-urllib", "Python-urllib", "python-urllib", "tool"], ["python/", "Python", "python", "tool"], ["scrapy", "Scrapy", "scrapy", "tool"], ["httpx", "HTTPX", "httpx", "tool"], ["aiohttp", "aiohttp", "aiohttp", "tool"], ["beautifulsoup", "BeautifulSoup", "beautifulsoup", "tool"], ["node-fetch", "node-fetch", "node-fetch", "tool"], ["axios/", "Axios", "axios", "tool"], ["got/", "Got", "got", "tool"], ["undici", "Undici", "undici", "tool"], ["go-http-client", "Go-HTTP-Client", "go-http-client", "tool"], ["colly", "Colly", "colly", "tool"], ["java/", "Java", "java", "tool"], ["okhttp", "OkHttp", "okhttp", "tool"], ["apache-httpclient", "Apache-HttpClient", "apache-httpclient", "tool"], ["jsoup", "Jsoup", "jsoup", "tool"], ["guzzlehttp", "GuzzleHttp", "guzzlehttp", "tool"], ["php/", "PHP", "php", "tool"], ["ruby", "Ruby", "ruby", "tool"], ["faraday", "Faraday", "faraday", "tool"], ["mechanize", "Mechanize", "mechanize", "tool"], ["headlesschrome", "HeadlessChrome", "headlesschrome", "tool"], ["puppeteer", "Puppeteer", "puppeteer", "tool"], ["playwright", "Playwright", "playwright", "tool"], ["selenium", "Selenium", "selenium", "tool"], ["phantomjs", "PhantomJS", "phantomjs", "tool"], ["splash", "Splash", "splash", "tool"], ["browserless", "Browserless", "browserless", "tool"], ["browserbase", "Browserbase", "browserbase", "tool"], ["ia_archiver", "Internet Archive", "ia-archiver", "crawler"], ["archive.org_bot", "Archive.org", "archive-org-bot", "crawler"], ["wayback", "Wayback Machine", "wayback", "crawler"], ["heritrix", "Heritrix", "heritrix", "crawler"], ["brozzler", "Brozzler", "brozzler", "crawler"], ["facebookexternalhit", "Facebook", "facebookexternalhit", "crawler"], ["facebot", "Facebot", "facebot", "crawler"], ["twitterbot", "Twitterbot", "twitterbot", "crawler"], ["linkedinbot", "LinkedInBot", "linkedinbot", "crawler"], ["slackbot", "Slackbot", "slackbot", "crawler"], ["telegrambot", "TelegramBot", "telegrambot", "crawler"], ["whatsapp", "WhatsApp", "whatsapp", "crawler"], ["discordbot", "Discordbot", "discordbot", "crawler"], ["pinterest", "Pinterest", "pinterestbot", "crawler"], ["tumblr", "Tumblr", "tumblr", "crawler"], ["reddit", "Reddit", "reddit", "crawler"], ["embedly", "Embedly", "embedly", "crawler"], ["iframely", "Iframely", "iframely", "crawler"], ["curl/", "cURL", "curl", "tool"], ["wget/", "Wget", "wget", "tool"], ["libwww-perl", "libwww-perl", "libwww-perl", "tool"], ["lwp-", "LWP", "lwp", "tool"], ["httrack", "HTTrack", "httrack", "tool"], ["webdecoybot", "WebDecoyBot", "webdecoybot", "crawler"], ["uptimerobot", "UptimeRobot", "uptimerobot", "crawler"], ["pingdom", "Pingdom", "pingdom", "crawler"], ["statuscake", "StatusCake", "statuscake", "crawler"], ["betteruptime", "Better Uptime", "better-uptime", "crawler"], ["datadog", "Datadog Synthetics", "datadog-synthetics", "crawler"], ["newrelic", "New Relic", "newrelic", "crawler"], ["site24x7", "Site24x7", "site24x7", "crawler"], ["freshping", "Freshping", "freshping", "crawler"], ["hetrixtools", "HetrixTools", "hetrixtools", "crawler"], ["nodeping", "NodePing", "nodeping", "crawler"], ["gtmetrix", "GTmetrix", "gtmetrix", "crawler"], ["chrome-lighthouse", "Lighthouse", "chrome-lighthouse", "crawler"], ["google page speed", "Lighthouse", "chrome-lighthouse", "crawler"], ["feedly", "Feedly", "feedly", "crawler"], ["feedfetcher", "Feedfetcher-Google", "feedfetcher-google", "crawler"], ["newsblur", "NewsBlur", "newsblur", "crawler"], ["inoreader", "Inoreader", "inoreader", "crawler"], ["theoldreader", "The Old Reader", "theoldreader", "crawler"], ["feedbin", "Feedbin", "feedbin", "crawler"], ["miniflux", "Miniflux", "miniflux", "crawler"], ["freshrss", "FreshRSS", "freshrss", "crawler"], ["commafeed", "CommaFeed", "commafeed", "crawler"], ["diffbot", "Diffbot", "diffbot", "crawler"], ["import.io", "Import.io", "import-io", "crawler"], ["brightdata", "Bright Data", "bright-data", "crawler"], ["luminati", "Bright Data", "bright-data", "crawler"], ["oxylabs", "Oxylabs", "oxylabs", "crawler"], ["scrapingbee", "ScrapingBee", "scrapingbee", "crawler"], ["scrapingant", "ScrapingAnt", "scrapingant", "crawler"], ["zyte", "Zyte", "zyte", "crawler"], ["scrapinghub", "Zyte", "zyte", "crawler"], ["apify", "Apify", "apify", "crawler"], ["crawlbase", "Crawlbase", "crawlbase", "crawler"], ["webscrapingapi", "WebScrapingAPI", "webscrapingapi", "crawler"], ["chatgpt-user", "ChatGPT-User", "chatgpt-user", "crawler"], ["perplexity-user", "Perplexity-User", "perplexity-user", "crawler"], ["mistralai-user", "MistralAI-User", "mistralai-user", "crawler"], ["meta-externalfetcher", "Meta-ExternalFetcher", "meta-externalfetcher", "crawler"], ["gemini-deep-research", "Gemini-Deep-Research", "gemini-deep-research", "crawler"], ["copilot", "Microsoft Copilot", "copilot", "crawler"], ["cortana", "Cortana", "cortana", "crawler"], ["siri", "Siri", "siri", "crawler"]];
|
|
5029
|
+
function br(e) {
|
|
5030
|
+
for (let [t, r, n, o] of Ye) if (e.includes(t)) return { name: r, id: n, kind: o };
|
|
5031
|
+
return null;
|
|
5032
|
+
}
|
|
5033
|
+
var yr = /(?:bot|crawler|spider)(?:[/\s);,]|$)/i;
|
|
5034
|
+
function Xe(e) {
|
|
5035
|
+
let t = e.toLowerCase(), r = br(t);
|
|
5036
|
+
return r?.kind === "crawler" || !r && yr.test(e);
|
|
5037
|
+
}
|
|
5038
|
+
var vr = "Search Engine Crawler";
|
|
5039
|
+
var te = 1e3;
|
|
5040
|
+
var _r = { search_engines: true, ai_crawlers: true, monitoring: true };
|
|
5041
|
+
function xr(e) {
|
|
5042
|
+
if (!e.includes(":")) return e.split(".").reverse().join(".") + ".in-addr.arpa";
|
|
5043
|
+
let [t, r = ""] = e.split("::"), n = t ? t.split(":") : [], o = r ? r.split(":") : [], a = 8 - n.length - o.length;
|
|
5044
|
+
return a < 0 ? "" : [...n, ...Array(Math.max(0, a)).fill("0"), ...o].map((s) => s.padStart(4, "0")).join("").split("").reverse().join(".") + ".ip6.arpa";
|
|
5045
|
+
}
|
|
5046
|
+
function re(e, t) {
|
|
5047
|
+
return Promise.race([e, new Promise((r, n) => setTimeout(() => n(new Error("dns timeout")), t))]);
|
|
5048
|
+
}
|
|
5049
|
+
function Ar(e) {
|
|
5050
|
+
return { reverse: (t) => re(e(xr(t), "PTR"), te), resolve4: (t) => re(e(t, "A"), te), resolve6: (t) => re(e(t, "AAAA"), te) };
|
|
5051
|
+
}
|
|
5052
|
+
function Ze(e, t, r, n = typeof Deno < "u" && Deno && typeof Deno.resolveDns == "function" ? Deno.resolveDns.bind(Deno) : void 0, o = Date.now()) {
|
|
5053
|
+
return !r || !e || !n || !Xe(t) ? Promise.resolve("") : Je(e, _r, Ar(n), o).then((a) => a === "search_engines" ? vr : "").catch(() => "");
|
|
5054
|
+
}
|
|
5055
|
+
var Rr = "https://cloudflare-dns.com/dns-query";
|
|
5056
|
+
var Cr = 1e3;
|
|
5057
|
+
var Sr = { A: 1, PTR: 12, AAAA: 28 };
|
|
5058
|
+
function kr(e = fetch) {
|
|
5059
|
+
return async (t, r) => {
|
|
5060
|
+
let n = Sr[r];
|
|
5061
|
+
if (!n) throw new Error(`unsupported record type ${r}`);
|
|
5062
|
+
let o = `${Rr}?name=${encodeURIComponent(t)}&type=${r}`, a = await e(o, { headers: { accept: "application/dns-json" }, signal: AbortSignal.timeout(Cr) });
|
|
5063
|
+
if (!a.ok) throw new Error(`doh ${a.status}`);
|
|
5064
|
+
let i = await a.json();
|
|
5065
|
+
if (i.Status !== 0) throw new Error(`dns status ${i.Status}`);
|
|
5066
|
+
let s = (i.Answer ?? []).filter((c) => c.type === n && typeof c.data == "string").map((c) => c.data);
|
|
5067
|
+
if (s.length === 0) throw new Error("no records");
|
|
5068
|
+
return s;
|
|
5069
|
+
};
|
|
5070
|
+
}
|
|
5071
|
+
function Qe(e, t, r, n = fetch) {
|
|
5072
|
+
return Ze(e, t, r, kr(n));
|
|
5073
|
+
}
|
|
5074
|
+
var ne = "vercel-895bda3b1f84";
|
|
5075
|
+
var et = "https://in.webdecoy.com";
|
|
5076
|
+
function tt(e) {
|
|
5077
|
+
let t = new Headers(e.headers);
|
|
5078
|
+
return t.delete(U), t.delete(Ue), t;
|
|
5079
|
+
}
|
|
5080
|
+
function oe(e, t) {
|
|
5081
|
+
let r = tt(e);
|
|
5082
|
+
return t && r.set(U, t), { action: "continue", headers: r, verdict: t };
|
|
5083
|
+
}
|
|
5084
|
+
async function Er(e, t, r) {
|
|
5085
|
+
try {
|
|
5086
|
+
let n = (r.ingest ?? "").trim().replace(/\/+$/, "") || et, o = new URL(e.url), a = o.searchParams.get(Ne), i = N(o.hostname), s = await He({ apiBase: n, siteKey: r.siteKey }, i);
|
|
5087
|
+
if (a !== null) return { action: "respond", response: Ve(a, s ? s.mode : "unknown", r.siteKey, G) };
|
|
5088
|
+
if (o.pathname === Q) return { action: "respond", response: await ze(e, n) };
|
|
5089
|
+
if (o.pathname === L) return { action: "respond", response: await De(e, { apiBase: n, siteKey: r.siteKey, sensorKey: r.sensorKey, host: i }) };
|
|
5090
|
+
if (!s) return oe(e, null);
|
|
5091
|
+
let c = await Ce(e, s, { siteKey: r.siteKey, verifiedBotCategory: (p, l) => Qe(t.ip, p.headers.get("user-agent") ?? "", l, t.fetch ?? fetch) });
|
|
5092
|
+
if (j(c)) {
|
|
5093
|
+
let p = q(e.headers.get("cookie") ?? "", J);
|
|
5094
|
+
p && await Ie(p, r.sensorKey, i, e.headers.get("user-agent") ?? "", Date.now()) && (c = Se(c));
|
|
5095
|
+
}
|
|
5096
|
+
return qe({ ...c, refusal: c.pass ? null : { ip: t.ip, path: o.pathname } }, o.hostname, { siteKey: r.siteKey, apiBase: n, scannerId: r.scannerId, sensorKey: r.sensorKey, bundleVersion: ne, capabilities: G }, { waitUntil: (p) => t.waitUntil?.(p) }, Date.now()), c.pass || c.mode !== "enforce" ? oe(e, c.label) : { action: "respond", response: We(e, n, r.siteKey, c.label) };
|
|
5097
|
+
} catch {
|
|
5098
|
+
try {
|
|
5099
|
+
return oe(e, null);
|
|
5100
|
+
} catch {
|
|
5101
|
+
return { action: "continue", headers: null, verdict: null };
|
|
5102
|
+
}
|
|
5103
|
+
}
|
|
5104
|
+
}
|
|
5105
|
+
|
|
5106
|
+
// src/clearance/index.ts
|
|
5107
|
+
function fromEnv(name) {
|
|
5108
|
+
try {
|
|
5109
|
+
const env = globalThis.process?.env;
|
|
5110
|
+
return (env?.[name] ?? "").trim();
|
|
5111
|
+
} catch {
|
|
5112
|
+
return "";
|
|
5113
|
+
}
|
|
5114
|
+
}
|
|
5115
|
+
function resolveGateEnv(options = {}) {
|
|
5116
|
+
const siteKey = (options.siteKey ?? fromEnv("WEBDECOY_SITE_KEY")).trim();
|
|
5117
|
+
const scannerId = (options.scannerId ?? fromEnv("WEBDECOY_SCANNER_ID")).trim();
|
|
5118
|
+
const sensorKey = (options.sensorKey ?? fromEnv("WEBDECOY_SENSOR_KEY")).trim();
|
|
5119
|
+
if (!siteKey || !scannerId || !sensorKey) return null;
|
|
5120
|
+
const ingest = (options.ingest ?? fromEnv("WEBDECOY_INGEST")).trim() || et;
|
|
5121
|
+
return { siteKey, scannerId, sensorKey, ingest };
|
|
5122
|
+
}
|
|
5123
|
+
var warnedMissing = false;
|
|
5124
|
+
function createClearanceGate(options = {}) {
|
|
5125
|
+
const trustProxy = options.trustProxy ?? 1;
|
|
5126
|
+
return async (request, context = {}) => {
|
|
5127
|
+
const env = resolveGateEnv(options);
|
|
5128
|
+
if (!env) {
|
|
5129
|
+
if (!warnedMissing) {
|
|
5130
|
+
warnedMissing = true;
|
|
5131
|
+
console.warn(
|
|
5132
|
+
"[WebDecoy] clearance gate is off: set WEBDECOY_SITE_KEY, WEBDECOY_SCANNER_ID and WEBDECOY_SENSOR_KEY."
|
|
5133
|
+
);
|
|
5134
|
+
}
|
|
5135
|
+
return { action: "continue", headers: tt(request), verdict: null };
|
|
5136
|
+
}
|
|
5137
|
+
const ip = resolveClientIp({ headers: request.headers, trustProxy }) ?? "";
|
|
5138
|
+
return Er(request, { ip, waitUntil: context.waitUntil }, env);
|
|
5139
|
+
};
|
|
5140
|
+
}
|
|
5141
|
+
|
|
3926
5142
|
// src/client-signals.ts
|
|
3927
5143
|
var MemoryClientSignalStore = class {
|
|
3928
5144
|
constructor(options = {}) {
|
|
@@ -4040,28 +5256,28 @@ function shouldSkipPath(path, patterns) {
|
|
|
4040
5256
|
);
|
|
4041
5257
|
}
|
|
4042
5258
|
function ruleBlockResponse(decision) {
|
|
4043
|
-
const
|
|
4044
|
-
if (decision.allowed || !
|
|
4045
|
-
if (
|
|
4046
|
-
const retryAfter = Number(
|
|
5259
|
+
const rr2 = decision.ruleResult;
|
|
5260
|
+
if (decision.allowed || !rr2) return null;
|
|
5261
|
+
if (rr2.action === "THROTTLE") {
|
|
5262
|
+
const retryAfter = Number(rr2.metadata?.retryAfter ?? 60);
|
|
4047
5263
|
return {
|
|
4048
5264
|
status: 429,
|
|
4049
5265
|
headers: { "Retry-After": String(retryAfter) },
|
|
4050
5266
|
body: {
|
|
4051
5267
|
error: "Too Many Requests",
|
|
4052
|
-
message:
|
|
5268
|
+
message: rr2.reason || "Rate limit exceeded",
|
|
4053
5269
|
retry_after: retryAfter
|
|
4054
5270
|
}
|
|
4055
5271
|
};
|
|
4056
5272
|
}
|
|
4057
|
-
if (
|
|
5273
|
+
if (rr2.action === "DENY") {
|
|
4058
5274
|
return {
|
|
4059
5275
|
status: 403,
|
|
4060
5276
|
headers: {},
|
|
4061
5277
|
body: {
|
|
4062
5278
|
error: "Forbidden",
|
|
4063
|
-
message:
|
|
4064
|
-
rule:
|
|
5279
|
+
message: rr2.reason || "Access denied by rule",
|
|
5280
|
+
rule: rr2.rule
|
|
4065
5281
|
}
|
|
4066
5282
|
};
|
|
4067
5283
|
}
|
|
@@ -4968,13 +6184,13 @@ function analyzeAudioContext(audioInfo) {
|
|
|
4968
6184
|
reason: "AudioContext missing baseLatency (mocked/headless audio)"
|
|
4969
6185
|
});
|
|
4970
6186
|
}
|
|
4971
|
-
const
|
|
4972
|
-
if (
|
|
6187
|
+
const sr2 = audioInfo.sampleRate;
|
|
6188
|
+
if (sr2 !== void 0 && sr2 !== 44100 && sr2 !== 48e3) {
|
|
4973
6189
|
detections.push({
|
|
4974
6190
|
category: "headless",
|
|
4975
6191
|
score: 0.4,
|
|
4976
6192
|
confidence: 0.5,
|
|
4977
|
-
reason: `Unusual AudioContext sample rate (${
|
|
6193
|
+
reason: `Unusual AudioContext sample rate (${sr2})`
|
|
4978
6194
|
});
|
|
4979
6195
|
}
|
|
4980
6196
|
return detections;
|
|
@@ -5184,16 +6400,16 @@ function stddev(arr) {
|
|
|
5184
6400
|
const variance = arr.reduce((acc, v) => acc + (v - m) * (v - m), 0) / arr.length;
|
|
5185
6401
|
return Math.sqrt(variance);
|
|
5186
6402
|
}
|
|
5187
|
-
function erf(
|
|
5188
|
-
const sign =
|
|
5189
|
-
|
|
5190
|
-
const t = 1 / (1 + 0.3275911 *
|
|
5191
|
-
const y = 1 - ((((1.061405429 * t - 1.453152027) * t + 1.421413741) * t - 0.284496736) * t + 0.254829592) * t * Math.exp(-
|
|
6403
|
+
function erf(x2) {
|
|
6404
|
+
const sign = x2 >= 0 ? 1 : -1;
|
|
6405
|
+
x2 = Math.abs(x2);
|
|
6406
|
+
const t = 1 / (1 + 0.3275911 * x2);
|
|
6407
|
+
const y = 1 - ((((1.061405429 * t - 1.453152027) * t + 1.421413741) * t - 0.284496736) * t + 0.254829592) * t * Math.exp(-x2 * x2);
|
|
5192
6408
|
return sign * y;
|
|
5193
6409
|
}
|
|
5194
|
-
function normalCDF(
|
|
5195
|
-
if (sigma <= 0) return
|
|
5196
|
-
return 0.5 * (1 + erf((
|
|
6410
|
+
function normalCDF(x2, mu, sigma) {
|
|
6411
|
+
if (sigma <= 0) return x2 >= mu ? 1 : 0;
|
|
6412
|
+
return 0.5 * (1 + erf((x2 - mu) / (sigma * Math.SQRT2)));
|
|
5197
6413
|
}
|
|
5198
6414
|
function ksTestStatistic(samples, cdfFn) {
|
|
5199
6415
|
const n = samples.length;
|
|
@@ -5234,15 +6450,15 @@ function shannonEntropy(arr, bins) {
|
|
|
5234
6450
|
function lag1Autocorrelation(arr) {
|
|
5235
6451
|
if (arr.length < 3) return 0;
|
|
5236
6452
|
const n = arr.length - 1;
|
|
5237
|
-
const
|
|
6453
|
+
const x2 = arr.slice(0, n);
|
|
5238
6454
|
const y = arr.slice(1);
|
|
5239
|
-
const mx = mean(
|
|
6455
|
+
const mx = mean(x2);
|
|
5240
6456
|
const my = mean(y);
|
|
5241
6457
|
let num = 0;
|
|
5242
6458
|
let dx2 = 0;
|
|
5243
6459
|
let dy2 = 0;
|
|
5244
6460
|
for (let i = 0; i < n; i++) {
|
|
5245
|
-
const dx =
|
|
6461
|
+
const dx = x2[i] - mx;
|
|
5246
6462
|
const dy = y[i] - my;
|
|
5247
6463
|
num += dx * dy;
|
|
5248
6464
|
dx2 += dx * dx;
|
|
@@ -5281,12 +6497,12 @@ function analyzeKeystrokeCadence(stats) {
|
|
|
5281
6497
|
if (logIntervals.length >= 10) {
|
|
5282
6498
|
const mu = mean(logIntervals);
|
|
5283
6499
|
const sigma = stddev(logIntervals);
|
|
5284
|
-
const
|
|
6500
|
+
const D2 = ksTestStatistic(logIntervals, (x2) => normalCDF(x2, mu, sigma));
|
|
5285
6501
|
const critical = 1.22 / Math.sqrt(logIntervals.length);
|
|
5286
6502
|
let score;
|
|
5287
|
-
if (
|
|
5288
|
-
else if (
|
|
5289
|
-
else if (
|
|
6503
|
+
if (D2 <= critical * 0.8) score = 1;
|
|
6504
|
+
else if (D2 <= critical) score = 0.7;
|
|
6505
|
+
else if (D2 <= critical * 1.5) score = 0.3;
|
|
5290
6506
|
else score = 0;
|
|
5291
6507
|
metrics.logNormalFit = score;
|
|
5292
6508
|
totalWeight += 0.2;
|
|
@@ -5298,11 +6514,11 @@ function analyzeKeystrokeCadence(stats) {
|
|
|
5298
6514
|
const minI = Math.min(...intervals);
|
|
5299
6515
|
const maxI = Math.max(...intervals);
|
|
5300
6516
|
if (maxI > minI) {
|
|
5301
|
-
const
|
|
6517
|
+
const D2 = ksTestStatistic(intervals, (x2) => (x2 - minI) / (maxI - minI));
|
|
5302
6518
|
let score;
|
|
5303
|
-
if (
|
|
5304
|
-
else if (
|
|
5305
|
-
else if (
|
|
6519
|
+
if (D2 < 0.05) score = 0;
|
|
6520
|
+
else if (D2 < 0.1) score = 0.3;
|
|
6521
|
+
else if (D2 < 0.15) score = 0.6;
|
|
5306
6522
|
else score = 1;
|
|
5307
6523
|
metrics.uniformity = score;
|
|
5308
6524
|
totalWeight += 0.15;
|
|
@@ -5342,13 +6558,13 @@ function analyzeKeystrokeCadence(stats) {
|
|
|
5342
6558
|
activeMetricCount++;
|
|
5343
6559
|
}
|
|
5344
6560
|
if (intervals.length >= 15) {
|
|
5345
|
-
const
|
|
6561
|
+
const H2 = shannonEntropy(intervals, 10);
|
|
5346
6562
|
let score;
|
|
5347
|
-
if (
|
|
5348
|
-
else if (
|
|
5349
|
-
else if (
|
|
5350
|
-
else if (
|
|
5351
|
-
else if (
|
|
6563
|
+
if (H2 < 0.5) score = 0.1;
|
|
6564
|
+
else if (H2 < 1.5) score = 0.1 + 0.5 * (H2 - 0.5);
|
|
6565
|
+
else if (H2 < 2) score = 0.6 + 0.4 * (H2 - 1.5) / 0.5;
|
|
6566
|
+
else if (H2 <= 3) score = 1;
|
|
6567
|
+
else if (H2 <= 3.3) score = 0.7;
|
|
5352
6568
|
else score = 0.4;
|
|
5353
6569
|
metrics.entropy = score;
|
|
5354
6570
|
totalWeight += 0.15;
|
|
@@ -6148,6 +7364,7 @@ function createCaptchaEndpoints(options = {}) {
|
|
|
6148
7364
|
BOT_REGISTRY,
|
|
6149
7365
|
BotPolicy,
|
|
6150
7366
|
BotRule,
|
|
7367
|
+
CLEARANCE_GATE_BUILD,
|
|
6151
7368
|
CLIENT_SESSION_COOKIE,
|
|
6152
7369
|
CLIENT_SESSION_HEADER,
|
|
6153
7370
|
Captcha,
|
|
@@ -6191,6 +7408,7 @@ function createCaptchaEndpoints(options = {}) {
|
|
|
6191
7408
|
consoleLogger,
|
|
6192
7409
|
createAgentVerifier,
|
|
6193
7410
|
createCaptchaEndpoints,
|
|
7411
|
+
createClearanceGate,
|
|
6194
7412
|
createFetchGuard,
|
|
6195
7413
|
deriveAndArm,
|
|
6196
7414
|
deriveKey,
|
|
@@ -6212,6 +7430,7 @@ function createCaptchaEndpoints(options = {}) {
|
|
|
6212
7430
|
readEdgeVerdict,
|
|
6213
7431
|
recommend,
|
|
6214
7432
|
resolveClientIp,
|
|
7433
|
+
resolveGateEnv,
|
|
6215
7434
|
resolveSecret,
|
|
6216
7435
|
ruleBlockResponse,
|
|
6217
7436
|
shouldSkipPath,
|