@webdecoy/node 0.12.0 → 0.14.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/README.md +1 -1
- package/dist/chunk-4QKKW7GN.mjs +3425 -0
- package/dist/index.d.mts +1102 -1469
- package/dist/index.d.ts +1102 -1469
- package/dist/index.js +1584 -615
- package/dist/index.mjs +358 -2726
- package/dist/sdk-qUjMf8ZX.d.mts +1404 -0
- package/dist/sdk-qUjMf8ZX.d.ts +1404 -0
- package/dist/testing.d.mts +85 -0
- package/dist/testing.d.ts +85 -0
- package/dist/testing.js +2324 -0
- package/dist/testing.mjs +113 -0
- package/package.json +8 -3
package/dist/index.js
CHANGED
|
@@ -20,14 +20,23 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
20
20
|
// src/index.ts
|
|
21
21
|
var index_exports = {};
|
|
22
22
|
__export(index_exports, {
|
|
23
|
+
ATTACK_SIGNATURE_IDS: () => ATTACK_SIGNATURE_IDS,
|
|
23
24
|
AgentVerifier: () => AgentVerifier,
|
|
25
|
+
AttackSignatureRule: () => AttackSignatureRule,
|
|
24
26
|
BOT_CATEGORIES: () => BOT_CATEGORIES,
|
|
25
27
|
BOT_REGISTRY: () => BOT_REGISTRY,
|
|
28
|
+
BotPolicy: () => BotPolicy,
|
|
26
29
|
BotRule: () => BotRule,
|
|
30
|
+
CLIENT_SESSION_COOKIE: () => CLIENT_SESSION_COOKIE,
|
|
31
|
+
CLIENT_SESSION_HEADER: () => CLIENT_SESSION_HEADER,
|
|
27
32
|
Captcha: () => Captcha,
|
|
33
|
+
ClientSignalRule: () => ClientSignalRule,
|
|
34
|
+
DEFAULT_CHARACTERISTICS: () => DEFAULT_CHARACTERISTICS,
|
|
28
35
|
DEFAULT_SIGNED_AGENT_DIRECTORIES: () => DEFAULT_SIGNED_AGENT_DIRECTORIES,
|
|
29
36
|
DEFAULT_TRIPWIRE_PATHS: () => DEFAULT_TRIPWIRE_PATHS,
|
|
30
37
|
DEFAULT_WEIGHTS: () => DEFAULT_WEIGHTS,
|
|
38
|
+
Decision: () => Decision,
|
|
39
|
+
DecisionCache: () => DecisionCache,
|
|
31
40
|
DetectionEngine: () => DetectionEngine,
|
|
32
41
|
DirectoryCache: () => DirectoryCache,
|
|
33
42
|
EDGE_CLASS_HEADER: () => EDGE_CLASS_HEADER,
|
|
@@ -38,6 +47,8 @@ __export(index_exports, {
|
|
|
38
47
|
InMemoryFingerprintStore: () => InMemoryFingerprintStore,
|
|
39
48
|
InMemoryRateLimiter: () => InMemoryRateLimiter2,
|
|
40
49
|
InMemoryTokenStore: () => InMemoryTokenStore,
|
|
50
|
+
MemoryClientSignalStore: () => MemoryClientSignalStore,
|
|
51
|
+
MemoryRateLimitStore: () => MemoryRateLimitStore,
|
|
41
52
|
PoWManager: () => PoWManager,
|
|
42
53
|
RateLimitRule: () => RateLimitRule,
|
|
43
54
|
RuleEngine: () => RuleEngine,
|
|
@@ -45,15 +56,25 @@ __export(index_exports, {
|
|
|
45
56
|
TEST_TRIGGER_USER_AGENT: () => TEST_TRIGGER_USER_AGENT,
|
|
46
57
|
TokenManager: () => TokenManager,
|
|
47
58
|
TripwireRule: () => TripwireRule,
|
|
59
|
+
UpstashRateLimitStore: () => UpstashRateLimitStore,
|
|
48
60
|
WebBotAuthRule: () => WebBotAuthRule,
|
|
49
61
|
WebDecoy: () => WebDecoy,
|
|
62
|
+
armSiteHoneytoken: () => armSiteHoneytoken,
|
|
63
|
+
attackSignatures: () => attackSignatures,
|
|
64
|
+
botPolicy: () => botPolicy,
|
|
50
65
|
bots: () => bots,
|
|
51
66
|
calculateCategoryScores: () => calculateCategoryScores,
|
|
52
67
|
calculateFinalScore: () => calculateFinalScore,
|
|
53
68
|
classifyUserAgent: () => classifyUserAgent,
|
|
69
|
+
clientSignals: () => clientSignals,
|
|
70
|
+
consoleLogger: () => consoleLogger,
|
|
54
71
|
createAgentVerifier: () => createAgentVerifier,
|
|
55
72
|
createCaptchaEndpoints: () => createCaptchaEndpoints,
|
|
73
|
+
createFetchGuard: () => createFetchGuard,
|
|
74
|
+
deriveAndArm: () => deriveAndArm,
|
|
75
|
+
deriveKey: () => deriveKey,
|
|
56
76
|
filter: () => filter,
|
|
77
|
+
fromPino: () => fromPino,
|
|
57
78
|
honeytoken: () => honeytoken,
|
|
58
79
|
injectHoneytokenLink: () => injectHoneytokenLink,
|
|
59
80
|
ipInCidr: () => ipInCidr,
|
|
@@ -62,15 +83,21 @@ __export(index_exports, {
|
|
|
62
83
|
isMobileUA: () => isMobileUA,
|
|
63
84
|
isTestTriggerUserAgent: () => isTestTriggerUserAgent,
|
|
64
85
|
matchUserAgent: () => matchUserAgent,
|
|
86
|
+
newDecisionId: () => newDecisionId,
|
|
65
87
|
normalizeIp: () => normalizeIp,
|
|
66
88
|
parseUserAgent: () => parseUserAgent,
|
|
67
89
|
rateLimit: () => rateLimit,
|
|
90
|
+
readClientSession: () => readClientSession,
|
|
68
91
|
readEdgeVerdict: () => readEdgeVerdict,
|
|
69
92
|
recommend: () => recommend,
|
|
70
93
|
resolveClientIp: () => resolveClientIp,
|
|
71
94
|
resolveSecret: () => resolveSecret,
|
|
95
|
+
ruleBlockResponse: () => ruleBlockResponse,
|
|
96
|
+
shouldSkipPath: () => shouldSkipPath,
|
|
97
|
+
silentLogger: () => silentLogger,
|
|
72
98
|
siteHoneytoken: () => siteHoneytoken,
|
|
73
99
|
tripwire: () => tripwire,
|
|
100
|
+
upstashRateLimitStore: () => upstashRateLimitStore,
|
|
74
101
|
webBotAuth: () => webBotAuth
|
|
75
102
|
});
|
|
76
103
|
module.exports = __toCommonJS(index_exports);
|
|
@@ -383,9 +410,19 @@ var RuleEngine = class {
|
|
|
383
410
|
*/
|
|
384
411
|
evaluate(context) {
|
|
385
412
|
const violations = [];
|
|
413
|
+
const results = [];
|
|
386
414
|
let decidingResult = null;
|
|
387
415
|
for (const rule of this.rules) {
|
|
388
416
|
const result = rule.evaluate(context);
|
|
417
|
+
const dryRun = result.metadata?.dryRun === true;
|
|
418
|
+
results.push({
|
|
419
|
+
rule: result.rule,
|
|
420
|
+
state: result.state ?? (dryRun ? "DRY_RUN" : "RUN"),
|
|
421
|
+
conclusion: dryRun || result.action !== "ALLOW" ? "DENY" : "ALLOW",
|
|
422
|
+
action: result.action,
|
|
423
|
+
reason: result.reason,
|
|
424
|
+
metadata: result.metadata
|
|
425
|
+
});
|
|
389
426
|
if (result.action !== "ALLOW") {
|
|
390
427
|
violations.push({
|
|
391
428
|
rule: result.rule,
|
|
@@ -397,10 +434,10 @@ var RuleEngine = class {
|
|
|
397
434
|
reason: result.reason,
|
|
398
435
|
clearance: result.rule === "tripwire" ? extractClearance(context.headers) : void 0,
|
|
399
436
|
metadata: result.metadata,
|
|
400
|
-
dryRun
|
|
437
|
+
dryRun,
|
|
401
438
|
timestamp: new Date(context.timestamp).toISOString()
|
|
402
439
|
});
|
|
403
|
-
if (!decidingResult && !
|
|
440
|
+
if (!decidingResult && !dryRun) {
|
|
404
441
|
decidingResult = result;
|
|
405
442
|
}
|
|
406
443
|
}
|
|
@@ -411,12 +448,14 @@ var RuleEngine = class {
|
|
|
411
448
|
rule: decidingResult.rule,
|
|
412
449
|
reason: decidingResult.reason,
|
|
413
450
|
metadata: decidingResult.metadata,
|
|
414
|
-
violations
|
|
451
|
+
violations,
|
|
452
|
+
results
|
|
415
453
|
};
|
|
416
454
|
}
|
|
417
455
|
return {
|
|
418
456
|
action: "ALLOW",
|
|
419
|
-
violations
|
|
457
|
+
violations,
|
|
458
|
+
results
|
|
420
459
|
};
|
|
421
460
|
}
|
|
422
461
|
/**
|
|
@@ -510,11 +549,25 @@ var InMemoryRateLimiter = class {
|
|
|
510
549
|
}
|
|
511
550
|
};
|
|
512
551
|
|
|
552
|
+
// src/rules/rate-limit-store.ts
|
|
553
|
+
var MemoryRateLimitStore = class {
|
|
554
|
+
constructor() {
|
|
555
|
+
this.sync = true;
|
|
556
|
+
this.limiter = new InMemoryRateLimiter();
|
|
557
|
+
}
|
|
558
|
+
consume({ key, max, windowMs, algorithm }) {
|
|
559
|
+
return algorithm === "sliding" ? this.limiter.checkSlidingWindow(key, max, windowMs) : this.limiter.checkFixedWindow(key, max, windowMs);
|
|
560
|
+
}
|
|
561
|
+
destroy() {
|
|
562
|
+
this.limiter.destroy();
|
|
563
|
+
}
|
|
564
|
+
};
|
|
565
|
+
|
|
513
566
|
// src/rules/rate-limit-rule.ts
|
|
514
567
|
var RateLimitRule = class {
|
|
515
568
|
constructor(config) {
|
|
516
569
|
this.name = `rate-limit:${config.max}/${config.window}s`;
|
|
517
|
-
this.
|
|
570
|
+
this.store = config.store ?? new MemoryRateLimitStore();
|
|
518
571
|
this.config = {
|
|
519
572
|
max: config.max,
|
|
520
573
|
window: config.window,
|
|
@@ -524,10 +577,47 @@ var RateLimitRule = class {
|
|
|
524
577
|
dryRun: config.dryRun ?? false
|
|
525
578
|
};
|
|
526
579
|
}
|
|
580
|
+
/**
|
|
581
|
+
* Which bucket this request counts against.
|
|
582
|
+
*
|
|
583
|
+
* Precedence: this rule's own keyBy, then the SDK-wide characteristics, then
|
|
584
|
+
* the IP. `context.key` is always populated, so the last fallback only matters
|
|
585
|
+
* for a context built by hand.
|
|
586
|
+
*/
|
|
587
|
+
keyFor(context) {
|
|
588
|
+
return this.config.keyBy ? this.config.keyBy(context) : context.key ?? context.ip;
|
|
589
|
+
}
|
|
590
|
+
consumption(context) {
|
|
591
|
+
return {
|
|
592
|
+
key: this.keyFor(context),
|
|
593
|
+
max: this.config.max,
|
|
594
|
+
windowMs: this.config.window * 1e3,
|
|
595
|
+
algorithm: this.config.algorithm
|
|
596
|
+
};
|
|
597
|
+
}
|
|
598
|
+
/** Consume from a networked store before evaluation. No-op for a sync store. */
|
|
599
|
+
async prepare(context) {
|
|
600
|
+
if (this.store.sync) return;
|
|
601
|
+
const outcome = await this.store.consume(this.consumption(context));
|
|
602
|
+
context.prepared ?? (context.prepared = {});
|
|
603
|
+
context.prepared[this.name] = outcome;
|
|
604
|
+
}
|
|
527
605
|
evaluate(context) {
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
606
|
+
let result;
|
|
607
|
+
if (this.store.sync) {
|
|
608
|
+
result = this.store.consume(this.consumption(context));
|
|
609
|
+
} else {
|
|
610
|
+
const prepared = context.prepared?.[this.name];
|
|
611
|
+
if (!prepared) {
|
|
612
|
+
return {
|
|
613
|
+
action: "ALLOW",
|
|
614
|
+
rule: this.name,
|
|
615
|
+
state: "NOT_RUN",
|
|
616
|
+
reason: "Rate limit uses an async store and was not prepared \u2014 call protect() or evaluateRulesAsync()"
|
|
617
|
+
};
|
|
618
|
+
}
|
|
619
|
+
result = prepared;
|
|
620
|
+
}
|
|
531
621
|
if (!result.allowed) {
|
|
532
622
|
const retryAfter = Math.ceil((result.resetAt - Date.now()) / 1e3);
|
|
533
623
|
return {
|
|
@@ -554,7 +644,7 @@ var RateLimitRule = class {
|
|
|
554
644
|
};
|
|
555
645
|
}
|
|
556
646
|
destroy() {
|
|
557
|
-
this.
|
|
647
|
+
void this.store.destroy?.();
|
|
558
648
|
}
|
|
559
649
|
};
|
|
560
650
|
|
|
@@ -1016,6 +1106,14 @@ var FilterRule = class {
|
|
|
1016
1106
|
this.ast = parser.parse();
|
|
1017
1107
|
}
|
|
1018
1108
|
evaluate(context) {
|
|
1109
|
+
if (!context.enrichment && this.expression.includes("ip.")) {
|
|
1110
|
+
return {
|
|
1111
|
+
action: "ALLOW",
|
|
1112
|
+
rule: this.name,
|
|
1113
|
+
state: "NOT_RUN",
|
|
1114
|
+
reason: "No IP enrichment available \u2014 filter needs an API key"
|
|
1115
|
+
};
|
|
1116
|
+
}
|
|
1019
1117
|
const result = evaluate(this.ast, context);
|
|
1020
1118
|
if (result) {
|
|
1021
1119
|
return {
|
|
@@ -1125,235 +1223,786 @@ var BotRule = class {
|
|
|
1125
1223
|
}
|
|
1126
1224
|
};
|
|
1127
1225
|
|
|
1128
|
-
// src/
|
|
1129
|
-
var
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
}
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
}
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
}
|
|
1175
|
-
}
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
}
|
|
1187
|
-
}
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
}
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
}
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
}
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
}
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
}
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
}
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
}
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
}
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
}
|
|
1248
|
-
|
|
1249
|
-
}
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
}
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
}
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
}
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
}
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
}
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
}
|
|
1292
|
-
}
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
}
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
}
|
|
1316
|
-
}
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
}
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1226
|
+
// src/bots/registry.generated.ts
|
|
1227
|
+
var BOT_CATEGORIES = [
|
|
1228
|
+
"training_crawler",
|
|
1229
|
+
"ai_search_crawler",
|
|
1230
|
+
"ai_agent",
|
|
1231
|
+
"ai_assistant",
|
|
1232
|
+
"search_crawler",
|
|
1233
|
+
"seo_crawler",
|
|
1234
|
+
"security_scanner",
|
|
1235
|
+
"generic_scraper",
|
|
1236
|
+
"archiver",
|
|
1237
|
+
"fetcher",
|
|
1238
|
+
"monitoring",
|
|
1239
|
+
"headless_browser",
|
|
1240
|
+
"feed_reader",
|
|
1241
|
+
"commercial_scraper",
|
|
1242
|
+
"none"
|
|
1243
|
+
];
|
|
1244
|
+
var BOT_REGISTRY = [
|
|
1245
|
+
{ id: "reflectionbot", name: "Reflectionbot", category: "training_crawler", organization: "Reflection AI", baseScore: 70, respectsRobots: true, uaPatterns: ["reflectionbot"] },
|
|
1246
|
+
{ id: "gptbot", name: "GPTBot", category: "training_crawler", organization: "OpenAI", baseScore: 85, respectsRobots: true, uaPatterns: ["gptbot"] },
|
|
1247
|
+
{ id: "chatgpt-user", name: "ChatGPT-User", category: "training_crawler", organization: "OpenAI", baseScore: 85, respectsRobots: true, uaPatterns: ["chatgpt-user", "chatgpt"] },
|
|
1248
|
+
{ id: "oai-searchbot", name: "OAI-SearchBot", category: "training_crawler", organization: "OpenAI", baseScore: 80, respectsRobots: true, uaPatterns: ["oai-searchbot"] },
|
|
1249
|
+
{ id: "claudebot", name: "ClaudeBot", category: "training_crawler", organization: "Anthropic", baseScore: 85, respectsRobots: true, uaPatterns: ["claudebot"] },
|
|
1250
|
+
{ id: "anthropic", name: "Anthropic", category: "training_crawler", organization: "Anthropic", baseScore: 85, respectsRobots: true, uaPatterns: ["anthropic"] },
|
|
1251
|
+
{ id: "ccbot", name: "CCBot", category: "training_crawler", organization: "Common Crawl", baseScore: 80, respectsRobots: true, uaPatterns: ["ccbot"] },
|
|
1252
|
+
{ id: "google-extended", name: "Google-Extended", category: "training_crawler", organization: "Google", baseScore: 80, respectsRobots: true, uaPatterns: ["google-extended"] },
|
|
1253
|
+
{ id: "bytespider", name: "ByteSpider", category: "training_crawler", organization: "ByteDance", baseScore: 75, respectsRobots: false, uaPatterns: ["bytespider"] },
|
|
1254
|
+
{ id: "amazonbot", name: "Amazonbot", category: "training_crawler", organization: "Amazon", baseScore: 70, respectsRobots: true, uaPatterns: ["amazonbot"] },
|
|
1255
|
+
{ id: "facebookbot", name: "FacebookBot", category: "training_crawler", organization: "Meta", baseScore: 70, respectsRobots: true, uaPatterns: ["facebookbot"] },
|
|
1256
|
+
{ id: "meta-externalagent", name: "Meta-ExternalAgent", category: "training_crawler", organization: "Meta", baseScore: 75, respectsRobots: true, uaPatterns: ["meta-externalagent"] },
|
|
1257
|
+
{ id: "cohere-ai", name: "Cohere", category: "training_crawler", organization: "Cohere", baseScore: 80, respectsRobots: true, uaPatterns: ["cohere-ai", "cohere"] },
|
|
1258
|
+
{ id: "perplexitybot", name: "PerplexityBot", category: "training_crawler", organization: "Perplexity AI", baseScore: 80, respectsRobots: true, uaPatterns: ["perplexitybot"] },
|
|
1259
|
+
{ id: "applebot-extended", name: "Applebot-Extended", category: "training_crawler", organization: "Apple", baseScore: 75, respectsRobots: true, uaPatterns: ["applebot-extended"] },
|
|
1260
|
+
{ id: "youbot", name: "YouBot", category: "training_crawler", organization: "You.com", baseScore: 75, respectsRobots: true, uaPatterns: ["youbot"] },
|
|
1261
|
+
{ id: "mistral", name: "MistralBot", category: "training_crawler", organization: "Mistral AI", baseScore: 80, respectsRobots: true, uaPatterns: ["mistral"] },
|
|
1262
|
+
{ id: "gemini", name: "Gemini", category: "training_crawler", organization: "Google", baseScore: 80, respectsRobots: true, uaPatterns: ["gemini"] },
|
|
1263
|
+
{ id: "ai2bot", name: "AI2Bot", category: "training_crawler", organization: "Allen Institute for AI", baseScore: 75, respectsRobots: true, uaPatterns: ["ai2bot"] },
|
|
1264
|
+
{ id: "deepseek", name: "DeepSeek", category: "training_crawler", organization: "DeepSeek", baseScore: 80, respectsRobots: true, uaPatterns: ["deepseek"] },
|
|
1265
|
+
{ id: "qwen", name: "Qwen", category: "training_crawler", organization: "Alibaba", baseScore: 75, respectsRobots: true, uaPatterns: ["qwen"] },
|
|
1266
|
+
{ id: "webzio", name: "Webz.io", category: "training_crawler", organization: "Webz.io", baseScore: 70, respectsRobots: false, uaPatterns: ["webzio"] },
|
|
1267
|
+
{ id: "sentibot", name: "Sentibot", category: "training_crawler", organization: "Sentibot", baseScore: 70, respectsRobots: false, uaPatterns: ["sentibot"] },
|
|
1268
|
+
{ id: "omgili", name: "Omgili", category: "training_crawler", organization: "Webz.io", baseScore: 70, respectsRobots: false, uaPatterns: ["omgili"] },
|
|
1269
|
+
{ id: "img2dataset", name: "img2dataset", category: "training_crawler", organization: "LAION", baseScore: 75, respectsRobots: false, uaPatterns: ["img2dataset"] },
|
|
1270
|
+
{ id: "timpibot", name: "Timpibot", category: "training_crawler", organization: "Timpi", baseScore: 70, respectsRobots: true, uaPatterns: ["timpibot"] },
|
|
1271
|
+
{ id: "velenpublicwebcrawler", name: "VelenPublicWebCrawler", category: "training_crawler", organization: "Velen", baseScore: 70, respectsRobots: false, uaPatterns: ["velenpublicwebcrawler"] },
|
|
1272
|
+
{ id: "isscyberriskcrawler", name: "ISSCyberRiskCrawler", category: "training_crawler", organization: "ISS", baseScore: 65, respectsRobots: false, uaPatterns: ["isscyberriskcrawler"] },
|
|
1273
|
+
{ id: "friendlycrawler", name: "FriendlyCrawler", category: "training_crawler", organization: "Unknown", baseScore: 65, respectsRobots: true, uaPatterns: ["friendlycrawler"] },
|
|
1274
|
+
{ id: "duckassistbot", name: "DuckAssistBot", category: "ai_search_crawler", organization: "DuckDuckGo", baseScore: 65, respectsRobots: true, uaPatterns: ["duckassistbot"] },
|
|
1275
|
+
{ id: "sofyabot", name: "SofyaBot", category: "ai_search_crawler", organization: "Sofya", baseScore: 65, respectsRobots: true, uaPatterns: ["sofyabot"] },
|
|
1276
|
+
{ id: "xai-searchbot", name: "xAI-SearchBot", category: "ai_search_crawler", organization: "xAI", baseScore: 70, respectsRobots: true, uaPatterns: ["xai-searchbot"] },
|
|
1277
|
+
{ id: "linkupbot", name: "LinkupBot", category: "ai_search_crawler", organization: "Linkup", baseScore: 65, respectsRobots: true, uaPatterns: ["linkupbot"] },
|
|
1278
|
+
{ id: "searchgpt", name: "SearchGPT", category: "ai_search_crawler", organization: "OpenAI", baseScore: 75, respectsRobots: true, uaPatterns: ["searchgpt"] },
|
|
1279
|
+
{ id: "phind", name: "Phind", category: "ai_search_crawler", organization: "Phind", baseScore: 70, respectsRobots: true, uaPatterns: ["phind"] },
|
|
1280
|
+
{ id: "kagi", name: "Kagi", category: "ai_search_crawler", organization: "Kagi", baseScore: 65, respectsRobots: true, uaPatterns: ["kagi"] },
|
|
1281
|
+
{ id: "exa", name: "Exa", category: "ai_search_crawler", organization: "Exa AI", baseScore: 70, respectsRobots: true, uaPatterns: ["exa.ai", "exabot"] },
|
|
1282
|
+
{ id: "metaphor", name: "Metaphor", category: "ai_search_crawler", organization: "Metaphor", baseScore: 70, respectsRobots: true, uaPatterns: ["metaphor"] },
|
|
1283
|
+
{ id: "tavily", name: "Tavily", category: "ai_search_crawler", organization: "Tavily", baseScore: 70, respectsRobots: true, uaPatterns: ["tavily"] },
|
|
1284
|
+
{ id: "brave-search", name: "BraveSearch", category: "ai_search_crawler", organization: "Brave", baseScore: 65, respectsRobots: true, uaPatterns: ["bravesearch"] },
|
|
1285
|
+
{ id: "neeva", name: "NeevaBot", category: "ai_search_crawler", organization: "Neeva", baseScore: 65, respectsRobots: true, uaPatterns: ["neevabot"] },
|
|
1286
|
+
{ id: "operator", name: "Operator", category: "ai_agent", organization: "OpenAI", baseScore: 75, respectsRobots: true, uaPatterns: ["operator"] },
|
|
1287
|
+
{ id: "claude-user", name: "Claude-User", category: "ai_agent", organization: "Anthropic", baseScore: 75, respectsRobots: true, uaPatterns: ["claude-user"] },
|
|
1288
|
+
{ id: "gemini-user", name: "Gemini-User", category: "ai_agent", organization: "Google", baseScore: 75, respectsRobots: true, uaPatterns: ["gemini-user"] },
|
|
1289
|
+
{ id: "googleagent-mariner", name: "GoogleAgent-Mariner", category: "ai_agent", organization: "Google", baseScore: 75, respectsRobots: true, uaPatterns: ["googleagent-mariner", "mariner"] },
|
|
1290
|
+
{ id: "amazon-buyforme", name: "AmazonBuyForMe", category: "ai_agent", organization: "Amazon", baseScore: 70, respectsRobots: true, uaPatterns: ["amazonbuyforme", "buyforme"] },
|
|
1291
|
+
{ id: "browser-use", name: "Browser-Use", category: "ai_agent", organization: "Open Source", baseScore: 70, respectsRobots: false, uaPatterns: ["browser-use"] },
|
|
1292
|
+
{ id: "stagehand", name: "Stagehand", category: "ai_agent", organization: "Browserbase", baseScore: 70, respectsRobots: false, uaPatterns: ["stagehand"] },
|
|
1293
|
+
{ id: "multion", name: "MultiOn", category: "ai_agent", organization: "MultiOn", baseScore: 70, respectsRobots: false, uaPatterns: ["multion"] },
|
|
1294
|
+
{ id: "iboubot", name: "IbouBot", category: "search_crawler", organization: "Ibou", baseScore: 30, respectsRobots: true, uaPatterns: ["iboubot"] },
|
|
1295
|
+
{ id: "googlebot", name: "Googlebot", category: "search_crawler", organization: "Google", baseScore: 30, respectsRobots: true, uaPatterns: ["googlebot"] },
|
|
1296
|
+
{ id: "bingbot", name: "Bingbot", category: "search_crawler", organization: "Microsoft", baseScore: 30, respectsRobots: true, uaPatterns: ["bingbot"] },
|
|
1297
|
+
{ id: "yandexbot", name: "YandexBot", category: "search_crawler", organization: "Yandex", baseScore: 35, respectsRobots: true, uaPatterns: ["yandexbot"] },
|
|
1298
|
+
{ id: "baiduspider", name: "Baiduspider", category: "search_crawler", organization: "Baidu", baseScore: 40, respectsRobots: true, uaPatterns: ["baiduspider"] },
|
|
1299
|
+
{ id: "duckduckbot", name: "DuckDuckBot", category: "search_crawler", organization: "DuckDuckGo", baseScore: 30, respectsRobots: true, uaPatterns: ["duckduckbot"] },
|
|
1300
|
+
{ id: "applebot", name: "Applebot", category: "search_crawler", organization: "Apple", baseScore: 30, respectsRobots: true, uaPatterns: ["applebot"] },
|
|
1301
|
+
{ id: "sogou", name: "Sogou Spider", category: "search_crawler", organization: "Sogou", baseScore: 40, respectsRobots: true, uaPatterns: ["sogou"] },
|
|
1302
|
+
{ id: "qwantify", name: "Qwantify", category: "search_crawler", organization: "Qwant", baseScore: 35, respectsRobots: true, uaPatterns: ["qwantify"] },
|
|
1303
|
+
{ id: "naver", name: "Naver", category: "search_crawler", organization: "Naver", baseScore: 35, respectsRobots: true, uaPatterns: ["naver", "yeti"] },
|
|
1304
|
+
{ id: "seznam", name: "SeznamBot", category: "search_crawler", organization: "Seznam", baseScore: 35, respectsRobots: true, uaPatterns: ["seznambot"] },
|
|
1305
|
+
{ id: "ecosia", name: "Ecosia", category: "search_crawler", organization: "Ecosia", baseScore: 30, respectsRobots: true, uaPatterns: ["ecosia"] },
|
|
1306
|
+
{ id: "mojeek", name: "MojeekBot", category: "search_crawler", organization: "Mojeek", baseScore: 35, respectsRobots: true, uaPatterns: ["mojeekbot"] },
|
|
1307
|
+
{ id: "yahoo-slurp", name: "Yahoo! Slurp", category: "search_crawler", organization: "Yahoo", baseScore: 30, respectsRobots: true, uaPatterns: ["slurp"] },
|
|
1308
|
+
{ id: "ahrefsbot", name: "AhrefsBot", category: "seo_crawler", organization: "Ahrefs", baseScore: 50, respectsRobots: true, uaPatterns: ["ahrefsbot", "ahrefs"] },
|
|
1309
|
+
{ id: "semrushbot", name: "SemrushBot", category: "seo_crawler", organization: "Semrush", baseScore: 50, respectsRobots: true, uaPatterns: ["semrushbot", "semrush"] },
|
|
1310
|
+
{ id: "mj12bot", name: "MJ12bot", category: "seo_crawler", organization: "Majestic", baseScore: 50, respectsRobots: true, uaPatterns: ["mj12bot"] },
|
|
1311
|
+
{ id: "dotbot", name: "DotBot", category: "seo_crawler", organization: "Moz", baseScore: 50, respectsRobots: true, uaPatterns: ["dotbot"] },
|
|
1312
|
+
{ id: "rogerbot", name: "Rogerbot", category: "seo_crawler", organization: "Moz", baseScore: 50, respectsRobots: true, uaPatterns: ["rogerbot"] },
|
|
1313
|
+
{ id: "screaming-frog", name: "Screaming Frog", category: "seo_crawler", organization: "Screaming Frog", baseScore: 55, respectsRobots: true, uaPatterns: ["screaming frog"] },
|
|
1314
|
+
{ id: "sitebulb", name: "Sitebulb", category: "seo_crawler", organization: "Sitebulb", baseScore: 55, respectsRobots: true, uaPatterns: ["sitebulb"] },
|
|
1315
|
+
{ id: "deepcrawl", name: "DeepCrawl", category: "seo_crawler", organization: "Lumar", baseScore: 50, respectsRobots: true, uaPatterns: ["deepcrawl"] },
|
|
1316
|
+
{ id: "oncrawl", name: "OnCrawl", category: "seo_crawler", organization: "OnCrawl", baseScore: 50, respectsRobots: true, uaPatterns: ["oncrawl"] },
|
|
1317
|
+
{ id: "botify", name: "Botify", category: "seo_crawler", organization: "Botify", baseScore: 50, respectsRobots: true, uaPatterns: ["botify"] },
|
|
1318
|
+
{ id: "contentking", name: "ContentKing", category: "seo_crawler", organization: "ContentKing", baseScore: 50, respectsRobots: true, uaPatterns: ["contentking"] },
|
|
1319
|
+
{ id: "sistrix", name: "SISTRIX", category: "seo_crawler", organization: "SISTRIX", baseScore: 50, respectsRobots: true, uaPatterns: ["sistrix"] },
|
|
1320
|
+
{ id: "serpstat", name: "Serpstat", category: "seo_crawler", organization: "Serpstat", baseScore: 50, respectsRobots: true, uaPatterns: ["serpstat"] },
|
|
1321
|
+
{ id: "spyfu", name: "SpyFu", category: "seo_crawler", organization: "SpyFu", baseScore: 50, respectsRobots: true, uaPatterns: ["spyfu"] },
|
|
1322
|
+
{ id: "nessus", name: "Nessus", category: "security_scanner", organization: "Tenable", baseScore: 70, respectsRobots: false, uaPatterns: ["nessus"] },
|
|
1323
|
+
{ id: "qualys", name: "Qualys", category: "security_scanner", organization: "Qualys", baseScore: 70, respectsRobots: false, uaPatterns: ["qualys"] },
|
|
1324
|
+
{ id: "shodan", name: "Shodan", category: "security_scanner", organization: "Shodan", baseScore: 75, respectsRobots: false, uaPatterns: ["shodan"] },
|
|
1325
|
+
{ id: "censys", name: "Censys", category: "security_scanner", organization: "Censys", baseScore: 75, respectsRobots: false, uaPatterns: ["censys"] },
|
|
1326
|
+
{ id: "nmap", name: "Nmap", category: "security_scanner", organization: "Open Source", baseScore: 70, respectsRobots: false, uaPatterns: ["nmap"] },
|
|
1327
|
+
{ id: "zap", name: "OWASP ZAP", category: "security_scanner", organization: "OWASP", baseScore: 70, respectsRobots: false, uaPatterns: ["zap/"] },
|
|
1328
|
+
{ id: "burp", name: "Burp Suite", category: "security_scanner", organization: "PortSwigger", baseScore: 70, respectsRobots: false, uaPatterns: ["burp"] },
|
|
1329
|
+
{ id: "nikto", name: "Nikto", category: "security_scanner", organization: "Open Source", baseScore: 70, respectsRobots: false, uaPatterns: ["nikto"] },
|
|
1330
|
+
{ id: "nuclei", name: "Nuclei", category: "security_scanner", organization: "ProjectDiscovery", baseScore: 70, respectsRobots: false, uaPatterns: ["nuclei"] },
|
|
1331
|
+
{ id: "acunetix", name: "Acunetix", category: "security_scanner", organization: "Invicti", baseScore: 70, respectsRobots: false, uaPatterns: ["acunetix"] },
|
|
1332
|
+
{ id: "netsparker", name: "Netsparker", category: "security_scanner", organization: "Invicti", baseScore: 70, respectsRobots: false, uaPatterns: ["netsparker"] },
|
|
1333
|
+
{ id: "detectify", name: "Detectify", category: "security_scanner", organization: "Detectify", baseScore: 65, respectsRobots: false, uaPatterns: ["detectify"] },
|
|
1334
|
+
{ id: "intruder", name: "Intruder", category: "security_scanner", organization: "Intruder", baseScore: 65, respectsRobots: false, uaPatterns: ["intruder"] },
|
|
1335
|
+
{ id: "python-requests", name: "Python-Requests", category: "generic_scraper", organization: "Open Source", baseScore: 55, respectsRobots: false, uaPatterns: ["python-requests"] },
|
|
1336
|
+
{ id: "python-urllib", name: "Python-urllib", category: "generic_scraper", organization: "Python", baseScore: 55, respectsRobots: false, uaPatterns: ["python-urllib"] },
|
|
1337
|
+
{ id: "python", name: "Python", category: "generic_scraper", organization: "Python", baseScore: 50, respectsRobots: false, uaPatterns: ["python/"] },
|
|
1338
|
+
{ id: "scrapy", name: "Scrapy", category: "generic_scraper", organization: "Scrapy", baseScore: 65, respectsRobots: true, uaPatterns: ["scrapy"] },
|
|
1339
|
+
{ id: "httpx", name: "HTTPX", category: "generic_scraper", organization: "Open Source", baseScore: 55, respectsRobots: false, uaPatterns: ["httpx"] },
|
|
1340
|
+
{ id: "aiohttp", name: "aiohttp", category: "generic_scraper", organization: "Open Source", baseScore: 55, respectsRobots: false, uaPatterns: ["aiohttp"] },
|
|
1341
|
+
{ id: "beautifulsoup", name: "BeautifulSoup", category: "generic_scraper", organization: "Open Source", baseScore: 60, respectsRobots: false, uaPatterns: ["beautifulsoup"] },
|
|
1342
|
+
{ id: "node-fetch", name: "node-fetch", category: "generic_scraper", organization: "Open Source", baseScore: 55, respectsRobots: false, uaPatterns: ["node-fetch"] },
|
|
1343
|
+
{ id: "axios", name: "Axios", category: "generic_scraper", organization: "Open Source", baseScore: 55, respectsRobots: false, uaPatterns: ["axios/"] },
|
|
1344
|
+
{ id: "got", name: "Got", category: "generic_scraper", organization: "Open Source", baseScore: 55, respectsRobots: false, uaPatterns: ["got/"] },
|
|
1345
|
+
{ id: "undici", name: "Undici", category: "generic_scraper", organization: "Node.js", baseScore: 55, respectsRobots: false, uaPatterns: ["undici"] },
|
|
1346
|
+
{ id: "go-http-client", name: "Go-HTTP-Client", category: "generic_scraper", organization: "Go", baseScore: 55, respectsRobots: false, uaPatterns: ["go-http-client"] },
|
|
1347
|
+
{ id: "colly", name: "Colly", category: "generic_scraper", organization: "Open Source", baseScore: 65, respectsRobots: true, uaPatterns: ["colly"] },
|
|
1348
|
+
{ id: "java", name: "Java", category: "generic_scraper", organization: "Oracle", baseScore: 50, respectsRobots: false, uaPatterns: ["java/"] },
|
|
1349
|
+
{ id: "okhttp", name: "OkHttp", category: "generic_scraper", organization: "Square", baseScore: 55, respectsRobots: false, uaPatterns: ["okhttp"] },
|
|
1350
|
+
{ id: "apache-httpclient", name: "Apache-HttpClient", category: "generic_scraper", organization: "Apache", baseScore: 55, respectsRobots: false, uaPatterns: ["apache-httpclient"] },
|
|
1351
|
+
{ id: "jsoup", name: "Jsoup", category: "generic_scraper", organization: "Open Source", baseScore: 60, respectsRobots: false, uaPatterns: ["jsoup"] },
|
|
1352
|
+
{ id: "guzzlehttp", name: "GuzzleHttp", category: "generic_scraper", organization: "Open Source", baseScore: 55, respectsRobots: false, uaPatterns: ["guzzlehttp"] },
|
|
1353
|
+
{ id: "php", name: "PHP", category: "generic_scraper", organization: "PHP", baseScore: 50, respectsRobots: false, uaPatterns: ["php/"] },
|
|
1354
|
+
{ id: "ruby", name: "Ruby", category: "generic_scraper", organization: "Ruby", baseScore: 50, respectsRobots: false, uaPatterns: ["ruby"] },
|
|
1355
|
+
{ id: "faraday", name: "Faraday", category: "generic_scraper", organization: "Open Source", baseScore: 55, respectsRobots: false, uaPatterns: ["faraday"] },
|
|
1356
|
+
{ id: "mechanize", name: "Mechanize", category: "generic_scraper", organization: "Open Source", baseScore: 60, respectsRobots: false, uaPatterns: ["mechanize"] },
|
|
1357
|
+
{ id: "headlesschrome", name: "HeadlessChrome", category: "headless_browser", organization: "Google", baseScore: 70, respectsRobots: false, uaPatterns: ["headlesschrome"] },
|
|
1358
|
+
{ id: "puppeteer", name: "Puppeteer", category: "headless_browser", organization: "Google", baseScore: 70, respectsRobots: false, uaPatterns: ["puppeteer"] },
|
|
1359
|
+
{ id: "playwright", name: "Playwright", category: "headless_browser", organization: "Microsoft", baseScore: 70, respectsRobots: false, uaPatterns: ["playwright"] },
|
|
1360
|
+
{ id: "selenium", name: "Selenium", category: "headless_browser", organization: "Open Source", baseScore: 70, respectsRobots: false, uaPatterns: ["selenium"] },
|
|
1361
|
+
{ id: "phantomjs", name: "PhantomJS", category: "headless_browser", organization: "Open Source", baseScore: 75, respectsRobots: false, uaPatterns: ["phantomjs"] },
|
|
1362
|
+
{ id: "splash", name: "Splash", category: "headless_browser", organization: "Scrapinghub", baseScore: 70, respectsRobots: false, uaPatterns: ["splash"] },
|
|
1363
|
+
{ id: "browserless", name: "Browserless", category: "headless_browser", organization: "Browserless", baseScore: 65, respectsRobots: false, uaPatterns: ["browserless"] },
|
|
1364
|
+
{ id: "browserbase", name: "Browserbase", category: "headless_browser", organization: "Browserbase", baseScore: 65, respectsRobots: false, uaPatterns: ["browserbase"] },
|
|
1365
|
+
{ id: "ia-archiver", name: "Internet Archive", category: "archiver", organization: "Internet Archive", baseScore: 25, respectsRobots: true, uaPatterns: ["ia_archiver"] },
|
|
1366
|
+
{ id: "archive-org-bot", name: "Archive.org", category: "archiver", organization: "Internet Archive", baseScore: 25, respectsRobots: true, uaPatterns: ["archive.org_bot"] },
|
|
1367
|
+
{ id: "wayback", name: "Wayback Machine", category: "archiver", organization: "Internet Archive", baseScore: 25, respectsRobots: true, uaPatterns: ["wayback"] },
|
|
1368
|
+
{ id: "heritrix", name: "Heritrix", category: "archiver", organization: "Internet Archive", baseScore: 30, respectsRobots: true, uaPatterns: ["heritrix"] },
|
|
1369
|
+
{ id: "brozzler", name: "Brozzler", category: "archiver", organization: "Internet Archive", baseScore: 30, respectsRobots: true, uaPatterns: ["brozzler"] },
|
|
1370
|
+
{ id: "facebookexternalhit", name: "Facebook", category: "fetcher", organization: "Meta", baseScore: 25, respectsRobots: true, uaPatterns: ["facebookexternalhit"] },
|
|
1371
|
+
{ id: "twitterbot", name: "Twitterbot", category: "fetcher", organization: "X Corp", baseScore: 25, respectsRobots: true, uaPatterns: ["twitterbot"] },
|
|
1372
|
+
{ id: "linkedinbot", name: "LinkedInBot", category: "fetcher", organization: "LinkedIn", baseScore: 25, respectsRobots: true, uaPatterns: ["linkedinbot"] },
|
|
1373
|
+
{ id: "slackbot", name: "Slackbot", category: "fetcher", organization: "Slack", baseScore: 25, respectsRobots: true, uaPatterns: ["slackbot"] },
|
|
1374
|
+
{ id: "telegrambot", name: "TelegramBot", category: "fetcher", organization: "Telegram", baseScore: 25, respectsRobots: true, uaPatterns: ["telegrambot"] },
|
|
1375
|
+
{ id: "whatsapp", name: "WhatsApp", category: "fetcher", organization: "Meta", baseScore: 25, respectsRobots: true, uaPatterns: ["whatsapp"] },
|
|
1376
|
+
{ id: "discordbot", name: "Discordbot", category: "fetcher", organization: "Discord", baseScore: 25, respectsRobots: true, uaPatterns: ["discordbot"] },
|
|
1377
|
+
{ id: "pinterestbot", name: "Pinterest", category: "fetcher", organization: "Pinterest", baseScore: 30, respectsRobots: true, uaPatterns: ["pinterest"] },
|
|
1378
|
+
{ id: "tumblr", name: "Tumblr", category: "fetcher", organization: "Automattic", baseScore: 30, respectsRobots: true, uaPatterns: ["tumblr"] },
|
|
1379
|
+
{ id: "reddit", name: "Reddit", category: "fetcher", organization: "Reddit", baseScore: 30, respectsRobots: true, uaPatterns: ["reddit"] },
|
|
1380
|
+
{ id: "embedly", name: "Embedly", category: "fetcher", organization: "Medium", baseScore: 30, respectsRobots: true, uaPatterns: ["embedly"] },
|
|
1381
|
+
{ id: "iframely", name: "Iframely", category: "fetcher", organization: "Iframely", baseScore: 30, respectsRobots: true, uaPatterns: ["iframely"] },
|
|
1382
|
+
{ id: "curl", name: "cURL", category: "fetcher", organization: "Open Source", baseScore: 45, respectsRobots: false, uaPatterns: ["curl/"] },
|
|
1383
|
+
{ id: "wget", name: "Wget", category: "fetcher", organization: "GNU", baseScore: 45, respectsRobots: false, uaPatterns: ["wget/"] },
|
|
1384
|
+
{ id: "libwww-perl", name: "libwww-perl", category: "fetcher", organization: "Perl", baseScore: 50, respectsRobots: false, uaPatterns: ["libwww-perl"] },
|
|
1385
|
+
{ id: "lwp", name: "LWP", category: "fetcher", organization: "Perl", baseScore: 50, respectsRobots: false, uaPatterns: ["lwp-"] },
|
|
1386
|
+
{ id: "httrack", name: "HTTrack", category: "fetcher", organization: "Open Source", baseScore: 60, respectsRobots: true, uaPatterns: ["httrack"] },
|
|
1387
|
+
{ id: "webdecoybot", name: "WebDecoyBot", category: "monitoring", organization: "WebDecoy", baseScore: 5, respectsRobots: true, uaPatterns: ["webdecoybot"] },
|
|
1388
|
+
{ id: "uptimerobot", name: "UptimeRobot", category: "monitoring", organization: "UptimeRobot", baseScore: 20, respectsRobots: true, uaPatterns: ["uptimerobot"] },
|
|
1389
|
+
{ id: "pingdom", name: "Pingdom", category: "monitoring", organization: "SolarWinds", baseScore: 20, respectsRobots: true, uaPatterns: ["pingdom"] },
|
|
1390
|
+
{ id: "statuscake", name: "StatusCake", category: "monitoring", organization: "StatusCake", baseScore: 20, respectsRobots: true, uaPatterns: ["statuscake"] },
|
|
1391
|
+
{ id: "better-uptime", name: "Better Uptime", category: "monitoring", organization: "Better Stack", baseScore: 20, respectsRobots: true, uaPatterns: ["betteruptime"] },
|
|
1392
|
+
{ id: "datadog-synthetics", name: "Datadog Synthetics", category: "monitoring", organization: "Datadog", baseScore: 25, respectsRobots: true, uaPatterns: ["datadog"] },
|
|
1393
|
+
{ id: "newrelic", name: "New Relic", category: "monitoring", organization: "New Relic", baseScore: 25, respectsRobots: true, uaPatterns: ["newrelic"] },
|
|
1394
|
+
{ id: "site24x7", name: "Site24x7", category: "monitoring", organization: "Zoho", baseScore: 20, respectsRobots: true, uaPatterns: ["site24x7"] },
|
|
1395
|
+
{ id: "freshping", name: "Freshping", category: "monitoring", organization: "Freshworks", baseScore: 20, respectsRobots: true, uaPatterns: ["freshping"] },
|
|
1396
|
+
{ id: "hetrixtools", name: "HetrixTools", category: "monitoring", organization: "HetrixTools", baseScore: 20, respectsRobots: true, uaPatterns: ["hetrixtools"] },
|
|
1397
|
+
{ id: "nodeping", name: "NodePing", category: "monitoring", organization: "NodePing", baseScore: 20, respectsRobots: true, uaPatterns: ["nodeping"] },
|
|
1398
|
+
{ id: "feedly", name: "Feedly", category: "feed_reader", organization: "Feedly", baseScore: 25, respectsRobots: true, uaPatterns: ["feedly"] },
|
|
1399
|
+
{ id: "newsblur", name: "NewsBlur", category: "feed_reader", organization: "NewsBlur", baseScore: 25, respectsRobots: true, uaPatterns: ["newsblur"] },
|
|
1400
|
+
{ id: "inoreader", name: "Inoreader", category: "feed_reader", organization: "Inoreader", baseScore: 25, respectsRobots: true, uaPatterns: ["inoreader"] },
|
|
1401
|
+
{ id: "theoldreader", name: "The Old Reader", category: "feed_reader", organization: "The Old Reader", baseScore: 25, respectsRobots: true, uaPatterns: ["theoldreader"] },
|
|
1402
|
+
{ id: "feedbin", name: "Feedbin", category: "feed_reader", organization: "Feedbin", baseScore: 25, respectsRobots: true, uaPatterns: ["feedbin"] },
|
|
1403
|
+
{ id: "miniflux", name: "Miniflux", category: "feed_reader", organization: "Open Source", baseScore: 25, respectsRobots: true, uaPatterns: ["miniflux"] },
|
|
1404
|
+
{ id: "freshrss", name: "FreshRSS", category: "feed_reader", organization: "Open Source", baseScore: 25, respectsRobots: true, uaPatterns: ["freshrss"] },
|
|
1405
|
+
{ id: "commafeed", name: "CommaFeed", category: "feed_reader", organization: "Open Source", baseScore: 25, respectsRobots: true, uaPatterns: ["commafeed"] },
|
|
1406
|
+
{ id: "diffbot", name: "Diffbot", category: "commercial_scraper", organization: "Diffbot", baseScore: 70, respectsRobots: true, uaPatterns: ["diffbot"] },
|
|
1407
|
+
{ id: "import-io", name: "Import.io", category: "commercial_scraper", organization: "Import.io", baseScore: 65, respectsRobots: true, uaPatterns: ["import.io"] },
|
|
1408
|
+
{ id: "bright-data", name: "Bright Data", category: "commercial_scraper", organization: "Bright Data", baseScore: 70, respectsRobots: false, uaPatterns: ["brightdata", "luminati"] },
|
|
1409
|
+
{ id: "oxylabs", name: "Oxylabs", category: "commercial_scraper", organization: "Oxylabs", baseScore: 70, respectsRobots: false, uaPatterns: ["oxylabs"] },
|
|
1410
|
+
{ id: "scrapingbee", name: "ScrapingBee", category: "commercial_scraper", organization: "ScrapingBee", baseScore: 65, respectsRobots: true, uaPatterns: ["scrapingbee"] },
|
|
1411
|
+
{ id: "scrapingant", name: "ScrapingAnt", category: "commercial_scraper", organization: "ScrapingAnt", baseScore: 65, respectsRobots: true, uaPatterns: ["scrapingant"] },
|
|
1412
|
+
{ id: "zyte", name: "Zyte", category: "commercial_scraper", organization: "Zyte", baseScore: 65, respectsRobots: true, uaPatterns: ["zyte", "scrapinghub"] },
|
|
1413
|
+
{ id: "apify", name: "Apify", category: "commercial_scraper", organization: "Apify", baseScore: 65, respectsRobots: true, uaPatterns: ["apify"] },
|
|
1414
|
+
{ id: "crawlbase", name: "Crawlbase", category: "commercial_scraper", organization: "Crawlbase", baseScore: 65, respectsRobots: true, uaPatterns: ["crawlbase"] },
|
|
1415
|
+
{ id: "webscrapingapi", name: "WebScrapingAPI", category: "commercial_scraper", organization: "WebScrapingAPI", baseScore: 65, respectsRobots: true, uaPatterns: ["webscrapingapi"] },
|
|
1416
|
+
{ id: "gemini-deep-research", name: "Gemini-Deep-Research", category: "ai_assistant", organization: "Google", baseScore: 65, respectsRobots: true, uaPatterns: ["gemini-deep-research"] },
|
|
1417
|
+
{ id: "copilot", name: "Microsoft Copilot", category: "ai_assistant", organization: "Microsoft", baseScore: 65, respectsRobots: true, uaPatterns: ["copilot"] },
|
|
1418
|
+
{ id: "cortana", name: "Cortana", category: "ai_assistant", organization: "Microsoft", baseScore: 60, respectsRobots: true, uaPatterns: ["cortana"] },
|
|
1419
|
+
{ id: "siri", name: "Siri", category: "ai_assistant", organization: "Apple", baseScore: 60, respectsRobots: true, uaPatterns: ["siri"] }
|
|
1420
|
+
];
|
|
1421
|
+
|
|
1422
|
+
// src/bots/index.ts
|
|
1423
|
+
var AI_CATEGORIES = /* @__PURE__ */ new Set([
|
|
1424
|
+
"training_crawler",
|
|
1425
|
+
"ai_search_crawler",
|
|
1426
|
+
"ai_agent",
|
|
1427
|
+
"ai_assistant"
|
|
1428
|
+
]);
|
|
1429
|
+
var UNKNOWN = Object.freeze({
|
|
1430
|
+
known: false,
|
|
1431
|
+
category: "none",
|
|
1432
|
+
score: 0,
|
|
1433
|
+
isAI: false
|
|
1434
|
+
});
|
|
1435
|
+
var MAX_CACHE = 1e3;
|
|
1436
|
+
var cache = /* @__PURE__ */ new Map();
|
|
1437
|
+
function matchUserAgent(userAgent) {
|
|
1438
|
+
if (!userAgent) return void 0;
|
|
1439
|
+
const cached = cache.get(userAgent);
|
|
1440
|
+
if (cached !== void 0) return cached ?? void 0;
|
|
1441
|
+
const ua = userAgent.toLowerCase();
|
|
1442
|
+
let found = null;
|
|
1443
|
+
for (const agent of BOT_REGISTRY) {
|
|
1444
|
+
for (const pattern of agent.uaPatterns) {
|
|
1445
|
+
if (ua.includes(pattern)) {
|
|
1446
|
+
found = agent;
|
|
1447
|
+
break;
|
|
1448
|
+
}
|
|
1449
|
+
}
|
|
1450
|
+
if (found) break;
|
|
1451
|
+
}
|
|
1452
|
+
if (cache.size >= MAX_CACHE) cache.clear();
|
|
1453
|
+
cache.set(userAgent, found);
|
|
1454
|
+
return found ?? void 0;
|
|
1455
|
+
}
|
|
1456
|
+
function classifyUserAgent(userAgent) {
|
|
1457
|
+
const agent = matchUserAgent(userAgent);
|
|
1458
|
+
if (!agent) return UNKNOWN;
|
|
1459
|
+
return {
|
|
1460
|
+
known: true,
|
|
1461
|
+
id: agent.id,
|
|
1462
|
+
name: agent.name,
|
|
1463
|
+
category: agent.category,
|
|
1464
|
+
organization: agent.organization,
|
|
1465
|
+
score: agent.baseScore,
|
|
1466
|
+
respectsRobots: agent.respectsRobots,
|
|
1467
|
+
isAI: AI_CATEGORIES.has(agent.category)
|
|
1468
|
+
};
|
|
1469
|
+
}
|
|
1470
|
+
|
|
1471
|
+
// src/rules/bot-policy.ts
|
|
1472
|
+
var AI_CATEGORIES2 = /* @__PURE__ */ new Set([
|
|
1473
|
+
"training_crawler",
|
|
1474
|
+
"ai_search_crawler",
|
|
1475
|
+
"ai_agent",
|
|
1476
|
+
"ai_assistant"
|
|
1477
|
+
]);
|
|
1478
|
+
var BotPolicy = class {
|
|
1479
|
+
constructor(options = {}) {
|
|
1480
|
+
const deny = options.deny ?? [];
|
|
1481
|
+
const allow = new Set((options.allow ?? []).map((a) => a.toLowerCase()));
|
|
1482
|
+
const categories = /* @__PURE__ */ new Set();
|
|
1483
|
+
const agents = /* @__PURE__ */ new Set();
|
|
1484
|
+
let ai = false;
|
|
1485
|
+
for (const token of deny) {
|
|
1486
|
+
if (token === "ai") ai = true;
|
|
1487
|
+
else if (BOT_CATEGORIES.includes(token)) categories.add(token);
|
|
1488
|
+
else agents.add(token.toLowerCase());
|
|
1489
|
+
}
|
|
1490
|
+
this.config = {
|
|
1491
|
+
categories: [...categories],
|
|
1492
|
+
agents: [...agents],
|
|
1493
|
+
ai,
|
|
1494
|
+
allow: options.allow,
|
|
1495
|
+
action: options.action,
|
|
1496
|
+
dryRun: options.dryRun
|
|
1497
|
+
};
|
|
1498
|
+
this.matched = BOT_REGISTRY.filter((agent) => {
|
|
1499
|
+
if (allow.has(agent.id) || allow.has(agent.name.toLowerCase())) return false;
|
|
1500
|
+
return ai && AI_CATEGORIES2.has(agent.category) || categories.has(agent.category) || agents.has(agent.id) || agents.has(agent.name.toLowerCase());
|
|
1501
|
+
});
|
|
1502
|
+
}
|
|
1503
|
+
/**
|
|
1504
|
+
* Agents in the deny set whose operator does not document honouring
|
|
1505
|
+
* robots.txt. Publishing still declares the policy; only the rule enforces it
|
|
1506
|
+
* against these.
|
|
1507
|
+
*/
|
|
1508
|
+
get unenforceable() {
|
|
1509
|
+
return this.matched.filter((a) => a.respectsRobots !== true);
|
|
1510
|
+
}
|
|
1511
|
+
/** The enforcing rule. Denies exactly the agents in {@link matched}. */
|
|
1512
|
+
rule() {
|
|
1513
|
+
return new BotRule(this.config);
|
|
1514
|
+
}
|
|
1515
|
+
/** The published policy, as a `robots.txt` body. */
|
|
1516
|
+
robotsTxt(options = {}) {
|
|
1517
|
+
const { allowOthers = true, annotate = true } = options;
|
|
1518
|
+
const lines = [];
|
|
1519
|
+
if (annotate) {
|
|
1520
|
+
lines.push("# Managed by WebDecoy \u2014 published and enforced from one policy.");
|
|
1521
|
+
const ignoring = this.unenforceable;
|
|
1522
|
+
if (ignoring.length > 0) {
|
|
1523
|
+
lines.push(
|
|
1524
|
+
"# These do not document honouring robots.txt, so the lines below are a",
|
|
1525
|
+
"# request only. The bots() rule is what actually stops them:",
|
|
1526
|
+
...ignoring.map((a) => `# ${a.name}${a.organization ? ` (${a.organization})` : ""}`)
|
|
1527
|
+
);
|
|
1528
|
+
}
|
|
1529
|
+
lines.push("");
|
|
1530
|
+
}
|
|
1531
|
+
for (const agent of this.matched) {
|
|
1532
|
+
lines.push(`User-agent: ${agent.name}`, "Disallow: /", "");
|
|
1533
|
+
}
|
|
1534
|
+
if (allowOthers) {
|
|
1535
|
+
lines.push("User-agent: *");
|
|
1536
|
+
for (const path of options.disallow ?? []) lines.push(`Disallow: ${path}`);
|
|
1537
|
+
if ((options.disallow ?? []).length === 0) lines.push("Disallow:");
|
|
1538
|
+
if (options.crawlDelay !== void 0) lines.push(`Crawl-delay: ${options.crawlDelay}`);
|
|
1539
|
+
lines.push("");
|
|
1540
|
+
}
|
|
1541
|
+
if (options.sitemap) lines.push(`Sitemap: ${options.sitemap}`, "");
|
|
1542
|
+
return lines.join("\n").replace(/\n{3,}/g, "\n\n").trimStart();
|
|
1543
|
+
}
|
|
1544
|
+
};
|
|
1545
|
+
function botPolicy(options = {}) {
|
|
1546
|
+
return new BotPolicy(options);
|
|
1547
|
+
}
|
|
1548
|
+
|
|
1549
|
+
// src/rules/attack-signatures.ts
|
|
1550
|
+
var SIGNATURES = [
|
|
1551
|
+
// --- SQL injection -------------------------------------------------------
|
|
1552
|
+
{ id: "sqli_union", label: "SQL UNION SELECT", test: /\bunion\b[\s/*]+\bselect\b/i },
|
|
1553
|
+
{
|
|
1554
|
+
id: "sqli_tautology",
|
|
1555
|
+
label: "SQL tautology",
|
|
1556
|
+
// ' OR 1=1 / " or 'a'='a — the quote is required, which is what keeps this
|
|
1557
|
+
// off ordinary query strings containing "or".
|
|
1558
|
+
test: /['"`]\s*(?:or|and)\s+(?:\d+\s*=\s*\d+|['"`][^'"`]{0,32}['"`]\s*=\s*['"`])/i
|
|
1559
|
+
},
|
|
1560
|
+
{
|
|
1561
|
+
id: "sqli_stacked",
|
|
1562
|
+
label: "Stacked SQL statement",
|
|
1563
|
+
test: /;\s*(?:drop|truncate|alter|create|insert|update|delete)\s+(?:table|database|from|into)\b/i
|
|
1564
|
+
},
|
|
1565
|
+
{
|
|
1566
|
+
id: "sqli_timing",
|
|
1567
|
+
label: "SQL timing function",
|
|
1568
|
+
test: /\b(?:sleep|pg_sleep|benchmark|waitfor\s+delay)\s*\(/i
|
|
1569
|
+
},
|
|
1570
|
+
{ id: "sqli_probe", label: "SQL metadata probe", test: /\binformation_schema\.[a-z_]+/i },
|
|
1571
|
+
// --- Cross-site scripting -----------------------------------------------
|
|
1572
|
+
{ id: "xss_script_tag", label: "Inline <script>", test: /<\s*script[\s>/]/i },
|
|
1573
|
+
{ id: "xss_javascript_uri", label: "javascript: URI", test: /javascript\s*:[^\s]{0,64}\(/i },
|
|
1574
|
+
{
|
|
1575
|
+
id: "xss_event_handler",
|
|
1576
|
+
label: "Inline event handler",
|
|
1577
|
+
// Requires a tag context, so `onerror` as a bare parameter name is not a hit.
|
|
1578
|
+
test: /<[a-z][a-z0-9]{0,15}[^>]{0,256}\son(?:error|load|click|mouseover|focus)\s*=/i
|
|
1579
|
+
},
|
|
1580
|
+
{ id: "xss_svg_onload", label: "SVG onload", test: /<\s*svg[^>]{0,128}\bonload\b/i },
|
|
1581
|
+
// --- Path traversal ------------------------------------------------------
|
|
1582
|
+
{
|
|
1583
|
+
id: "traversal",
|
|
1584
|
+
label: "Path traversal",
|
|
1585
|
+
// Two or more segments: a single `../` shows up in legitimately relative
|
|
1586
|
+
// redirect targets often enough to be worth the extra evidence.
|
|
1587
|
+
test: /(?:\.\.[/\\]){2,}/
|
|
1588
|
+
},
|
|
1589
|
+
{ id: "traversal_etc", label: "Sensitive file path", test: /\/etc\/(?:passwd|shadow)\b/i },
|
|
1590
|
+
// --- Command injection ---------------------------------------------------
|
|
1591
|
+
{
|
|
1592
|
+
id: "cmdi_shell",
|
|
1593
|
+
label: "Shell command injection",
|
|
1594
|
+
test: /[;|&`]\s*(?:cat|curl|wget|nc|bash|sh|python|perl|chmod)\s+[-/\w]/i
|
|
1595
|
+
},
|
|
1596
|
+
{ id: "cmdi_subshell", label: "Shell substitution", test: /\$\([a-z][^)]{0,64}\)/i },
|
|
1597
|
+
// --- Template / expression injection -------------------------------------
|
|
1598
|
+
{ id: "ssti_jndi", label: "JNDI lookup (Log4Shell)", test: /\$\{\s*jndi\s*:/i },
|
|
1599
|
+
{ id: "ssti_expression", label: "Template expression", test: /\{\{\s*[\w.]+\s*[(*]/ }
|
|
1600
|
+
];
|
|
1601
|
+
function decodeBounded(input) {
|
|
1602
|
+
const forms = [input];
|
|
1603
|
+
let current = input;
|
|
1604
|
+
for (let i = 0; i < 2; i++) {
|
|
1605
|
+
if (!current.includes("%")) break;
|
|
1606
|
+
let next;
|
|
1607
|
+
try {
|
|
1608
|
+
next = decodeURIComponent(current);
|
|
1609
|
+
} catch {
|
|
1610
|
+
break;
|
|
1611
|
+
}
|
|
1612
|
+
if (next === current) break;
|
|
1613
|
+
forms.push(next);
|
|
1614
|
+
current = next;
|
|
1615
|
+
}
|
|
1616
|
+
return forms;
|
|
1617
|
+
}
|
|
1618
|
+
var AttackSignatureRule = class {
|
|
1619
|
+
constructor(config = {}) {
|
|
1620
|
+
this.name = "attack-signatures";
|
|
1621
|
+
this.inspect = new Set(config.inspect ?? ["path", "query"]);
|
|
1622
|
+
this.maxBytes = config.maxBytes ?? 8192;
|
|
1623
|
+
const excluded = new Set(config.exclude ?? []);
|
|
1624
|
+
this.signatures = SIGNATURES.filter((s) => !excluded.has(s.id));
|
|
1625
|
+
this.action = config.action ?? "DENY";
|
|
1626
|
+
this.dryRun = config.dryRun ?? false;
|
|
1627
|
+
}
|
|
1628
|
+
evaluate(context) {
|
|
1629
|
+
for (const [where, raw] of this.parts(context)) {
|
|
1630
|
+
if (!raw) continue;
|
|
1631
|
+
const truncated = raw.length > this.maxBytes ? raw.slice(0, this.maxBytes) : raw;
|
|
1632
|
+
for (const form of decodeBounded(truncated)) {
|
|
1633
|
+
for (const signature of this.signatures) {
|
|
1634
|
+
if (!signature.test.test(form)) continue;
|
|
1635
|
+
return {
|
|
1636
|
+
action: this.dryRun ? "ALLOW" : this.action,
|
|
1637
|
+
rule: this.name,
|
|
1638
|
+
reason: `${signature.label} in request ${where}`,
|
|
1639
|
+
metadata: {
|
|
1640
|
+
signature: signature.id,
|
|
1641
|
+
label: signature.label,
|
|
1642
|
+
where,
|
|
1643
|
+
dryRun: this.dryRun
|
|
1644
|
+
}
|
|
1645
|
+
};
|
|
1646
|
+
}
|
|
1647
|
+
}
|
|
1648
|
+
}
|
|
1649
|
+
return { action: "ALLOW", rule: this.name };
|
|
1650
|
+
}
|
|
1651
|
+
parts(context) {
|
|
1652
|
+
const out = [];
|
|
1653
|
+
if (this.inspect.has("path")) out.push(["path", context.path]);
|
|
1654
|
+
if (this.inspect.has("query")) out.push(["query", context.query]);
|
|
1655
|
+
if (this.inspect.has("body")) out.push(["body", context.body]);
|
|
1656
|
+
if (this.inspect.has("headers")) {
|
|
1657
|
+
for (const [name, value] of Object.entries(context.headers ?? {})) {
|
|
1658
|
+
if (name === "cookie") continue;
|
|
1659
|
+
out.push([`header:${name}`, value]);
|
|
1660
|
+
}
|
|
1661
|
+
}
|
|
1662
|
+
return out;
|
|
1663
|
+
}
|
|
1664
|
+
};
|
|
1665
|
+
function attackSignatures(config = {}) {
|
|
1666
|
+
return new AttackSignatureRule(config);
|
|
1667
|
+
}
|
|
1668
|
+
var ATTACK_SIGNATURE_IDS = SIGNATURES.map((s) => s.id);
|
|
1669
|
+
|
|
1670
|
+
// src/rules/web-bot-auth-rule.ts
|
|
1671
|
+
var WebBotAuthRule = class {
|
|
1672
|
+
constructor(config = {}) {
|
|
1673
|
+
this.name = "web-bot-auth";
|
|
1674
|
+
this.onImpersonation = config.onImpersonation ?? "DENY";
|
|
1675
|
+
this.onClaimed = config.onClaimed ?? "ALLOW";
|
|
1676
|
+
this.allowCategories = config.allowCategories ? new Set(config.allowCategories) : void 0;
|
|
1677
|
+
this.dryRun = config.dryRun ?? false;
|
|
1678
|
+
}
|
|
1679
|
+
evaluate(context) {
|
|
1680
|
+
const verdict = context.agent;
|
|
1681
|
+
if (!verdict) {
|
|
1682
|
+
return {
|
|
1683
|
+
action: "ALLOW",
|
|
1684
|
+
rule: this.name,
|
|
1685
|
+
state: "NOT_RUN",
|
|
1686
|
+
reason: "Request lacked the host information needed to verify a signature"
|
|
1687
|
+
};
|
|
1688
|
+
}
|
|
1689
|
+
if (verdict.status === "none") return this.allow();
|
|
1690
|
+
if (verdict.status === "impersonation") {
|
|
1691
|
+
return this.act(this.onImpersonation, "agent_impersonation", {
|
|
1692
|
+
agentName: verdict.agentName,
|
|
1693
|
+
category: verdict.category,
|
|
1694
|
+
keyId: verdict.keyId,
|
|
1695
|
+
detail: verdict.reason
|
|
1696
|
+
});
|
|
1697
|
+
}
|
|
1698
|
+
if (verdict.status === "claimed") {
|
|
1699
|
+
return this.act(this.onClaimed, "agent_unverifiable", {
|
|
1700
|
+
keyId: verdict.keyId,
|
|
1701
|
+
detail: verdict.reason
|
|
1702
|
+
});
|
|
1703
|
+
}
|
|
1704
|
+
if (this.allowCategories && verdict.category && !this.allowCategories.has(verdict.category)) {
|
|
1705
|
+
return this.act(this.onClaimed, "agent_category_not_allowed", {
|
|
1706
|
+
agentName: verdict.agentName,
|
|
1707
|
+
category: verdict.category,
|
|
1708
|
+
keyId: verdict.keyId
|
|
1709
|
+
});
|
|
1710
|
+
}
|
|
1711
|
+
return this.allow();
|
|
1712
|
+
}
|
|
1713
|
+
act(action, verdict, detail) {
|
|
1714
|
+
if (action === "ALLOW") return this.allow();
|
|
1715
|
+
return {
|
|
1716
|
+
action: this.dryRun ? "ALLOW" : action,
|
|
1717
|
+
rule: this.name,
|
|
1718
|
+
reason: reasonFor(verdict),
|
|
1719
|
+
metadata: { verdict, dryRun: this.dryRun, ...detail }
|
|
1720
|
+
};
|
|
1721
|
+
}
|
|
1722
|
+
allow() {
|
|
1723
|
+
return { action: "ALLOW", rule: this.name };
|
|
1724
|
+
}
|
|
1725
|
+
};
|
|
1726
|
+
function reasonFor(verdict) {
|
|
1727
|
+
switch (verdict) {
|
|
1728
|
+
case "agent_impersonation":
|
|
1729
|
+
return "Web Bot Auth signature failed verification (agent impersonation)";
|
|
1730
|
+
case "agent_unverifiable":
|
|
1731
|
+
return "Web Bot Auth signature could not be verified";
|
|
1732
|
+
case "agent_category_not_allowed":
|
|
1733
|
+
return "Verified agent category is not allowed";
|
|
1734
|
+
default:
|
|
1735
|
+
return "Web Bot Auth rule triggered";
|
|
1736
|
+
}
|
|
1737
|
+
}
|
|
1738
|
+
function webBotAuth(config = {}) {
|
|
1739
|
+
return new WebBotAuthRule(config);
|
|
1740
|
+
}
|
|
1741
|
+
|
|
1742
|
+
// src/webcrypto.ts
|
|
1743
|
+
var encoder = new TextEncoder();
|
|
1744
|
+
function toHex(bytes) {
|
|
1745
|
+
let hex = "";
|
|
1746
|
+
for (let i = 0; i < bytes.length; i++) hex += bytes[i].toString(16).padStart(2, "0");
|
|
1747
|
+
return hex;
|
|
1748
|
+
}
|
|
1749
|
+
async function sha256Hex(data) {
|
|
1750
|
+
const digest2 = await crypto.subtle.digest("SHA-256", encoder.encode(data));
|
|
1751
|
+
return toHex(new Uint8Array(digest2));
|
|
1752
|
+
}
|
|
1753
|
+
async function hmacSha256Hex(secret, data) {
|
|
1754
|
+
const key = await crypto.subtle.importKey(
|
|
1755
|
+
"raw",
|
|
1756
|
+
encoder.encode(secret),
|
|
1757
|
+
{ name: "HMAC", hash: "SHA-256" },
|
|
1758
|
+
false,
|
|
1759
|
+
["sign"]
|
|
1760
|
+
);
|
|
1761
|
+
const sig = await crypto.subtle.sign("HMAC", key, encoder.encode(data));
|
|
1762
|
+
return toHex(new Uint8Array(sig));
|
|
1763
|
+
}
|
|
1764
|
+
function randomHex(bytes) {
|
|
1765
|
+
const buf = new Uint8Array(bytes);
|
|
1766
|
+
crypto.getRandomValues(buf);
|
|
1767
|
+
return toHex(buf);
|
|
1768
|
+
}
|
|
1769
|
+
function timingSafeEqualStr(a, b) {
|
|
1770
|
+
if (a.length !== b.length) return false;
|
|
1771
|
+
let diff = 0;
|
|
1772
|
+
for (let i = 0; i < a.length; i++) diff |= a.charCodeAt(i) ^ b.charCodeAt(i);
|
|
1773
|
+
return diff === 0;
|
|
1774
|
+
}
|
|
1775
|
+
function base64urlEncode(data) {
|
|
1776
|
+
const bytes = encoder.encode(data);
|
|
1777
|
+
let binary = "";
|
|
1778
|
+
for (let i = 0; i < bytes.length; i++) binary += String.fromCharCode(bytes[i]);
|
|
1779
|
+
return btoa(binary).replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "");
|
|
1780
|
+
}
|
|
1781
|
+
function base64urlDecode(data) {
|
|
1782
|
+
const b64 = data.replace(/-/g, "+").replace(/_/g, "/");
|
|
1783
|
+
const padded = b64 + "=".repeat((4 - b64.length % 4) % 4);
|
|
1784
|
+
const binary = atob(padded);
|
|
1785
|
+
const bytes = new Uint8Array(binary.length);
|
|
1786
|
+
for (let i = 0; i < binary.length; i++) bytes[i] = binary.charCodeAt(i);
|
|
1787
|
+
return new TextDecoder().decode(bytes);
|
|
1788
|
+
}
|
|
1789
|
+
function fnv1a64Hex(data) {
|
|
1790
|
+
const PRIME = 0x100000001b3n;
|
|
1791
|
+
const MASK = 0xffffffffffffffffn;
|
|
1792
|
+
let hash = 0xcbf29ce484222325n;
|
|
1793
|
+
const bytes = encoder.encode(data);
|
|
1794
|
+
for (let i = 0; i < bytes.length; i++) {
|
|
1795
|
+
hash ^= BigInt(bytes[i]);
|
|
1796
|
+
hash = hash * PRIME & MASK;
|
|
1797
|
+
}
|
|
1798
|
+
return hash.toString(16).padStart(16, "0");
|
|
1799
|
+
}
|
|
1800
|
+
|
|
1801
|
+
// src/rules/honeytoken.ts
|
|
1802
|
+
function honeytoken(options = {}) {
|
|
1803
|
+
const base = (options.basePath ?? "/__wd").replace(/\/+$/, "");
|
|
1804
|
+
const token = options.token ?? randomHex(6);
|
|
1805
|
+
const path = `${base}/${token}`;
|
|
1806
|
+
const text = options.text ?? ".";
|
|
1807
|
+
const linkHtml = `<a href="${path}" aria-hidden="true" tabindex="-1" rel="nofollow noindex" style="position:absolute;left:-9999px;top:auto;width:1px;height:1px;overflow:hidden">${text}</a>`;
|
|
1808
|
+
return { path, linkHtml };
|
|
1809
|
+
}
|
|
1810
|
+
|
|
1811
|
+
// src/rules/upstash-store.ts
|
|
1812
|
+
var UpstashRateLimitStore = class {
|
|
1813
|
+
constructor(options) {
|
|
1814
|
+
this.sync = false;
|
|
1815
|
+
if (!options.url) throw new Error("upstashRateLimitStore: `url` is required");
|
|
1816
|
+
if (!options.token) throw new Error("upstashRateLimitStore: `token` is required");
|
|
1817
|
+
this.url = options.url.replace(/\/+$/, "");
|
|
1818
|
+
this.token = options.token;
|
|
1819
|
+
this.prefix = options.prefix ?? "wd:rl:";
|
|
1820
|
+
this.timeout = options.timeout ?? 1e3;
|
|
1821
|
+
this.failOpen = (options.onError ?? "open") === "open";
|
|
1822
|
+
}
|
|
1823
|
+
async consume(input) {
|
|
1824
|
+
try {
|
|
1825
|
+
return input.algorithm === "sliding" ? await this.sliding(input) : await this.fixed(input);
|
|
1826
|
+
} catch {
|
|
1827
|
+
const now = Date.now();
|
|
1828
|
+
return {
|
|
1829
|
+
allowed: this.failOpen,
|
|
1830
|
+
current: 0,
|
|
1831
|
+
resetAt: now + input.windowMs
|
|
1832
|
+
};
|
|
1833
|
+
}
|
|
1834
|
+
}
|
|
1835
|
+
/**
|
|
1836
|
+
* Fixed window: one counter per key per window.
|
|
1837
|
+
*
|
|
1838
|
+
* The window id is in the key rather than tracked separately, so expiry is the
|
|
1839
|
+
* only cleanup needed and two processes incrementing concurrently cannot
|
|
1840
|
+
* disagree about which window they are in.
|
|
1841
|
+
*/
|
|
1842
|
+
async fixed({ key, max, windowMs }) {
|
|
1843
|
+
const now = Date.now();
|
|
1844
|
+
const windowStart = Math.floor(now / windowMs) * windowMs;
|
|
1845
|
+
const redisKey = `${this.prefix}f:${key}:${windowStart}`;
|
|
1846
|
+
const ttlSeconds = Math.ceil(windowMs / 1e3);
|
|
1847
|
+
const [incr] = await this.pipeline([
|
|
1848
|
+
["INCR", redisKey],
|
|
1849
|
+
["EXPIRE", redisKey, String(ttlSeconds), "NX"]
|
|
1850
|
+
]);
|
|
1851
|
+
const current = toCount(incr);
|
|
1852
|
+
return { allowed: current <= max, current, resetAt: windowStart + windowMs };
|
|
1853
|
+
}
|
|
1854
|
+
/**
|
|
1855
|
+
* Sliding window: a sorted set of request timestamps, trimmed on every read.
|
|
1856
|
+
*
|
|
1857
|
+
* The member is timestamp plus random bytes because two requests in the same
|
|
1858
|
+
* millisecond would otherwise be one ZADD that overwrites rather than two that
|
|
1859
|
+
* count — undercounting exactly when the limit matters.
|
|
1860
|
+
*/
|
|
1861
|
+
async sliding({ key, max, windowMs }) {
|
|
1862
|
+
const now = Date.now();
|
|
1863
|
+
const redisKey = `${this.prefix}s:${key}`;
|
|
1864
|
+
const cutoff = now - windowMs;
|
|
1865
|
+
const ttlSeconds = Math.ceil(windowMs / 1e3) + 1;
|
|
1866
|
+
const results = await this.pipeline([
|
|
1867
|
+
["ZREMRANGEBYSCORE", redisKey, "0", String(cutoff)],
|
|
1868
|
+
["ZADD", redisKey, String(now), `${now}-${randomHex(4)}`],
|
|
1869
|
+
["ZCARD", redisKey],
|
|
1870
|
+
["EXPIRE", redisKey, String(ttlSeconds)]
|
|
1871
|
+
]);
|
|
1872
|
+
const current = toCount(results[2]);
|
|
1873
|
+
return { allowed: current <= max, current, resetAt: now + windowMs };
|
|
1874
|
+
}
|
|
1875
|
+
async pipeline(commands) {
|
|
1876
|
+
const controller = new AbortController();
|
|
1877
|
+
const timer = setTimeout(() => controller.abort(), this.timeout);
|
|
1878
|
+
try {
|
|
1879
|
+
const response = await fetch(`${this.url}/pipeline`, {
|
|
1880
|
+
method: "POST",
|
|
1881
|
+
headers: {
|
|
1882
|
+
Authorization: `Bearer ${this.token}`,
|
|
1883
|
+
"Content-Type": "application/json"
|
|
1884
|
+
},
|
|
1885
|
+
body: JSON.stringify(commands),
|
|
1886
|
+
signal: controller.signal
|
|
1887
|
+
});
|
|
1888
|
+
if (!response.ok) {
|
|
1889
|
+
throw new Error(`Upstash responded ${response.status}`);
|
|
1890
|
+
}
|
|
1891
|
+
const body = await response.json();
|
|
1892
|
+
if (!Array.isArray(body)) throw new Error("Upstash returned a non-pipeline body");
|
|
1893
|
+
for (const entry of body) {
|
|
1894
|
+
if (entry?.error) throw new Error(`Upstash command failed: ${entry.error}`);
|
|
1895
|
+
}
|
|
1896
|
+
return body.map((entry) => entry?.result);
|
|
1897
|
+
} finally {
|
|
1898
|
+
clearTimeout(timer);
|
|
1899
|
+
}
|
|
1900
|
+
}
|
|
1901
|
+
};
|
|
1902
|
+
function toCount(value) {
|
|
1903
|
+
const n = typeof value === "string" ? Number(value) : value;
|
|
1904
|
+
return typeof n === "number" && Number.isFinite(n) ? n : 0;
|
|
1905
|
+
}
|
|
1906
|
+
function upstashRateLimitStore(options) {
|
|
1907
|
+
return new UpstashRateLimitStore(options);
|
|
1908
|
+
}
|
|
1909
|
+
|
|
1910
|
+
// src/rules/honeytoken-site.ts
|
|
1911
|
+
var HONEYTOKEN_BASE_PATH = "/__wd";
|
|
1912
|
+
var TOKEN_LEN = 12;
|
|
1913
|
+
function utcDay(offsetDays = 0) {
|
|
1914
|
+
const d = new Date(Date.now() + offsetDays * 864e5);
|
|
1915
|
+
return d.toISOString().slice(0, 10);
|
|
1916
|
+
}
|
|
1917
|
+
function escapeHtml(v) {
|
|
1918
|
+
return v.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """);
|
|
1919
|
+
}
|
|
1920
|
+
function linkFor(path, text) {
|
|
1921
|
+
text = escapeHtml(text);
|
|
1922
|
+
return `<a href="${path}" aria-hidden="true" tabindex="-1" rel="nofollow noindex" style="position:absolute;left:-9999px;top:auto;width:1px;height:1px;overflow:hidden">${text}</a>`;
|
|
1923
|
+
}
|
|
1924
|
+
var HIDDEN_STYLE = {
|
|
1925
|
+
position: "absolute",
|
|
1926
|
+
left: "-9999px",
|
|
1927
|
+
top: "auto",
|
|
1928
|
+
width: "1px",
|
|
1929
|
+
height: "1px",
|
|
1930
|
+
overflow: "hidden"
|
|
1931
|
+
};
|
|
1932
|
+
function propsFor(path, text) {
|
|
1933
|
+
return {
|
|
1934
|
+
href: path,
|
|
1935
|
+
rel: "nofollow noindex",
|
|
1936
|
+
tabIndex: -1,
|
|
1937
|
+
"aria-hidden": "true",
|
|
1938
|
+
style: HIDDEN_STYLE,
|
|
1939
|
+
text
|
|
1940
|
+
};
|
|
1941
|
+
}
|
|
1942
|
+
async function siteHoneytoken(options) {
|
|
1943
|
+
const base = (options.basePath ?? HONEYTOKEN_BASE_PATH).replace(/\/+$/, "");
|
|
1944
|
+
const text = options.text ?? ".";
|
|
1945
|
+
const derive = async (label) => `${base}/${(await hmacSha256Hex(options.secret, label)).slice(0, TOKEN_LEN)}`;
|
|
1946
|
+
if (!options.rotate) {
|
|
1947
|
+
const path = await derive("stable");
|
|
1948
|
+
return {
|
|
1949
|
+
primaryPath: path,
|
|
1950
|
+
activePaths: [path],
|
|
1951
|
+
linkHtml: linkFor(path, text),
|
|
1952
|
+
linkProps: propsFor(path, text)
|
|
1953
|
+
};
|
|
1954
|
+
}
|
|
1955
|
+
const today = await derive(`day:${utcDay(0)}`);
|
|
1956
|
+
const yesterday = await derive(`day:${utcDay(-1)}`);
|
|
1957
|
+
return {
|
|
1958
|
+
primaryPath: today,
|
|
1959
|
+
// Yesterday stays armed so a crawler that read the page before midnight and
|
|
1960
|
+
// follows the link after it still trips.
|
|
1961
|
+
activePaths: Array.from(/* @__PURE__ */ new Set([today, yesterday])),
|
|
1962
|
+
linkHtml: linkFor(today, text),
|
|
1963
|
+
linkProps: propsFor(today, text)
|
|
1964
|
+
};
|
|
1965
|
+
}
|
|
1966
|
+
function injectHoneytokenLink(html, linkHtml) {
|
|
1967
|
+
if (!html || html.includes(linkHtml)) return html;
|
|
1968
|
+
const lower = html.toLowerCase();
|
|
1969
|
+
for (const close of ["</body>", "</html>"]) {
|
|
1970
|
+
const at = lower.lastIndexOf(close);
|
|
1971
|
+
if (at !== -1) {
|
|
1972
|
+
return html.slice(0, at) + linkHtml + html.slice(at);
|
|
1973
|
+
}
|
|
1974
|
+
}
|
|
1975
|
+
return html;
|
|
1976
|
+
}
|
|
1977
|
+
function isInjectableHtml(contentType) {
|
|
1978
|
+
if (!contentType) return false;
|
|
1979
|
+
return contentType.toLowerCase().split(";")[0].trim() === "text/html";
|
|
1980
|
+
}
|
|
1981
|
+
|
|
1982
|
+
// src/rules/index.ts
|
|
1983
|
+
function rateLimit(config) {
|
|
1984
|
+
return new RateLimitRule(config);
|
|
1985
|
+
}
|
|
1986
|
+
function filter(config) {
|
|
1987
|
+
return new FilterRule(config);
|
|
1988
|
+
}
|
|
1989
|
+
function tripwire(config = {}) {
|
|
1990
|
+
return new TripwireRule(config);
|
|
1991
|
+
}
|
|
1992
|
+
function bots(config = {}) {
|
|
1993
|
+
return new BotRule(config);
|
|
1994
|
+
}
|
|
1995
|
+
|
|
1996
|
+
// src/violation-reporter.ts
|
|
1997
|
+
var ViolationReporter = class {
|
|
1998
|
+
constructor(client, config = {}) {
|
|
1999
|
+
this.buffer = [];
|
|
2000
|
+
this.flushing = false;
|
|
2001
|
+
this.client = client;
|
|
2002
|
+
this.maxBufferSize = config.maxBufferSize ?? 50;
|
|
2003
|
+
this.debug = config.debug ?? false;
|
|
1355
2004
|
const flushInterval = config.flushInterval ?? 5e3;
|
|
1356
|
-
this.flushTimer = setInterval(() => this.flush(), flushInterval);
|
|
2005
|
+
this.flushTimer = setInterval(() => void this.flush(), flushInterval);
|
|
1357
2006
|
if (this.flushTimer.unref) {
|
|
1358
2007
|
this.flushTimer.unref();
|
|
1359
2008
|
}
|
|
@@ -2026,298 +2675,281 @@ function normalize(input) {
|
|
|
2026
2675
|
const headers = input.headers instanceof Headers ? input.headers : toHeaders(input.headers);
|
|
2027
2676
|
return { method: input.method, url: new URL(input.url), headers };
|
|
2028
2677
|
}
|
|
2029
|
-
function isRequest(input) {
|
|
2030
|
-
return typeof Request !== "undefined" && input instanceof Request && typeof input.url === "string";
|
|
2031
|
-
}
|
|
2032
|
-
function toHeaders(record) {
|
|
2033
|
-
const h = new Headers();
|
|
2034
|
-
for (const [k, v] of Object.entries(record)) {
|
|
2035
|
-
if (v !== void 0 && v !== null) h.set(k, String(v));
|
|
2036
|
-
}
|
|
2037
|
-
return h;
|
|
2038
|
-
}
|
|
2039
|
-
|
|
2040
|
-
// src/edge.ts
|
|
2041
|
-
var EDGE_CLEARANCE_HEADER = "x-wd-clearance";
|
|
2042
|
-
var EDGE_CLASS_HEADER = "x-wd-class";
|
|
2043
|
-
var EDGE_CLASSES = ["verified", "crawler", "script", "browser"];
|
|
2044
|
-
function absent() {
|
|
2045
|
-
return {
|
|
2046
|
-
present: false,
|
|
2047
|
-
isVerified: false,
|
|
2048
|
-
isCrawler: false,
|
|
2049
|
-
isScript: false,
|
|
2050
|
-
isBrowser: false,
|
|
2051
|
-
isUnattestedNonBrowser: false
|
|
2052
|
-
};
|
|
2053
|
-
}
|
|
2054
|
-
function normaliseClass(raw) {
|
|
2055
|
-
if (!raw) return void 0;
|
|
2056
|
-
const v = raw.trim().toLowerCase();
|
|
2057
|
-
return EDGE_CLASSES.includes(v) ? v : void 0;
|
|
2678
|
+
function isRequest(input) {
|
|
2679
|
+
return typeof Request !== "undefined" && input instanceof Request && typeof input.url === "string";
|
|
2058
2680
|
}
|
|
2059
|
-
function
|
|
2060
|
-
|
|
2061
|
-
|
|
2062
|
-
|
|
2063
|
-
for (const key of Object.keys(headers)) {
|
|
2064
|
-
const k = key.toLowerCase();
|
|
2065
|
-
if (k === EDGE_CLEARANCE_HEADER) clearanceRaw = headers[key];
|
|
2066
|
-
else if (k === EDGE_CLASS_HEADER) classRaw = headers[key];
|
|
2681
|
+
function toHeaders(record) {
|
|
2682
|
+
const h = new Headers();
|
|
2683
|
+
for (const [k, v] of Object.entries(record)) {
|
|
2684
|
+
if (v !== void 0 && v !== null) h.set(k, String(v));
|
|
2067
2685
|
}
|
|
2068
|
-
|
|
2069
|
-
const cls = normaliseClass(classRaw);
|
|
2070
|
-
if (!clearance && !cls) return absent();
|
|
2071
|
-
return {
|
|
2072
|
-
present: true,
|
|
2073
|
-
clearance,
|
|
2074
|
-
class: cls,
|
|
2075
|
-
isVerified: cls === "verified",
|
|
2076
|
-
isCrawler: cls === "crawler",
|
|
2077
|
-
isScript: cls === "script",
|
|
2078
|
-
isBrowser: cls === "browser",
|
|
2079
|
-
isUnattestedNonBrowser: cls === "script" || cls === "crawler"
|
|
2080
|
-
};
|
|
2686
|
+
return h;
|
|
2081
2687
|
}
|
|
2082
2688
|
|
|
2083
|
-
// src/
|
|
2084
|
-
var
|
|
2085
|
-
|
|
2086
|
-
|
|
2087
|
-
|
|
2088
|
-
|
|
2089
|
-
|
|
2090
|
-
|
|
2091
|
-
|
|
2092
|
-
|
|
2093
|
-
|
|
2094
|
-
|
|
2095
|
-
|
|
2096
|
-
|
|
2097
|
-
|
|
2098
|
-
|
|
2099
|
-
|
|
2100
|
-
|
|
2101
|
-
|
|
2102
|
-
|
|
2103
|
-
|
|
2104
|
-
|
|
2105
|
-
|
|
2106
|
-
|
|
2107
|
-
|
|
2108
|
-
|
|
2109
|
-
|
|
2110
|
-
{ id: "amazonbot", name: "Amazonbot", category: "training_crawler", organization: "Amazon", baseScore: 70, respectsRobots: true, uaPatterns: ["amazonbot"] },
|
|
2111
|
-
{ id: "facebookbot", name: "FacebookBot", category: "training_crawler", organization: "Meta", baseScore: 70, respectsRobots: true, uaPatterns: ["facebookbot"] },
|
|
2112
|
-
{ id: "meta-externalagent", name: "Meta-ExternalAgent", category: "training_crawler", organization: "Meta", baseScore: 75, respectsRobots: true, uaPatterns: ["meta-externalagent"] },
|
|
2113
|
-
{ id: "cohere-ai", name: "Cohere", category: "training_crawler", organization: "Cohere", baseScore: 80, respectsRobots: true, uaPatterns: ["cohere-ai", "cohere"] },
|
|
2114
|
-
{ id: "perplexitybot", name: "PerplexityBot", category: "training_crawler", organization: "Perplexity AI", baseScore: 80, respectsRobots: true, uaPatterns: ["perplexitybot"] },
|
|
2115
|
-
{ id: "applebot-extended", name: "Applebot-Extended", category: "training_crawler", organization: "Apple", baseScore: 75, respectsRobots: true, uaPatterns: ["applebot-extended"] },
|
|
2116
|
-
{ id: "youbot", name: "YouBot", category: "training_crawler", organization: "You.com", baseScore: 75, respectsRobots: true, uaPatterns: ["youbot"] },
|
|
2117
|
-
{ id: "mistral", name: "MistralBot", category: "training_crawler", organization: "Mistral AI", baseScore: 80, respectsRobots: true, uaPatterns: ["mistral"] },
|
|
2118
|
-
{ id: "gemini", name: "Gemini", category: "training_crawler", organization: "Google", baseScore: 80, respectsRobots: true, uaPatterns: ["gemini"] },
|
|
2119
|
-
{ id: "ai2bot", name: "AI2Bot", category: "training_crawler", organization: "Allen Institute for AI", baseScore: 75, respectsRobots: true, uaPatterns: ["ai2bot"] },
|
|
2120
|
-
{ id: "deepseek", name: "DeepSeek", category: "training_crawler", organization: "DeepSeek", baseScore: 80, respectsRobots: true, uaPatterns: ["deepseek"] },
|
|
2121
|
-
{ id: "qwen", name: "Qwen", category: "training_crawler", organization: "Alibaba", baseScore: 75, respectsRobots: true, uaPatterns: ["qwen"] },
|
|
2122
|
-
{ id: "webzio", name: "Webz.io", category: "training_crawler", organization: "Webz.io", baseScore: 70, respectsRobots: false, uaPatterns: ["webzio"] },
|
|
2123
|
-
{ id: "sentibot", name: "Sentibot", category: "training_crawler", organization: "Sentibot", baseScore: 70, respectsRobots: false, uaPatterns: ["sentibot"] },
|
|
2124
|
-
{ id: "omgili", name: "Omgili", category: "training_crawler", organization: "Webz.io", baseScore: 70, respectsRobots: false, uaPatterns: ["omgili"] },
|
|
2125
|
-
{ id: "img2dataset", name: "img2dataset", category: "training_crawler", organization: "LAION", baseScore: 75, respectsRobots: false, uaPatterns: ["img2dataset"] },
|
|
2126
|
-
{ id: "timpibot", name: "Timpibot", category: "training_crawler", organization: "Timpi", baseScore: 70, respectsRobots: true, uaPatterns: ["timpibot"] },
|
|
2127
|
-
{ id: "velenpublicwebcrawler", name: "VelenPublicWebCrawler", category: "training_crawler", organization: "Velen", baseScore: 70, respectsRobots: false, uaPatterns: ["velenpublicwebcrawler"] },
|
|
2128
|
-
{ id: "isscyberriskcrawler", name: "ISSCyberRiskCrawler", category: "training_crawler", organization: "ISS", baseScore: 65, respectsRobots: false, uaPatterns: ["isscyberriskcrawler"] },
|
|
2129
|
-
{ id: "friendlycrawler", name: "FriendlyCrawler", category: "training_crawler", organization: "Unknown", baseScore: 65, respectsRobots: true, uaPatterns: ["friendlycrawler"] },
|
|
2130
|
-
{ id: "searchgpt", name: "SearchGPT", category: "ai_search_crawler", organization: "OpenAI", baseScore: 75, respectsRobots: true, uaPatterns: ["searchgpt"] },
|
|
2131
|
-
{ id: "phind", name: "Phind", category: "ai_search_crawler", organization: "Phind", baseScore: 70, respectsRobots: true, uaPatterns: ["phind"] },
|
|
2132
|
-
{ id: "kagi", name: "Kagi", category: "ai_search_crawler", organization: "Kagi", baseScore: 65, respectsRobots: true, uaPatterns: ["kagi"] },
|
|
2133
|
-
{ id: "exa", name: "Exa", category: "ai_search_crawler", organization: "Exa AI", baseScore: 70, respectsRobots: true, uaPatterns: ["exa.ai", "exabot"] },
|
|
2134
|
-
{ id: "metaphor", name: "Metaphor", category: "ai_search_crawler", organization: "Metaphor", baseScore: 70, respectsRobots: true, uaPatterns: ["metaphor"] },
|
|
2135
|
-
{ id: "tavily", name: "Tavily", category: "ai_search_crawler", organization: "Tavily", baseScore: 70, respectsRobots: true, uaPatterns: ["tavily"] },
|
|
2136
|
-
{ id: "brave-search", name: "BraveSearch", category: "ai_search_crawler", organization: "Brave", baseScore: 65, respectsRobots: true, uaPatterns: ["bravesearch"] },
|
|
2137
|
-
{ id: "neeva", name: "NeevaBot", category: "ai_search_crawler", organization: "Neeva", baseScore: 65, respectsRobots: true, uaPatterns: ["neevabot"] },
|
|
2138
|
-
{ id: "operator", name: "Operator", category: "ai_agent", organization: "OpenAI", baseScore: 75, respectsRobots: true, uaPatterns: ["operator"] },
|
|
2139
|
-
{ id: "claude-user", name: "Claude-User", category: "ai_agent", organization: "Anthropic", baseScore: 75, respectsRobots: true, uaPatterns: ["claude-user"] },
|
|
2140
|
-
{ id: "gemini-user", name: "Gemini-User", category: "ai_agent", organization: "Google", baseScore: 75, respectsRobots: true, uaPatterns: ["gemini-user"] },
|
|
2141
|
-
{ id: "googleagent-mariner", name: "GoogleAgent-Mariner", category: "ai_agent", organization: "Google", baseScore: 75, respectsRobots: true, uaPatterns: ["googleagent-mariner", "mariner"] },
|
|
2142
|
-
{ id: "amazon-buyforme", name: "AmazonBuyForMe", category: "ai_agent", organization: "Amazon", baseScore: 70, respectsRobots: true, uaPatterns: ["amazonbuyforme", "buyforme"] },
|
|
2143
|
-
{ id: "browser-use", name: "Browser-Use", category: "ai_agent", organization: "Open Source", baseScore: 70, respectsRobots: false, uaPatterns: ["browser-use"] },
|
|
2144
|
-
{ id: "stagehand", name: "Stagehand", category: "ai_agent", organization: "Browserbase", baseScore: 70, respectsRobots: false, uaPatterns: ["stagehand"] },
|
|
2145
|
-
{ id: "multion", name: "MultiOn", category: "ai_agent", organization: "MultiOn", baseScore: 70, respectsRobots: false, uaPatterns: ["multion"] },
|
|
2146
|
-
{ id: "googlebot", name: "Googlebot", category: "search_crawler", organization: "Google", baseScore: 30, respectsRobots: true, uaPatterns: ["googlebot"] },
|
|
2147
|
-
{ id: "bingbot", name: "Bingbot", category: "search_crawler", organization: "Microsoft", baseScore: 30, respectsRobots: true, uaPatterns: ["bingbot"] },
|
|
2148
|
-
{ id: "yandexbot", name: "YandexBot", category: "search_crawler", organization: "Yandex", baseScore: 35, respectsRobots: true, uaPatterns: ["yandexbot"] },
|
|
2149
|
-
{ id: "baiduspider", name: "Baiduspider", category: "search_crawler", organization: "Baidu", baseScore: 40, respectsRobots: true, uaPatterns: ["baiduspider"] },
|
|
2150
|
-
{ id: "duckduckbot", name: "DuckDuckBot", category: "search_crawler", organization: "DuckDuckGo", baseScore: 30, respectsRobots: true, uaPatterns: ["duckduckbot"] },
|
|
2151
|
-
{ id: "applebot", name: "Applebot", category: "search_crawler", organization: "Apple", baseScore: 30, respectsRobots: true, uaPatterns: ["applebot"] },
|
|
2152
|
-
{ id: "sogou", name: "Sogou Spider", category: "search_crawler", organization: "Sogou", baseScore: 40, respectsRobots: true, uaPatterns: ["sogou"] },
|
|
2153
|
-
{ id: "qwantify", name: "Qwantify", category: "search_crawler", organization: "Qwant", baseScore: 35, respectsRobots: true, uaPatterns: ["qwantify"] },
|
|
2154
|
-
{ id: "naver", name: "Naver", category: "search_crawler", organization: "Naver", baseScore: 35, respectsRobots: true, uaPatterns: ["naver", "yeti"] },
|
|
2155
|
-
{ id: "seznam", name: "SeznamBot", category: "search_crawler", organization: "Seznam", baseScore: 35, respectsRobots: true, uaPatterns: ["seznambot"] },
|
|
2156
|
-
{ id: "ecosia", name: "Ecosia", category: "search_crawler", organization: "Ecosia", baseScore: 30, respectsRobots: true, uaPatterns: ["ecosia"] },
|
|
2157
|
-
{ id: "mojeek", name: "MojeekBot", category: "search_crawler", organization: "Mojeek", baseScore: 35, respectsRobots: true, uaPatterns: ["mojeekbot"] },
|
|
2158
|
-
{ id: "yahoo-slurp", name: "Yahoo! Slurp", category: "search_crawler", organization: "Yahoo", baseScore: 30, respectsRobots: true, uaPatterns: ["slurp"] },
|
|
2159
|
-
{ id: "ahrefsbot", name: "AhrefsBot", category: "seo_crawler", organization: "Ahrefs", baseScore: 50, respectsRobots: true, uaPatterns: ["ahrefsbot", "ahrefs"] },
|
|
2160
|
-
{ id: "semrushbot", name: "SemrushBot", category: "seo_crawler", organization: "Semrush", baseScore: 50, respectsRobots: true, uaPatterns: ["semrushbot", "semrush"] },
|
|
2161
|
-
{ id: "mj12bot", name: "MJ12bot", category: "seo_crawler", organization: "Majestic", baseScore: 50, respectsRobots: true, uaPatterns: ["mj12bot"] },
|
|
2162
|
-
{ id: "dotbot", name: "DotBot", category: "seo_crawler", organization: "Moz", baseScore: 50, respectsRobots: true, uaPatterns: ["dotbot"] },
|
|
2163
|
-
{ id: "rogerbot", name: "Rogerbot", category: "seo_crawler", organization: "Moz", baseScore: 50, respectsRobots: true, uaPatterns: ["rogerbot"] },
|
|
2164
|
-
{ id: "screaming-frog", name: "Screaming Frog", category: "seo_crawler", organization: "Screaming Frog", baseScore: 55, respectsRobots: true, uaPatterns: ["screaming frog"] },
|
|
2165
|
-
{ id: "sitebulb", name: "Sitebulb", category: "seo_crawler", organization: "Sitebulb", baseScore: 55, respectsRobots: true, uaPatterns: ["sitebulb"] },
|
|
2166
|
-
{ id: "deepcrawl", name: "DeepCrawl", category: "seo_crawler", organization: "Lumar", baseScore: 50, respectsRobots: true, uaPatterns: ["deepcrawl"] },
|
|
2167
|
-
{ id: "oncrawl", name: "OnCrawl", category: "seo_crawler", organization: "OnCrawl", baseScore: 50, respectsRobots: true, uaPatterns: ["oncrawl"] },
|
|
2168
|
-
{ id: "botify", name: "Botify", category: "seo_crawler", organization: "Botify", baseScore: 50, respectsRobots: true, uaPatterns: ["botify"] },
|
|
2169
|
-
{ id: "contentking", name: "ContentKing", category: "seo_crawler", organization: "ContentKing", baseScore: 50, respectsRobots: true, uaPatterns: ["contentking"] },
|
|
2170
|
-
{ id: "sistrix", name: "SISTRIX", category: "seo_crawler", organization: "SISTRIX", baseScore: 50, respectsRobots: true, uaPatterns: ["sistrix"] },
|
|
2171
|
-
{ id: "serpstat", name: "Serpstat", category: "seo_crawler", organization: "Serpstat", baseScore: 50, respectsRobots: true, uaPatterns: ["serpstat"] },
|
|
2172
|
-
{ id: "spyfu", name: "SpyFu", category: "seo_crawler", organization: "SpyFu", baseScore: 50, respectsRobots: true, uaPatterns: ["spyfu"] },
|
|
2173
|
-
{ id: "nessus", name: "Nessus", category: "security_scanner", organization: "Tenable", baseScore: 70, respectsRobots: false, uaPatterns: ["nessus"] },
|
|
2174
|
-
{ id: "qualys", name: "Qualys", category: "security_scanner", organization: "Qualys", baseScore: 70, respectsRobots: false, uaPatterns: ["qualys"] },
|
|
2175
|
-
{ id: "shodan", name: "Shodan", category: "security_scanner", organization: "Shodan", baseScore: 75, respectsRobots: false, uaPatterns: ["shodan"] },
|
|
2176
|
-
{ id: "censys", name: "Censys", category: "security_scanner", organization: "Censys", baseScore: 75, respectsRobots: false, uaPatterns: ["censys"] },
|
|
2177
|
-
{ id: "nmap", name: "Nmap", category: "security_scanner", organization: "Open Source", baseScore: 70, respectsRobots: false, uaPatterns: ["nmap"] },
|
|
2178
|
-
{ id: "zap", name: "OWASP ZAP", category: "security_scanner", organization: "OWASP", baseScore: 70, respectsRobots: false, uaPatterns: ["zap/"] },
|
|
2179
|
-
{ id: "burp", name: "Burp Suite", category: "security_scanner", organization: "PortSwigger", baseScore: 70, respectsRobots: false, uaPatterns: ["burp"] },
|
|
2180
|
-
{ id: "nikto", name: "Nikto", category: "security_scanner", organization: "Open Source", baseScore: 70, respectsRobots: false, uaPatterns: ["nikto"] },
|
|
2181
|
-
{ id: "nuclei", name: "Nuclei", category: "security_scanner", organization: "ProjectDiscovery", baseScore: 70, respectsRobots: false, uaPatterns: ["nuclei"] },
|
|
2182
|
-
{ id: "acunetix", name: "Acunetix", category: "security_scanner", organization: "Invicti", baseScore: 70, respectsRobots: false, uaPatterns: ["acunetix"] },
|
|
2183
|
-
{ id: "netsparker", name: "Netsparker", category: "security_scanner", organization: "Invicti", baseScore: 70, respectsRobots: false, uaPatterns: ["netsparker"] },
|
|
2184
|
-
{ id: "detectify", name: "Detectify", category: "security_scanner", organization: "Detectify", baseScore: 65, respectsRobots: false, uaPatterns: ["detectify"] },
|
|
2185
|
-
{ id: "intruder", name: "Intruder", category: "security_scanner", organization: "Intruder", baseScore: 65, respectsRobots: false, uaPatterns: ["intruder"] },
|
|
2186
|
-
{ id: "python-requests", name: "Python-Requests", category: "generic_scraper", organization: "Open Source", baseScore: 55, respectsRobots: false, uaPatterns: ["python-requests"] },
|
|
2187
|
-
{ id: "python-urllib", name: "Python-urllib", category: "generic_scraper", organization: "Python", baseScore: 55, respectsRobots: false, uaPatterns: ["python-urllib"] },
|
|
2188
|
-
{ id: "python", name: "Python", category: "generic_scraper", organization: "Python", baseScore: 50, respectsRobots: false, uaPatterns: ["python/"] },
|
|
2189
|
-
{ id: "scrapy", name: "Scrapy", category: "generic_scraper", organization: "Scrapy", baseScore: 65, respectsRobots: true, uaPatterns: ["scrapy"] },
|
|
2190
|
-
{ id: "httpx", name: "HTTPX", category: "generic_scraper", organization: "Open Source", baseScore: 55, respectsRobots: false, uaPatterns: ["httpx"] },
|
|
2191
|
-
{ id: "aiohttp", name: "aiohttp", category: "generic_scraper", organization: "Open Source", baseScore: 55, respectsRobots: false, uaPatterns: ["aiohttp"] },
|
|
2192
|
-
{ id: "beautifulsoup", name: "BeautifulSoup", category: "generic_scraper", organization: "Open Source", baseScore: 60, respectsRobots: false, uaPatterns: ["beautifulsoup"] },
|
|
2193
|
-
{ id: "node-fetch", name: "node-fetch", category: "generic_scraper", organization: "Open Source", baseScore: 55, respectsRobots: false, uaPatterns: ["node-fetch"] },
|
|
2194
|
-
{ id: "axios", name: "Axios", category: "generic_scraper", organization: "Open Source", baseScore: 55, respectsRobots: false, uaPatterns: ["axios/"] },
|
|
2195
|
-
{ id: "got", name: "Got", category: "generic_scraper", organization: "Open Source", baseScore: 55, respectsRobots: false, uaPatterns: ["got/"] },
|
|
2196
|
-
{ id: "undici", name: "Undici", category: "generic_scraper", organization: "Node.js", baseScore: 55, respectsRobots: false, uaPatterns: ["undici"] },
|
|
2197
|
-
{ id: "go-http-client", name: "Go-HTTP-Client", category: "generic_scraper", organization: "Go", baseScore: 55, respectsRobots: false, uaPatterns: ["go-http-client"] },
|
|
2198
|
-
{ id: "colly", name: "Colly", category: "generic_scraper", organization: "Open Source", baseScore: 65, respectsRobots: true, uaPatterns: ["colly"] },
|
|
2199
|
-
{ id: "java", name: "Java", category: "generic_scraper", organization: "Oracle", baseScore: 50, respectsRobots: false, uaPatterns: ["java/"] },
|
|
2200
|
-
{ id: "okhttp", name: "OkHttp", category: "generic_scraper", organization: "Square", baseScore: 55, respectsRobots: false, uaPatterns: ["okhttp"] },
|
|
2201
|
-
{ id: "apache-httpclient", name: "Apache-HttpClient", category: "generic_scraper", organization: "Apache", baseScore: 55, respectsRobots: false, uaPatterns: ["apache-httpclient"] },
|
|
2202
|
-
{ id: "jsoup", name: "Jsoup", category: "generic_scraper", organization: "Open Source", baseScore: 60, respectsRobots: false, uaPatterns: ["jsoup"] },
|
|
2203
|
-
{ id: "guzzlehttp", name: "GuzzleHttp", category: "generic_scraper", organization: "Open Source", baseScore: 55, respectsRobots: false, uaPatterns: ["guzzlehttp"] },
|
|
2204
|
-
{ id: "php", name: "PHP", category: "generic_scraper", organization: "PHP", baseScore: 50, respectsRobots: false, uaPatterns: ["php/"] },
|
|
2205
|
-
{ id: "ruby", name: "Ruby", category: "generic_scraper", organization: "Ruby", baseScore: 50, respectsRobots: false, uaPatterns: ["ruby"] },
|
|
2206
|
-
{ id: "faraday", name: "Faraday", category: "generic_scraper", organization: "Open Source", baseScore: 55, respectsRobots: false, uaPatterns: ["faraday"] },
|
|
2207
|
-
{ id: "mechanize", name: "Mechanize", category: "generic_scraper", organization: "Open Source", baseScore: 60, respectsRobots: false, uaPatterns: ["mechanize"] },
|
|
2208
|
-
{ id: "headlesschrome", name: "HeadlessChrome", category: "headless_browser", organization: "Google", baseScore: 70, respectsRobots: false, uaPatterns: ["headlesschrome"] },
|
|
2209
|
-
{ id: "puppeteer", name: "Puppeteer", category: "headless_browser", organization: "Google", baseScore: 70, respectsRobots: false, uaPatterns: ["puppeteer"] },
|
|
2210
|
-
{ id: "playwright", name: "Playwright", category: "headless_browser", organization: "Microsoft", baseScore: 70, respectsRobots: false, uaPatterns: ["playwright"] },
|
|
2211
|
-
{ id: "selenium", name: "Selenium", category: "headless_browser", organization: "Open Source", baseScore: 70, respectsRobots: false, uaPatterns: ["selenium"] },
|
|
2212
|
-
{ id: "phantomjs", name: "PhantomJS", category: "headless_browser", organization: "Open Source", baseScore: 75, respectsRobots: false, uaPatterns: ["phantomjs"] },
|
|
2213
|
-
{ id: "splash", name: "Splash", category: "headless_browser", organization: "Scrapinghub", baseScore: 70, respectsRobots: false, uaPatterns: ["splash"] },
|
|
2214
|
-
{ id: "browserless", name: "Browserless", category: "headless_browser", organization: "Browserless", baseScore: 65, respectsRobots: false, uaPatterns: ["browserless"] },
|
|
2215
|
-
{ id: "browserbase", name: "Browserbase", category: "headless_browser", organization: "Browserbase", baseScore: 65, respectsRobots: false, uaPatterns: ["browserbase"] },
|
|
2216
|
-
{ id: "ia-archiver", name: "Internet Archive", category: "archiver", organization: "Internet Archive", baseScore: 25, respectsRobots: true, uaPatterns: ["ia_archiver"] },
|
|
2217
|
-
{ id: "archive-org-bot", name: "Archive.org", category: "archiver", organization: "Internet Archive", baseScore: 25, respectsRobots: true, uaPatterns: ["archive.org_bot"] },
|
|
2218
|
-
{ id: "wayback", name: "Wayback Machine", category: "archiver", organization: "Internet Archive", baseScore: 25, respectsRobots: true, uaPatterns: ["wayback"] },
|
|
2219
|
-
{ id: "heritrix", name: "Heritrix", category: "archiver", organization: "Internet Archive", baseScore: 30, respectsRobots: true, uaPatterns: ["heritrix"] },
|
|
2220
|
-
{ id: "brozzler", name: "Brozzler", category: "archiver", organization: "Internet Archive", baseScore: 30, respectsRobots: true, uaPatterns: ["brozzler"] },
|
|
2221
|
-
{ id: "facebookexternalhit", name: "Facebook", category: "fetcher", organization: "Meta", baseScore: 25, respectsRobots: true, uaPatterns: ["facebookexternalhit"] },
|
|
2222
|
-
{ id: "twitterbot", name: "Twitterbot", category: "fetcher", organization: "X Corp", baseScore: 25, respectsRobots: true, uaPatterns: ["twitterbot"] },
|
|
2223
|
-
{ id: "linkedinbot", name: "LinkedInBot", category: "fetcher", organization: "LinkedIn", baseScore: 25, respectsRobots: true, uaPatterns: ["linkedinbot"] },
|
|
2224
|
-
{ id: "slackbot", name: "Slackbot", category: "fetcher", organization: "Slack", baseScore: 25, respectsRobots: true, uaPatterns: ["slackbot"] },
|
|
2225
|
-
{ id: "telegrambot", name: "TelegramBot", category: "fetcher", organization: "Telegram", baseScore: 25, respectsRobots: true, uaPatterns: ["telegrambot"] },
|
|
2226
|
-
{ id: "whatsapp", name: "WhatsApp", category: "fetcher", organization: "Meta", baseScore: 25, respectsRobots: true, uaPatterns: ["whatsapp"] },
|
|
2227
|
-
{ id: "discordbot", name: "Discordbot", category: "fetcher", organization: "Discord", baseScore: 25, respectsRobots: true, uaPatterns: ["discordbot"] },
|
|
2228
|
-
{ id: "pinterestbot", name: "Pinterest", category: "fetcher", organization: "Pinterest", baseScore: 30, respectsRobots: true, uaPatterns: ["pinterest"] },
|
|
2229
|
-
{ id: "tumblr", name: "Tumblr", category: "fetcher", organization: "Automattic", baseScore: 30, respectsRobots: true, uaPatterns: ["tumblr"] },
|
|
2230
|
-
{ id: "reddit", name: "Reddit", category: "fetcher", organization: "Reddit", baseScore: 30, respectsRobots: true, uaPatterns: ["reddit"] },
|
|
2231
|
-
{ id: "embedly", name: "Embedly", category: "fetcher", organization: "Medium", baseScore: 30, respectsRobots: true, uaPatterns: ["embedly"] },
|
|
2232
|
-
{ id: "iframely", name: "Iframely", category: "fetcher", organization: "Iframely", baseScore: 30, respectsRobots: true, uaPatterns: ["iframely"] },
|
|
2233
|
-
{ id: "curl", name: "cURL", category: "fetcher", organization: "Open Source", baseScore: 45, respectsRobots: false, uaPatterns: ["curl/"] },
|
|
2234
|
-
{ id: "wget", name: "Wget", category: "fetcher", organization: "GNU", baseScore: 45, respectsRobots: false, uaPatterns: ["wget/"] },
|
|
2235
|
-
{ id: "libwww-perl", name: "libwww-perl", category: "fetcher", organization: "Perl", baseScore: 50, respectsRobots: false, uaPatterns: ["libwww-perl"] },
|
|
2236
|
-
{ id: "lwp", name: "LWP", category: "fetcher", organization: "Perl", baseScore: 50, respectsRobots: false, uaPatterns: ["lwp-"] },
|
|
2237
|
-
{ id: "httrack", name: "HTTrack", category: "fetcher", organization: "Open Source", baseScore: 60, respectsRobots: true, uaPatterns: ["httrack"] },
|
|
2238
|
-
{ id: "webdecoybot", name: "WebDecoyBot", category: "monitoring", organization: "WebDecoy", baseScore: 5, respectsRobots: true, uaPatterns: ["webdecoybot"] },
|
|
2239
|
-
{ id: "uptimerobot", name: "UptimeRobot", category: "monitoring", organization: "UptimeRobot", baseScore: 20, respectsRobots: true, uaPatterns: ["uptimerobot"] },
|
|
2240
|
-
{ id: "pingdom", name: "Pingdom", category: "monitoring", organization: "SolarWinds", baseScore: 20, respectsRobots: true, uaPatterns: ["pingdom"] },
|
|
2241
|
-
{ id: "statuscake", name: "StatusCake", category: "monitoring", organization: "StatusCake", baseScore: 20, respectsRobots: true, uaPatterns: ["statuscake"] },
|
|
2242
|
-
{ id: "better-uptime", name: "Better Uptime", category: "monitoring", organization: "Better Stack", baseScore: 20, respectsRobots: true, uaPatterns: ["betteruptime"] },
|
|
2243
|
-
{ id: "datadog-synthetics", name: "Datadog Synthetics", category: "monitoring", organization: "Datadog", baseScore: 25, respectsRobots: true, uaPatterns: ["datadog"] },
|
|
2244
|
-
{ id: "newrelic", name: "New Relic", category: "monitoring", organization: "New Relic", baseScore: 25, respectsRobots: true, uaPatterns: ["newrelic"] },
|
|
2245
|
-
{ id: "site24x7", name: "Site24x7", category: "monitoring", organization: "Zoho", baseScore: 20, respectsRobots: true, uaPatterns: ["site24x7"] },
|
|
2246
|
-
{ id: "freshping", name: "Freshping", category: "monitoring", organization: "Freshworks", baseScore: 20, respectsRobots: true, uaPatterns: ["freshping"] },
|
|
2247
|
-
{ id: "hetrixtools", name: "HetrixTools", category: "monitoring", organization: "HetrixTools", baseScore: 20, respectsRobots: true, uaPatterns: ["hetrixtools"] },
|
|
2248
|
-
{ id: "nodeping", name: "NodePing", category: "monitoring", organization: "NodePing", baseScore: 20, respectsRobots: true, uaPatterns: ["nodeping"] },
|
|
2249
|
-
{ id: "feedly", name: "Feedly", category: "feed_reader", organization: "Feedly", baseScore: 25, respectsRobots: true, uaPatterns: ["feedly"] },
|
|
2250
|
-
{ id: "newsblur", name: "NewsBlur", category: "feed_reader", organization: "NewsBlur", baseScore: 25, respectsRobots: true, uaPatterns: ["newsblur"] },
|
|
2251
|
-
{ id: "inoreader", name: "Inoreader", category: "feed_reader", organization: "Inoreader", baseScore: 25, respectsRobots: true, uaPatterns: ["inoreader"] },
|
|
2252
|
-
{ id: "theoldreader", name: "The Old Reader", category: "feed_reader", organization: "The Old Reader", baseScore: 25, respectsRobots: true, uaPatterns: ["theoldreader"] },
|
|
2253
|
-
{ id: "feedbin", name: "Feedbin", category: "feed_reader", organization: "Feedbin", baseScore: 25, respectsRobots: true, uaPatterns: ["feedbin"] },
|
|
2254
|
-
{ id: "miniflux", name: "Miniflux", category: "feed_reader", organization: "Open Source", baseScore: 25, respectsRobots: true, uaPatterns: ["miniflux"] },
|
|
2255
|
-
{ id: "freshrss", name: "FreshRSS", category: "feed_reader", organization: "Open Source", baseScore: 25, respectsRobots: true, uaPatterns: ["freshrss"] },
|
|
2256
|
-
{ id: "commafeed", name: "CommaFeed", category: "feed_reader", organization: "Open Source", baseScore: 25, respectsRobots: true, uaPatterns: ["commafeed"] },
|
|
2257
|
-
{ id: "diffbot", name: "Diffbot", category: "commercial_scraper", organization: "Diffbot", baseScore: 70, respectsRobots: true, uaPatterns: ["diffbot"] },
|
|
2258
|
-
{ id: "import-io", name: "Import.io", category: "commercial_scraper", organization: "Import.io", baseScore: 65, respectsRobots: true, uaPatterns: ["import.io"] },
|
|
2259
|
-
{ id: "bright-data", name: "Bright Data", category: "commercial_scraper", organization: "Bright Data", baseScore: 70, respectsRobots: false, uaPatterns: ["brightdata", "luminati"] },
|
|
2260
|
-
{ id: "oxylabs", name: "Oxylabs", category: "commercial_scraper", organization: "Oxylabs", baseScore: 70, respectsRobots: false, uaPatterns: ["oxylabs"] },
|
|
2261
|
-
{ id: "scrapingbee", name: "ScrapingBee", category: "commercial_scraper", organization: "ScrapingBee", baseScore: 65, respectsRobots: true, uaPatterns: ["scrapingbee"] },
|
|
2262
|
-
{ id: "scrapingant", name: "ScrapingAnt", category: "commercial_scraper", organization: "ScrapingAnt", baseScore: 65, respectsRobots: true, uaPatterns: ["scrapingant"] },
|
|
2263
|
-
{ id: "zyte", name: "Zyte", category: "commercial_scraper", organization: "Zyte", baseScore: 65, respectsRobots: true, uaPatterns: ["zyte", "scrapinghub"] },
|
|
2264
|
-
{ id: "apify", name: "Apify", category: "commercial_scraper", organization: "Apify", baseScore: 65, respectsRobots: true, uaPatterns: ["apify"] },
|
|
2265
|
-
{ id: "crawlbase", name: "Crawlbase", category: "commercial_scraper", organization: "Crawlbase", baseScore: 65, respectsRobots: true, uaPatterns: ["crawlbase"] },
|
|
2266
|
-
{ id: "webscrapingapi", name: "WebScrapingAPI", category: "commercial_scraper", organization: "WebScrapingAPI", baseScore: 65, respectsRobots: true, uaPatterns: ["webscrapingapi"] },
|
|
2267
|
-
{ id: "gemini-deep-research", name: "Gemini-Deep-Research", category: "ai_assistant", organization: "Google", baseScore: 65, respectsRobots: true, uaPatterns: ["gemini-deep-research"] },
|
|
2268
|
-
{ id: "copilot", name: "Microsoft Copilot", category: "ai_assistant", organization: "Microsoft", baseScore: 65, respectsRobots: true, uaPatterns: ["copilot"] },
|
|
2269
|
-
{ id: "cortana", name: "Cortana", category: "ai_assistant", organization: "Microsoft", baseScore: 60, respectsRobots: true, uaPatterns: ["cortana"] },
|
|
2270
|
-
{ id: "siri", name: "Siri", category: "ai_assistant", organization: "Apple", baseScore: 60, respectsRobots: true, uaPatterns: ["siri"] }
|
|
2271
|
-
];
|
|
2272
|
-
|
|
2273
|
-
// src/bots/index.ts
|
|
2274
|
-
var AI_CATEGORIES = /* @__PURE__ */ new Set([
|
|
2275
|
-
"training_crawler",
|
|
2276
|
-
"ai_search_crawler",
|
|
2277
|
-
"ai_agent",
|
|
2278
|
-
"ai_assistant"
|
|
2279
|
-
]);
|
|
2280
|
-
var UNKNOWN = Object.freeze({
|
|
2281
|
-
known: false,
|
|
2282
|
-
category: "none",
|
|
2283
|
-
score: 0,
|
|
2284
|
-
isAI: false
|
|
2285
|
-
});
|
|
2286
|
-
var MAX_CACHE = 1e3;
|
|
2287
|
-
var cache = /* @__PURE__ */ new Map();
|
|
2288
|
-
function matchUserAgent(userAgent) {
|
|
2289
|
-
if (!userAgent) return void 0;
|
|
2290
|
-
const cached = cache.get(userAgent);
|
|
2291
|
-
if (cached !== void 0) return cached ?? void 0;
|
|
2292
|
-
const ua = userAgent.toLowerCase();
|
|
2293
|
-
let found = null;
|
|
2294
|
-
for (const agent of BOT_REGISTRY) {
|
|
2295
|
-
for (const pattern of agent.uaPatterns) {
|
|
2296
|
-
if (ua.includes(pattern)) {
|
|
2297
|
-
found = agent;
|
|
2298
|
-
break;
|
|
2299
|
-
}
|
|
2300
|
-
}
|
|
2301
|
-
if (found) break;
|
|
2689
|
+
// src/edge.ts
|
|
2690
|
+
var EDGE_CLEARANCE_HEADER = "x-wd-clearance";
|
|
2691
|
+
var EDGE_CLASS_HEADER = "x-wd-class";
|
|
2692
|
+
var EDGE_CLASSES = ["verified", "crawler", "script", "browser"];
|
|
2693
|
+
function absent() {
|
|
2694
|
+
return {
|
|
2695
|
+
present: false,
|
|
2696
|
+
isVerified: false,
|
|
2697
|
+
isCrawler: false,
|
|
2698
|
+
isScript: false,
|
|
2699
|
+
isBrowser: false,
|
|
2700
|
+
isUnattestedNonBrowser: false
|
|
2701
|
+
};
|
|
2702
|
+
}
|
|
2703
|
+
function normaliseClass(raw) {
|
|
2704
|
+
if (!raw) return void 0;
|
|
2705
|
+
const v = raw.trim().toLowerCase();
|
|
2706
|
+
return EDGE_CLASSES.includes(v) ? v : void 0;
|
|
2707
|
+
}
|
|
2708
|
+
function readEdgeVerdict(headers) {
|
|
2709
|
+
if (!headers) return absent();
|
|
2710
|
+
let clearanceRaw;
|
|
2711
|
+
let classRaw;
|
|
2712
|
+
for (const key of Object.keys(headers)) {
|
|
2713
|
+
const k = key.toLowerCase();
|
|
2714
|
+
if (k === EDGE_CLEARANCE_HEADER) clearanceRaw = headers[key];
|
|
2715
|
+
else if (k === EDGE_CLASS_HEADER) classRaw = headers[key];
|
|
2302
2716
|
}
|
|
2303
|
-
|
|
2304
|
-
|
|
2305
|
-
|
|
2717
|
+
const clearance = clearanceRaw?.trim() || void 0;
|
|
2718
|
+
const cls = normaliseClass(classRaw);
|
|
2719
|
+
if (!clearance && !cls) return absent();
|
|
2720
|
+
return {
|
|
2721
|
+
present: true,
|
|
2722
|
+
clearance,
|
|
2723
|
+
class: cls,
|
|
2724
|
+
isVerified: cls === "verified",
|
|
2725
|
+
isCrawler: cls === "crawler",
|
|
2726
|
+
isScript: cls === "script",
|
|
2727
|
+
isBrowser: cls === "browser",
|
|
2728
|
+
isUnattestedNonBrowser: cls === "script" || cls === "crawler"
|
|
2729
|
+
};
|
|
2306
2730
|
}
|
|
2307
|
-
|
|
2308
|
-
|
|
2309
|
-
|
|
2731
|
+
|
|
2732
|
+
// src/logger.ts
|
|
2733
|
+
var PREFIX = "[WebDecoy]";
|
|
2734
|
+
function consoleLogger(debug) {
|
|
2735
|
+
const emit = (fn, gated) => (message, fields) => {
|
|
2736
|
+
if (gated && !debug) return;
|
|
2737
|
+
if (fields) fn(`${PREFIX} ${message}`, fields);
|
|
2738
|
+
else fn(`${PREFIX} ${message}`);
|
|
2739
|
+
};
|
|
2310
2740
|
return {
|
|
2311
|
-
|
|
2312
|
-
|
|
2313
|
-
|
|
2314
|
-
|
|
2315
|
-
|
|
2316
|
-
|
|
2317
|
-
|
|
2318
|
-
|
|
2741
|
+
debug: emit(console.log, true),
|
|
2742
|
+
info: emit(console.log, true),
|
|
2743
|
+
// Warnings and errors are not debug output. A violation that failed to
|
|
2744
|
+
// report, or a key that was rejected, is something the operator needs to
|
|
2745
|
+
// see whether or not they opted into diagnostics.
|
|
2746
|
+
warn: emit(console.warn, false),
|
|
2747
|
+
error: emit(console.error, false)
|
|
2748
|
+
};
|
|
2749
|
+
}
|
|
2750
|
+
var silentLogger = {
|
|
2751
|
+
debug() {
|
|
2752
|
+
},
|
|
2753
|
+
info() {
|
|
2754
|
+
},
|
|
2755
|
+
warn() {
|
|
2756
|
+
},
|
|
2757
|
+
error() {
|
|
2758
|
+
}
|
|
2759
|
+
};
|
|
2760
|
+
function fromPino(pino) {
|
|
2761
|
+
return {
|
|
2762
|
+
debug: (m, f) => pino.debug(f ?? {}, m),
|
|
2763
|
+
info: (m, f) => pino.info(f ?? {}, m),
|
|
2764
|
+
warn: (m, f) => pino.warn(f ?? {}, m),
|
|
2765
|
+
error: (m, f) => pino.error(f ?? {}, m)
|
|
2319
2766
|
};
|
|
2320
2767
|
}
|
|
2768
|
+
function resolveLogger(provided, debug) {
|
|
2769
|
+
return provided ?? consoleLogger(debug);
|
|
2770
|
+
}
|
|
2771
|
+
|
|
2772
|
+
// src/tracing.ts
|
|
2773
|
+
var STATUS_ERROR = 2;
|
|
2774
|
+
var NOOP_SPAN = {
|
|
2775
|
+
setAttribute: () => void 0,
|
|
2776
|
+
end: () => void 0
|
|
2777
|
+
};
|
|
2778
|
+
function startSpan(tracer, name) {
|
|
2779
|
+
if (!tracer) return NOOP_SPAN;
|
|
2780
|
+
try {
|
|
2781
|
+
return tracer.startSpan(name) ?? NOOP_SPAN;
|
|
2782
|
+
} catch {
|
|
2783
|
+
return NOOP_SPAN;
|
|
2784
|
+
}
|
|
2785
|
+
}
|
|
2786
|
+
function setAttribute(span, key, value) {
|
|
2787
|
+
try {
|
|
2788
|
+
span.setAttribute(key, value);
|
|
2789
|
+
} catch {
|
|
2790
|
+
}
|
|
2791
|
+
}
|
|
2792
|
+
function recordError(span, error) {
|
|
2793
|
+
try {
|
|
2794
|
+
span.recordException?.(error);
|
|
2795
|
+
span.setStatus?.({
|
|
2796
|
+
code: STATUS_ERROR,
|
|
2797
|
+
message: error instanceof Error ? error.message : String(error)
|
|
2798
|
+
});
|
|
2799
|
+
} catch {
|
|
2800
|
+
}
|
|
2801
|
+
}
|
|
2802
|
+
function endSpan(span) {
|
|
2803
|
+
try {
|
|
2804
|
+
span.end();
|
|
2805
|
+
} catch {
|
|
2806
|
+
}
|
|
2807
|
+
}
|
|
2808
|
+
|
|
2809
|
+
// src/decision.ts
|
|
2810
|
+
function newDecisionId() {
|
|
2811
|
+
return `dec_${randomHex(12)}`;
|
|
2812
|
+
}
|
|
2813
|
+
var Decision = class _Decision {
|
|
2814
|
+
constructor(init) {
|
|
2815
|
+
this.id = init.id ?? newDecisionId();
|
|
2816
|
+
this.conclusion = init.conclusion;
|
|
2817
|
+
this.results = Object.freeze([...init.results ?? []]);
|
|
2818
|
+
this.reason = init.reason;
|
|
2819
|
+
this.detection = init.detection;
|
|
2820
|
+
this.error = init.error;
|
|
2821
|
+
this.ruleResult = init.ruleResult;
|
|
2822
|
+
this.agent = init.agent;
|
|
2823
|
+
this.edge = init.edge;
|
|
2824
|
+
this.key = init.key;
|
|
2825
|
+
this.ttl = init.ttl ?? 0;
|
|
2826
|
+
}
|
|
2827
|
+
get allowed() {
|
|
2828
|
+
return this.conclusion === "ALLOW" || this.conclusion === "ERROR";
|
|
2829
|
+
}
|
|
2830
|
+
isAllowed() {
|
|
2831
|
+
return this.conclusion === "ALLOW";
|
|
2832
|
+
}
|
|
2833
|
+
isDenied() {
|
|
2834
|
+
return this.conclusion === "DENY";
|
|
2835
|
+
}
|
|
2836
|
+
isChallenged() {
|
|
2837
|
+
return this.conclusion === "CHALLENGE";
|
|
2838
|
+
}
|
|
2839
|
+
isErrored() {
|
|
2840
|
+
return this.conclusion === "ERROR";
|
|
2841
|
+
}
|
|
2842
|
+
deniedBy(rule) {
|
|
2843
|
+
return this.results.some(
|
|
2844
|
+
(r) => r.rule === rule && r.state === "RUN" && r.conclusion === "DENY"
|
|
2845
|
+
);
|
|
2846
|
+
}
|
|
2847
|
+
/** A copy of this decision with the edge verdict attached. */
|
|
2848
|
+
withEdge(edge) {
|
|
2849
|
+
return new _Decision({ ...this.init(), edge });
|
|
2850
|
+
}
|
|
2851
|
+
/** A copy marked as served from cache, with every rule re-stated as CACHED. */
|
|
2852
|
+
asCached() {
|
|
2853
|
+
return new _Decision({
|
|
2854
|
+
...this.init(),
|
|
2855
|
+
results: this.results.map((r) => ({ ...r, state: "CACHED" }))
|
|
2856
|
+
});
|
|
2857
|
+
}
|
|
2858
|
+
init() {
|
|
2859
|
+
return {
|
|
2860
|
+
id: this.id,
|
|
2861
|
+
conclusion: this.conclusion,
|
|
2862
|
+
results: [...this.results],
|
|
2863
|
+
reason: this.reason,
|
|
2864
|
+
detection: this.detection,
|
|
2865
|
+
error: this.error,
|
|
2866
|
+
ruleResult: this.ruleResult,
|
|
2867
|
+
agent: this.agent,
|
|
2868
|
+
edge: this.edge,
|
|
2869
|
+
key: this.key,
|
|
2870
|
+
ttl: this.ttl
|
|
2871
|
+
};
|
|
2872
|
+
}
|
|
2873
|
+
};
|
|
2874
|
+
|
|
2875
|
+
// src/characteristics.ts
|
|
2876
|
+
var DEFAULT_CHARACTERISTICS = ["ip"];
|
|
2877
|
+
function resolveOne(context, c) {
|
|
2878
|
+
if (typeof c === "function") {
|
|
2879
|
+
try {
|
|
2880
|
+
return c(context) || void 0;
|
|
2881
|
+
} catch {
|
|
2882
|
+
return void 0;
|
|
2883
|
+
}
|
|
2884
|
+
}
|
|
2885
|
+
switch (c) {
|
|
2886
|
+
case "ip":
|
|
2887
|
+
return context.ip || void 0;
|
|
2888
|
+
case "path":
|
|
2889
|
+
return context.path || void 0;
|
|
2890
|
+
case "method":
|
|
2891
|
+
return context.method || void 0;
|
|
2892
|
+
case "userAgent":
|
|
2893
|
+
return context.userAgent || void 0;
|
|
2894
|
+
}
|
|
2895
|
+
}
|
|
2896
|
+
function deriveKey(context, characteristics = DEFAULT_CHARACTERISTICS) {
|
|
2897
|
+
if (characteristics.length === 0) return context.ip;
|
|
2898
|
+
const parts = [];
|
|
2899
|
+
for (const c of characteristics) {
|
|
2900
|
+
const value = resolveOne(context, c);
|
|
2901
|
+
if (value === void 0) return context.ip;
|
|
2902
|
+
parts.push(value);
|
|
2903
|
+
}
|
|
2904
|
+
return parts.join("|");
|
|
2905
|
+
}
|
|
2906
|
+
|
|
2907
|
+
// src/decision-cache.ts
|
|
2908
|
+
var DecisionCache = class {
|
|
2909
|
+
constructor(options = {}) {
|
|
2910
|
+
// Insertion-ordered, which is what makes the eviction below oldest-first.
|
|
2911
|
+
this.entries = /* @__PURE__ */ new Map();
|
|
2912
|
+
this.ttl = options.ttl ?? 6e4;
|
|
2913
|
+
this.max = options.max ?? 1e4;
|
|
2914
|
+
}
|
|
2915
|
+
/** A cached decision for this key, or undefined. Expired entries are dropped. */
|
|
2916
|
+
get(key) {
|
|
2917
|
+
const entry = this.entries.get(key);
|
|
2918
|
+
if (!entry) return void 0;
|
|
2919
|
+
if (entry.expiresAt <= Date.now()) {
|
|
2920
|
+
this.entries.delete(key);
|
|
2921
|
+
return void 0;
|
|
2922
|
+
}
|
|
2923
|
+
return entry.decision;
|
|
2924
|
+
}
|
|
2925
|
+
/**
|
|
2926
|
+
* Remember a decision, if it is one of the kinds worth remembering.
|
|
2927
|
+
* Returns whether it was stored, so a caller can assert on the policy rather
|
|
2928
|
+
* than infer it.
|
|
2929
|
+
*/
|
|
2930
|
+
set(key, decision) {
|
|
2931
|
+
if (decision.conclusion !== "DENY" && decision.conclusion !== "CHALLENGE") return false;
|
|
2932
|
+
if (this.ttl <= 0) return false;
|
|
2933
|
+
this.entries.delete(key);
|
|
2934
|
+
this.entries.set(key, { decision, expiresAt: Date.now() + this.ttl });
|
|
2935
|
+
while (this.entries.size > this.max) {
|
|
2936
|
+
const oldest = this.entries.keys().next();
|
|
2937
|
+
if (oldest.done) break;
|
|
2938
|
+
this.entries.delete(oldest.value);
|
|
2939
|
+
}
|
|
2940
|
+
return true;
|
|
2941
|
+
}
|
|
2942
|
+
clear() {
|
|
2943
|
+
this.entries.clear();
|
|
2944
|
+
}
|
|
2945
|
+
get size() {
|
|
2946
|
+
return this.entries.size;
|
|
2947
|
+
}
|
|
2948
|
+
/** How long entries live, in milliseconds. Reported on the decision. */
|
|
2949
|
+
get lifetime() {
|
|
2950
|
+
return this.ttl;
|
|
2951
|
+
}
|
|
2952
|
+
};
|
|
2321
2953
|
|
|
2322
2954
|
// src/test-trigger.ts
|
|
2323
2955
|
var TEST_TRIGGER_UA_PREFIX = "WebDecoy-Test/";
|
|
@@ -2334,6 +2966,7 @@ var WebDecoy = class {
|
|
|
2334
2966
|
this.ipEnrichmentClient = null;
|
|
2335
2967
|
this._hasFilterRules = false;
|
|
2336
2968
|
this._hasAgentRules = false;
|
|
2969
|
+
this._preparingRules = [];
|
|
2337
2970
|
this.agentVerifier = null;
|
|
2338
2971
|
const hasApiKey = !!config.apiKey;
|
|
2339
2972
|
if (hasApiKey) {
|
|
@@ -2345,13 +2978,15 @@ var WebDecoy = class {
|
|
|
2345
2978
|
}
|
|
2346
2979
|
this.config = {
|
|
2347
2980
|
apiKey: config.apiKey,
|
|
2348
|
-
apiUrl: config.apiUrl || "https://
|
|
2981
|
+
apiUrl: config.apiUrl || "https://in.webdecoy.com",
|
|
2349
2982
|
enableTLSFingerprinting: config.enableTLSFingerprinting ?? true,
|
|
2350
2983
|
threatScoreThreshold: config.threatScoreThreshold ?? 80,
|
|
2351
2984
|
timeout: config.timeout ?? 5e3,
|
|
2352
2985
|
debug: config.debug ?? false,
|
|
2353
2986
|
tlsRejectUnauthorized: config.tlsRejectUnauthorized ?? true
|
|
2354
2987
|
};
|
|
2988
|
+
this.log = resolveLogger(config.logger, this.config.debug);
|
|
2989
|
+
this.tracer = config.tracer;
|
|
2355
2990
|
if (hasApiKey) {
|
|
2356
2991
|
this.client = new WebDecoyClient({
|
|
2357
2992
|
apiKey: config.apiKey,
|
|
@@ -2362,16 +2997,17 @@ var WebDecoy = class {
|
|
|
2362
2997
|
});
|
|
2363
2998
|
} else {
|
|
2364
2999
|
this.client = null;
|
|
2365
|
-
|
|
2366
|
-
console.log("[WebDecoy] Running in local-only mode (no API key). Rules will still evaluate.");
|
|
2367
|
-
}
|
|
3000
|
+
this.log.info("Running in local-only mode (no API key). Rules will still evaluate.");
|
|
2368
3001
|
}
|
|
2369
3002
|
this.webBotAuthOptions = config.webBotAuth;
|
|
3003
|
+
this.characteristics = config.characteristics ?? DEFAULT_CHARACTERISTICS;
|
|
3004
|
+
this.decisionCache = config.decisionCache === false ? null : new DecisionCache(config.decisionCache ?? {});
|
|
2370
3005
|
const rules = config.rules ?? [tripwire()];
|
|
2371
3006
|
if (rules.length > 0) {
|
|
2372
3007
|
this.ruleEngine = new RuleEngine(rules);
|
|
2373
3008
|
this._hasFilterRules = rules.some((r) => r.name.startsWith("filter:"));
|
|
2374
3009
|
this._hasAgentRules = rules.some((r) => r.name === "web-bot-auth");
|
|
3010
|
+
this._preparingRules = rules.filter((r) => typeof r.prepare === "function");
|
|
2375
3011
|
if (this._hasAgentRules) {
|
|
2376
3012
|
this.getAgentVerifier().warmup();
|
|
2377
3013
|
}
|
|
@@ -2387,15 +3023,13 @@ var WebDecoy = class {
|
|
|
2387
3023
|
});
|
|
2388
3024
|
this.setViolationReporter(reporter);
|
|
2389
3025
|
}
|
|
2390
|
-
|
|
2391
|
-
|
|
2392
|
-
|
|
2393
|
-
|
|
2394
|
-
|
|
2395
|
-
|
|
2396
|
-
|
|
2397
|
-
});
|
|
2398
|
-
}
|
|
3026
|
+
this.log.debug("Initialized", {
|
|
3027
|
+
apiUrl: this.config.apiUrl,
|
|
3028
|
+
enableTLSFingerprinting: this.config.enableTLSFingerprinting,
|
|
3029
|
+
threatScoreThreshold: this.config.threatScoreThreshold,
|
|
3030
|
+
hasApiKey,
|
|
3031
|
+
rulesCount: rules.length
|
|
3032
|
+
});
|
|
2399
3033
|
}
|
|
2400
3034
|
/**
|
|
2401
3035
|
* Evaluate rules against request metadata (synchronous).
|
|
@@ -2431,15 +3065,18 @@ var WebDecoy = class {
|
|
|
2431
3065
|
}
|
|
2432
3066
|
if (rule.name.startsWith("filter:")) this._hasFilterRules = true;
|
|
2433
3067
|
if (rule.name === "web-bot-auth") this._hasAgentRules = true;
|
|
3068
|
+
if (typeof rule.prepare === "function") this._preparingRules.push(rule);
|
|
2434
3069
|
}
|
|
2435
3070
|
/** Build the base (synchronous) rule context from request metadata. */
|
|
2436
3071
|
buildContext(metadata) {
|
|
2437
|
-
|
|
3072
|
+
const context = {
|
|
2438
3073
|
ip: metadata.ip,
|
|
2439
3074
|
path: metadata.path,
|
|
2440
3075
|
method: metadata.method,
|
|
2441
3076
|
userAgent: metadata.user_agent,
|
|
2442
3077
|
headers: metadata.headers,
|
|
3078
|
+
query: metadata.query,
|
|
3079
|
+
body: metadata.body,
|
|
2443
3080
|
timestamp: metadata.timestamp || Date.now(),
|
|
2444
3081
|
// Parsed synchronously and unconditionally: it is two header reads,
|
|
2445
3082
|
// it needs no network, and a rule that has to check whether the edge
|
|
@@ -2451,6 +3088,8 @@ var WebDecoy = class {
|
|
|
2451
3088
|
// ran.
|
|
2452
3089
|
bot: classifyUserAgent(metadata.user_agent)
|
|
2453
3090
|
};
|
|
3091
|
+
context.key = deriveKey(context, this.characteristics);
|
|
3092
|
+
return context;
|
|
2454
3093
|
}
|
|
2455
3094
|
/**
|
|
2456
3095
|
* Build a rule context with async signals resolved: IP enrichment (for
|
|
@@ -2467,12 +3106,21 @@ var WebDecoy = class {
|
|
|
2467
3106
|
if (this._hasAgentRules) {
|
|
2468
3107
|
context.agent = await this.computeAgentVerdict(metadata);
|
|
2469
3108
|
}
|
|
3109
|
+
if (this._preparingRules.length > 0) {
|
|
3110
|
+
await Promise.all(this._preparingRules.map((rule) => rule.prepare(context)));
|
|
3111
|
+
}
|
|
2470
3112
|
return context;
|
|
2471
3113
|
}
|
|
2472
3114
|
/** Evaluate rules against a prepared context and report any violations. */
|
|
2473
3115
|
runRules(context) {
|
|
2474
3116
|
if (!this.ruleEngine) return null;
|
|
3117
|
+
const span = startSpan(this.tracer, "webdecoy.rules");
|
|
2475
3118
|
const result = this.ruleEngine.evaluate(context);
|
|
3119
|
+
setAttribute(span, "webdecoy.rules.action", result.action);
|
|
3120
|
+
setAttribute(span, "webdecoy.rules.evaluated", result.results.length);
|
|
3121
|
+
setAttribute(span, "webdecoy.rules.violations", result.violations.length);
|
|
3122
|
+
if (result.rule) setAttribute(span, "webdecoy.rules.deciding", result.rule);
|
|
3123
|
+
endSpan(span);
|
|
2476
3124
|
if (result.violations.length > 0 && this.violationReporter) {
|
|
2477
3125
|
this.violationReporter.report(result.violations);
|
|
2478
3126
|
}
|
|
@@ -2535,14 +3183,40 @@ var WebDecoy = class {
|
|
|
2535
3183
|
*
|
|
2536
3184
|
* @param metadata - Request metadata to analyze
|
|
2537
3185
|
* @param options - Optional configuration for this specific request
|
|
2538
|
-
* @returns
|
|
3186
|
+
* @returns The decision — `conclusion`, every rule's outcome, and the
|
|
3187
|
+
* narrowing helpers. Satisfies `ProtectResult`.
|
|
2539
3188
|
*/
|
|
2540
3189
|
async protect(metadata, options = {}) {
|
|
2541
3190
|
const edge = readEdgeVerdict(metadata.headers);
|
|
2542
|
-
const
|
|
2543
|
-
|
|
3191
|
+
const span = startSpan(this.tracer, "webdecoy.protect");
|
|
3192
|
+
try {
|
|
3193
|
+
const decision = (await this.decide(metadata, options)).withEdge(edge);
|
|
3194
|
+
setAttribute(span, "webdecoy.decision.id", decision.id);
|
|
3195
|
+
setAttribute(span, "webdecoy.decision.conclusion", decision.conclusion);
|
|
3196
|
+
setAttribute(span, "webdecoy.decision.allowed", decision.allowed);
|
|
3197
|
+
setAttribute(span, "webdecoy.rules.evaluated", decision.results.length);
|
|
3198
|
+
if (decision.ruleResult?.rule) {
|
|
3199
|
+
setAttribute(span, "webdecoy.decision.rule", decision.ruleResult.rule);
|
|
3200
|
+
}
|
|
3201
|
+
setAttribute(
|
|
3202
|
+
span,
|
|
3203
|
+
"webdecoy.remote",
|
|
3204
|
+
decision.detection.detection_id !== decision.id
|
|
3205
|
+
);
|
|
3206
|
+
if (decision.error) {
|
|
3207
|
+
setAttribute(span, "webdecoy.error", decision.error);
|
|
3208
|
+
}
|
|
3209
|
+
return decision;
|
|
3210
|
+
} catch (error) {
|
|
3211
|
+
recordError(span, error);
|
|
3212
|
+
throw error;
|
|
3213
|
+
} finally {
|
|
3214
|
+
endSpan(span);
|
|
3215
|
+
}
|
|
2544
3216
|
}
|
|
2545
3217
|
async decide(metadata, options = {}) {
|
|
3218
|
+
const id = newDecisionId();
|
|
3219
|
+
let key = metadata.ip || "unknown";
|
|
2546
3220
|
try {
|
|
2547
3221
|
if (!metadata.ip) {
|
|
2548
3222
|
throw new Error("IP address is required in request metadata");
|
|
@@ -2551,62 +3225,53 @@ var WebDecoy = class {
|
|
|
2551
3225
|
metadata.timestamp = Date.now();
|
|
2552
3226
|
}
|
|
2553
3227
|
if (isTestTriggerUserAgent(metadata.user_agent)) {
|
|
2554
|
-
return this.reportTestTrigger(metadata);
|
|
3228
|
+
return this.reportTestTrigger(metadata, id);
|
|
2555
3229
|
}
|
|
2556
|
-
|
|
2557
|
-
|
|
2558
|
-
|
|
2559
|
-
|
|
2560
|
-
|
|
2561
|
-
|
|
2562
|
-
|
|
2563
|
-
|
|
2564
|
-
|
|
2565
|
-
|
|
2566
|
-
return {
|
|
2567
|
-
allowed: false,
|
|
2568
|
-
detection: {
|
|
2569
|
-
decision: "block",
|
|
2570
|
-
confidence: 100,
|
|
2571
|
-
threat_level: "HIGH",
|
|
2572
|
-
bot_detected: false,
|
|
2573
|
-
detection_id: "rule_" + Date.now(),
|
|
2574
|
-
rule_enforced: true
|
|
2575
|
-
},
|
|
2576
|
-
ruleResult,
|
|
2577
|
-
agent: agentVerdict
|
|
2578
|
-
};
|
|
2579
|
-
}
|
|
2580
|
-
if (ruleResult && ruleResult.action === "THROTTLE") {
|
|
2581
|
-
return {
|
|
2582
|
-
allowed: false,
|
|
3230
|
+
const needsAsync = this._hasFilterRules || this._hasAgentRules || this._preparingRules.length > 0;
|
|
3231
|
+
const context = needsAsync ? await this.buildAsyncContext(metadata) : this.buildContext(metadata);
|
|
3232
|
+
key = context.key ?? key;
|
|
3233
|
+
const agentVerdict = context.agent;
|
|
3234
|
+
const ruleResult = this.ruleEngine ? this.runRules(context) : null;
|
|
3235
|
+
if (ruleResult && ruleResult.action !== "ALLOW") {
|
|
3236
|
+
const throttled = ruleResult.action === "THROTTLE";
|
|
3237
|
+
return new Decision({
|
|
3238
|
+
conclusion: "DENY",
|
|
3239
|
+
reason: ruleResult.reason,
|
|
2583
3240
|
detection: {
|
|
2584
3241
|
decision: "block",
|
|
2585
3242
|
confidence: 100,
|
|
2586
|
-
threat_level: "MEDIUM",
|
|
3243
|
+
threat_level: throttled ? "MEDIUM" : "HIGH",
|
|
2587
3244
|
bot_detected: false,
|
|
2588
|
-
detection_id:
|
|
3245
|
+
detection_id: id,
|
|
2589
3246
|
rule_enforced: true
|
|
2590
3247
|
},
|
|
3248
|
+
id,
|
|
3249
|
+
results: ruleResult.results,
|
|
2591
3250
|
ruleResult,
|
|
2592
|
-
agent: agentVerdict
|
|
2593
|
-
|
|
3251
|
+
agent: agentVerdict,
|
|
3252
|
+
key
|
|
3253
|
+
});
|
|
2594
3254
|
}
|
|
2595
3255
|
if (!this.client) {
|
|
2596
|
-
return {
|
|
2597
|
-
|
|
3256
|
+
return new Decision({
|
|
3257
|
+
conclusion: "ALLOW",
|
|
2598
3258
|
detection: {
|
|
2599
3259
|
decision: "allow",
|
|
2600
3260
|
confidence: 0,
|
|
2601
3261
|
threat_level: "MINIMAL",
|
|
2602
3262
|
bot_detected: false,
|
|
2603
|
-
detection_id:
|
|
3263
|
+
detection_id: id,
|
|
2604
3264
|
rule_enforced: false
|
|
2605
3265
|
},
|
|
3266
|
+
id,
|
|
3267
|
+
results: ruleResult?.results ?? [],
|
|
2606
3268
|
ruleResult: ruleResult ?? void 0,
|
|
2607
|
-
agent: agentVerdict
|
|
2608
|
-
|
|
3269
|
+
agent: agentVerdict,
|
|
3270
|
+
key
|
|
3271
|
+
});
|
|
2609
3272
|
}
|
|
3273
|
+
const cached = this.decisionCache?.get(key);
|
|
3274
|
+
if (cached) return cached.asCached();
|
|
2610
3275
|
const localAnalysis = options.skipLocalAnalysis ? {
|
|
2611
3276
|
suspicious_headers: false,
|
|
2612
3277
|
missing_sec_ch_ua: false,
|
|
@@ -2615,62 +3280,70 @@ var WebDecoy = class {
|
|
|
2615
3280
|
needs_verification: true,
|
|
2616
3281
|
flags: ["local_analysis_skipped"]
|
|
2617
3282
|
} : analyzeRequest(metadata);
|
|
2618
|
-
|
|
2619
|
-
console.log("[WebDecoy] Local analysis result:", localAnalysis);
|
|
2620
|
-
}
|
|
3283
|
+
this.log.debug("Local analysis", { ...localAnalysis });
|
|
2621
3284
|
const detectionRequest = {
|
|
2622
3285
|
request_metadata: metadata,
|
|
2623
3286
|
local_analysis: localAnalysis
|
|
2624
3287
|
};
|
|
2625
3288
|
const shouldCallServer = localAnalysis.needs_verification || this.config.enableTLSFingerprinting && metadata.tls_info;
|
|
2626
3289
|
if (!shouldCallServer && localAnalysis.local_score < 50) {
|
|
2627
|
-
return {
|
|
2628
|
-
|
|
3290
|
+
return new Decision({
|
|
3291
|
+
conclusion: "ALLOW",
|
|
2629
3292
|
detection: {
|
|
2630
3293
|
decision: "allow",
|
|
2631
3294
|
confidence: 100 - localAnalysis.local_score,
|
|
2632
3295
|
threat_level: "MINIMAL",
|
|
2633
3296
|
bot_detected: false,
|
|
2634
|
-
detection_id:
|
|
3297
|
+
detection_id: id,
|
|
2635
3298
|
rule_enforced: false
|
|
2636
3299
|
},
|
|
3300
|
+
id,
|
|
3301
|
+
results: ruleResult?.results ?? [],
|
|
2637
3302
|
ruleResult: ruleResult ?? void 0,
|
|
2638
|
-
agent: agentVerdict
|
|
2639
|
-
|
|
3303
|
+
agent: agentVerdict,
|
|
3304
|
+
key
|
|
3305
|
+
});
|
|
2640
3306
|
}
|
|
2641
3307
|
const detection = await this.client.detect(detectionRequest);
|
|
2642
3308
|
const threshold = options.threshold ?? this.config.threatScoreThreshold;
|
|
2643
3309
|
const allowed = detection.decision === "allow" || detection.confidence < threshold;
|
|
2644
|
-
|
|
2645
|
-
|
|
2646
|
-
|
|
2647
|
-
|
|
2648
|
-
|
|
2649
|
-
|
|
2650
|
-
|
|
2651
|
-
|
|
2652
|
-
allowed
|
|
3310
|
+
this.log.debug("Server detection", {
|
|
3311
|
+
decision: detection.decision,
|
|
3312
|
+
confidence: detection.confidence,
|
|
3313
|
+
allowed
|
|
3314
|
+
});
|
|
3315
|
+
const conclusion = allowed ? "ALLOW" : detection.decision === "challenge" ? "CHALLENGE" : "DENY";
|
|
3316
|
+
const decision = new Decision({
|
|
3317
|
+
conclusion,
|
|
3318
|
+
reason: allowed ? void 0 : `Threat score ${detection.confidence} (threshold ${threshold})`,
|
|
2653
3319
|
detection,
|
|
3320
|
+
id,
|
|
3321
|
+
results: ruleResult?.results ?? [],
|
|
2654
3322
|
ruleResult: ruleResult ?? void 0,
|
|
2655
|
-
agent: agentVerdict
|
|
2656
|
-
|
|
3323
|
+
agent: agentVerdict,
|
|
3324
|
+
key,
|
|
3325
|
+
ttl: this.decisionCache && !allowed ? this.decisionCache.lifetime : 0
|
|
3326
|
+
});
|
|
3327
|
+
if (this.decisionCache) this.decisionCache.set(key, decision);
|
|
3328
|
+
return decision;
|
|
2657
3329
|
} catch (error) {
|
|
2658
|
-
|
|
2659
|
-
|
|
2660
|
-
}
|
|
2661
|
-
return {
|
|
2662
|
-
|
|
2663
|
-
// Fail open to avoid blocking legitimate users
|
|
3330
|
+
this.log.error("Protection error", {
|
|
3331
|
+
error: error instanceof Error ? error.message : String(error)
|
|
3332
|
+
});
|
|
3333
|
+
return new Decision({
|
|
3334
|
+
conclusion: "ERROR",
|
|
2664
3335
|
detection: {
|
|
2665
3336
|
decision: "allow",
|
|
2666
3337
|
confidence: 0,
|
|
2667
3338
|
threat_level: "MINIMAL",
|
|
2668
3339
|
bot_detected: false,
|
|
2669
|
-
detection_id:
|
|
3340
|
+
detection_id: id,
|
|
2670
3341
|
rule_enforced: false
|
|
2671
3342
|
},
|
|
3343
|
+
id,
|
|
3344
|
+
key,
|
|
2672
3345
|
error: error instanceof Error ? error.message : "Unknown error"
|
|
2673
|
-
};
|
|
3346
|
+
});
|
|
2674
3347
|
}
|
|
2675
3348
|
}
|
|
2676
3349
|
/**
|
|
@@ -2684,22 +3357,24 @@ var WebDecoy = class {
|
|
|
2684
3357
|
* Without an API key nothing can reach the dashboard, so the verdict says
|
|
2685
3358
|
* so via `error` instead of pretending the test ran.
|
|
2686
3359
|
*/
|
|
2687
|
-
async reportTestTrigger(metadata) {
|
|
3360
|
+
async reportTestTrigger(metadata, id) {
|
|
2688
3361
|
const blocked = {
|
|
2689
3362
|
decision: "block",
|
|
2690
3363
|
confidence: 100,
|
|
2691
3364
|
threat_level: "HIGH",
|
|
2692
3365
|
bot_detected: true,
|
|
2693
3366
|
bot_type: "test_trigger",
|
|
2694
|
-
detection_id:
|
|
3367
|
+
detection_id: id,
|
|
2695
3368
|
rule_enforced: false
|
|
2696
3369
|
};
|
|
2697
3370
|
if (!this.client) {
|
|
2698
|
-
return {
|
|
2699
|
-
|
|
3371
|
+
return new Decision({
|
|
3372
|
+
id,
|
|
3373
|
+
conclusion: "DENY",
|
|
3374
|
+
reason: "Reserved test trigger",
|
|
2700
3375
|
detection: blocked,
|
|
2701
3376
|
error: "Test trigger recognized, but no apiKey is configured \u2014 nothing was reported to the dashboard."
|
|
2702
|
-
};
|
|
3377
|
+
});
|
|
2703
3378
|
}
|
|
2704
3379
|
try {
|
|
2705
3380
|
const detection = await this.client.detect({
|
|
@@ -2713,13 +3388,20 @@ var WebDecoy = class {
|
|
|
2713
3388
|
flags: ["test_trigger"]
|
|
2714
3389
|
}
|
|
2715
3390
|
});
|
|
2716
|
-
return {
|
|
3391
|
+
return new Decision({
|
|
3392
|
+
id,
|
|
3393
|
+
conclusion: "DENY",
|
|
3394
|
+
reason: "Reserved test trigger",
|
|
3395
|
+
detection
|
|
3396
|
+
});
|
|
2717
3397
|
} catch (error) {
|
|
2718
|
-
return {
|
|
2719
|
-
|
|
3398
|
+
return new Decision({
|
|
3399
|
+
id,
|
|
3400
|
+
conclusion: "DENY",
|
|
3401
|
+
reason: "Reserved test trigger",
|
|
2720
3402
|
detection: blocked,
|
|
2721
3403
|
error: error instanceof Error ? error.message : "Failed to report test detection"
|
|
2722
|
-
};
|
|
3404
|
+
});
|
|
2723
3405
|
}
|
|
2724
3406
|
}
|
|
2725
3407
|
/**
|
|
@@ -2916,11 +3598,12 @@ function resolveClientIp(options) {
|
|
|
2916
3598
|
return normalizeIp(readHeader(headers, "cf-connecting-ip")) ?? peer;
|
|
2917
3599
|
}
|
|
2918
3600
|
const chain = forwardedChain(headers);
|
|
3601
|
+
const singleHeaderFallback = () => normalizeIp(readHeader(headers, "x-real-ip")) ?? normalizeIp(readHeader(headers, "x-vercel-forwarded-for")?.split(",").pop()) ?? void 0;
|
|
2919
3602
|
if (typeof trustProxy === "number") {
|
|
2920
3603
|
if (!Number.isInteger(trustProxy) || trustProxy < 0) return peer;
|
|
2921
3604
|
const index = chain.length - trustProxy;
|
|
2922
|
-
if (index < 0 || index >= chain.length) return peer;
|
|
2923
|
-
return chain[index] ?? peer;
|
|
3605
|
+
if (index < 0 || index >= chain.length) return singleHeaderFallback() ?? peer;
|
|
3606
|
+
return chain[index] ?? singleHeaderFallback() ?? peer;
|
|
2924
3607
|
}
|
|
2925
3608
|
const full = peer ? [...chain, peer] : [...chain];
|
|
2926
3609
|
for (let i = full.length - 1; i >= 0; i--) {
|
|
@@ -2928,7 +3611,253 @@ function resolveClientIp(options) {
|
|
|
2928
3611
|
if (candidate === null) return peer;
|
|
2929
3612
|
if (!trustProxy.some((range) => ipInCidr(candidate, range))) return candidate;
|
|
2930
3613
|
}
|
|
2931
|
-
return full[0] ?? void 0 ?? peer;
|
|
3614
|
+
return full[0] ?? void 0 ?? singleHeaderFallback() ?? peer;
|
|
3615
|
+
}
|
|
3616
|
+
|
|
3617
|
+
// src/client-signals.ts
|
|
3618
|
+
var MemoryClientSignalStore = class {
|
|
3619
|
+
constructor(options = {}) {
|
|
3620
|
+
this.sync = true;
|
|
3621
|
+
this.entries = /* @__PURE__ */ new Map();
|
|
3622
|
+
this.ttl = options.ttl ?? 9e5;
|
|
3623
|
+
this.max = options.max ?? 1e4;
|
|
3624
|
+
}
|
|
3625
|
+
get(sessionId) {
|
|
3626
|
+
const entry = this.entries.get(sessionId);
|
|
3627
|
+
if (!entry) return void 0;
|
|
3628
|
+
if (Date.now() - entry.at > this.ttl) {
|
|
3629
|
+
this.entries.delete(sessionId);
|
|
3630
|
+
return void 0;
|
|
3631
|
+
}
|
|
3632
|
+
return entry;
|
|
3633
|
+
}
|
|
3634
|
+
set(verdict) {
|
|
3635
|
+
this.entries.delete(verdict.sessionId);
|
|
3636
|
+
this.entries.set(verdict.sessionId, verdict);
|
|
3637
|
+
while (this.entries.size > this.max) {
|
|
3638
|
+
const oldest = this.entries.keys().next();
|
|
3639
|
+
if (oldest.done) break;
|
|
3640
|
+
this.entries.delete(oldest.value);
|
|
3641
|
+
}
|
|
3642
|
+
}
|
|
3643
|
+
get size() {
|
|
3644
|
+
return this.entries.size;
|
|
3645
|
+
}
|
|
3646
|
+
};
|
|
3647
|
+
var CLIENT_SESSION_COOKIE = "wd_cs";
|
|
3648
|
+
var CLIENT_SESSION_HEADER = "x-wd-session";
|
|
3649
|
+
function readClientSession(headers) {
|
|
3650
|
+
const cookie = headers["cookie"];
|
|
3651
|
+
if (cookie) {
|
|
3652
|
+
for (const part of cookie.split(";")) {
|
|
3653
|
+
const eq = part.indexOf("=");
|
|
3654
|
+
if (eq < 0) continue;
|
|
3655
|
+
if (part.slice(0, eq).trim() === CLIENT_SESSION_COOKIE) {
|
|
3656
|
+
const value = part.slice(eq + 1).trim();
|
|
3657
|
+
if (value) return value;
|
|
3658
|
+
}
|
|
3659
|
+
}
|
|
3660
|
+
}
|
|
3661
|
+
const header = headers[CLIENT_SESSION_HEADER];
|
|
3662
|
+
return header || void 0;
|
|
3663
|
+
}
|
|
3664
|
+
var ClientSignalRule = class {
|
|
3665
|
+
constructor(config) {
|
|
3666
|
+
this.name = "client-signals";
|
|
3667
|
+
this.store = config.store;
|
|
3668
|
+
this.minScore = config.minScore;
|
|
3669
|
+
this.action = config.action ?? "DENY";
|
|
3670
|
+
this.dryRun = config.dryRun ?? false;
|
|
3671
|
+
}
|
|
3672
|
+
async prepare(context) {
|
|
3673
|
+
if (this.store.sync) return;
|
|
3674
|
+
const sessionId = readClientSession(context.headers);
|
|
3675
|
+
if (!sessionId) return;
|
|
3676
|
+
const verdict = await this.store.get(sessionId);
|
|
3677
|
+
if (verdict) {
|
|
3678
|
+
context.prepared ?? (context.prepared = {});
|
|
3679
|
+
context.prepared[this.name] = verdict;
|
|
3680
|
+
}
|
|
3681
|
+
}
|
|
3682
|
+
evaluate(context) {
|
|
3683
|
+
const sessionId = readClientSession(context.headers);
|
|
3684
|
+
if (!sessionId) {
|
|
3685
|
+
return {
|
|
3686
|
+
action: "ALLOW",
|
|
3687
|
+
rule: this.name,
|
|
3688
|
+
state: "NOT_RUN",
|
|
3689
|
+
reason: "No browser session \u2014 the client widget did not run for this request"
|
|
3690
|
+
};
|
|
3691
|
+
}
|
|
3692
|
+
const verdict = this.store.sync ? this.store.get(sessionId) : context.prepared?.[this.name];
|
|
3693
|
+
if (!verdict) {
|
|
3694
|
+
return {
|
|
3695
|
+
action: "ALLOW",
|
|
3696
|
+
rule: this.name,
|
|
3697
|
+
state: "NOT_RUN",
|
|
3698
|
+
reason: "No signals recorded for this session yet"
|
|
3699
|
+
};
|
|
3700
|
+
}
|
|
3701
|
+
const bad = this.minScore !== void 0 ? verdict.score >= this.minScore : verdict.recommendation === "block";
|
|
3702
|
+
if (!bad) {
|
|
3703
|
+
return {
|
|
3704
|
+
action: "ALLOW",
|
|
3705
|
+
rule: this.name,
|
|
3706
|
+
metadata: { score: verdict.score, recommendation: verdict.recommendation }
|
|
3707
|
+
};
|
|
3708
|
+
}
|
|
3709
|
+
return {
|
|
3710
|
+
action: this.dryRun ? "ALLOW" : this.action,
|
|
3711
|
+
rule: this.name,
|
|
3712
|
+
reason: `Client signals scored ${verdict.score.toFixed(2)} (${verdict.recommendation})`,
|
|
3713
|
+
metadata: {
|
|
3714
|
+
score: verdict.score,
|
|
3715
|
+
recommendation: verdict.recommendation,
|
|
3716
|
+
sessionId,
|
|
3717
|
+
dryRun: this.dryRun
|
|
3718
|
+
}
|
|
3719
|
+
};
|
|
3720
|
+
}
|
|
3721
|
+
};
|
|
3722
|
+
function clientSignals(config) {
|
|
3723
|
+
return new ClientSignalRule(config);
|
|
3724
|
+
}
|
|
3725
|
+
|
|
3726
|
+
// src/adapter-core.ts
|
|
3727
|
+
function shouldSkipPath(path, patterns) {
|
|
3728
|
+
if (!patterns || patterns.length === 0) return false;
|
|
3729
|
+
return patterns.some(
|
|
3730
|
+
(pattern) => typeof pattern === "string" ? path === pattern || path.startsWith(pattern) : pattern.test(path)
|
|
3731
|
+
);
|
|
3732
|
+
}
|
|
3733
|
+
function ruleBlockResponse(decision) {
|
|
3734
|
+
const rr = decision.ruleResult;
|
|
3735
|
+
if (decision.allowed || !rr) return null;
|
|
3736
|
+
if (rr.action === "THROTTLE") {
|
|
3737
|
+
const retryAfter = Number(rr.metadata?.retryAfter ?? 60);
|
|
3738
|
+
return {
|
|
3739
|
+
status: 429,
|
|
3740
|
+
headers: { "Retry-After": String(retryAfter) },
|
|
3741
|
+
body: {
|
|
3742
|
+
error: "Too Many Requests",
|
|
3743
|
+
message: rr.reason || "Rate limit exceeded",
|
|
3744
|
+
retry_after: retryAfter
|
|
3745
|
+
}
|
|
3746
|
+
};
|
|
3747
|
+
}
|
|
3748
|
+
if (rr.action === "DENY") {
|
|
3749
|
+
return {
|
|
3750
|
+
status: 403,
|
|
3751
|
+
headers: {},
|
|
3752
|
+
body: {
|
|
3753
|
+
error: "Forbidden",
|
|
3754
|
+
message: rr.reason || "Access denied by rule",
|
|
3755
|
+
rule: rr.rule
|
|
3756
|
+
}
|
|
3757
|
+
};
|
|
3758
|
+
}
|
|
3759
|
+
return null;
|
|
3760
|
+
}
|
|
3761
|
+
function armSiteHoneytoken(sdk, options) {
|
|
3762
|
+
let token = null;
|
|
3763
|
+
void deriveAndArm(sdk, options).then((t) => {
|
|
3764
|
+
token = t;
|
|
3765
|
+
});
|
|
3766
|
+
return () => token;
|
|
3767
|
+
}
|
|
3768
|
+
async function deriveAndArm(sdk, options) {
|
|
3769
|
+
const enabled = (options.enabled ?? true) && Boolean(options.apiKey);
|
|
3770
|
+
if (!enabled) return null;
|
|
3771
|
+
try {
|
|
3772
|
+
const token = await siteHoneytoken({ secret: options.apiKey });
|
|
3773
|
+
sdk.addRule(tripwire({ paths: token.activePaths, includeDefaults: false }));
|
|
3774
|
+
return token;
|
|
3775
|
+
} catch (error) {
|
|
3776
|
+
options.onError?.(error);
|
|
3777
|
+
return null;
|
|
3778
|
+
}
|
|
3779
|
+
}
|
|
3780
|
+
|
|
3781
|
+
// src/fetch-guard.ts
|
|
3782
|
+
function defaultBlocked(_request, decision) {
|
|
3783
|
+
const block = ruleBlockResponse(decision) ?? {
|
|
3784
|
+
status: 403,
|
|
3785
|
+
headers: {},
|
|
3786
|
+
body: { error: "Forbidden", message: "Access denied by Web Decoy protection" }
|
|
3787
|
+
};
|
|
3788
|
+
return new Response(JSON.stringify({ ...block.body, detection_id: decision.id }), {
|
|
3789
|
+
status: block.status,
|
|
3790
|
+
headers: { "content-type": "application/json", ...block.headers }
|
|
3791
|
+
});
|
|
3792
|
+
}
|
|
3793
|
+
function headerRecord(headers) {
|
|
3794
|
+
const out = {};
|
|
3795
|
+
headers.forEach((value, key) => {
|
|
3796
|
+
out[key.toLowerCase()] = value;
|
|
3797
|
+
});
|
|
3798
|
+
return out;
|
|
3799
|
+
}
|
|
3800
|
+
function createFetchGuard(options = {}) {
|
|
3801
|
+
const sdk = new WebDecoy(options);
|
|
3802
|
+
const mode = options.mode ?? "monitor";
|
|
3803
|
+
const onBlocked = options.onBlocked ?? defaultBlocked;
|
|
3804
|
+
const getToken = armSiteHoneytoken(sdk, {
|
|
3805
|
+
apiKey: options.apiKey,
|
|
3806
|
+
enabled: options.honeytoken
|
|
3807
|
+
});
|
|
3808
|
+
function resolveIP(request, peer) {
|
|
3809
|
+
if (options.getIP) return options.getIP(request);
|
|
3810
|
+
return resolveClientIp({
|
|
3811
|
+
headers: request.headers,
|
|
3812
|
+
peer,
|
|
3813
|
+
trustProxy: options.trustProxy ?? 1
|
|
3814
|
+
}) ?? normalizeIp(peer) ?? "127.0.0.1";
|
|
3815
|
+
}
|
|
3816
|
+
return {
|
|
3817
|
+
sdk,
|
|
3818
|
+
skips(pathname) {
|
|
3819
|
+
return shouldSkipPath(pathname, options.skipPaths);
|
|
3820
|
+
},
|
|
3821
|
+
async check(request, peer) {
|
|
3822
|
+
const url = new URL(request.url);
|
|
3823
|
+
const metadata = {
|
|
3824
|
+
method: request.method,
|
|
3825
|
+
path: url.pathname,
|
|
3826
|
+
ip: resolveIP(request, peer),
|
|
3827
|
+
user_agent: request.headers.get("user-agent") ?? void 0,
|
|
3828
|
+
headers: headerRecord(request.headers),
|
|
3829
|
+
query: url.search ? url.search.slice(1) : void 0,
|
|
3830
|
+
timestamp: Date.now()
|
|
3831
|
+
};
|
|
3832
|
+
const decision = await sdk.protect(metadata, {
|
|
3833
|
+
threshold: options.threshold,
|
|
3834
|
+
skipLocalAnalysis: options.skipLocalAnalysis,
|
|
3835
|
+
metadata: options.metadata
|
|
3836
|
+
});
|
|
3837
|
+
if (decision.allowed || mode !== "enforce") return { decision };
|
|
3838
|
+
return { decision, response: await onBlocked(request, decision) };
|
|
3839
|
+
},
|
|
3840
|
+
async decorate(response) {
|
|
3841
|
+
const current = getToken();
|
|
3842
|
+
if (!current) return response;
|
|
3843
|
+
if (!isInjectableHtml(response.headers.get("content-type"))) return response;
|
|
3844
|
+
if (response.bodyUsed) return response;
|
|
3845
|
+
try {
|
|
3846
|
+
const html = await response.text();
|
|
3847
|
+
const injected = injectHoneytokenLink(html, current.linkHtml);
|
|
3848
|
+
if (injected === html) return new Response(html, response);
|
|
3849
|
+
const headers = new Headers(response.headers);
|
|
3850
|
+
headers.delete("content-length");
|
|
3851
|
+
return new Response(injected, {
|
|
3852
|
+
status: response.status,
|
|
3853
|
+
statusText: response.statusText,
|
|
3854
|
+
headers
|
|
3855
|
+
});
|
|
3856
|
+
} catch {
|
|
3857
|
+
return response;
|
|
3858
|
+
}
|
|
3859
|
+
}
|
|
3860
|
+
};
|
|
2932
3861
|
}
|
|
2933
3862
|
|
|
2934
3863
|
// src/detection/weights.ts
|
|
@@ -4827,7 +5756,7 @@ var Captcha = class {
|
|
|
4827
5756
|
// src/captcha/http.ts
|
|
4828
5757
|
var JSON_HEADERS = { "content-type": "application/json" };
|
|
4829
5758
|
function createCaptchaEndpoints(options = {}) {
|
|
4830
|
-
const { basePath = "/__webdecoy", ...captchaOptions } = options;
|
|
5759
|
+
const { basePath = "/__webdecoy", signalStore, ...captchaOptions } = options;
|
|
4831
5760
|
const captcha = new Captcha(captchaOptions);
|
|
4832
5761
|
const base = basePath.replace(/\/$/, "");
|
|
4833
5762
|
function route(pathname) {
|
|
@@ -4877,7 +5806,20 @@ function createCaptchaEndpoints(options = {}) {
|
|
|
4877
5806
|
ja3Hash,
|
|
4878
5807
|
action: b.action
|
|
4879
5808
|
});
|
|
4880
|
-
|
|
5809
|
+
if (signalStore && b.sessionId) {
|
|
5810
|
+
await signalStore.set({
|
|
5811
|
+
sessionId: b.sessionId,
|
|
5812
|
+
score: result.score,
|
|
5813
|
+
recommendation: result.recommendation,
|
|
5814
|
+
at: Date.now()
|
|
5815
|
+
});
|
|
5816
|
+
}
|
|
5817
|
+
return json(200, {
|
|
5818
|
+
...result,
|
|
5819
|
+
// Echoed so the widget can set the cookie the rule reads, without the
|
|
5820
|
+
// developer wiring a second endpoint to hand it one.
|
|
5821
|
+
sessionId: b.sessionId ?? null
|
|
5822
|
+
});
|
|
4881
5823
|
}
|
|
4882
5824
|
if (sub === "/token/verify" && method === "POST") {
|
|
4883
5825
|
const b = req.body ?? {};
|
|
@@ -4890,14 +5832,23 @@ function createCaptchaEndpoints(options = {}) {
|
|
|
4890
5832
|
}
|
|
4891
5833
|
// Annotate the CommonJS export names for ESM import in node:
|
|
4892
5834
|
0 && (module.exports = {
|
|
5835
|
+
ATTACK_SIGNATURE_IDS,
|
|
4893
5836
|
AgentVerifier,
|
|
5837
|
+
AttackSignatureRule,
|
|
4894
5838
|
BOT_CATEGORIES,
|
|
4895
5839
|
BOT_REGISTRY,
|
|
5840
|
+
BotPolicy,
|
|
4896
5841
|
BotRule,
|
|
5842
|
+
CLIENT_SESSION_COOKIE,
|
|
5843
|
+
CLIENT_SESSION_HEADER,
|
|
4897
5844
|
Captcha,
|
|
5845
|
+
ClientSignalRule,
|
|
5846
|
+
DEFAULT_CHARACTERISTICS,
|
|
4898
5847
|
DEFAULT_SIGNED_AGENT_DIRECTORIES,
|
|
4899
5848
|
DEFAULT_TRIPWIRE_PATHS,
|
|
4900
5849
|
DEFAULT_WEIGHTS,
|
|
5850
|
+
Decision,
|
|
5851
|
+
DecisionCache,
|
|
4901
5852
|
DetectionEngine,
|
|
4902
5853
|
DirectoryCache,
|
|
4903
5854
|
EDGE_CLASS_HEADER,
|
|
@@ -4908,6 +5859,8 @@ function createCaptchaEndpoints(options = {}) {
|
|
|
4908
5859
|
InMemoryFingerprintStore,
|
|
4909
5860
|
InMemoryRateLimiter,
|
|
4910
5861
|
InMemoryTokenStore,
|
|
5862
|
+
MemoryClientSignalStore,
|
|
5863
|
+
MemoryRateLimitStore,
|
|
4911
5864
|
PoWManager,
|
|
4912
5865
|
RateLimitRule,
|
|
4913
5866
|
RuleEngine,
|
|
@@ -4915,15 +5868,25 @@ function createCaptchaEndpoints(options = {}) {
|
|
|
4915
5868
|
TEST_TRIGGER_USER_AGENT,
|
|
4916
5869
|
TokenManager,
|
|
4917
5870
|
TripwireRule,
|
|
5871
|
+
UpstashRateLimitStore,
|
|
4918
5872
|
WebBotAuthRule,
|
|
4919
5873
|
WebDecoy,
|
|
5874
|
+
armSiteHoneytoken,
|
|
5875
|
+
attackSignatures,
|
|
5876
|
+
botPolicy,
|
|
4920
5877
|
bots,
|
|
4921
5878
|
calculateCategoryScores,
|
|
4922
5879
|
calculateFinalScore,
|
|
4923
5880
|
classifyUserAgent,
|
|
5881
|
+
clientSignals,
|
|
5882
|
+
consoleLogger,
|
|
4924
5883
|
createAgentVerifier,
|
|
4925
5884
|
createCaptchaEndpoints,
|
|
5885
|
+
createFetchGuard,
|
|
5886
|
+
deriveAndArm,
|
|
5887
|
+
deriveKey,
|
|
4926
5888
|
filter,
|
|
5889
|
+
fromPino,
|
|
4927
5890
|
honeytoken,
|
|
4928
5891
|
injectHoneytokenLink,
|
|
4929
5892
|
ipInCidr,
|
|
@@ -4932,14 +5895,20 @@ function createCaptchaEndpoints(options = {}) {
|
|
|
4932
5895
|
isMobileUA,
|
|
4933
5896
|
isTestTriggerUserAgent,
|
|
4934
5897
|
matchUserAgent,
|
|
5898
|
+
newDecisionId,
|
|
4935
5899
|
normalizeIp,
|
|
4936
5900
|
parseUserAgent,
|
|
4937
5901
|
rateLimit,
|
|
5902
|
+
readClientSession,
|
|
4938
5903
|
readEdgeVerdict,
|
|
4939
5904
|
recommend,
|
|
4940
5905
|
resolveClientIp,
|
|
4941
5906
|
resolveSecret,
|
|
5907
|
+
ruleBlockResponse,
|
|
5908
|
+
shouldSkipPath,
|
|
5909
|
+
silentLogger,
|
|
4942
5910
|
siteHoneytoken,
|
|
4943
5911
|
tripwire,
|
|
5912
|
+
upstashRateLimitStore,
|
|
4944
5913
|
webBotAuth
|
|
4945
5914
|
});
|