@webdecoy/node 0.25.2 → 0.27.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 +43 -1
- package/dist/{chunk-AUHVIVMA.mjs → chunk-32TEUD5K.mjs} +233 -40
- package/dist/{chunk-G5WMRJSQ.mjs → chunk-P6IWJ7K5.mjs} +3 -2
- package/dist/{detect-and-gate-B1HMK-Sd.d.mts → detect-and-gate-BNq26N9d.d.mts} +1 -1
- package/dist/{detect-and-gate-B4KDPdyP.d.ts → detect-and-gate-Dnfo2t3B.d.ts} +1 -1
- package/dist/index.d.mts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +236 -41
- package/dist/index.mjs +4 -2
- package/dist/{sdk-UlKzxL3L.d.mts → sdk-CJ6pmQGy.d.mts} +145 -11
- package/dist/{sdk-UlKzxL3L.d.ts → sdk-CJ6pmQGy.d.ts} +145 -11
- package/dist/testing.d.mts +1 -1
- package/dist/testing.d.ts +1 -1
- package/dist/testing.js +236 -40
- package/dist/testing.mjs +1 -1
- package/dist/vercel.d.mts +2 -2
- package/dist/vercel.d.ts +2 -2
- package/dist/vercel.js +238 -41
- package/dist/vercel.mjs +2 -2
- package/package.json +1 -1
|
@@ -595,6 +595,7 @@ interface Tracer {
|
|
|
595
595
|
* Based on the ingest service API contract
|
|
596
596
|
*/
|
|
597
597
|
|
|
598
|
+
type DecisionMode = 'legacy' | 'unified_v1';
|
|
598
599
|
/**
|
|
599
600
|
* Configuration options for the Web Decoy SDK
|
|
600
601
|
*/
|
|
@@ -618,9 +619,14 @@ interface WebDecoyConfig {
|
|
|
618
619
|
*/
|
|
619
620
|
enableTLSFingerprinting?: boolean;
|
|
620
621
|
/**
|
|
621
|
-
*
|
|
622
|
-
*
|
|
623
|
-
|
|
622
|
+
* Cloud decision policy. Legacy is the default. Opt in to unified_v1 to
|
|
623
|
+
* use the ingest verdict based on the same synchronous score as its row.
|
|
624
|
+
*/
|
|
625
|
+
decisionMode?: DecisionMode;
|
|
626
|
+
/**
|
|
627
|
+
* Minimum cloud confidence (0–100) required to act on a block or challenge.
|
|
628
|
+
* Defaults to 80 in legacy mode. Unified mode uses ingest's confidence
|
|
629
|
+
* gates unless a minimum is explicitly set.
|
|
624
630
|
*/
|
|
625
631
|
threatScoreThreshold?: number;
|
|
626
632
|
/**
|
|
@@ -678,7 +684,7 @@ interface WebDecoyConfig {
|
|
|
678
684
|
/**
|
|
679
685
|
* Reuse of decisions that cost a network round trip. `false` disables it.
|
|
680
686
|
*
|
|
681
|
-
* Only server-derived DENY and CHALLENGE verdicts are cached — never ALLOW,
|
|
687
|
+
* Used in legacy mode. Only server-derived DENY and CHALLENGE verdicts are cached — never ALLOW,
|
|
682
688
|
* and never a rule outcome, because a rate limiter has to see every request.
|
|
683
689
|
* @default { ttl: 60_000, max: 10_000 }
|
|
684
690
|
*/
|
|
@@ -843,11 +849,48 @@ interface LocalAnalysis {
|
|
|
843
849
|
interface SDKDetectionRequest {
|
|
844
850
|
request_metadata: RequestMetadata;
|
|
845
851
|
local_analysis: LocalAnalysis;
|
|
852
|
+
/** Sent only when a caller explicitly requests unified admission. */
|
|
853
|
+
decision_mode?: 'unified_v1';
|
|
854
|
+
/** Privacy-bounded model-plane tool orchestration; never raw arguments or results. */
|
|
855
|
+
offensive_toolchain?: OffensiveToolchainObservation;
|
|
856
|
+
/** Reviewed framework identity evidence produced by an SDK helper. */
|
|
857
|
+
framework_evidence?: FrameworkEvidenceObservation;
|
|
858
|
+
}
|
|
859
|
+
type OffensiveToolFamily = 'network_reconnaissance' | 'vulnerability_scanning' | 'injection_testing' | 'exploitation';
|
|
860
|
+
interface OffensiveToolchainObservation {
|
|
861
|
+
schema_version: 1;
|
|
862
|
+
registry_revision: 1;
|
|
863
|
+
plane: 'model_api';
|
|
864
|
+
sensor: string;
|
|
865
|
+
/** HMAC-SHA-256 digest; never the raw run or conversation ID. */
|
|
866
|
+
run_correlation_id: string;
|
|
867
|
+
tool_families: OffensiveToolFamily[];
|
|
868
|
+
invocation_count: number;
|
|
869
|
+
family_set_sha256: string;
|
|
870
|
+
sequence_sha256: string;
|
|
871
|
+
redacted_argument_count: number;
|
|
872
|
+
dropped_tool_count: number;
|
|
873
|
+
}
|
|
874
|
+
interface FrameworkEvidenceObservation {
|
|
875
|
+
schema_version: 1;
|
|
876
|
+
registry_revision: number;
|
|
877
|
+
framework: string;
|
|
878
|
+
plane: 'model_api';
|
|
879
|
+
evidence: Array<{
|
|
880
|
+
family_id: string;
|
|
881
|
+
count: number;
|
|
882
|
+
sha256: string;
|
|
883
|
+
}>;
|
|
884
|
+
observation_sha256: string;
|
|
846
885
|
}
|
|
847
886
|
/**
|
|
848
887
|
* Detection response from the ingest service
|
|
849
888
|
*/
|
|
850
889
|
interface SDKDetectionResponse {
|
|
890
|
+
/** Present for a verdict produced by the unified policy. */
|
|
891
|
+
decision_mode?: 'unified_v1';
|
|
892
|
+
/** Synchronous ingest score (0–100), before asynchronous enrichment. */
|
|
893
|
+
unified_score?: number;
|
|
851
894
|
/** Decision: "allow", "block", or "challenge" */
|
|
852
895
|
decision: 'allow' | 'block' | 'challenge';
|
|
853
896
|
/** Confidence score (0-100) */
|
|
@@ -867,12 +910,17 @@ interface SDKDetectionResponse {
|
|
|
867
910
|
* Options for the protect() method
|
|
868
911
|
*/
|
|
869
912
|
interface ProtectOptions {
|
|
870
|
-
/**
|
|
913
|
+
/** Minimum cloud confidence required to act on this request */
|
|
871
914
|
threshold?: number;
|
|
872
915
|
/** Skip local analysis and only use server-side detection */
|
|
873
916
|
skipLocalAnalysis?: boolean;
|
|
874
917
|
/** Additional metadata to include in the detection */
|
|
875
918
|
metadata?: Record<string, any>;
|
|
919
|
+
/** How the caller handles local violations and keeps a background report alive. */
|
|
920
|
+
violationReporting?: {
|
|
921
|
+
mode: 'monitor' | 'enforce';
|
|
922
|
+
waitUntil?: (delivery: Promise<void>) => void;
|
|
923
|
+
};
|
|
876
924
|
}
|
|
877
925
|
|
|
878
926
|
/**
|
|
@@ -1369,6 +1417,8 @@ declare class WebDecoyClient {
|
|
|
1369
1417
|
* Send violation events to the ingest service
|
|
1370
1418
|
*/
|
|
1371
1419
|
sendViolations(events: ViolationEvent[]): Promise<void>;
|
|
1420
|
+
/** Acknowledgment from ingest for one batch. Transport failures resolve false. */
|
|
1421
|
+
sendViolationBatch(events: ViolationEvent[]): Promise<boolean>;
|
|
1372
1422
|
/**
|
|
1373
1423
|
* Send AI referral counts. Resolves true when the batch needs no retry:
|
|
1374
1424
|
* accepted, or refused for a reason a retry cannot fix (a 4xx). Only a
|
|
@@ -1386,6 +1436,86 @@ declare class WebDecoyClient {
|
|
|
1386
1436
|
validateAPIKey(): Promise<boolean>;
|
|
1387
1437
|
}
|
|
1388
1438
|
|
|
1439
|
+
/**
|
|
1440
|
+
* Violation Reporter
|
|
1441
|
+
* Buffers violation events and flushes them to the backend in batches
|
|
1442
|
+
*/
|
|
1443
|
+
|
|
1444
|
+
interface ViolationReporterConfig {
|
|
1445
|
+
/** Flush interval in milliseconds (default: 5000) */
|
|
1446
|
+
flushInterval?: number;
|
|
1447
|
+
/** Max buffer size before auto-flush (default: 50) */
|
|
1448
|
+
maxBufferSize?: number;
|
|
1449
|
+
/** Enable debug logging */
|
|
1450
|
+
debug?: boolean;
|
|
1451
|
+
}
|
|
1452
|
+
/** Delivery counters for this SDK instance. */
|
|
1453
|
+
interface ViolationDeliveryStats {
|
|
1454
|
+
/** Events in batches acknowledged by ingest. */
|
|
1455
|
+
acknowledgedEvents: number;
|
|
1456
|
+
/** HTTP or transport failures for attempted batches. */
|
|
1457
|
+
failedBatches: number;
|
|
1458
|
+
/** Events discarded after failure, overflow, or shutdown. */
|
|
1459
|
+
droppedEvents: number;
|
|
1460
|
+
/** Events waiting for an attempt. */
|
|
1461
|
+
bufferedEvents: number;
|
|
1462
|
+
}
|
|
1463
|
+
declare class ViolationReporter {
|
|
1464
|
+
private client;
|
|
1465
|
+
private buffer;
|
|
1466
|
+
private flushTimer;
|
|
1467
|
+
private maxBufferSize;
|
|
1468
|
+
private debug;
|
|
1469
|
+
private flushPromise;
|
|
1470
|
+
private queuedFlush;
|
|
1471
|
+
private acknowledgedEvents;
|
|
1472
|
+
private failedBatches;
|
|
1473
|
+
private droppedEvents;
|
|
1474
|
+
constructor(client: WebDecoyClient, config?: ViolationReporterConfig);
|
|
1475
|
+
/**
|
|
1476
|
+
* Add violations to the buffer. Auto-flushes when buffer reaches maxBufferSize.
|
|
1477
|
+
*/
|
|
1478
|
+
report(violations: ViolationEvent[]): void;
|
|
1479
|
+
/** Flush the buffer, coalescing requests that arrive during an active send. */
|
|
1480
|
+
flush(): Promise<void>;
|
|
1481
|
+
private flushBatches;
|
|
1482
|
+
getDeliveryStats(): ViolationDeliveryStats;
|
|
1483
|
+
/** Stop the timer and give remaining events one final flush. */
|
|
1484
|
+
destroy(): Promise<void>;
|
|
1485
|
+
}
|
|
1486
|
+
|
|
1487
|
+
interface OffensiveToolInvocation {
|
|
1488
|
+
/** Reviewed tool identifier. Unknown identifiers are counted and dropped. */
|
|
1489
|
+
tool: string;
|
|
1490
|
+
/** Number of argument values the sensor removed before reporting. */
|
|
1491
|
+
redactedArgumentCount?: number;
|
|
1492
|
+
}
|
|
1493
|
+
interface OffensiveToolchainEvidenceInput {
|
|
1494
|
+
/** Stable name for the authenticated model-plane sensor, at most 128 characters. */
|
|
1495
|
+
sensor: string;
|
|
1496
|
+
/** Raw run ID used only as HMAC input. It is never returned. */
|
|
1497
|
+
runId: string;
|
|
1498
|
+
/** Deployment-held HMAC secret used to pseudonymize run IDs. */
|
|
1499
|
+
correlationSecret: string;
|
|
1500
|
+
invocations: readonly OffensiveToolInvocation[];
|
|
1501
|
+
/** Set only when instrumenting the official HexStrike AI MCP orchestrator. */
|
|
1502
|
+
orchestrator?: 'hexstrike_ai';
|
|
1503
|
+
}
|
|
1504
|
+
interface OffensiveToolchainEvidence {
|
|
1505
|
+
offensive_toolchain: OffensiveToolchainObservation;
|
|
1506
|
+
framework_evidence?: FrameworkEvidenceObservation;
|
|
1507
|
+
}
|
|
1508
|
+
/**
|
|
1509
|
+
* Build the strict model-plane evidence accepted by WebDecoy ingest.
|
|
1510
|
+
*
|
|
1511
|
+
* Tool arguments, results, prompts, credentials and targets are intentionally
|
|
1512
|
+
* absent from this API. Unknown tool names are counted and discarded. One
|
|
1513
|
+
* recognized family can be reported for coverage but does not correlate; the
|
|
1514
|
+
* backend requires coordinated use of at least two reviewed families.
|
|
1515
|
+
*/
|
|
1516
|
+
declare function createOffensiveToolchainEvidence(input: OffensiveToolchainEvidenceInput): Promise<OffensiveToolchainEvidence>;
|
|
1517
|
+
|
|
1518
|
+
type ConfiguredViolationReporter = Pick<ViolationReporter, 'report' | 'flush' | 'destroy'> & Partial<Pick<ViolationReporter, 'getDeliveryStats'>>;
|
|
1389
1519
|
declare class WebDecoy {
|
|
1390
1520
|
private client;
|
|
1391
1521
|
private config;
|
|
@@ -1479,6 +1609,12 @@ declare class WebDecoy {
|
|
|
1479
1609
|
*/
|
|
1480
1610
|
observeHoneyCredentialPresentation(candidate: string, handle: HoneyCredentialHandle, routeTemplate: string): Promise<HoneyCredentialPresentationResult>;
|
|
1481
1611
|
private honeyCredentialFingerprint;
|
|
1612
|
+
/**
|
|
1613
|
+
* Report a privacy-bounded model-plane tool run. The helper sends only
|
|
1614
|
+
* reviewed generic families, counts, and digests; it never sends prompts,
|
|
1615
|
+
* arguments, results, credentials, targets, or the raw run ID.
|
|
1616
|
+
*/
|
|
1617
|
+
reportOffensiveToolchain(input: OffensiveToolchainEvidenceInput): Promise<SDKDetectionResponse>;
|
|
1482
1618
|
/**
|
|
1483
1619
|
* Whether this SDK instance has filter rules that need async enrichment
|
|
1484
1620
|
*/
|
|
@@ -1522,11 +1658,9 @@ declare class WebDecoy {
|
|
|
1522
1658
|
* Attach a violation reporter for sending violations to the backend.
|
|
1523
1659
|
* Called internally when apiKey is present and rules are configured.
|
|
1524
1660
|
*/
|
|
1525
|
-
setViolationReporter(reporter:
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
destroy(): Promise<void>;
|
|
1529
|
-
}): void;
|
|
1661
|
+
setViolationReporter(reporter: ConfiguredViolationReporter): void;
|
|
1662
|
+
/** Snapshot of this instance's violation delivery, when reporting is enabled. */
|
|
1663
|
+
getViolationDeliveryStats(): ViolationDeliveryStats | undefined;
|
|
1530
1664
|
/**
|
|
1531
1665
|
* Get the API client (for use by violation reporter, enrichment, etc.)
|
|
1532
1666
|
*/
|
|
@@ -1541,4 +1675,4 @@ declare class WebDecoy {
|
|
|
1541
1675
|
destroy(): Promise<void>;
|
|
1542
1676
|
}
|
|
1543
1677
|
|
|
1544
|
-
export { type
|
|
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 };
|
|
@@ -595,6 +595,7 @@ interface Tracer {
|
|
|
595
595
|
* Based on the ingest service API contract
|
|
596
596
|
*/
|
|
597
597
|
|
|
598
|
+
type DecisionMode = 'legacy' | 'unified_v1';
|
|
598
599
|
/**
|
|
599
600
|
* Configuration options for the Web Decoy SDK
|
|
600
601
|
*/
|
|
@@ -618,9 +619,14 @@ interface WebDecoyConfig {
|
|
|
618
619
|
*/
|
|
619
620
|
enableTLSFingerprinting?: boolean;
|
|
620
621
|
/**
|
|
621
|
-
*
|
|
622
|
-
*
|
|
623
|
-
|
|
622
|
+
* Cloud decision policy. Legacy is the default. Opt in to unified_v1 to
|
|
623
|
+
* use the ingest verdict based on the same synchronous score as its row.
|
|
624
|
+
*/
|
|
625
|
+
decisionMode?: DecisionMode;
|
|
626
|
+
/**
|
|
627
|
+
* Minimum cloud confidence (0–100) required to act on a block or challenge.
|
|
628
|
+
* Defaults to 80 in legacy mode. Unified mode uses ingest's confidence
|
|
629
|
+
* gates unless a minimum is explicitly set.
|
|
624
630
|
*/
|
|
625
631
|
threatScoreThreshold?: number;
|
|
626
632
|
/**
|
|
@@ -678,7 +684,7 @@ interface WebDecoyConfig {
|
|
|
678
684
|
/**
|
|
679
685
|
* Reuse of decisions that cost a network round trip. `false` disables it.
|
|
680
686
|
*
|
|
681
|
-
* Only server-derived DENY and CHALLENGE verdicts are cached — never ALLOW,
|
|
687
|
+
* Used in legacy mode. Only server-derived DENY and CHALLENGE verdicts are cached — never ALLOW,
|
|
682
688
|
* and never a rule outcome, because a rate limiter has to see every request.
|
|
683
689
|
* @default { ttl: 60_000, max: 10_000 }
|
|
684
690
|
*/
|
|
@@ -843,11 +849,48 @@ interface LocalAnalysis {
|
|
|
843
849
|
interface SDKDetectionRequest {
|
|
844
850
|
request_metadata: RequestMetadata;
|
|
845
851
|
local_analysis: LocalAnalysis;
|
|
852
|
+
/** Sent only when a caller explicitly requests unified admission. */
|
|
853
|
+
decision_mode?: 'unified_v1';
|
|
854
|
+
/** Privacy-bounded model-plane tool orchestration; never raw arguments or results. */
|
|
855
|
+
offensive_toolchain?: OffensiveToolchainObservation;
|
|
856
|
+
/** Reviewed framework identity evidence produced by an SDK helper. */
|
|
857
|
+
framework_evidence?: FrameworkEvidenceObservation;
|
|
858
|
+
}
|
|
859
|
+
type OffensiveToolFamily = 'network_reconnaissance' | 'vulnerability_scanning' | 'injection_testing' | 'exploitation';
|
|
860
|
+
interface OffensiveToolchainObservation {
|
|
861
|
+
schema_version: 1;
|
|
862
|
+
registry_revision: 1;
|
|
863
|
+
plane: 'model_api';
|
|
864
|
+
sensor: string;
|
|
865
|
+
/** HMAC-SHA-256 digest; never the raw run or conversation ID. */
|
|
866
|
+
run_correlation_id: string;
|
|
867
|
+
tool_families: OffensiveToolFamily[];
|
|
868
|
+
invocation_count: number;
|
|
869
|
+
family_set_sha256: string;
|
|
870
|
+
sequence_sha256: string;
|
|
871
|
+
redacted_argument_count: number;
|
|
872
|
+
dropped_tool_count: number;
|
|
873
|
+
}
|
|
874
|
+
interface FrameworkEvidenceObservation {
|
|
875
|
+
schema_version: 1;
|
|
876
|
+
registry_revision: number;
|
|
877
|
+
framework: string;
|
|
878
|
+
plane: 'model_api';
|
|
879
|
+
evidence: Array<{
|
|
880
|
+
family_id: string;
|
|
881
|
+
count: number;
|
|
882
|
+
sha256: string;
|
|
883
|
+
}>;
|
|
884
|
+
observation_sha256: string;
|
|
846
885
|
}
|
|
847
886
|
/**
|
|
848
887
|
* Detection response from the ingest service
|
|
849
888
|
*/
|
|
850
889
|
interface SDKDetectionResponse {
|
|
890
|
+
/** Present for a verdict produced by the unified policy. */
|
|
891
|
+
decision_mode?: 'unified_v1';
|
|
892
|
+
/** Synchronous ingest score (0–100), before asynchronous enrichment. */
|
|
893
|
+
unified_score?: number;
|
|
851
894
|
/** Decision: "allow", "block", or "challenge" */
|
|
852
895
|
decision: 'allow' | 'block' | 'challenge';
|
|
853
896
|
/** Confidence score (0-100) */
|
|
@@ -867,12 +910,17 @@ interface SDKDetectionResponse {
|
|
|
867
910
|
* Options for the protect() method
|
|
868
911
|
*/
|
|
869
912
|
interface ProtectOptions {
|
|
870
|
-
/**
|
|
913
|
+
/** Minimum cloud confidence required to act on this request */
|
|
871
914
|
threshold?: number;
|
|
872
915
|
/** Skip local analysis and only use server-side detection */
|
|
873
916
|
skipLocalAnalysis?: boolean;
|
|
874
917
|
/** Additional metadata to include in the detection */
|
|
875
918
|
metadata?: Record<string, any>;
|
|
919
|
+
/** How the caller handles local violations and keeps a background report alive. */
|
|
920
|
+
violationReporting?: {
|
|
921
|
+
mode: 'monitor' | 'enforce';
|
|
922
|
+
waitUntil?: (delivery: Promise<void>) => void;
|
|
923
|
+
};
|
|
876
924
|
}
|
|
877
925
|
|
|
878
926
|
/**
|
|
@@ -1369,6 +1417,8 @@ declare class WebDecoyClient {
|
|
|
1369
1417
|
* Send violation events to the ingest service
|
|
1370
1418
|
*/
|
|
1371
1419
|
sendViolations(events: ViolationEvent[]): Promise<void>;
|
|
1420
|
+
/** Acknowledgment from ingest for one batch. Transport failures resolve false. */
|
|
1421
|
+
sendViolationBatch(events: ViolationEvent[]): Promise<boolean>;
|
|
1372
1422
|
/**
|
|
1373
1423
|
* Send AI referral counts. Resolves true when the batch needs no retry:
|
|
1374
1424
|
* accepted, or refused for a reason a retry cannot fix (a 4xx). Only a
|
|
@@ -1386,6 +1436,86 @@ declare class WebDecoyClient {
|
|
|
1386
1436
|
validateAPIKey(): Promise<boolean>;
|
|
1387
1437
|
}
|
|
1388
1438
|
|
|
1439
|
+
/**
|
|
1440
|
+
* Violation Reporter
|
|
1441
|
+
* Buffers violation events and flushes them to the backend in batches
|
|
1442
|
+
*/
|
|
1443
|
+
|
|
1444
|
+
interface ViolationReporterConfig {
|
|
1445
|
+
/** Flush interval in milliseconds (default: 5000) */
|
|
1446
|
+
flushInterval?: number;
|
|
1447
|
+
/** Max buffer size before auto-flush (default: 50) */
|
|
1448
|
+
maxBufferSize?: number;
|
|
1449
|
+
/** Enable debug logging */
|
|
1450
|
+
debug?: boolean;
|
|
1451
|
+
}
|
|
1452
|
+
/** Delivery counters for this SDK instance. */
|
|
1453
|
+
interface ViolationDeliveryStats {
|
|
1454
|
+
/** Events in batches acknowledged by ingest. */
|
|
1455
|
+
acknowledgedEvents: number;
|
|
1456
|
+
/** HTTP or transport failures for attempted batches. */
|
|
1457
|
+
failedBatches: number;
|
|
1458
|
+
/** Events discarded after failure, overflow, or shutdown. */
|
|
1459
|
+
droppedEvents: number;
|
|
1460
|
+
/** Events waiting for an attempt. */
|
|
1461
|
+
bufferedEvents: number;
|
|
1462
|
+
}
|
|
1463
|
+
declare class ViolationReporter {
|
|
1464
|
+
private client;
|
|
1465
|
+
private buffer;
|
|
1466
|
+
private flushTimer;
|
|
1467
|
+
private maxBufferSize;
|
|
1468
|
+
private debug;
|
|
1469
|
+
private flushPromise;
|
|
1470
|
+
private queuedFlush;
|
|
1471
|
+
private acknowledgedEvents;
|
|
1472
|
+
private failedBatches;
|
|
1473
|
+
private droppedEvents;
|
|
1474
|
+
constructor(client: WebDecoyClient, config?: ViolationReporterConfig);
|
|
1475
|
+
/**
|
|
1476
|
+
* Add violations to the buffer. Auto-flushes when buffer reaches maxBufferSize.
|
|
1477
|
+
*/
|
|
1478
|
+
report(violations: ViolationEvent[]): void;
|
|
1479
|
+
/** Flush the buffer, coalescing requests that arrive during an active send. */
|
|
1480
|
+
flush(): Promise<void>;
|
|
1481
|
+
private flushBatches;
|
|
1482
|
+
getDeliveryStats(): ViolationDeliveryStats;
|
|
1483
|
+
/** Stop the timer and give remaining events one final flush. */
|
|
1484
|
+
destroy(): Promise<void>;
|
|
1485
|
+
}
|
|
1486
|
+
|
|
1487
|
+
interface OffensiveToolInvocation {
|
|
1488
|
+
/** Reviewed tool identifier. Unknown identifiers are counted and dropped. */
|
|
1489
|
+
tool: string;
|
|
1490
|
+
/** Number of argument values the sensor removed before reporting. */
|
|
1491
|
+
redactedArgumentCount?: number;
|
|
1492
|
+
}
|
|
1493
|
+
interface OffensiveToolchainEvidenceInput {
|
|
1494
|
+
/** Stable name for the authenticated model-plane sensor, at most 128 characters. */
|
|
1495
|
+
sensor: string;
|
|
1496
|
+
/** Raw run ID used only as HMAC input. It is never returned. */
|
|
1497
|
+
runId: string;
|
|
1498
|
+
/** Deployment-held HMAC secret used to pseudonymize run IDs. */
|
|
1499
|
+
correlationSecret: string;
|
|
1500
|
+
invocations: readonly OffensiveToolInvocation[];
|
|
1501
|
+
/** Set only when instrumenting the official HexStrike AI MCP orchestrator. */
|
|
1502
|
+
orchestrator?: 'hexstrike_ai';
|
|
1503
|
+
}
|
|
1504
|
+
interface OffensiveToolchainEvidence {
|
|
1505
|
+
offensive_toolchain: OffensiveToolchainObservation;
|
|
1506
|
+
framework_evidence?: FrameworkEvidenceObservation;
|
|
1507
|
+
}
|
|
1508
|
+
/**
|
|
1509
|
+
* Build the strict model-plane evidence accepted by WebDecoy ingest.
|
|
1510
|
+
*
|
|
1511
|
+
* Tool arguments, results, prompts, credentials and targets are intentionally
|
|
1512
|
+
* absent from this API. Unknown tool names are counted and discarded. One
|
|
1513
|
+
* recognized family can be reported for coverage but does not correlate; the
|
|
1514
|
+
* backend requires coordinated use of at least two reviewed families.
|
|
1515
|
+
*/
|
|
1516
|
+
declare function createOffensiveToolchainEvidence(input: OffensiveToolchainEvidenceInput): Promise<OffensiveToolchainEvidence>;
|
|
1517
|
+
|
|
1518
|
+
type ConfiguredViolationReporter = Pick<ViolationReporter, 'report' | 'flush' | 'destroy'> & Partial<Pick<ViolationReporter, 'getDeliveryStats'>>;
|
|
1389
1519
|
declare class WebDecoy {
|
|
1390
1520
|
private client;
|
|
1391
1521
|
private config;
|
|
@@ -1479,6 +1609,12 @@ declare class WebDecoy {
|
|
|
1479
1609
|
*/
|
|
1480
1610
|
observeHoneyCredentialPresentation(candidate: string, handle: HoneyCredentialHandle, routeTemplate: string): Promise<HoneyCredentialPresentationResult>;
|
|
1481
1611
|
private honeyCredentialFingerprint;
|
|
1612
|
+
/**
|
|
1613
|
+
* Report a privacy-bounded model-plane tool run. The helper sends only
|
|
1614
|
+
* reviewed generic families, counts, and digests; it never sends prompts,
|
|
1615
|
+
* arguments, results, credentials, targets, or the raw run ID.
|
|
1616
|
+
*/
|
|
1617
|
+
reportOffensiveToolchain(input: OffensiveToolchainEvidenceInput): Promise<SDKDetectionResponse>;
|
|
1482
1618
|
/**
|
|
1483
1619
|
* Whether this SDK instance has filter rules that need async enrichment
|
|
1484
1620
|
*/
|
|
@@ -1522,11 +1658,9 @@ declare class WebDecoy {
|
|
|
1522
1658
|
* Attach a violation reporter for sending violations to the backend.
|
|
1523
1659
|
* Called internally when apiKey is present and rules are configured.
|
|
1524
1660
|
*/
|
|
1525
|
-
setViolationReporter(reporter:
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
destroy(): Promise<void>;
|
|
1529
|
-
}): void;
|
|
1661
|
+
setViolationReporter(reporter: ConfiguredViolationReporter): void;
|
|
1662
|
+
/** Snapshot of this instance's violation delivery, when reporting is enabled. */
|
|
1663
|
+
getViolationDeliveryStats(): ViolationDeliveryStats | undefined;
|
|
1530
1664
|
/**
|
|
1531
1665
|
* Get the API client (for use by violation reporter, enrichment, etc.)
|
|
1532
1666
|
*/
|
|
@@ -1541,4 +1675,4 @@ declare class WebDecoy {
|
|
|
1541
1675
|
destroy(): Promise<void>;
|
|
1542
1676
|
}
|
|
1543
1677
|
|
|
1544
|
-
export { type
|
|
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 };
|
package/dist/testing.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ad as WebDecoyConfig, $ as RequestMetadata, W as WebDecoy, P as ProtectResult, a1 as RuleState } from './sdk-CJ6pmQGy.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 {
|
|
1
|
+
import { ad as WebDecoyConfig, $ as RequestMetadata, W as WebDecoy, P as ProtectResult, a1 as RuleState } from './sdk-CJ6pmQGy.js';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Testing utilities, for the application's test suite rather than ours.
|