@webdecoy/node 0.24.0 → 0.25.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.
@@ -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
- * 235 agents across 15 categories.
313
+ * 245 agents across 15 categories.
314
314
  */
315
315
  /**
316
316
  * Classification categories, mirroring `agents.Category` in Go.
@@ -708,6 +708,57 @@ interface WebDecoyConfig {
708
708
  */
709
709
  tracer?: Tracer;
710
710
  }
711
+ /** Options for one short-lived, property-scoped SSRF canary. */
712
+ interface SSRFCanaryOptions {
713
+ /** The application route that will perform the server-side fetch. */
714
+ routeTemplate: string;
715
+ /** Required only when an organization-wide API key is used. */
716
+ propertyId?: string;
717
+ /** Keep a controlled validation out of production threat metrics. */
718
+ test?: boolean;
719
+ }
720
+ /** A callback marker. Put callbackUrl in the controlled outbound request. */
721
+ interface SSRFCanary {
722
+ markerId: string;
723
+ callbackUrl: string;
724
+ routeTemplate: string;
725
+ expiresAt: string;
726
+ test: boolean;
727
+ }
728
+ interface SSRFInitiationReceipt {
729
+ detectionId: string;
730
+ markerId: string;
731
+ test: boolean;
732
+ }
733
+ /** Options for an inert, property-scoped decoy credential. */
734
+ interface HoneyCredentialOptions {
735
+ /** Required only when an organization-wide API key is used. */
736
+ propertyId?: string;
737
+ /** Keep a controlled validation out of production threat metrics. */
738
+ test?: boolean;
739
+ }
740
+ /** Safe material retained after the bearer has been placed in a decoy. */
741
+ interface HoneyCredentialHandle {
742
+ tokenId: string;
743
+ keyedFingerprint: string;
744
+ propertyId?: string;
745
+ expiresAt: string;
746
+ test: boolean;
747
+ }
748
+ /** The bearer is returned only at creation and is never sent to WebDecoy. */
749
+ interface CreatedHoneyCredential {
750
+ bearer: string;
751
+ handle: HoneyCredentialHandle;
752
+ }
753
+ interface HoneyCredentialReceipt {
754
+ detectionId: string;
755
+ tokenId: string;
756
+ test: boolean;
757
+ }
758
+ interface HoneyCredentialPresentationResult {
759
+ matched: boolean;
760
+ receipt?: HoneyCredentialReceipt;
761
+ }
711
762
  /**
712
763
  * TLS connection information from the request
713
764
  */
@@ -1309,6 +1360,11 @@ declare class WebDecoyClient {
1309
1360
  * Send a detection request to the ingest service
1310
1361
  */
1311
1362
  detect(request: SDKDetectionRequest): Promise<SDKDetectionResponse>;
1363
+ createSSRFCanary(options: SSRFCanaryOptions): Promise<SSRFCanary>;
1364
+ reportSSRFInitiation(canary: Pick<SSRFCanary, 'markerId' | 'routeTemplate'>): Promise<SSRFInitiationReceipt>;
1365
+ registerHoneyCredential(tokenId: string, keyedFingerprint: string, options: HoneyCredentialOptions): Promise<HoneyCredentialHandle>;
1366
+ reportHoneyCredentialEvent(event: 'retrieval' | 'presentation', handle: HoneyCredentialHandle, routeTemplate: string): Promise<HoneyCredentialReceipt>;
1367
+ private requireSuccess;
1312
1368
  /**
1313
1369
  * Send violation events to the ingest service
1314
1370
  */
@@ -1403,6 +1459,26 @@ declare class WebDecoy {
1403
1459
  * ```
1404
1460
  */
1405
1461
  detectBot(request: AgentRequestInput): Promise<AgentVerdict>;
1462
+ /** Mint a signed, single-use callback marker for an SSRF test or observation. */
1463
+ createSSRFCanary(options: SSRFCanaryOptions): Promise<SSRFCanary>;
1464
+ /**
1465
+ * Report the initiating server request immediately before the application's
1466
+ * ordinary fetch. Only the marker ID and route template are sent.
1467
+ */
1468
+ reportSSRFInitiation(canary: Pick<SSRFCanary, 'markerId' | 'routeTemplate'>): Promise<SSRFInitiationReceipt>;
1469
+ /**
1470
+ * Create an inert decoy bearer. WebDecoy receives only a tenant-scoped ID
1471
+ * and keyed fingerprint; the bearer is returned locally exactly once.
1472
+ */
1473
+ createHoneyCredential(options?: HoneyCredentialOptions): Promise<CreatedHoneyCredential>;
1474
+ /** Report that the inert credential was exposed by a decoy route. */
1475
+ reportHoneyCredentialRetrieval(handle: HoneyCredentialHandle, routeTemplate: string): Promise<HoneyCredentialReceipt>;
1476
+ /**
1477
+ * Compare a presented value locally. A mismatch—including a real
1478
+ * credential—never leaves the process and creates no WebDecoy request.
1479
+ */
1480
+ observeHoneyCredentialPresentation(candidate: string, handle: HoneyCredentialHandle, routeTemplate: string): Promise<HoneyCredentialPresentationResult>;
1481
+ private honeyCredentialFingerprint;
1406
1482
  /**
1407
1483
  * Whether this SDK instance has filter rules that need async enrichment
1408
1484
  */
@@ -1465,4 +1541,4 @@ declare class WebDecoy {
1465
1541
  destroy(): Promise<void>;
1466
1542
  }
1467
1543
 
1468
- export { consoleLogger 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 ProtectOptions as G, type RequestMetadata as H, type IPEnrichmentData as I, type RuleOutcome as J, type RuleState as K, type LocalAnalysis as L, MemoryRateLimitStore as M, type SDKDetectionRequest as N, type SDKDetectionResponse as O, type ProtectResult as P, type Span as Q, type Rule as R, type SignedAgentDirectory as S, type TripwireConfig as T, type SyncRateLimitStore as U, type TLSInfo as V, WebDecoy as W, type Tracer as X, type ViolationEvent as Y, type WebDecoyConfig as Z, classifyUserAgent as _, type RuleContext as a, deriveKey as a0, fromPino as a1, matchUserAgent as a2, newDecisionId as a3, readEdgeVerdict as a4, silentLogger as a5, 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, Decision as r, DecisionCache as s, type DecisionCacheOptions as t, type DecisionInit as u, EDGE_CLEARANCE_HEADER as v, type EdgeClass as w, type EdgeVerdict as x, type LogFields as y, type Logger as z };
1544
+ export { type SSRFInitiationReceipt 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 HoneyCredentialPresentationResult as G, type HoneyCredentialHandle as H, type HoneyCredentialReceipt as I, type IPEnrichmentData as J, type LogFields as K, type LocalAnalysis as L, type Logger as M, MemoryRateLimitStore as N, type ProtectOptions as O, type ProtectResult as P, type RequestMetadata as Q, type Rule as R, type SignedAgentDirectory as S, type TripwireConfig as T, type RuleOutcome as U, type RuleState as V, WebDecoy as W, type SDKDetectionRequest as X, type SDKDetectionResponse as Y, type SSRFCanary as Z, type SSRFCanaryOptions as _, type RuleContext as a, type Span as a0, type SyncRateLimitStore as a1, type TLSInfo as a2, type Tracer as a3, type ViolationEvent as a4, type WebDecoyConfig as a5, classifyUserAgent as a6, consoleLogger as a7, deriveKey as a8, fromPino as a9, matchUserAgent as aa, newDecisionId as ab, readEdgeVerdict as ac, silentLogger as ad, 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, EDGE_CLEARANCE_HEADER as w, type EdgeClass as x, type EdgeVerdict as y, type HoneyCredentialOptions as z };
@@ -1,4 +1,4 @@
1
- import { Z as WebDecoyConfig, H as RequestMetadata, W as WebDecoy, P as ProtectResult, K as RuleState } from './sdk-CmWmCDuZ.mjs';
1
+ import { a5 as WebDecoyConfig, Q as RequestMetadata, W as WebDecoy, P as ProtectResult, V as RuleState } from './sdk-D8Cn_xRm.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 { Z as WebDecoyConfig, H as RequestMetadata, W as WebDecoy, P as ProtectResult, K as RuleState } from './sdk-CmWmCDuZ.js';
1
+ import { a5 as WebDecoyConfig, Q as RequestMetadata, W as WebDecoy, P as ProtectResult, V as RuleState } from './sdk-D8Cn_xRm.js';
2
2
 
3
3
  /**
4
4
  * Testing utilities, for the application's test suite rather than ours.
package/dist/testing.js CHANGED
@@ -183,6 +183,87 @@ var WebDecoyClient = class {
183
183
  }
184
184
  return response.data;
185
185
  }
186
+ async createSSRFCanary(options) {
187
+ const response = await this.request("POST", "/api/v1/sdk/ssrf/markers", {
188
+ property_id: options.propertyId,
189
+ route_template: options.routeTemplate,
190
+ test: options.test === true
191
+ });
192
+ this.requireSuccess(response);
193
+ const data = response.data;
194
+ if (!data.marker_id || !data.callback_url || !data.route_template || !data.expires_at) {
195
+ throw new Error("WebDecoy returned an invalid SSRF canary");
196
+ }
197
+ return {
198
+ markerId: data.marker_id,
199
+ callbackUrl: data.callback_url,
200
+ routeTemplate: data.route_template,
201
+ expiresAt: data.expires_at,
202
+ test: data.test === true
203
+ };
204
+ }
205
+ async reportSSRFInitiation(canary) {
206
+ const response = await this.request("POST", "/api/v1/sdk/ssrf/initiate", {
207
+ marker_id: canary.markerId,
208
+ route_template: canary.routeTemplate
209
+ });
210
+ this.requireSuccess(response);
211
+ const data = response.data;
212
+ if (!data.detection_id || !data.marker_id) {
213
+ throw new Error("WebDecoy returned an invalid SSRF initiation receipt");
214
+ }
215
+ return { detectionId: data.detection_id, markerId: data.marker_id, test: data.test === true };
216
+ }
217
+ async registerHoneyCredential(tokenId, keyedFingerprint, options) {
218
+ const response = await this.request("POST", "/api/v1/sdk/honey-credentials", {
219
+ property_id: options.propertyId,
220
+ token_id: tokenId,
221
+ keyed_fingerprint: keyedFingerprint,
222
+ test: options.test === true
223
+ });
224
+ this.requireSuccess(response);
225
+ const data = response.data;
226
+ if (!data.token_id || !data.expires_at) {
227
+ throw new Error("WebDecoy returned an invalid honey credential handle");
228
+ }
229
+ return {
230
+ tokenId: data.token_id,
231
+ keyedFingerprint,
232
+ propertyId: options.propertyId,
233
+ expiresAt: data.expires_at,
234
+ test: data.test === true
235
+ };
236
+ }
237
+ async reportHoneyCredentialEvent(event, handle, routeTemplate) {
238
+ const response = await this.request("POST", `/api/v1/sdk/honey-credentials/${event}`, {
239
+ property_id: handle.propertyId,
240
+ token_id: handle.tokenId,
241
+ keyed_fingerprint: handle.keyedFingerprint,
242
+ route_template: routeTemplate
243
+ });
244
+ this.requireSuccess(response);
245
+ const data = response.data;
246
+ if (!data.detection_id || !data.token_id) {
247
+ throw new Error("WebDecoy returned an invalid honey credential receipt");
248
+ }
249
+ return { detectionId: data.detection_id, tokenId: data.token_id, test: data.test === true };
250
+ }
251
+ requireSuccess(response) {
252
+ if (response.status === 401) {
253
+ throw new Error("Invalid API key. Please check your Web Decoy configuration.");
254
+ }
255
+ if (response.status === 429) {
256
+ throw new Error("Rate limit exceeded. Please try again later.");
257
+ }
258
+ if (response.status >= 400) {
259
+ throw new Error(
260
+ response.data?.error || response.data?.message || `API request failed: HTTP ${response.status}`
261
+ );
262
+ }
263
+ if (!response.data) {
264
+ throw new Error("WebDecoy returned an empty response");
265
+ }
266
+ }
186
267
  /**
187
268
  * Send violation events to the ingest service
188
269
  */
@@ -277,6 +358,9 @@ function toWireDetectionRequest(request2) {
277
358
 
278
359
  // src/bots/registry.generated.ts
279
360
  var BOT_REGISTRY = [
361
+ { id: "speridlabsresearchcrawler", name: "SperidLabsResearchCrawler", category: "training_crawler", organization: "Speridlabs", baseScore: 75, respectsRobots: false, uaPatterns: ["speridlabsresearchcrawler"] },
362
+ { id: "abliterantbot", name: "AbliterantBot", category: "training_crawler", organization: "Abliterant", baseScore: 75, respectsRobots: false, uaPatterns: ["abliterantbot"] },
363
+ { id: "tokenfoundrybot", name: "TokenFoundryBot", category: "training_crawler", organization: "Unknown", baseScore: 75, respectsRobots: false, uaPatterns: ["tokenfoundrybot"] },
280
364
  { id: "reflectionbot", name: "Reflectionbot", category: "training_crawler", organization: "Reflection AI", baseScore: 70, respectsRobots: true, uaPatterns: ["reflectionbot"] },
281
365
  { id: "gptbot", name: "GPTBot", category: "training_crawler", organization: "OpenAI", baseScore: 85, respectsRobots: true, uaPatterns: ["gptbot"] },
282
366
  { id: "claudebot", name: "ClaudeBot", category: "training_crawler", organization: "Anthropic", baseScore: 85, respectsRobots: true, uaPatterns: ["claudebot"] },
@@ -309,6 +393,9 @@ var BOT_REGISTRY = [
309
393
  { id: "kimibot", name: "KimiBot", category: "training_crawler", organization: "Moonshot AI", baseScore: 80, respectsRobots: true, uaPatterns: ["kimibot"] },
310
394
  { id: "moonshotbot", name: "MoonshotBot", category: "training_crawler", organization: "Moonshot AI", baseScore: 80, respectsRobots: false, uaPatterns: ["moonshotbot"] },
311
395
  { id: "chatglm-spider", name: "ChatGLM-Spider", category: "training_crawler", organization: "Zhipu AI", baseScore: 80, respectsRobots: false, uaPatterns: ["chatglm-spider"] },
396
+ { id: "talarionsearchbot", name: "TalarionSearchBot", category: "ai_search_crawler", organization: "Talarion", baseScore: 65, respectsRobots: false, uaPatterns: ["talarionsearchbot"] },
397
+ { id: "unfragilebot", name: "UnfragileBot", category: "ai_search_crawler", organization: "Unfragile", baseScore: 65, respectsRobots: true, uaPatterns: ["unfragilebot"] },
398
+ { id: "aranet-searchbot", name: "Aranet-SearchBot", category: "ai_search_crawler", organization: "Aranet", baseScore: 65, respectsRobots: false, uaPatterns: ["aranet-searchbot"] },
312
399
  { id: "duckassistbot", name: "DuckAssistBot", category: "ai_search_crawler", organization: "DuckDuckGo", baseScore: 65, respectsRobots: true, uaPatterns: ["duckassistbot"] },
313
400
  { id: "sofyabot", name: "SofyaBot", category: "ai_search_crawler", organization: "Sofya", baseScore: 65, respectsRobots: true, uaPatterns: ["sofyabot"] },
314
401
  { id: "xai-searchbot", name: "xAI-SearchBot", category: "ai_search_crawler", organization: "xAI", baseScore: 70, respectsRobots: true, uaPatterns: ["xai-searchbot"] },
@@ -362,6 +449,7 @@ var BOT_REGISTRY = [
362
449
  { id: "coccocbot", name: "Coc Coc", category: "search_crawler", organization: "Coc Coc", baseScore: 35, respectsRobots: true, uaPatterns: ["coccocbot"] },
363
450
  { id: "yisouspider", name: "YisouSpider", category: "search_crawler", organization: "Alibaba", baseScore: 40, respectsRobots: true, uaPatterns: ["yisouspider"] },
364
451
  { id: "yepbot", name: "YepBot", category: "search_crawler", organization: "Ahrefs", baseScore: 30, respectsRobots: true, uaPatterns: ["yepbot"] },
452
+ { id: "crolbot", name: "CrolBot", category: "seo_crawler", organization: "cloro", baseScore: 50, respectsRobots: false, uaPatterns: ["crolbot"] },
365
453
  { id: "ahrefsbot", name: "AhrefsBot", category: "seo_crawler", organization: "Ahrefs", baseScore: 50, respectsRobots: true, uaPatterns: ["ahrefsbot", "ahrefs"] },
366
454
  { id: "semrushbot", name: "SemrushBot", category: "seo_crawler", organization: "Semrush", baseScore: 50, respectsRobots: true, uaPatterns: ["semrushbot", "semrush"] },
367
455
  { id: "mj12bot", name: "MJ12bot", category: "seo_crawler", organization: "Majestic", baseScore: 50, respectsRobots: true, uaPatterns: ["mj12bot"] },
@@ -386,6 +474,7 @@ var BOT_REGISTRY = [
386
474
  { id: "seojuice-searchbot", name: "SEOJuice-SearchBot", category: "seo_crawler", organization: "SEOJuice", baseScore: 50, respectsRobots: true, uaPatterns: ["seojuice-searchbot"] },
387
475
  { id: "trendictionbot", name: "trendictionbot", category: "seo_crawler", organization: "Talkwalker", baseScore: 50, respectsRobots: true, uaPatterns: ["trendictionbot"] },
388
476
  { id: "hubspot-crawler", name: "HubSpot Crawler", category: "seo_crawler", organization: "HubSpot", baseScore: 45, respectsRobots: true, uaPatterns: ["hubspot crawler"] },
477
+ { id: "artex", name: "ARTEX", category: "security_scanner", organization: "Open Source", baseScore: 90, respectsRobots: false, uaPatterns: ["artex-enrich/"] },
389
478
  { id: "nessus", name: "Nessus", category: "security_scanner", organization: "Tenable", baseScore: 70, respectsRobots: false, uaPatterns: ["nessus"] },
390
479
  { id: "qualys", name: "Qualys", category: "security_scanner", organization: "Qualys", baseScore: 70, respectsRobots: false, uaPatterns: ["qualys"] },
391
480
  { id: "shodan", name: "Shodan", category: "security_scanner", organization: "Shodan", baseScore: 75, respectsRobots: false, uaPatterns: ["shodan"] },
@@ -403,6 +492,7 @@ var BOT_REGISTRY = [
403
492
  { id: "cloudflare-security-center", name: "Cloudflare Security Center", category: "security_scanner", organization: "Cloudflare", baseScore: 40, respectsRobots: false, uaPatterns: ["developers.cloudflare.com/security-center"] },
404
493
  { id: "virustotal-cloud", name: "VirusTotal", category: "security_scanner", organization: "Google", baseScore: 40, respectsRobots: false, uaPatterns: ["virustotalcloud"] },
405
494
  { id: "intruder", name: "Intruder", category: "security_scanner", organization: "Intruder", baseScore: 65, respectsRobots: false, uaPatterns: ["intruder"] },
495
+ { id: "norma", name: "Norma WebFetch", category: "generic_scraper", organization: "Open Source", baseScore: 70, respectsRobots: false, uaPatterns: ["norma/"] },
406
496
  { id: "python-requests", name: "Python-Requests", category: "generic_scraper", organization: "Open Source", baseScore: 55, respectsRobots: false, uaPatterns: ["python-requests"] },
407
497
  { id: "python-urllib", name: "Python-urllib", category: "generic_scraper", organization: "Python", baseScore: 55, respectsRobots: false, uaPatterns: ["python-urllib"] },
408
498
  { id: "python", name: "Python", category: "generic_scraper", organization: "Python", baseScore: 50, respectsRobots: false, uaPatterns: ["python/"] },
@@ -485,6 +575,7 @@ var BOT_REGISTRY = [
485
575
  { id: "miniflux", name: "Miniflux", category: "feed_reader", organization: "Open Source", baseScore: 25, respectsRobots: true, uaPatterns: ["miniflux"] },
486
576
  { id: "freshrss", name: "FreshRSS", category: "feed_reader", organization: "Open Source", baseScore: 25, respectsRobots: true, uaPatterns: ["freshrss"] },
487
577
  { id: "commafeed", name: "CommaFeed", category: "feed_reader", organization: "Open Source", baseScore: 25, respectsRobots: true, uaPatterns: ["commafeed"] },
578
+ { id: "terncrawler", name: "TernCrawler", category: "commercial_scraper", organization: "Unknown", baseScore: 60, respectsRobots: false, uaPatterns: ["terncrawler"] },
488
579
  { id: "diffbot", name: "Diffbot", category: "commercial_scraper", organization: "Diffbot", baseScore: 70, respectsRobots: true, uaPatterns: ["diffbot"] },
489
580
  { id: "import-io", name: "Import.io", category: "commercial_scraper", organization: "Import.io", baseScore: 65, respectsRobots: true, uaPatterns: ["import.io"] },
490
581
  { id: "bright-data", name: "Bright Data", category: "commercial_scraper", organization: "Bright Data", baseScore: 70, respectsRobots: false, uaPatterns: ["brightdata", "luminati"] },
@@ -935,11 +1026,28 @@ function toHex(bytes) {
935
1026
  for (let i = 0; i < bytes.length; i++) hex += bytes[i].toString(16).padStart(2, "0");
936
1027
  return hex;
937
1028
  }
1029
+ async function hmacSha256Hex(secret, data) {
1030
+ const key = await crypto.subtle.importKey(
1031
+ "raw",
1032
+ encoder.encode(secret),
1033
+ { name: "HMAC", hash: "SHA-256" },
1034
+ false,
1035
+ ["sign"]
1036
+ );
1037
+ const sig = await crypto.subtle.sign("HMAC", key, encoder.encode(data));
1038
+ return toHex(new Uint8Array(sig));
1039
+ }
938
1040
  function randomHex(bytes) {
939
1041
  const buf = new Uint8Array(bytes);
940
1042
  crypto.getRandomValues(buf);
941
1043
  return toHex(buf);
942
1044
  }
1045
+ function timingSafeEqualStr(a, b) {
1046
+ if (a.length !== b.length) return false;
1047
+ let diff = 0;
1048
+ for (let i = 0; i < a.length; i++) diff |= a.charCodeAt(i) ^ b.charCodeAt(i);
1049
+ return diff === 0;
1050
+ }
943
1051
 
944
1052
  // src/rules/index.ts
945
1053
  function tripwire(config = {}) {
@@ -2329,6 +2437,62 @@ var WebDecoy = class {
2329
2437
  async detectBot(request2) {
2330
2438
  return this.getAgentVerifier().verify(request2);
2331
2439
  }
2440
+ /** Mint a signed, single-use callback marker for an SSRF test or observation. */
2441
+ async createSSRFCanary(options) {
2442
+ if (!this.client) {
2443
+ throw new Error("An apiKey is required to create an SSRF canary");
2444
+ }
2445
+ return this.client.createSSRFCanary(options);
2446
+ }
2447
+ /**
2448
+ * Report the initiating server request immediately before the application's
2449
+ * ordinary fetch. Only the marker ID and route template are sent.
2450
+ */
2451
+ async reportSSRFInitiation(canary) {
2452
+ if (!this.client) {
2453
+ throw new Error("An apiKey is required to report an SSRF initiation");
2454
+ }
2455
+ return this.client.reportSSRFInitiation(canary);
2456
+ }
2457
+ /**
2458
+ * Create an inert decoy bearer. WebDecoy receives only a tenant-scoped ID
2459
+ * and keyed fingerprint; the bearer is returned locally exactly once.
2460
+ */
2461
+ async createHoneyCredential(options = {}) {
2462
+ if (!this.client || !this.config.apiKey) {
2463
+ throw new Error("An apiKey is required to create a honey credential");
2464
+ }
2465
+ const tokenId = crypto.randomUUID();
2466
+ const bearer = `wd_hc_v1_${randomHex(32)}`;
2467
+ const keyedFingerprint = await this.honeyCredentialFingerprint(tokenId, bearer);
2468
+ const handle = await this.client.registerHoneyCredential(tokenId, keyedFingerprint, options);
2469
+ return { bearer, handle };
2470
+ }
2471
+ /** Report that the inert credential was exposed by a decoy route. */
2472
+ async reportHoneyCredentialRetrieval(handle, routeTemplate) {
2473
+ if (!this.client) {
2474
+ throw new Error("An apiKey is required to report a honey credential retrieval");
2475
+ }
2476
+ return this.client.reportHoneyCredentialEvent("retrieval", handle, routeTemplate);
2477
+ }
2478
+ /**
2479
+ * Compare a presented value locally. A mismatch—including a real
2480
+ * credential—never leaves the process and creates no WebDecoy request.
2481
+ */
2482
+ async observeHoneyCredentialPresentation(candidate, handle, routeTemplate) {
2483
+ if (!this.client || !this.config.apiKey) {
2484
+ throw new Error("An apiKey is required to observe a honey credential presentation");
2485
+ }
2486
+ const candidateFingerprint = await this.honeyCredentialFingerprint(handle.tokenId, candidate);
2487
+ if (!timingSafeEqualStr(candidateFingerprint, handle.keyedFingerprint)) {
2488
+ return { matched: false };
2489
+ }
2490
+ const receipt = await this.client.reportHoneyCredentialEvent("presentation", handle, routeTemplate);
2491
+ return { matched: true, receipt };
2492
+ }
2493
+ honeyCredentialFingerprint(tokenId, bearer) {
2494
+ return hmacSha256Hex(this.config.apiKey, `webdecoy/honey-credential/v1\0${tokenId}\0${bearer}`);
2495
+ }
2332
2496
  /**
2333
2497
  * Whether this SDK instance has filter rules that need async enrichment
2334
2498
  */
package/dist/testing.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  WebDecoy,
3
3
  silentLogger
4
- } from "./chunk-ANOZMV4M.mjs";
4
+ } from "./chunk-ABIJ7NMX.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-BUFbu1y5.mjs';
2
- import './sdk-CmWmCDuZ.mjs';
1
+ import { a as ClearanceGateOptions, C as ClearanceContext, D as DetectAndGateOptions, d as GateOutcome } from './detect-and-gate-DhKYwcQ1.mjs';
2
+ import './sdk-D8Cn_xRm.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-CU2u2EZD.js';
2
- import './sdk-CmWmCDuZ.js';
1
+ import { a as ClearanceGateOptions, C as ClearanceContext, D as DetectAndGateOptions, d as GateOutcome } from './detect-and-gate-CEpuKXTE.js';
2
+ import './sdk-D8Cn_xRm.js';
3
3
 
4
4
  /**
5
5
  * WebDecoy for Vercel Routing Middleware, any framework.