@webdecoy/node 0.25.1 → 0.26.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 +37 -1
- package/dist/{chunk-ABIJ7NMX.mjs → chunk-2SIFEEYE.mjs} +167 -13
- package/dist/{chunk-5VMXAH64.mjs → chunk-CFJ7R2CG.mjs} +52 -52
- package/dist/{detect-and-gate-CEpuKXTE.d.ts → detect-and-gate-Ay294Lr2.d.ts} +1 -1
- package/dist/{detect-and-gate-DhKYwcQ1.d.mts → detect-and-gate-NBeqXdH6.d.mts} +1 -1
- package/dist/index.d.mts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +219 -64
- package/dist/index.mjs +4 -2
- package/dist/{sdk-D8Cn_xRm.d.mts → sdk-Dh8Jj07-.d.mts} +87 -7
- package/dist/{sdk-D8Cn_xRm.d.ts → sdk-Dh8Jj07-.d.ts} +87 -7
- package/dist/testing.d.mts +1 -1
- package/dist/testing.d.ts +1 -1
- package/dist/testing.js +170 -13
- package/dist/testing.mjs +1 -1
- package/dist/vercel.d.mts +2 -2
- package/dist/vercel.d.ts +2 -2
- package/dist/vercel.js +221 -64
- package/dist/vercel.mjs +2 -2
- package/package.json +1 -1
package/dist/testing.js
CHANGED
|
@@ -181,7 +181,11 @@ var WebDecoyClient = class {
|
|
|
181
181
|
}
|
|
182
182
|
throw new Error(`API request failed: HTTP ${response.status}`);
|
|
183
183
|
}
|
|
184
|
-
|
|
184
|
+
const detection = response.data;
|
|
185
|
+
if (request2.decision_mode === "unified_v1" && (detection?.decision_mode !== "unified_v1" || !(typeof detection.unified_score === "number" && Number.isInteger(detection.unified_score) && detection.unified_score >= 0 && detection.unified_score <= 100) || !(Number.isInteger(detection.confidence) && detection.confidence >= 0 && detection.confidence <= 100) || !["allow", "challenge", "block"].includes(detection.decision) || typeof detection.detection_id !== "string" || !detection.detection_id)) {
|
|
186
|
+
throw new Error("WebDecoy did not return a valid unified decision");
|
|
187
|
+
}
|
|
188
|
+
return detection;
|
|
185
189
|
}
|
|
186
190
|
async createSSRFCanary(options) {
|
|
187
191
|
const response = await this.request("POST", "/api/v1/sdk/ssrf/markers", {
|
|
@@ -358,6 +362,7 @@ function toWireDetectionRequest(request2) {
|
|
|
358
362
|
|
|
359
363
|
// src/bots/registry.generated.ts
|
|
360
364
|
var BOT_REGISTRY = [
|
|
365
|
+
{ id: "hunyuan", name: "Hunyuan", category: "training_crawler", organization: "Unknown", baseScore: 70, respectsRobots: false, uaPatterns: ["hunyuan/"] },
|
|
361
366
|
{ id: "speridlabsresearchcrawler", name: "SperidLabsResearchCrawler", category: "training_crawler", organization: "Speridlabs", baseScore: 75, respectsRobots: false, uaPatterns: ["speridlabsresearchcrawler"] },
|
|
362
367
|
{ id: "abliterantbot", name: "AbliterantBot", category: "training_crawler", organization: "Abliterant", baseScore: 75, respectsRobots: false, uaPatterns: ["abliterantbot"] },
|
|
363
368
|
{ id: "tokenfoundrybot", name: "TokenFoundryBot", category: "training_crawler", organization: "Unknown", baseScore: 75, respectsRobots: false, uaPatterns: ["tokenfoundrybot"] },
|
|
@@ -428,6 +433,8 @@ var BOT_REGISTRY = [
|
|
|
428
433
|
{ id: "manus-user", name: "Manus-User", category: "ai_agent", organization: "Manus", baseScore: 70, respectsRobots: false, uaPatterns: ["manus-user"] },
|
|
429
434
|
{ id: "multion", name: "MultiOn", category: "ai_agent", organization: "MultiOn", baseScore: 70, respectsRobots: false, uaPatterns: ["multion"] },
|
|
430
435
|
{ id: "opencode-user", name: "OpenCode-User", category: "ai_agent", organization: "OpenCode", baseScore: 75, respectsRobots: false, uaPatterns: ["opencode-user"] },
|
|
436
|
+
{ id: "360spider", name: "360Spider", category: "search_crawler", organization: "Qihoo 360", baseScore: 40, respectsRobots: true, uaPatterns: ["360spider"] },
|
|
437
|
+
{ id: "cgmsearchbot", name: "CGMSearchBot", category: "search_crawler", organization: "CGMIMM", baseScore: 40, respectsRobots: true, uaPatterns: ["cgmsearchbot"] },
|
|
431
438
|
{ id: "iboubot", name: "IbouBot", category: "search_crawler", organization: "Ibou", baseScore: 30, respectsRobots: true, uaPatterns: ["iboubot", "ibou-search"] },
|
|
432
439
|
{ id: "googlebot", name: "Googlebot", category: "search_crawler", organization: "Google", baseScore: 30, respectsRobots: true, uaPatterns: ["googlebot"] },
|
|
433
440
|
{ id: "google-inspectiontool", name: "Google-InspectionTool", category: "search_crawler", organization: "Google", baseScore: 30, respectsRobots: true, uaPatterns: ["google-inspectiontool"] },
|
|
@@ -575,6 +582,9 @@ var BOT_REGISTRY = [
|
|
|
575
582
|
{ id: "miniflux", name: "Miniflux", category: "feed_reader", organization: "Open Source", baseScore: 25, respectsRobots: true, uaPatterns: ["miniflux"] },
|
|
576
583
|
{ id: "freshrss", name: "FreshRSS", category: "feed_reader", organization: "Open Source", baseScore: 25, respectsRobots: true, uaPatterns: ["freshrss"] },
|
|
577
584
|
{ id: "commafeed", name: "CommaFeed", category: "feed_reader", organization: "Open Source", baseScore: 25, respectsRobots: true, uaPatterns: ["commafeed"] },
|
|
585
|
+
{ id: "spiderling", name: "SpiderLing", category: "commercial_scraper", organization: "Lexical Computing", baseScore: 55, respectsRobots: true, uaPatterns: ["spiderling", "sketchengine"] },
|
|
586
|
+
{ id: "netapi", name: "NetAPI Bot", category: "commercial_scraper", organization: "NetAPI", baseScore: 50, respectsRobots: true, uaPatterns: ["netapi/"] },
|
|
587
|
+
{ id: "anticlonebot", name: "AntiCloneBot", category: "commercial_scraper", organization: "AntiClone", baseScore: 45, respectsRobots: true, uaPatterns: ["anticlonebot"] },
|
|
578
588
|
{ id: "terncrawler", name: "TernCrawler", category: "commercial_scraper", organization: "Unknown", baseScore: 60, respectsRobots: false, uaPatterns: ["terncrawler"] },
|
|
579
589
|
{ id: "diffbot", name: "Diffbot", category: "commercial_scraper", organization: "Diffbot", baseScore: 70, respectsRobots: true, uaPatterns: ["diffbot"] },
|
|
580
590
|
{ id: "import-io", name: "Import.io", category: "commercial_scraper", organization: "Import.io", baseScore: 65, respectsRobots: true, uaPatterns: ["import.io"] },
|
|
@@ -1026,6 +1036,10 @@ function toHex(bytes) {
|
|
|
1026
1036
|
for (let i = 0; i < bytes.length; i++) hex += bytes[i].toString(16).padStart(2, "0");
|
|
1027
1037
|
return hex;
|
|
1028
1038
|
}
|
|
1039
|
+
async function sha256Hex(data) {
|
|
1040
|
+
const digest2 = await crypto.subtle.digest("SHA-256", encoder.encode(data));
|
|
1041
|
+
return toHex(new Uint8Array(digest2));
|
|
1042
|
+
}
|
|
1029
1043
|
async function hmacSha256Hex(secret, data) {
|
|
1030
1044
|
const key = await crypto.subtle.importKey(
|
|
1031
1045
|
"raw",
|
|
@@ -2226,6 +2240,100 @@ function isTestTriggerUserAgent(userAgent) {
|
|
|
2226
2240
|
return userAgent.trimStart().toLowerCase().startsWith(TEST_TRIGGER_UA_PREFIX.toLowerCase());
|
|
2227
2241
|
}
|
|
2228
2242
|
|
|
2243
|
+
// src/offensive-toolchain.ts
|
|
2244
|
+
var TOOLCHAIN_REGISTRY_REVISION = 1;
|
|
2245
|
+
var FRAMEWORK_REGISTRY_REVISION = 5;
|
|
2246
|
+
var reviewedTools = Object.freeze({
|
|
2247
|
+
nmap_scan: "network_reconnaissance",
|
|
2248
|
+
nmap_advanced_scan: "network_reconnaissance",
|
|
2249
|
+
masscan_scan: "network_reconnaissance",
|
|
2250
|
+
nuclei_scan: "vulnerability_scanning",
|
|
2251
|
+
sqlmap_scan: "injection_testing",
|
|
2252
|
+
metasploit_run: "exploitation"
|
|
2253
|
+
});
|
|
2254
|
+
async function createOffensiveToolchainEvidence(input) {
|
|
2255
|
+
const sensor = input.sensor.trim();
|
|
2256
|
+
if (!/^[a-z0-9][a-z0-9_.-]{0,127}$/i.test(sensor)) {
|
|
2257
|
+
throw new Error("sensor must be a 1-128 character stable identifier");
|
|
2258
|
+
}
|
|
2259
|
+
if (!input.runId || input.runId.length > 1024) {
|
|
2260
|
+
throw new Error("runId must be 1-1024 characters");
|
|
2261
|
+
}
|
|
2262
|
+
if (input.correlationSecret.length < 32 || input.correlationSecret.length > 4096) {
|
|
2263
|
+
throw new Error("correlationSecret must be 32-4096 characters");
|
|
2264
|
+
}
|
|
2265
|
+
if (!Array.isArray(input.invocations) || input.invocations.length === 0 || input.invocations.length > 256) {
|
|
2266
|
+
throw new Error("invocations must contain 1-256 entries");
|
|
2267
|
+
}
|
|
2268
|
+
const sequence = [];
|
|
2269
|
+
let redactedArgumentCount = 0;
|
|
2270
|
+
let droppedToolCount = 0;
|
|
2271
|
+
for (const invocation of input.invocations) {
|
|
2272
|
+
if (!invocation.tool || invocation.tool.length > 128) {
|
|
2273
|
+
throw new Error("tool must be 1-128 characters");
|
|
2274
|
+
}
|
|
2275
|
+
const redacted = invocation.redactedArgumentCount ?? 0;
|
|
2276
|
+
if (!Number.isInteger(redacted) || redacted < 0 || redacted > 1024) {
|
|
2277
|
+
throw new Error("redactedArgumentCount must be an integer from 0 through 1024");
|
|
2278
|
+
}
|
|
2279
|
+
const family = reviewedTools[invocation.tool.trim().toLowerCase()];
|
|
2280
|
+
if (!family) {
|
|
2281
|
+
droppedToolCount++;
|
|
2282
|
+
continue;
|
|
2283
|
+
}
|
|
2284
|
+
sequence.push(family);
|
|
2285
|
+
redactedArgumentCount += redacted;
|
|
2286
|
+
if (redactedArgumentCount > 1024) throw new Error("redacted argument count exceeds 1024");
|
|
2287
|
+
}
|
|
2288
|
+
if (sequence.length === 0) throw new Error("no reviewed offensive tools were observed");
|
|
2289
|
+
const families = [...new Set(sequence)].sort();
|
|
2290
|
+
const offensive_toolchain = {
|
|
2291
|
+
schema_version: 1,
|
|
2292
|
+
registry_revision: TOOLCHAIN_REGISTRY_REVISION,
|
|
2293
|
+
plane: "model_api",
|
|
2294
|
+
sensor,
|
|
2295
|
+
run_correlation_id: await hmacSha256Hex(input.correlationSecret, input.runId),
|
|
2296
|
+
tool_families: families,
|
|
2297
|
+
invocation_count: sequence.length,
|
|
2298
|
+
family_set_sha256: await fingerprintIDs(families),
|
|
2299
|
+
sequence_sha256: await sha256Hex(sequence.join("\n")),
|
|
2300
|
+
redacted_argument_count: redactedArgumentCount,
|
|
2301
|
+
dropped_tool_count: droppedToolCount
|
|
2302
|
+
};
|
|
2303
|
+
const evidence = { offensive_toolchain };
|
|
2304
|
+
if (input.orchestrator === "hexstrike_ai") {
|
|
2305
|
+
evidence.framework_evidence = await hexStrikeEvidence();
|
|
2306
|
+
}
|
|
2307
|
+
return evidence;
|
|
2308
|
+
}
|
|
2309
|
+
async function hexStrikeEvidence() {
|
|
2310
|
+
const family = {
|
|
2311
|
+
family_id: "orchestrator_identity",
|
|
2312
|
+
count: 1,
|
|
2313
|
+
sha256: await fingerprintIDs(["hexstrike-ai-mcp"])
|
|
2314
|
+
};
|
|
2315
|
+
return {
|
|
2316
|
+
schema_version: 1,
|
|
2317
|
+
registry_revision: FRAMEWORK_REGISTRY_REVISION,
|
|
2318
|
+
framework: "hexstrike_ai",
|
|
2319
|
+
plane: "model_api",
|
|
2320
|
+
evidence: [family],
|
|
2321
|
+
observation_sha256: await fingerprintEvidence([family])
|
|
2322
|
+
};
|
|
2323
|
+
}
|
|
2324
|
+
async function fingerprintIDs(values) {
|
|
2325
|
+
const canonical = [
|
|
2326
|
+
...new Set(values.map((value) => value.trim().toLowerCase()).filter(Boolean))
|
|
2327
|
+
].sort();
|
|
2328
|
+
return sha256Hex(canonical.join("\n"));
|
|
2329
|
+
}
|
|
2330
|
+
async function fingerprintEvidence(evidence) {
|
|
2331
|
+
const canonical = evidence.map(
|
|
2332
|
+
(value) => `${value.family_id.trim().toLowerCase()}\0${value.count}\0${value.sha256.trim().toLowerCase()}`
|
|
2333
|
+
);
|
|
2334
|
+
return fingerprintIDs(canonical);
|
|
2335
|
+
}
|
|
2336
|
+
|
|
2229
2337
|
// src/sdk.ts
|
|
2230
2338
|
var WebDecoy = class {
|
|
2231
2339
|
constructor(config = {}) {
|
|
@@ -2248,7 +2356,8 @@ var WebDecoy = class {
|
|
|
2248
2356
|
apiKey: config.apiKey,
|
|
2249
2357
|
apiUrl: config.apiUrl || "https://in.webdecoy.com",
|
|
2250
2358
|
enableTLSFingerprinting: config.enableTLSFingerprinting ?? true,
|
|
2251
|
-
|
|
2359
|
+
decisionMode: config.decisionMode ?? "legacy",
|
|
2360
|
+
threatScoreThreshold: config.threatScoreThreshold,
|
|
2252
2361
|
timeout: config.timeout ?? 5e3,
|
|
2253
2362
|
debug: config.debug ?? false,
|
|
2254
2363
|
tlsRejectUnauthorized: config.tlsRejectUnauthorized ?? true,
|
|
@@ -2270,7 +2379,7 @@ var WebDecoy = class {
|
|
|
2270
2379
|
}
|
|
2271
2380
|
this.webBotAuthOptions = config.webBotAuth;
|
|
2272
2381
|
this.characteristics = config.characteristics ?? DEFAULT_CHARACTERISTICS;
|
|
2273
|
-
this.decisionCache = config.decisionCache === false ? null : new DecisionCache(config.decisionCache ?? {});
|
|
2382
|
+
this.decisionCache = config.decisionCache === false || this.config.decisionMode === "unified_v1" ? null : new DecisionCache(config.decisionCache ?? {});
|
|
2274
2383
|
const rules = config.rules ?? [tripwire()];
|
|
2275
2384
|
if (rules.length > 0) {
|
|
2276
2385
|
this.ruleEngine = new RuleEngine(rules);
|
|
@@ -2493,6 +2602,38 @@ var WebDecoy = class {
|
|
|
2493
2602
|
honeyCredentialFingerprint(tokenId, bearer) {
|
|
2494
2603
|
return hmacSha256Hex(this.config.apiKey, `webdecoy/honey-credential/v1\0${tokenId}\0${bearer}`);
|
|
2495
2604
|
}
|
|
2605
|
+
/**
|
|
2606
|
+
* Report a privacy-bounded model-plane tool run. The helper sends only
|
|
2607
|
+
* reviewed generic families, counts, and digests; it never sends prompts,
|
|
2608
|
+
* arguments, results, credentials, targets, or the raw run ID.
|
|
2609
|
+
*/
|
|
2610
|
+
async reportOffensiveToolchain(input) {
|
|
2611
|
+
if (!this.client) {
|
|
2612
|
+
throw new Error("An apiKey is required to report an offensive toolchain");
|
|
2613
|
+
}
|
|
2614
|
+
const evidence = await createOffensiveToolchainEvidence(input);
|
|
2615
|
+
return this.client.detect({
|
|
2616
|
+
request_metadata: {
|
|
2617
|
+
method: "MODEL",
|
|
2618
|
+
path: "/model-toolchain",
|
|
2619
|
+
// The existing SDK route requires an address. Model-plane evidence has
|
|
2620
|
+
// no target client IP, so use the unspecified address rather than
|
|
2621
|
+
// inventing an identity that could enter actor correlation.
|
|
2622
|
+
ip: "0.0.0.0",
|
|
2623
|
+
headers: {},
|
|
2624
|
+
timestamp: Date.now()
|
|
2625
|
+
},
|
|
2626
|
+
local_analysis: {
|
|
2627
|
+
suspicious_headers: false,
|
|
2628
|
+
missing_sec_ch_ua: false,
|
|
2629
|
+
datacenter_ip: false,
|
|
2630
|
+
local_score: 0,
|
|
2631
|
+
needs_verification: true,
|
|
2632
|
+
flags: ["model_plane_toolchain"]
|
|
2633
|
+
},
|
|
2634
|
+
...evidence
|
|
2635
|
+
});
|
|
2636
|
+
}
|
|
2496
2637
|
/**
|
|
2497
2638
|
* Whether this SDK instance has filter rules that need async enrichment
|
|
2498
2639
|
*/
|
|
@@ -2519,7 +2660,8 @@ var WebDecoy = class {
|
|
|
2519
2660
|
this.referralCounter?.observe(metadata);
|
|
2520
2661
|
const span = startSpan(this.tracer, "webdecoy.protect");
|
|
2521
2662
|
try {
|
|
2522
|
-
|
|
2663
|
+
setAttribute(span, "webdecoy.cloud.decision_mode", this.config.decisionMode);
|
|
2664
|
+
const decision = (await this.decide(metadata, options, span)).withEdge(edge);
|
|
2523
2665
|
setAttribute(span, "webdecoy.decision.id", decision.id);
|
|
2524
2666
|
setAttribute(span, "webdecoy.decision.conclusion", decision.conclusion);
|
|
2525
2667
|
setAttribute(span, "webdecoy.decision.allowed", decision.allowed);
|
|
@@ -2543,7 +2685,7 @@ var WebDecoy = class {
|
|
|
2543
2685
|
endSpan(span);
|
|
2544
2686
|
}
|
|
2545
2687
|
}
|
|
2546
|
-
async decide(metadata, options
|
|
2688
|
+
async decide(metadata, options, span) {
|
|
2547
2689
|
const id = newDecisionId();
|
|
2548
2690
|
let key = metadata.ip || "unknown";
|
|
2549
2691
|
try {
|
|
@@ -2554,6 +2696,7 @@ var WebDecoy = class {
|
|
|
2554
2696
|
metadata.timestamp = Date.now();
|
|
2555
2697
|
}
|
|
2556
2698
|
if (isTestTriggerUserAgent(metadata.user_agent)) {
|
|
2699
|
+
setAttribute(span, "webdecoy.cloud.admission", "test_trigger");
|
|
2557
2700
|
return this.reportTestTrigger(metadata, id);
|
|
2558
2701
|
}
|
|
2559
2702
|
const needsAsync = this._hasFilterRules || this._hasAgentRules || this._preparingRules.length > 0;
|
|
@@ -2562,6 +2705,7 @@ var WebDecoy = class {
|
|
|
2562
2705
|
const agentVerdict = context.agent;
|
|
2563
2706
|
const ruleResult = this.ruleEngine ? this.runRules(context) : null;
|
|
2564
2707
|
if (ruleResult && ruleResult.action !== "ALLOW") {
|
|
2708
|
+
setAttribute(span, "webdecoy.cloud.admission", "local_rule");
|
|
2565
2709
|
const throttled = ruleResult.action === "THROTTLE";
|
|
2566
2710
|
return new Decision({
|
|
2567
2711
|
conclusion: "DENY",
|
|
@@ -2582,6 +2726,7 @@ var WebDecoy = class {
|
|
|
2582
2726
|
});
|
|
2583
2727
|
}
|
|
2584
2728
|
if (!this.client) {
|
|
2729
|
+
setAttribute(span, "webdecoy.cloud.admission", "no_api_key");
|
|
2585
2730
|
return new Decision({
|
|
2586
2731
|
conclusion: "ALLOW",
|
|
2587
2732
|
detection: {
|
|
@@ -2600,7 +2745,10 @@ var WebDecoy = class {
|
|
|
2600
2745
|
});
|
|
2601
2746
|
}
|
|
2602
2747
|
const cached = this.decisionCache?.get(key);
|
|
2603
|
-
if (cached)
|
|
2748
|
+
if (cached) {
|
|
2749
|
+
setAttribute(span, "webdecoy.cloud.admission", "cached");
|
|
2750
|
+
return cached.asCached();
|
|
2751
|
+
}
|
|
2604
2752
|
const localAnalysis = options.skipLocalAnalysis ? {
|
|
2605
2753
|
suspicious_headers: false,
|
|
2606
2754
|
missing_sec_ch_ua: false,
|
|
@@ -2610,12 +2758,11 @@ var WebDecoy = class {
|
|
|
2610
2758
|
flags: ["local_analysis_skipped"]
|
|
2611
2759
|
} : analyzeRequest(metadata);
|
|
2612
2760
|
this.log.debug("Local analysis", { ...localAnalysis });
|
|
2613
|
-
const detectionRequest = {
|
|
2614
|
-
request_metadata: metadata,
|
|
2615
|
-
local_analysis: localAnalysis
|
|
2616
|
-
};
|
|
2617
2761
|
const shouldCallServer = localAnalysis.needs_verification || this.config.enableTLSFingerprinting && metadata.tls_info;
|
|
2618
2762
|
if (!shouldCallServer) {
|
|
2763
|
+
setAttribute(span, "webdecoy.cloud.admission", "local_gate");
|
|
2764
|
+
setAttribute(span, "webdecoy.cloud.gate_datacenter_ip", localAnalysis.datacenter_ip);
|
|
2765
|
+
setAttribute(span, "webdecoy.cloud.gate_missing_sec_ch_ua", localAnalysis.missing_sec_ch_ua);
|
|
2619
2766
|
return new Decision({
|
|
2620
2767
|
conclusion: "ALLOW",
|
|
2621
2768
|
detection: {
|
|
@@ -2633,8 +2780,14 @@ var WebDecoy = class {
|
|
|
2633
2780
|
key
|
|
2634
2781
|
});
|
|
2635
2782
|
}
|
|
2636
|
-
const
|
|
2637
|
-
|
|
2783
|
+
const unified = this.config.decisionMode === "unified_v1";
|
|
2784
|
+
setAttribute(span, "webdecoy.cloud.admission", "cloud");
|
|
2785
|
+
const detection = await this.client.detect({
|
|
2786
|
+
request_metadata: metadata,
|
|
2787
|
+
local_analysis: localAnalysis,
|
|
2788
|
+
...unified && { decision_mode: "unified_v1" }
|
|
2789
|
+
});
|
|
2790
|
+
const threshold = options.threshold ?? this.config.threatScoreThreshold ?? (unified ? 0 : 80);
|
|
2638
2791
|
const allowed = detection.decision === "allow" || detection.confidence < threshold;
|
|
2639
2792
|
this.log.debug("Server detection", {
|
|
2640
2793
|
decision: detection.decision,
|
|
@@ -2644,7 +2797,7 @@ var WebDecoy = class {
|
|
|
2644
2797
|
const conclusion = allowed ? "ALLOW" : detection.decision === "challenge" ? "CHALLENGE" : "DENY";
|
|
2645
2798
|
const decision = new Decision({
|
|
2646
2799
|
conclusion,
|
|
2647
|
-
reason: allowed ? void 0 : `Threat score ${detection.confidence} (threshold ${threshold})`,
|
|
2800
|
+
reason: allowed ? void 0 : unified ? `Unified verdict ${detection.decision} (score ${detection.unified_score}, confidence ${detection.confidence})` : `Threat score ${detection.confidence} (threshold ${threshold})`,
|
|
2648
2801
|
detection,
|
|
2649
2802
|
id,
|
|
2650
2803
|
results: ruleResult?.results ?? [],
|
|
@@ -2656,6 +2809,9 @@ var WebDecoy = class {
|
|
|
2656
2809
|
if (this.decisionCache) this.decisionCache.set(key, decision);
|
|
2657
2810
|
return decision;
|
|
2658
2811
|
} catch (error) {
|
|
2812
|
+
if (error instanceof WebDecoyUnavailableError) {
|
|
2813
|
+
setAttribute(span, "webdecoy.cloud.admission", "backoff");
|
|
2814
|
+
}
|
|
2659
2815
|
const log = error instanceof WebDecoyUnavailableError ? this.log.debug.bind(this.log) : this.log.error.bind(this.log);
|
|
2660
2816
|
log("Protection error", {
|
|
2661
2817
|
error: error instanceof Error ? error.message : String(error)
|
|
@@ -2709,6 +2865,7 @@ var WebDecoy = class {
|
|
|
2709
2865
|
try {
|
|
2710
2866
|
const detection = await this.client.detect({
|
|
2711
2867
|
request_metadata: metadata,
|
|
2868
|
+
...this.config.decisionMode === "unified_v1" && { decision_mode: "unified_v1" },
|
|
2712
2869
|
local_analysis: {
|
|
2713
2870
|
suspicious_headers: false,
|
|
2714
2871
|
missing_sec_ch_ua: false,
|
package/dist/testing.mjs
CHANGED
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-
|
|
2
|
-
import './sdk-
|
|
1
|
+
import { a as ClearanceGateOptions, C as ClearanceContext, D as DetectAndGateOptions, d as GateOutcome } from './detect-and-gate-NBeqXdH6.mjs';
|
|
2
|
+
import './sdk-Dh8Jj07-.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-
|
|
2
|
-
import './sdk-
|
|
1
|
+
import { a as ClearanceGateOptions, C as ClearanceContext, D as DetectAndGateOptions, d as GateOutcome } from './detect-and-gate-Ay294Lr2.js';
|
|
2
|
+
import './sdk-Dh8Jj07-.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* WebDecoy for Vercel Routing Middleware, any framework.
|