@webdecoy/node 0.30.0 → 0.32.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -11,7 +11,7 @@ import {
11
11
  resolveGateEnv,
12
12
  ruleBlockResponse,
13
13
  shouldSkipPath
14
- } from "./chunk-VPPTUL5K.mjs";
14
+ } from "./chunk-S7GDCKKB.mjs";
15
15
  import {
16
16
  ATTACK_SIGNATURE_IDS,
17
17
  AgentVerifier,
@@ -69,7 +69,7 @@ import {
69
69
  tripwire,
70
70
  upstashRateLimitStore,
71
71
  webBotAuth
72
- } from "./chunk-32TEUD5K.mjs";
72
+ } from "./chunk-CUAZKMMQ.mjs";
73
73
 
74
74
  // src/client-signals.ts
75
75
  var MemoryClientSignalStore = class {
@@ -201,6 +201,56 @@ function clientSignals(config) {
201
201
  return new ClientSignalRule(config);
202
202
  }
203
203
 
204
+ // src/node-http-guard.ts
205
+ function createNodeHttpGuard(options = {}) {
206
+ const sdk = new WebDecoy(options);
207
+ const mode = options.mode ?? "monitor";
208
+ const protectOptions = {
209
+ threshold: options.threshold,
210
+ skipLocalAnalysis: options.skipLocalAnalysis,
211
+ metadata: options.metadata
212
+ };
213
+ return {
214
+ sdk,
215
+ async check(request) {
216
+ const target = (request.url ?? "/").replace(/^https?:\/\/[^/?#]+/i, "");
217
+ const queryStart = target.indexOf("?");
218
+ const path = (queryStart === -1 ? target : target.slice(0, queryStart)) || "/";
219
+ const query = queryStart === -1 ? void 0 : target.slice(queryStart + 1);
220
+ if (shouldSkipPath(path, options.skipPaths)) return void 0;
221
+ const headers = /* @__PURE__ */ Object.create(null);
222
+ for (const [name, value] of Object.entries(request.headers)) {
223
+ if (value !== void 0) headers[name] = Array.isArray(value) ? value.join(", ") : value;
224
+ }
225
+ const peer = request.socket.remoteAddress;
226
+ const metadata = {
227
+ method: request.method ?? "GET",
228
+ path,
229
+ query,
230
+ headers,
231
+ user_agent: headers["user-agent"],
232
+ ip: resolveClientIp({ headers, peer, trustProxy: options.trustProxy }) ?? normalizeIp(peer) ?? "127.0.0.1",
233
+ timestamp: Date.now()
234
+ };
235
+ const decision = await sdk.protect(metadata, protectOptions);
236
+ if (decision.allowed || mode !== "enforce") return { decision };
237
+ const block = ruleBlockResponse(decision) ?? {
238
+ status: 403,
239
+ headers: {},
240
+ body: { error: "Forbidden", message: "Access denied by WebDecoy protection" }
241
+ };
242
+ return {
243
+ decision,
244
+ response: {
245
+ status: block.status,
246
+ headers: { "content-type": "application/json", ...block.headers },
247
+ body: { ...block.body, detection_id: decision.id }
248
+ }
249
+ };
250
+ }
251
+ };
252
+ }
253
+
204
254
  // src/detection/weights.ts
205
255
  var DEFAULT_WEIGHTS = {
206
256
  vision_ai: 0.15,
@@ -2385,6 +2435,7 @@ export {
2385
2435
  createClearanceGate,
2386
2436
  createDetectAndGate,
2387
2437
  createFetchGuard,
2438
+ createNodeHttpGuard,
2388
2439
  createOffensiveToolchainEvidence,
2389
2440
  deriveAndArm,
2390
2441
  deriveKey,
@@ -310,7 +310,7 @@ declare function readEdgeVerdict(headers: Record<string, string> | undefined): E
310
310
  * agents share User-Agent substrings, so sorting this array changes how real
311
311
  * traffic is classified.
312
312
  *
313
- * 251 agents across 15 categories.
313
+ * 277 agents across 15 categories.
314
314
  */
315
315
  /**
316
316
  * Classification categories, mirroring `agents.Category` in Go.
@@ -1287,6 +1287,12 @@ interface ViolationEvent {
1287
1287
  dryRun: boolean;
1288
1288
  /** When the violation occurred (ISO 8601) */
1289
1289
  timestamp: string;
1290
+ /**
1291
+ * Unique id for this event (a UUID), assigned by the reporter when absent.
1292
+ * Ingest stores an event once per id, so a batch that reaches it twice adds
1293
+ * no second violation and no second tripwire detection.
1294
+ */
1295
+ eventId?: string;
1290
1296
  }
1291
1297
  /**
1292
1298
  * IP enrichment data from the WebDecoy API
@@ -1464,6 +1470,8 @@ declare class ViolationReporter {
1464
1470
  private client;
1465
1471
  private buffer;
1466
1472
  private flushTimer;
1473
+ private deliveryTimer;
1474
+ private flushInterval;
1467
1475
  private maxBufferSize;
1468
1476
  private debug;
1469
1477
  private flushPromise;
@@ -1476,6 +1484,19 @@ declare class ViolationReporter {
1476
1484
  * Add violations to the buffer. Auto-flushes when buffer reaches maxBufferSize.
1477
1485
  */
1478
1486
  report(violations: ViolationEvent[]): void;
1487
+ /**
1488
+ * Give buffered events one delivery attempt before the process can exit.
1489
+ *
1490
+ * The interval above is unref'd so an idle reporter never holds a process
1491
+ * open. On its own that meant a server shut down gracefully (Express after
1492
+ * server.close(), Fastify after close(), Hono on Node) exited with its last
1493
+ * events unsent and uncounted. This one-shot timer is left ref'd, so a
1494
+ * natural exit waits at most one flush interval plus the request timeout.
1495
+ * It is not re-armed while the client is paused, so an outage cannot keep
1496
+ * the process alive.
1497
+ */
1498
+ private cancelDelivery;
1499
+ private scheduleDelivery;
1479
1500
  /** Flush the buffer, coalescing requests that arrive during an active send. */
1480
1501
  flush(): Promise<void>;
1481
1502
  private flushBatches;
@@ -1675,4 +1696,4 @@ declare class WebDecoy {
1675
1696
  destroy(): Promise<void>;
1676
1697
  }
1677
1698
 
1678
- export { type RequestMetadata as $, type AgentCategory as A, type BotRuleConfig as B, type Characteristic as C, DEFAULT_CHARACTERISTICS as D, EDGE_CLASS_HEADER as E, type FilterConfig as F, type FrameworkEvidenceObservation as G, type HoneyCredentialHandle as H, type HoneyCredentialOptions as I, type HoneyCredentialPresentationResult as J, type HoneyCredentialReceipt as K, type IPEnrichmentData as L, type LocalAnalysis as M, type LogFields as N, type Logger as O, type ProtectResult as P, MemoryRateLimitStore as Q, type Rule as R, type SignedAgentDirectory as S, type TripwireConfig as T, type OffensiveToolFamily as U, type OffensiveToolInvocation as V, WebDecoy as W, type OffensiveToolchainEvidence as X, type OffensiveToolchainEvidenceInput as Y, type OffensiveToolchainObservation as Z, type ProtectOptions as _, type RuleContext as a, type RuleOutcome as a0, type RuleState as a1, type SDKDetectionRequest as a2, type SDKDetectionResponse as a3, type SSRFCanary as a4, type SSRFCanaryOptions as a5, type SSRFInitiationReceipt as a6, type Span as a7, type SyncRateLimitStore as a8, type TLSInfo as a9, type Tracer as aa, type ViolationDeliveryStats as ab, type ViolationEvent as ac, type WebDecoyConfig as ad, classifyUserAgent as ae, consoleLogger as af, createOffensiveToolchainEvidence as ag, deriveKey as ah, fromPino as ai, matchUserAgent as aj, newDecisionId as ak, readEdgeVerdict as al, silentLogger as am, type RuleResult as b, type RuleEngineResult as c, type RateLimitConfig as d, type BotAgent as e, type BotCategory as f, type RateLimitStore as g, type RateLimitConsume as h, type RateLimitOutcome as i, type AgentVerifierOptions as j, type AgentRequestInput as k, type AgentVerdict as l, type AgentStatus as m, BOT_CATEGORIES as n, BOT_REGISTRY as o, type BotVerdict as p, type Conclusion as q, type CreatedHoneyCredential as r, Decision as s, DecisionCache as t, type DecisionCacheOptions as u, type DecisionInit as v, type DecisionMode as w, EDGE_CLEARANCE_HEADER as x, type EdgeClass as y, type EdgeVerdict as z };
1699
+ export { type OffensiveToolchainObservation as $, type AgentCategory as A, type BotRuleConfig as B, type Characteristic as C, Decision as D, EDGE_CLASS_HEADER as E, type FilterConfig as F, type EdgeClass as G, type EdgeVerdict as H, type FrameworkEvidenceObservation as I, type HoneyCredentialHandle as J, type HoneyCredentialOptions as K, type HoneyCredentialPresentationResult as L, type HoneyCredentialReceipt as M, type IPEnrichmentData as N, type LocalAnalysis as O, type ProtectResult as P, type LogFields as Q, type Rule as R, type SignedAgentDirectory as S, type TripwireConfig as T, type Logger as U, MemoryRateLimitStore as V, WebDecoy as W, type OffensiveToolFamily as X, type OffensiveToolInvocation as Y, type OffensiveToolchainEvidence as Z, type OffensiveToolchainEvidenceInput as _, type RuleContext as a, type RequestMetadata as a0, type RuleOutcome as a1, type RuleState as a2, type SDKDetectionRequest as a3, type SDKDetectionResponse as a4, type SSRFCanary as a5, type SSRFCanaryOptions as a6, type SSRFInitiationReceipt as a7, type Span as a8, type SyncRateLimitStore as a9, type TLSInfo as aa, type Tracer as ab, type ViolationDeliveryStats as ac, type ViolationEvent as ad, classifyUserAgent as ae, consoleLogger as af, createOffensiveToolchainEvidence as ag, deriveKey as ah, fromPino as ai, matchUserAgent as aj, newDecisionId as ak, readEdgeVerdict as al, silentLogger as am, type RuleResult as b, type RuleEngineResult as c, type RateLimitConfig as d, type BotAgent as e, type BotCategory as f, type RateLimitStore as g, type RateLimitConsume as h, type RateLimitOutcome as i, type WebDecoyConfig as j, type ProtectOptions as k, type AgentVerifierOptions as l, type AgentRequestInput as m, type AgentVerdict as n, type AgentStatus as o, BOT_CATEGORIES as p, BOT_REGISTRY as q, type BotVerdict as r, type Conclusion as s, type CreatedHoneyCredential as t, DEFAULT_CHARACTERISTICS as u, DecisionCache as v, type DecisionCacheOptions as w, type DecisionInit as x, type DecisionMode as y, EDGE_CLEARANCE_HEADER as z };
@@ -310,7 +310,7 @@ declare function readEdgeVerdict(headers: Record<string, string> | undefined): E
310
310
  * agents share User-Agent substrings, so sorting this array changes how real
311
311
  * traffic is classified.
312
312
  *
313
- * 251 agents across 15 categories.
313
+ * 277 agents across 15 categories.
314
314
  */
315
315
  /**
316
316
  * Classification categories, mirroring `agents.Category` in Go.
@@ -1287,6 +1287,12 @@ interface ViolationEvent {
1287
1287
  dryRun: boolean;
1288
1288
  /** When the violation occurred (ISO 8601) */
1289
1289
  timestamp: string;
1290
+ /**
1291
+ * Unique id for this event (a UUID), assigned by the reporter when absent.
1292
+ * Ingest stores an event once per id, so a batch that reaches it twice adds
1293
+ * no second violation and no second tripwire detection.
1294
+ */
1295
+ eventId?: string;
1290
1296
  }
1291
1297
  /**
1292
1298
  * IP enrichment data from the WebDecoy API
@@ -1464,6 +1470,8 @@ declare class ViolationReporter {
1464
1470
  private client;
1465
1471
  private buffer;
1466
1472
  private flushTimer;
1473
+ private deliveryTimer;
1474
+ private flushInterval;
1467
1475
  private maxBufferSize;
1468
1476
  private debug;
1469
1477
  private flushPromise;
@@ -1476,6 +1484,19 @@ declare class ViolationReporter {
1476
1484
  * Add violations to the buffer. Auto-flushes when buffer reaches maxBufferSize.
1477
1485
  */
1478
1486
  report(violations: ViolationEvent[]): void;
1487
+ /**
1488
+ * Give buffered events one delivery attempt before the process can exit.
1489
+ *
1490
+ * The interval above is unref'd so an idle reporter never holds a process
1491
+ * open. On its own that meant a server shut down gracefully (Express after
1492
+ * server.close(), Fastify after close(), Hono on Node) exited with its last
1493
+ * events unsent and uncounted. This one-shot timer is left ref'd, so a
1494
+ * natural exit waits at most one flush interval plus the request timeout.
1495
+ * It is not re-armed while the client is paused, so an outage cannot keep
1496
+ * the process alive.
1497
+ */
1498
+ private cancelDelivery;
1499
+ private scheduleDelivery;
1479
1500
  /** Flush the buffer, coalescing requests that arrive during an active send. */
1480
1501
  flush(): Promise<void>;
1481
1502
  private flushBatches;
@@ -1675,4 +1696,4 @@ declare class WebDecoy {
1675
1696
  destroy(): Promise<void>;
1676
1697
  }
1677
1698
 
1678
- export { type RequestMetadata as $, type AgentCategory as A, type BotRuleConfig as B, type Characteristic as C, DEFAULT_CHARACTERISTICS as D, EDGE_CLASS_HEADER as E, type FilterConfig as F, type FrameworkEvidenceObservation as G, type HoneyCredentialHandle as H, type HoneyCredentialOptions as I, type HoneyCredentialPresentationResult as J, type HoneyCredentialReceipt as K, type IPEnrichmentData as L, type LocalAnalysis as M, type LogFields as N, type Logger as O, type ProtectResult as P, MemoryRateLimitStore as Q, type Rule as R, type SignedAgentDirectory as S, type TripwireConfig as T, type OffensiveToolFamily as U, type OffensiveToolInvocation as V, WebDecoy as W, type OffensiveToolchainEvidence as X, type OffensiveToolchainEvidenceInput as Y, type OffensiveToolchainObservation as Z, type ProtectOptions as _, type RuleContext as a, type RuleOutcome as a0, type RuleState as a1, type SDKDetectionRequest as a2, type SDKDetectionResponse as a3, type SSRFCanary as a4, type SSRFCanaryOptions as a5, type SSRFInitiationReceipt as a6, type Span as a7, type SyncRateLimitStore as a8, type TLSInfo as a9, type Tracer as aa, type ViolationDeliveryStats as ab, type ViolationEvent as ac, type WebDecoyConfig as ad, classifyUserAgent as ae, consoleLogger as af, createOffensiveToolchainEvidence as ag, deriveKey as ah, fromPino as ai, matchUserAgent as aj, newDecisionId as ak, readEdgeVerdict as al, silentLogger as am, type RuleResult as b, type RuleEngineResult as c, type RateLimitConfig as d, type BotAgent as e, type BotCategory as f, type RateLimitStore as g, type RateLimitConsume as h, type RateLimitOutcome as i, type AgentVerifierOptions as j, type AgentRequestInput as k, type AgentVerdict as l, type AgentStatus as m, BOT_CATEGORIES as n, BOT_REGISTRY as o, type BotVerdict as p, type Conclusion as q, type CreatedHoneyCredential as r, Decision as s, DecisionCache as t, type DecisionCacheOptions as u, type DecisionInit as v, type DecisionMode as w, EDGE_CLEARANCE_HEADER as x, type EdgeClass as y, type EdgeVerdict as z };
1699
+ export { type OffensiveToolchainObservation as $, type AgentCategory as A, type BotRuleConfig as B, type Characteristic as C, Decision as D, EDGE_CLASS_HEADER as E, type FilterConfig as F, type EdgeClass as G, type EdgeVerdict as H, type FrameworkEvidenceObservation as I, type HoneyCredentialHandle as J, type HoneyCredentialOptions as K, type HoneyCredentialPresentationResult as L, type HoneyCredentialReceipt as M, type IPEnrichmentData as N, type LocalAnalysis as O, type ProtectResult as P, type LogFields as Q, type Rule as R, type SignedAgentDirectory as S, type TripwireConfig as T, type Logger as U, MemoryRateLimitStore as V, WebDecoy as W, type OffensiveToolFamily as X, type OffensiveToolInvocation as Y, type OffensiveToolchainEvidence as Z, type OffensiveToolchainEvidenceInput as _, type RuleContext as a, type RequestMetadata as a0, type RuleOutcome as a1, type RuleState as a2, type SDKDetectionRequest as a3, type SDKDetectionResponse as a4, type SSRFCanary as a5, type SSRFCanaryOptions as a6, type SSRFInitiationReceipt as a7, type Span as a8, type SyncRateLimitStore as a9, type TLSInfo as aa, type Tracer as ab, type ViolationDeliveryStats as ac, type ViolationEvent as ad, classifyUserAgent as ae, consoleLogger as af, createOffensiveToolchainEvidence as ag, deriveKey as ah, fromPino as ai, matchUserAgent as aj, newDecisionId as ak, readEdgeVerdict as al, silentLogger as am, type RuleResult as b, type RuleEngineResult as c, type RateLimitConfig as d, type BotAgent as e, type BotCategory as f, type RateLimitStore as g, type RateLimitConsume as h, type RateLimitOutcome as i, type WebDecoyConfig as j, type ProtectOptions as k, type AgentVerifierOptions as l, type AgentRequestInput as m, type AgentVerdict as n, type AgentStatus as o, BOT_CATEGORIES as p, BOT_REGISTRY as q, type BotVerdict as r, type Conclusion as s, type CreatedHoneyCredential as t, DEFAULT_CHARACTERISTICS as u, DecisionCache as v, type DecisionCacheOptions as w, type DecisionInit as x, type DecisionMode as y, EDGE_CLEARANCE_HEADER as z };
@@ -1,4 +1,4 @@
1
- import { ad as WebDecoyConfig, $ as RequestMetadata, W as WebDecoy, P as ProtectResult, a1 as RuleState } from './sdk-CJ6pmQGy.mjs';
1
+ import { j as WebDecoyConfig, a0 as RequestMetadata, W as WebDecoy, P as ProtectResult, a2 as RuleState } from './sdk-Gay_Ddzy.mjs';
2
2
 
3
3
  /**
4
4
  * Testing utilities, for the application's test suite rather than ours.
package/dist/testing.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { ad as WebDecoyConfig, $ as RequestMetadata, W as WebDecoy, P as ProtectResult, a1 as RuleState } from './sdk-CJ6pmQGy.js';
1
+ import { j as WebDecoyConfig, a0 as RequestMetadata, W as WebDecoy, P as ProtectResult, a2 as RuleState } from './sdk-Gay_Ddzy.js';
2
2
 
3
3
  /**
4
4
  * Testing utilities, for the application's test suite rather than ours.
package/dist/testing.js CHANGED
@@ -407,6 +407,8 @@ var BOT_REGISTRY = [
407
407
  { id: "kimibot", name: "KimiBot", category: "training_crawler", organization: "Moonshot AI", baseScore: 80, respectsRobots: true, uaPatterns: ["kimibot"] },
408
408
  { id: "moonshotbot", name: "MoonshotBot", category: "training_crawler", organization: "Moonshot AI", baseScore: 80, respectsRobots: false, uaPatterns: ["moonshotbot"] },
409
409
  { id: "chatglm-spider", name: "ChatGLM-Spider", category: "training_crawler", organization: "Zhipu AI", baseScore: 80, respectsRobots: false, uaPatterns: ["chatglm-spider"] },
410
+ { id: "generalretrievalbot", name: "GeneralRetrievalBot", category: "ai_search_crawler", organization: "General Retrieval", baseScore: 60, respectsRobots: true, uaPatterns: ["generalretrievalbot"] },
411
+ { id: "andi-searchbot", name: "Andi-SearchBot", category: "ai_search_crawler", organization: "Andi", baseScore: 55, respectsRobots: true, uaPatterns: ["andi-searchbot"] },
410
412
  { id: "talarionsearchbot", name: "TalarionSearchBot", category: "ai_search_crawler", organization: "Talarion", baseScore: 65, respectsRobots: false, uaPatterns: ["talarionsearchbot"] },
411
413
  { id: "unfragilebot", name: "UnfragileBot", category: "ai_search_crawler", organization: "Unfragile", baseScore: 65, respectsRobots: true, uaPatterns: ["unfragilebot"] },
412
414
  { id: "aranet-searchbot", name: "Aranet-SearchBot", category: "ai_search_crawler", organization: "Aranet", baseScore: 65, respectsRobots: false, uaPatterns: ["aranet-searchbot"] },
@@ -442,6 +444,9 @@ var BOT_REGISTRY = [
442
444
  { id: "manus-user", name: "Manus-User", category: "ai_agent", organization: "Manus", baseScore: 70, respectsRobots: false, uaPatterns: ["manus-user"] },
443
445
  { id: "multion", name: "MultiOn", category: "ai_agent", organization: "MultiOn", baseScore: 70, respectsRobots: false, uaPatterns: ["multion"] },
444
446
  { id: "opencode-user", name: "OpenCode-User", category: "ai_agent", organization: "OpenCode", baseScore: 75, respectsRobots: false, uaPatterns: ["opencode-user"] },
447
+ { id: "jambot", name: "Jambot", category: "search_crawler", organization: "Jambot", baseScore: 40, respectsRobots: true, uaPatterns: ["jambot"] },
448
+ { id: "fyndbot", name: "fyndbot", category: "search_crawler", organization: "Fynd", baseScore: 40, respectsRobots: true, uaPatterns: ["fyndbot"] },
449
+ { id: "pexelsbot", name: "PexelsBot", category: "search_crawler", organization: "pexels.de", baseScore: 40, respectsRobots: true, uaPatterns: ["pexelsbot"] },
445
450
  { id: "360spider", name: "360Spider", category: "search_crawler", organization: "Qihoo 360", baseScore: 40, respectsRobots: true, uaPatterns: ["360spider"] },
446
451
  { id: "cgmsearchbot", name: "CGMSearchBot", category: "search_crawler", organization: "CGMIMM", baseScore: 40, respectsRobots: true, uaPatterns: ["cgmsearchbot"] },
447
452
  { id: "iboubot", name: "IbouBot", category: "search_crawler", organization: "Ibou", baseScore: 30, respectsRobots: true, uaPatterns: ["iboubot", "ibou-search"] },
@@ -465,6 +470,10 @@ var BOT_REGISTRY = [
465
470
  { id: "coccocbot", name: "Coc Coc", category: "search_crawler", organization: "Coc Coc", baseScore: 35, respectsRobots: true, uaPatterns: ["coccocbot"] },
466
471
  { id: "yisouspider", name: "YisouSpider", category: "search_crawler", organization: "Alibaba", baseScore: 40, respectsRobots: true, uaPatterns: ["yisouspider"] },
467
472
  { id: "yepbot", name: "YepBot", category: "search_crawler", organization: "Ahrefs", baseScore: 30, respectsRobots: true, uaPatterns: ["yepbot"] },
473
+ { id: "agentreadyscan", name: "AgentReadyScan", category: "seo_crawler", organization: "Agent Ready", baseScore: 45, respectsRobots: true, uaPatterns: ["agentreadyscan"] },
474
+ { id: "crawlcheck", name: "CrawlCheck", category: "seo_crawler", organization: "CrawlCheck", baseScore: 45, respectsRobots: true, uaPatterns: ["crawlcheck/"] },
475
+ { id: "kostobot", name: "KostoBot", category: "seo_crawler", organization: "Kosto", baseScore: 50, respectsRobots: true, uaPatterns: ["kostobot"] },
476
+ { id: "keys-so-bot", name: "keys.so", category: "seo_crawler", organization: "Keys.so", baseScore: 50, respectsRobots: false, uaPatterns: ["keys-so-bot"] },
468
477
  { id: "crolbot", name: "CrolBot", category: "seo_crawler", organization: "cloro", baseScore: 50, respectsRobots: false, uaPatterns: ["crolbot"] },
469
478
  { id: "ahrefsbot", name: "AhrefsBot", category: "seo_crawler", organization: "Ahrefs", baseScore: 50, respectsRobots: true, uaPatterns: ["ahrefsbot", "ahrefs"] },
470
479
  { id: "semrushbot", name: "SemrushBot", category: "seo_crawler", organization: "Semrush", baseScore: 50, respectsRobots: true, uaPatterns: ["semrushbot", "semrush"] },
@@ -490,6 +499,10 @@ var BOT_REGISTRY = [
490
499
  { id: "seojuice-searchbot", name: "SEOJuice-SearchBot", category: "seo_crawler", organization: "SEOJuice", baseScore: 50, respectsRobots: true, uaPatterns: ["seojuice-searchbot"] },
491
500
  { id: "trendictionbot", name: "trendictionbot", category: "seo_crawler", organization: "Talkwalker", baseScore: 50, respectsRobots: true, uaPatterns: ["trendictionbot"] },
492
501
  { id: "hubspot-crawler", name: "HubSpot Crawler", category: "seo_crawler", organization: "HubSpot", baseScore: 45, respectsRobots: true, uaPatterns: ["hubspot crawler"] },
502
+ { id: "bitsightbot", name: "BitSightBot", category: "security_scanner", organization: "BitSight", baseScore: 70, respectsRobots: false, uaPatterns: ["bitsightbot"] },
503
+ { id: "leakix", name: "LeakIX", category: "security_scanner", organization: "LeakIX", baseScore: 75, respectsRobots: false, uaPatterns: ["l9scan"] },
504
+ { id: "modatscanner", name: "ModatScanner", category: "security_scanner", organization: "Modat", baseScore: 75, respectsRobots: false, uaPatterns: ["modatscanner"] },
505
+ { id: "umaibot", name: "UmaiBot", category: "security_scanner", organization: "UMAI", baseScore: 60, respectsRobots: true, uaPatterns: ["umaibot"] },
493
506
  { id: "artex", name: "ARTEX", category: "security_scanner", organization: "Open Source", baseScore: 90, respectsRobots: false, uaPatterns: ["artex-enrich/"] },
494
507
  { id: "nessus", name: "Nessus", category: "security_scanner", organization: "Tenable", baseScore: 70, respectsRobots: false, uaPatterns: ["nessus"] },
495
508
  { id: "qualys", name: "Qualys", category: "security_scanner", organization: "Qualys", baseScore: 70, respectsRobots: false, uaPatterns: ["qualys"] },
@@ -544,6 +557,8 @@ var BOT_REGISTRY = [
544
557
  { id: "wayback", name: "Wayback Machine", category: "archiver", organization: "Internet Archive", baseScore: 25, respectsRobots: true, uaPatterns: ["wayback"] },
545
558
  { id: "heritrix", name: "Heritrix", category: "archiver", organization: "Internet Archive", baseScore: 30, respectsRobots: true, uaPatterns: ["heritrix"] },
546
559
  { id: "brozzler", name: "Brozzler", category: "archiver", organization: "Internet Archive", baseScore: 30, respectsRobots: true, uaPatterns: ["brozzler"] },
560
+ { id: "findfiles-linkchecker", name: "FindFiles.net LinkChecker", category: "fetcher", organization: "FindFiles.net", baseScore: 30, respectsRobots: true, uaPatterns: ["findfiles.net-linkchecker"] },
561
+ { id: "hstspreload-bot", name: "hstspreload-bot", category: "fetcher", organization: "Chromium", baseScore: 20, respectsRobots: false, uaPatterns: ["hstspreload-bot"] },
547
562
  { id: "facebookexternalhit", name: "Facebook", category: "fetcher", organization: "Meta", baseScore: 25, respectsRobots: true, uaPatterns: ["facebookexternalhit"] },
548
563
  { id: "facebot", name: "Facebot", category: "fetcher", organization: "Meta", baseScore: 25, respectsRobots: true, uaPatterns: ["facebot"] },
549
564
  { id: "twitterbot", name: "Twitterbot", category: "fetcher", organization: "X Corp", baseScore: 25, respectsRobots: true, uaPatterns: ["twitterbot"] },
@@ -568,6 +583,7 @@ var BOT_REGISTRY = [
568
583
  { id: "libwww-perl", name: "libwww-perl", category: "fetcher", organization: "Perl", baseScore: 50, respectsRobots: false, uaPatterns: ["libwww-perl"] },
569
584
  { id: "lwp", name: "LWP", category: "fetcher", organization: "Perl", baseScore: 50, respectsRobots: false, uaPatterns: ["lwp-"] },
570
585
  { id: "httrack", name: "HTTrack", category: "fetcher", organization: "Open Source", baseScore: 60, respectsRobots: true, uaPatterns: ["httrack"] },
586
+ { id: "truetierbot", name: "TrueTierBot", category: "monitoring", organization: "TrueTier", baseScore: 25, respectsRobots: true, uaPatterns: ["truetierbot"] },
571
587
  { id: "webdecoybot", name: "WebDecoyBot", category: "monitoring", organization: "WebDecoy", baseScore: 5, respectsRobots: true, uaPatterns: ["webdecoybot"] },
572
588
  { id: "uptimerobot", name: "UptimeRobot", category: "monitoring", organization: "UptimeRobot", baseScore: 20, respectsRobots: true, uaPatterns: ["uptimerobot"] },
573
589
  { id: "pingdom", name: "Pingdom", category: "monitoring", organization: "SolarWinds", baseScore: 20, respectsRobots: true, uaPatterns: ["pingdom"] },
@@ -581,6 +597,9 @@ var BOT_REGISTRY = [
581
597
  { id: "nodeping", name: "NodePing", category: "monitoring", organization: "NodePing", baseScore: 20, respectsRobots: true, uaPatterns: ["nodeping"] },
582
598
  { id: "gtmetrix", name: "GTmetrix", category: "monitoring", organization: "GTmetrix", baseScore: 20, respectsRobots: true, uaPatterns: ["gtmetrix"] },
583
599
  { id: "chrome-lighthouse", name: "Lighthouse", category: "monitoring", organization: "Google", baseScore: 20, respectsRobots: true, uaPatterns: ["chrome-lighthouse", "google page speed"] },
600
+ { id: "andifeedbot", name: "AndiFeedBot", category: "feed_reader", organization: "Andi", baseScore: 30, respectsRobots: true, uaPatterns: ["andifeedbot"] },
601
+ { id: "librarianbot", name: "LibrarianBot", category: "feed_reader", organization: "GenioFab", baseScore: 30, respectsRobots: true, uaPatterns: ["librarianbot"] },
602
+ { id: "oursignal", name: "oursignal", category: "feed_reader", organization: "oursignal", baseScore: 25, respectsRobots: true, uaPatterns: ["oursignal/"] },
584
603
  { id: "feedly", name: "Feedly", category: "feed_reader", organization: "Feedly", baseScore: 25, respectsRobots: true, uaPatterns: ["feedly"] },
585
604
  { id: "livelapbot", name: "LivelapBot", category: "feed_reader", organization: "Livelap", baseScore: 30, respectsRobots: true, uaPatterns: ["livelapbot"] },
586
605
  { id: "feedfetcher-google", name: "Feedfetcher-Google", category: "feed_reader", organization: "Google", baseScore: 25, respectsRobots: true, uaPatterns: ["feedfetcher"] },
@@ -591,6 +610,12 @@ var BOT_REGISTRY = [
591
610
  { id: "miniflux", name: "Miniflux", category: "feed_reader", organization: "Open Source", baseScore: 25, respectsRobots: true, uaPatterns: ["miniflux"] },
592
611
  { id: "freshrss", name: "FreshRSS", category: "feed_reader", organization: "Open Source", baseScore: 25, respectsRobots: true, uaPatterns: ["freshrss"] },
593
612
  { id: "commafeed", name: "CommaFeed", category: "feed_reader", organization: "Open Source", baseScore: 25, respectsRobots: true, uaPatterns: ["commafeed"] },
613
+ { id: "tphotobot", name: "tphotobot", category: "commercial_scraper", organization: "Estidraft", baseScore: 50, respectsRobots: true, uaPatterns: ["tphotobot"] },
614
+ { id: "bangobot", name: "BangoBot", category: "commercial_scraper", organization: "Bango API", baseScore: 55, respectsRobots: false, uaPatterns: ["bangobot"] },
615
+ { id: "kamatabot", name: "KamataBot", category: "commercial_scraper", organization: "Kamata", baseScore: 55, respectsRobots: true, uaPatterns: ["kamatabot"] },
616
+ { id: "boehmbot", name: "BoehmBot", category: "commercial_scraper", organization: "b\xF6hm systems", baseScore: 50, respectsRobots: true, uaPatterns: ["boehmbot"] },
617
+ { id: "pipericbot", name: "PipericBot", category: "commercial_scraper", organization: "Piperic", baseScore: 55, respectsRobots: true, uaPatterns: ["pipericbot"] },
618
+ { id: "pandalytics", name: "Pandalytics", category: "commercial_scraper", organization: "Domainsbot", baseScore: 50, respectsRobots: true, uaPatterns: ["pandalytics"] },
594
619
  { id: "spiderling", name: "SpiderLing", category: "commercial_scraper", organization: "Lexical Computing", baseScore: 55, respectsRobots: true, uaPatterns: ["spiderling", "sketchengine"] },
595
620
  { id: "netapi", name: "NetAPI Bot", category: "commercial_scraper", organization: "NetAPI", baseScore: 50, respectsRobots: true, uaPatterns: ["netapi/"] },
596
621
  { id: "anticlonebot", name: "AntiCloneBot", category: "commercial_scraper", organization: "AntiClone", baseScore: 45, respectsRobots: true, uaPatterns: ["anticlonebot"] },
@@ -608,6 +633,7 @@ var BOT_REGISTRY = [
608
633
  { id: "apify", name: "Apify", category: "commercial_scraper", organization: "Apify", baseScore: 65, respectsRobots: true, uaPatterns: ["apify"] },
609
634
  { id: "crawlbase", name: "Crawlbase", category: "commercial_scraper", organization: "Crawlbase", baseScore: 65, respectsRobots: true, uaPatterns: ["crawlbase"] },
610
635
  { id: "webscrapingapi", name: "WebScrapingAPI", category: "commercial_scraper", organization: "WebScrapingAPI", baseScore: 65, respectsRobots: true, uaPatterns: ["webscrapingapi"] },
636
+ { id: "andi-user", name: "Andi-User", category: "ai_assistant", organization: "Andi", baseScore: 60, respectsRobots: false, uaPatterns: ["andi-user"] },
611
637
  { id: "chatgpt-user", name: "ChatGPT-User", category: "ai_assistant", organization: "OpenAI", baseScore: 85, respectsRobots: true, uaPatterns: ["chatgpt-user"] },
612
638
  { id: "perplexity-user", name: "Perplexity-User", category: "ai_assistant", organization: "Perplexity AI", baseScore: 75, respectsRobots: false, uaPatterns: ["perplexity-user"] },
613
639
  { id: "mistralai-user", name: "MistralAI-User", category: "ai_assistant", organization: "Mistral AI", baseScore: 75, respectsRobots: true, uaPatterns: ["mistralai-user"] },
@@ -1089,6 +1115,7 @@ var ViolationReporter = class {
1089
1115
  this.maxBufferSize = config.maxBufferSize ?? 50;
1090
1116
  this.debug = config.debug ?? false;
1091
1117
  const flushInterval = config.flushInterval ?? 5e3;
1118
+ this.flushInterval = flushInterval;
1092
1119
  this.flushTimer = setInterval(() => void this.flush(), flushInterval);
1093
1120
  if (this.flushTimer.unref) {
1094
1121
  this.flushTimer.unref();
@@ -1098,7 +1125,9 @@ var ViolationReporter = class {
1098
1125
  * Add violations to the buffer. Auto-flushes when buffer reaches maxBufferSize.
1099
1126
  */
1100
1127
  report(violations) {
1101
- this.buffer.push(...violations);
1128
+ for (const violation of violations) {
1129
+ this.buffer.push(violation.eventId ? violation : { ...violation, eventId: crypto.randomUUID() });
1130
+ }
1102
1131
  if (this.buffer.length > MAX_BUFFERED_VIOLATIONS) {
1103
1132
  const overflow = this.buffer.length - MAX_BUFFERED_VIOLATIONS;
1104
1133
  this.buffer.splice(0, overflow);
@@ -1107,8 +1136,32 @@ var ViolationReporter = class {
1107
1136
  if (this.buffer.length >= this.maxBufferSize) {
1108
1137
  this.flush().catch(() => {
1109
1138
  });
1139
+ } else {
1140
+ this.scheduleDelivery();
1110
1141
  }
1111
1142
  }
1143
+ /**
1144
+ * Give buffered events one delivery attempt before the process can exit.
1145
+ *
1146
+ * The interval above is unref'd so an idle reporter never holds a process
1147
+ * open. On its own that meant a server shut down gracefully (Express after
1148
+ * server.close(), Fastify after close(), Hono on Node) exited with its last
1149
+ * events unsent and uncounted. This one-shot timer is left ref'd, so a
1150
+ * natural exit waits at most one flush interval plus the request timeout.
1151
+ * It is not re-armed while the client is paused, so an outage cannot keep
1152
+ * the process alive.
1153
+ */
1154
+ cancelDelivery() {
1155
+ clearTimeout(this.deliveryTimer);
1156
+ this.deliveryTimer = void 0;
1157
+ }
1158
+ scheduleDelivery() {
1159
+ if (this.deliveryTimer) return;
1160
+ this.deliveryTimer = setTimeout(() => {
1161
+ this.deliveryTimer = void 0;
1162
+ void this.flush();
1163
+ }, this.flushInterval);
1164
+ }
1112
1165
  /** Flush the buffer, coalescing requests that arrive during an active send. */
1113
1166
  flush() {
1114
1167
  if (this.queuedFlush) return this.queuedFlush;
@@ -1124,6 +1177,7 @@ var ViolationReporter = class {
1124
1177
  const size = this.buffer.length;
1125
1178
  this.flushPromise = Promise.resolve().then(() => this.flushBatches(size)).finally(() => {
1126
1179
  this.flushPromise = void 0;
1180
+ if (this.buffer.length === 0) this.cancelDelivery();
1127
1181
  });
1128
1182
  return this.flushPromise;
1129
1183
  }
@@ -1153,6 +1207,7 @@ var ViolationReporter = class {
1153
1207
  /** Stop the timer and give remaining events one final flush. */
1154
1208
  async destroy() {
1155
1209
  clearInterval(this.flushTimer);
1210
+ this.cancelDelivery();
1156
1211
  if (this.flushPromise) await this.flushPromise;
1157
1212
  await this.flush();
1158
1213
  this.droppedEvents += this.buffer.length;
package/dist/testing.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  WebDecoy,
3
3
  silentLogger
4
- } from "./chunk-32TEUD5K.mjs";
4
+ } from "./chunk-CUAZKMMQ.mjs";
5
5
 
6
6
  // src/testing.ts
7
7
  function request(over = {}) {
package/dist/vercel.d.mts CHANGED
@@ -1,5 +1,5 @@
1
- import { a as ClearanceGateOptions, C as ClearanceContext, D as DetectAndGateOptions, d as GateOutcome } from './detect-and-gate-BNq26N9d.mjs';
2
- import './sdk-CJ6pmQGy.mjs';
1
+ import { a as ClearanceGateOptions, C as ClearanceContext, D as DetectAndGateOptions, d as GateOutcome } from './detect-and-gate-DtE2PPTM.mjs';
2
+ import './sdk-Gay_Ddzy.mjs';
3
3
 
4
4
  /**
5
5
  * WebDecoy for Vercel Routing Middleware, any framework.
package/dist/vercel.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { a as ClearanceGateOptions, C as ClearanceContext, D as DetectAndGateOptions, d as GateOutcome } from './detect-and-gate-Dnfo2t3B.js';
2
- import './sdk-CJ6pmQGy.js';
1
+ import { a as ClearanceGateOptions, C as ClearanceContext, D as DetectAndGateOptions, d as GateOutcome } from './detect-and-gate-neuBgxUB.js';
2
+ import './sdk-Gay_Ddzy.js';
3
3
 
4
4
  /**
5
5
  * WebDecoy for Vercel Routing Middleware, any framework.