@webdecoy/node 0.9.0 → 0.11.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.d.mts +61 -22
- package/dist/index.d.ts +61 -22
- package/dist/index.js +69 -3
- package/dist/index.mjs +66 -3
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* or plain traffic carrying no agent signature at all?
|
|
9
9
|
*
|
|
10
10
|
* The verdict taxonomy mirrors the server-side verifier in the ingest service
|
|
11
|
-
*
|
|
11
|
+
* so the SDK, the edge validator, and the backend all speak
|
|
12
12
|
* the same language.
|
|
13
13
|
*/
|
|
14
14
|
/** The four possible outcomes of Web Bot Auth verification. */
|
|
@@ -118,7 +118,7 @@ type AgentRequestInput = Request | {
|
|
|
118
118
|
};
|
|
119
119
|
|
|
120
120
|
/**
|
|
121
|
-
* The edge validator's verdict, as the origin sees it
|
|
121
|
+
* The edge validator's verdict, as the origin sees it.
|
|
122
122
|
*
|
|
123
123
|
* WHY THIS MODULE EXISTS
|
|
124
124
|
*
|
|
@@ -222,7 +222,7 @@ declare function readEdgeVerdict(headers: Record<string, string> | undefined): E
|
|
|
222
222
|
/**
|
|
223
223
|
* GENERATED FILE — DO NOT EDIT.
|
|
224
224
|
*
|
|
225
|
-
* Source of truth:
|
|
225
|
+
* Source of truth: the Go agent registry in the main application repo.
|
|
226
226
|
* Regenerate with `packages/webdecoy/scripts/gen-bot-registry.mjs`; see that
|
|
227
227
|
* script for the command.
|
|
228
228
|
*
|
|
@@ -263,7 +263,7 @@ declare const BOT_CATEGORIES: readonly BotCategory[];
|
|
|
263
263
|
declare const BOT_REGISTRY: readonly BotAgent[];
|
|
264
264
|
|
|
265
265
|
/**
|
|
266
|
-
* Local bot classification
|
|
266
|
+
* Local bot classification.
|
|
267
267
|
*
|
|
268
268
|
* WHY THIS IS IN THE SDK AT ALL
|
|
269
269
|
*
|
|
@@ -357,19 +357,19 @@ interface RuleContext {
|
|
|
357
357
|
enrichment?: IPEnrichmentData;
|
|
358
358
|
/**
|
|
359
359
|
* Web Bot Auth verdict (populated async before evaluation when a
|
|
360
|
-
*
|
|
360
|
+
* `webBotAuth` rule is
|
|
361
361
|
* present). Lets a synchronous rule act on cryptographic agent verification.
|
|
362
362
|
*/
|
|
363
363
|
agent?: AgentVerdict;
|
|
364
364
|
/**
|
|
365
|
-
* The edge validator's annotations on this request
|
|
365
|
+
* The edge validator's annotations on this request, parsed from
|
|
366
366
|
* `x-wd-clearance` and `x-wd-class`. Always populated — `present: false` when
|
|
367
367
|
* the edge did not front this request. Filter expressions read it as
|
|
368
368
|
* `edge.class`, `edge.clearance` and `edge.present`.
|
|
369
369
|
*/
|
|
370
370
|
edge?: EdgeVerdict;
|
|
371
371
|
/**
|
|
372
|
-
* Who the User-Agent says it is
|
|
372
|
+
* Who the User-Agent says it is, matched against the generated agent
|
|
373
373
|
* registry. Always populated — `known: false` when nothing matched. Filter
|
|
374
374
|
* expressions read it as `bot.category`, `bot.name`, `bot.ai` and friends.
|
|
375
375
|
*
|
|
@@ -431,7 +431,7 @@ interface FilterConfig {
|
|
|
431
431
|
dryRun?: boolean;
|
|
432
432
|
}
|
|
433
433
|
/**
|
|
434
|
-
* Configuration for bot-category rules
|
|
434
|
+
* Configuration for bot-category rules
|
|
435
435
|
*/
|
|
436
436
|
interface BotRuleConfig {
|
|
437
437
|
/**
|
|
@@ -494,7 +494,7 @@ interface ViolationEvent {
|
|
|
494
494
|
/**
|
|
495
495
|
* The request's wd_clearance token, when present. Lets the backend bind a
|
|
496
496
|
* tripwire hit to the actor's device fingerprint and deny it — the same
|
|
497
|
-
* durable lockout a decoy hit produces
|
|
497
|
+
* durable lockout a decoy hit produces. Only carried
|
|
498
498
|
* for deception rules (tripwires); undefined otherwise.
|
|
499
499
|
*/
|
|
500
500
|
clearance?: string;
|
|
@@ -706,7 +706,7 @@ interface ProtectResult {
|
|
|
706
706
|
*/
|
|
707
707
|
agent?: AgentVerdict;
|
|
708
708
|
/**
|
|
709
|
-
* What the edge validator said about this request
|
|
709
|
+
* What the edge validator said about this request, parsed from
|
|
710
710
|
* `x-wd-clearance` and `x-wd-class`.
|
|
711
711
|
*
|
|
712
712
|
* Always present. Check `edge.present` before branching: false means the edge
|
|
@@ -855,6 +855,18 @@ declare class WebDecoy {
|
|
|
855
855
|
*/
|
|
856
856
|
protect(metadata: RequestMetadata, options?: ProtectOptions): Promise<ProtectResult>;
|
|
857
857
|
private decide;
|
|
858
|
+
/**
|
|
859
|
+
* Report a test-trigger request and return a blocking verdict.
|
|
860
|
+
*
|
|
861
|
+
* The verdict is `allowed: false` so an enforce-mode adapter answers the
|
|
862
|
+
* curl with a 403 — a visibly different response that tells the developer
|
|
863
|
+
* their middleware acted, Arcjet-quickstart style. (The default monitor
|
|
864
|
+
* mode still serves the request; the dashboard row is the real receipt.)
|
|
865
|
+
*
|
|
866
|
+
* Without an API key nothing can reach the dashboard, so the verdict says
|
|
867
|
+
* so via `error` instead of pretending the test ran.
|
|
868
|
+
*/
|
|
869
|
+
private reportTestTrigger;
|
|
858
870
|
/**
|
|
859
871
|
* Validate the API key configuration
|
|
860
872
|
* Useful for testing integration during setup
|
|
@@ -886,6 +898,31 @@ declare class WebDecoy {
|
|
|
886
898
|
destroy(): Promise<void>;
|
|
887
899
|
}
|
|
888
900
|
|
|
901
|
+
/**
|
|
902
|
+
* The reserved test trigger.
|
|
903
|
+
*
|
|
904
|
+
* A request whose User-Agent starts with `WebDecoy-Test/` is the documented
|
|
905
|
+
* install-verification probe:
|
|
906
|
+
*
|
|
907
|
+
* curl -A "WebDecoy-Test/1.0" http://localhost:3000/
|
|
908
|
+
*
|
|
909
|
+
* The SDK always reports it to ingest — before rules, before local-analysis
|
|
910
|
+
* thresholds, before sampling of any kind — so the developer who just
|
|
911
|
+
* installed the middleware gets a guaranteed, labeled detection in the
|
|
912
|
+
* dashboard within seconds, including from localhost. Ingest recognizes the
|
|
913
|
+
* same prefix server-side, marks the row `is_test`, and keeps it out of
|
|
914
|
+
* stats, billing, actor scoring, and enforcement.
|
|
915
|
+
*
|
|
916
|
+
* Prefix-anchored on purpose: a UA that merely mentions the string mid-way
|
|
917
|
+
* is NOT the trigger, so real traffic can't hide behind the test label.
|
|
918
|
+
*/
|
|
919
|
+
/** Any User-Agent starting with this (case-insensitive) is a test trigger. */
|
|
920
|
+
declare const TEST_TRIGGER_UA_PREFIX = "WebDecoy-Test/";
|
|
921
|
+
/** The exact value the quickstart docs tell developers to send. */
|
|
922
|
+
declare const TEST_TRIGGER_USER_AGENT = "WebDecoy-Test/1.0";
|
|
923
|
+
/** Whether this User-Agent is the reserved test trigger. */
|
|
924
|
+
declare function isTestTriggerUserAgent(userAgent: string | undefined): boolean;
|
|
925
|
+
|
|
889
926
|
/**
|
|
890
927
|
* Rule Engine
|
|
891
928
|
* Evaluates rules in order — first DENY/THROTTLE wins
|
|
@@ -898,7 +935,7 @@ declare class RuleEngine {
|
|
|
898
935
|
* Append a rule after construction.
|
|
899
936
|
*
|
|
900
937
|
* Exists for signals that cannot be known synchronously at construction —
|
|
901
|
-
* currently the site honeytoken
|
|
938
|
+
* currently the site honeytoken, whose path is derived by async HMAC.
|
|
902
939
|
* Evaluation order is append order, matching the constructor.
|
|
903
940
|
*/
|
|
904
941
|
add(rule: Rule): void;
|
|
@@ -975,7 +1012,7 @@ declare class TripwireRule implements Rule {
|
|
|
975
1012
|
}
|
|
976
1013
|
|
|
977
1014
|
/**
|
|
978
|
-
* Bot-category rule
|
|
1015
|
+
* Bot-category rule.
|
|
979
1016
|
*
|
|
980
1017
|
* The one-liner for the policy this product category exists to express:
|
|
981
1018
|
*
|
|
@@ -1010,7 +1047,7 @@ declare class BotRule implements Rule {
|
|
|
1010
1047
|
}
|
|
1011
1048
|
|
|
1012
1049
|
/**
|
|
1013
|
-
* Web Bot Auth rule (
|
|
1050
|
+
* Web Bot Auth rule (the main application repo).
|
|
1014
1051
|
*
|
|
1015
1052
|
* Acts on the Web Bot Auth verdict the SDK computes before rule evaluation
|
|
1016
1053
|
* (`context.agent`). Its headline job is to make **impersonation deny-able in
|
|
@@ -1109,7 +1146,7 @@ declare function honeytoken(options?: HoneytokenOptions): Honeytoken;
|
|
|
1109
1146
|
|
|
1110
1147
|
/**
|
|
1111
1148
|
* Site honeytoken — a stable, derivable trap the adapters can inject for you
|
|
1112
|
-
|
|
1149
|
+
*.
|
|
1113
1150
|
*
|
|
1114
1151
|
* WHY THIS EXISTS ALONGSIDE honeytoken()
|
|
1115
1152
|
*
|
|
@@ -1129,12 +1166,14 @@ declare function honeytoken(options?: HoneytokenOptions): Honeytoken;
|
|
|
1129
1166
|
* JavaScript, no fingerprint and no IP — the client asked for a path that exists
|
|
1130
1167
|
* nowhere and is linked only from an element no human can see.
|
|
1131
1168
|
*
|
|
1132
|
-
* That is not a stylistic preference, it is arithmetic.
|
|
1133
|
-
*
|
|
1134
|
-
* spoofed
|
|
1135
|
-
*
|
|
1136
|
-
*
|
|
1137
|
-
*
|
|
1169
|
+
* That is not a stylistic preference, it is arithmetic. Honeypot hits carry the
|
|
1170
|
+
* highest weight in the threat score and a User-Agent carries nearly none,
|
|
1171
|
+
* because a User-Agent is trivially spoofed — so the same client scores near
|
|
1172
|
+
* zero on a page view and very high on a trap.
|
|
1173
|
+
*
|
|
1174
|
+
* Which only pays off if the link is on the page. Generating a token and asking
|
|
1175
|
+
* the developer to place it is a step most installs never take, so the adapters
|
|
1176
|
+
* that own the response inject it themselves.
|
|
1138
1177
|
*/
|
|
1139
1178
|
/** Base path for honeytoken tripwires. Mirrors the WordPress plugin. */
|
|
1140
1179
|
declare const HONEYTOKEN_BASE_PATH = "/__wd";
|
|
@@ -1273,7 +1312,7 @@ declare function filter(config: FilterConfig): Rule;
|
|
|
1273
1312
|
*/
|
|
1274
1313
|
declare function tripwire(config?: TripwireConfig): Rule;
|
|
1275
1314
|
/**
|
|
1276
|
-
* Factory function to create a bot-category rule
|
|
1315
|
+
* Factory function to create a bot-category rule.
|
|
1277
1316
|
*
|
|
1278
1317
|
* Acts on agents that identify themselves in the User-Agent, matched against the
|
|
1279
1318
|
* registry generated from the same table the scoring pipeline uses — so
|
|
@@ -2093,4 +2132,4 @@ declare function createCaptchaEndpoints(options?: CaptchaEndpointsOptions): {
|
|
|
2093
2132
|
};
|
|
2094
2133
|
type CaptchaEndpoints = ReturnType<typeof createCaptchaEndpoints>;
|
|
2095
2134
|
|
|
2096
|
-
export { type AgentCategory, type AgentRequestInput, type AgentStatus, type AgentVerdict, AgentVerifier, type AgentVerifierOptions, BOT_CATEGORIES, BOT_REGISTRY, type BehavioralSignals, type BotAgent, type BotCategory, BotRule, type BotRuleConfig, type BotVerdict, Captcha, type CaptchaEndpoints, type CaptchaEndpointsOptions, type CaptchaHttpResponse, type CaptchaOptions, type CaptchaRequest, type CategoryScores, type ChallengeData, type ChallengeStore, DEFAULT_SIGNED_AGENT_DIRECTORIES, DEFAULT_TRIPWIRE_PATHS, DEFAULT_WEIGHTS, type Detection, type DetectionContext, DetectionEngine, type DetectionEngineOptions, DirectoryCache, EDGE_CLASS_HEADER, EDGE_CLEARANCE_HEADER, type EdgeClass, type EdgeVerdict, type EnvironmentalSignals, type FilterConfig, FilterRule, type FingerprintStore, type FormAnalysisSignals, HONEYTOKEN_BASE_PATH, type Honeytoken, type HoneytokenLinkProps, type HoneytokenOptions, type IPEnrichmentData, InMemoryChallengeStore, InMemoryFingerprintStore, InMemoryRateLimiter, InMemoryTokenStore, type LocalAnalysis, PoWManager, type PoWManagerOptions, type PoWOutcome, type PoWSolution, type PoWVerification, type ProtectOptions, type ProtectResult, type RateLimitConfig, RateLimitRule, type RateLimiter, type Recommendation, type RequestMetadata, type Rule, type RuleContext, RuleEngine, type RuleEngineResult, type RuleResult, type SDKDetectionRequest, type SDKDetectionResponse, type ScoreResult, type Signals, type SignedAgentDirectory, type SiteHoneytoken, type SiteHoneytokenOptions, type StoredChallenge, type TLSInfo, type TemporalSignals, type TextareaKeyboardStats, TokenManager, type TokenManagerOptions, type TokenStore, type TokenVerification, type TripwireConfig, TripwireRule, type Verdict, type VerifyInput, type VerifyResult, type ViolationEvent, type WebBotAuthConfig, WebBotAuthRule, WebDecoy, type WebDecoyConfig, bots, calculateCategoryScores, calculateFinalScore, classifyUserAgent, createAgentVerifier, createCaptchaEndpoints, filter, honeytoken, injectHoneytokenLink, isDatacenterIP, isInjectableHtml, isMobileUA, matchUserAgent, parseUserAgent, rateLimit, readEdgeVerdict, recommend, resolveSecret, siteHoneytoken, tripwire, webBotAuth };
|
|
2135
|
+
export { type AgentCategory, type AgentRequestInput, type AgentStatus, type AgentVerdict, AgentVerifier, type AgentVerifierOptions, BOT_CATEGORIES, BOT_REGISTRY, type BehavioralSignals, type BotAgent, type BotCategory, BotRule, type BotRuleConfig, type BotVerdict, Captcha, type CaptchaEndpoints, type CaptchaEndpointsOptions, type CaptchaHttpResponse, type CaptchaOptions, type CaptchaRequest, type CategoryScores, type ChallengeData, type ChallengeStore, DEFAULT_SIGNED_AGENT_DIRECTORIES, DEFAULT_TRIPWIRE_PATHS, DEFAULT_WEIGHTS, type Detection, type DetectionContext, DetectionEngine, type DetectionEngineOptions, DirectoryCache, EDGE_CLASS_HEADER, EDGE_CLEARANCE_HEADER, type EdgeClass, type EdgeVerdict, type EnvironmentalSignals, type FilterConfig, FilterRule, type FingerprintStore, type FormAnalysisSignals, HONEYTOKEN_BASE_PATH, type Honeytoken, type HoneytokenLinkProps, type HoneytokenOptions, type IPEnrichmentData, InMemoryChallengeStore, InMemoryFingerprintStore, InMemoryRateLimiter, InMemoryTokenStore, type LocalAnalysis, PoWManager, type PoWManagerOptions, type PoWOutcome, type PoWSolution, type PoWVerification, type ProtectOptions, type ProtectResult, type RateLimitConfig, RateLimitRule, type RateLimiter, type Recommendation, type RequestMetadata, type Rule, type RuleContext, RuleEngine, type RuleEngineResult, type RuleResult, type SDKDetectionRequest, type SDKDetectionResponse, type ScoreResult, type Signals, type SignedAgentDirectory, type SiteHoneytoken, type SiteHoneytokenOptions, type StoredChallenge, TEST_TRIGGER_UA_PREFIX, TEST_TRIGGER_USER_AGENT, type TLSInfo, type TemporalSignals, type TextareaKeyboardStats, TokenManager, type TokenManagerOptions, type TokenStore, type TokenVerification, type TripwireConfig, TripwireRule, type Verdict, type VerifyInput, type VerifyResult, type ViolationEvent, type WebBotAuthConfig, WebBotAuthRule, WebDecoy, type WebDecoyConfig, bots, calculateCategoryScores, calculateFinalScore, classifyUserAgent, createAgentVerifier, createCaptchaEndpoints, filter, honeytoken, injectHoneytokenLink, isDatacenterIP, isInjectableHtml, isMobileUA, isTestTriggerUserAgent, matchUserAgent, parseUserAgent, rateLimit, readEdgeVerdict, recommend, resolveSecret, siteHoneytoken, tripwire, webBotAuth };
|
package/dist/index.d.ts
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* or plain traffic carrying no agent signature at all?
|
|
9
9
|
*
|
|
10
10
|
* The verdict taxonomy mirrors the server-side verifier in the ingest service
|
|
11
|
-
*
|
|
11
|
+
* so the SDK, the edge validator, and the backend all speak
|
|
12
12
|
* the same language.
|
|
13
13
|
*/
|
|
14
14
|
/** The four possible outcomes of Web Bot Auth verification. */
|
|
@@ -118,7 +118,7 @@ type AgentRequestInput = Request | {
|
|
|
118
118
|
};
|
|
119
119
|
|
|
120
120
|
/**
|
|
121
|
-
* The edge validator's verdict, as the origin sees it
|
|
121
|
+
* The edge validator's verdict, as the origin sees it.
|
|
122
122
|
*
|
|
123
123
|
* WHY THIS MODULE EXISTS
|
|
124
124
|
*
|
|
@@ -222,7 +222,7 @@ declare function readEdgeVerdict(headers: Record<string, string> | undefined): E
|
|
|
222
222
|
/**
|
|
223
223
|
* GENERATED FILE — DO NOT EDIT.
|
|
224
224
|
*
|
|
225
|
-
* Source of truth:
|
|
225
|
+
* Source of truth: the Go agent registry in the main application repo.
|
|
226
226
|
* Regenerate with `packages/webdecoy/scripts/gen-bot-registry.mjs`; see that
|
|
227
227
|
* script for the command.
|
|
228
228
|
*
|
|
@@ -263,7 +263,7 @@ declare const BOT_CATEGORIES: readonly BotCategory[];
|
|
|
263
263
|
declare const BOT_REGISTRY: readonly BotAgent[];
|
|
264
264
|
|
|
265
265
|
/**
|
|
266
|
-
* Local bot classification
|
|
266
|
+
* Local bot classification.
|
|
267
267
|
*
|
|
268
268
|
* WHY THIS IS IN THE SDK AT ALL
|
|
269
269
|
*
|
|
@@ -357,19 +357,19 @@ interface RuleContext {
|
|
|
357
357
|
enrichment?: IPEnrichmentData;
|
|
358
358
|
/**
|
|
359
359
|
* Web Bot Auth verdict (populated async before evaluation when a
|
|
360
|
-
*
|
|
360
|
+
* `webBotAuth` rule is
|
|
361
361
|
* present). Lets a synchronous rule act on cryptographic agent verification.
|
|
362
362
|
*/
|
|
363
363
|
agent?: AgentVerdict;
|
|
364
364
|
/**
|
|
365
|
-
* The edge validator's annotations on this request
|
|
365
|
+
* The edge validator's annotations on this request, parsed from
|
|
366
366
|
* `x-wd-clearance` and `x-wd-class`. Always populated — `present: false` when
|
|
367
367
|
* the edge did not front this request. Filter expressions read it as
|
|
368
368
|
* `edge.class`, `edge.clearance` and `edge.present`.
|
|
369
369
|
*/
|
|
370
370
|
edge?: EdgeVerdict;
|
|
371
371
|
/**
|
|
372
|
-
* Who the User-Agent says it is
|
|
372
|
+
* Who the User-Agent says it is, matched against the generated agent
|
|
373
373
|
* registry. Always populated — `known: false` when nothing matched. Filter
|
|
374
374
|
* expressions read it as `bot.category`, `bot.name`, `bot.ai` and friends.
|
|
375
375
|
*
|
|
@@ -431,7 +431,7 @@ interface FilterConfig {
|
|
|
431
431
|
dryRun?: boolean;
|
|
432
432
|
}
|
|
433
433
|
/**
|
|
434
|
-
* Configuration for bot-category rules
|
|
434
|
+
* Configuration for bot-category rules
|
|
435
435
|
*/
|
|
436
436
|
interface BotRuleConfig {
|
|
437
437
|
/**
|
|
@@ -494,7 +494,7 @@ interface ViolationEvent {
|
|
|
494
494
|
/**
|
|
495
495
|
* The request's wd_clearance token, when present. Lets the backend bind a
|
|
496
496
|
* tripwire hit to the actor's device fingerprint and deny it — the same
|
|
497
|
-
* durable lockout a decoy hit produces
|
|
497
|
+
* durable lockout a decoy hit produces. Only carried
|
|
498
498
|
* for deception rules (tripwires); undefined otherwise.
|
|
499
499
|
*/
|
|
500
500
|
clearance?: string;
|
|
@@ -706,7 +706,7 @@ interface ProtectResult {
|
|
|
706
706
|
*/
|
|
707
707
|
agent?: AgentVerdict;
|
|
708
708
|
/**
|
|
709
|
-
* What the edge validator said about this request
|
|
709
|
+
* What the edge validator said about this request, parsed from
|
|
710
710
|
* `x-wd-clearance` and `x-wd-class`.
|
|
711
711
|
*
|
|
712
712
|
* Always present. Check `edge.present` before branching: false means the edge
|
|
@@ -855,6 +855,18 @@ declare class WebDecoy {
|
|
|
855
855
|
*/
|
|
856
856
|
protect(metadata: RequestMetadata, options?: ProtectOptions): Promise<ProtectResult>;
|
|
857
857
|
private decide;
|
|
858
|
+
/**
|
|
859
|
+
* Report a test-trigger request and return a blocking verdict.
|
|
860
|
+
*
|
|
861
|
+
* The verdict is `allowed: false` so an enforce-mode adapter answers the
|
|
862
|
+
* curl with a 403 — a visibly different response that tells the developer
|
|
863
|
+
* their middleware acted, Arcjet-quickstart style. (The default monitor
|
|
864
|
+
* mode still serves the request; the dashboard row is the real receipt.)
|
|
865
|
+
*
|
|
866
|
+
* Without an API key nothing can reach the dashboard, so the verdict says
|
|
867
|
+
* so via `error` instead of pretending the test ran.
|
|
868
|
+
*/
|
|
869
|
+
private reportTestTrigger;
|
|
858
870
|
/**
|
|
859
871
|
* Validate the API key configuration
|
|
860
872
|
* Useful for testing integration during setup
|
|
@@ -886,6 +898,31 @@ declare class WebDecoy {
|
|
|
886
898
|
destroy(): Promise<void>;
|
|
887
899
|
}
|
|
888
900
|
|
|
901
|
+
/**
|
|
902
|
+
* The reserved test trigger.
|
|
903
|
+
*
|
|
904
|
+
* A request whose User-Agent starts with `WebDecoy-Test/` is the documented
|
|
905
|
+
* install-verification probe:
|
|
906
|
+
*
|
|
907
|
+
* curl -A "WebDecoy-Test/1.0" http://localhost:3000/
|
|
908
|
+
*
|
|
909
|
+
* The SDK always reports it to ingest — before rules, before local-analysis
|
|
910
|
+
* thresholds, before sampling of any kind — so the developer who just
|
|
911
|
+
* installed the middleware gets a guaranteed, labeled detection in the
|
|
912
|
+
* dashboard within seconds, including from localhost. Ingest recognizes the
|
|
913
|
+
* same prefix server-side, marks the row `is_test`, and keeps it out of
|
|
914
|
+
* stats, billing, actor scoring, and enforcement.
|
|
915
|
+
*
|
|
916
|
+
* Prefix-anchored on purpose: a UA that merely mentions the string mid-way
|
|
917
|
+
* is NOT the trigger, so real traffic can't hide behind the test label.
|
|
918
|
+
*/
|
|
919
|
+
/** Any User-Agent starting with this (case-insensitive) is a test trigger. */
|
|
920
|
+
declare const TEST_TRIGGER_UA_PREFIX = "WebDecoy-Test/";
|
|
921
|
+
/** The exact value the quickstart docs tell developers to send. */
|
|
922
|
+
declare const TEST_TRIGGER_USER_AGENT = "WebDecoy-Test/1.0";
|
|
923
|
+
/** Whether this User-Agent is the reserved test trigger. */
|
|
924
|
+
declare function isTestTriggerUserAgent(userAgent: string | undefined): boolean;
|
|
925
|
+
|
|
889
926
|
/**
|
|
890
927
|
* Rule Engine
|
|
891
928
|
* Evaluates rules in order — first DENY/THROTTLE wins
|
|
@@ -898,7 +935,7 @@ declare class RuleEngine {
|
|
|
898
935
|
* Append a rule after construction.
|
|
899
936
|
*
|
|
900
937
|
* Exists for signals that cannot be known synchronously at construction —
|
|
901
|
-
* currently the site honeytoken
|
|
938
|
+
* currently the site honeytoken, whose path is derived by async HMAC.
|
|
902
939
|
* Evaluation order is append order, matching the constructor.
|
|
903
940
|
*/
|
|
904
941
|
add(rule: Rule): void;
|
|
@@ -975,7 +1012,7 @@ declare class TripwireRule implements Rule {
|
|
|
975
1012
|
}
|
|
976
1013
|
|
|
977
1014
|
/**
|
|
978
|
-
* Bot-category rule
|
|
1015
|
+
* Bot-category rule.
|
|
979
1016
|
*
|
|
980
1017
|
* The one-liner for the policy this product category exists to express:
|
|
981
1018
|
*
|
|
@@ -1010,7 +1047,7 @@ declare class BotRule implements Rule {
|
|
|
1010
1047
|
}
|
|
1011
1048
|
|
|
1012
1049
|
/**
|
|
1013
|
-
* Web Bot Auth rule (
|
|
1050
|
+
* Web Bot Auth rule (the main application repo).
|
|
1014
1051
|
*
|
|
1015
1052
|
* Acts on the Web Bot Auth verdict the SDK computes before rule evaluation
|
|
1016
1053
|
* (`context.agent`). Its headline job is to make **impersonation deny-able in
|
|
@@ -1109,7 +1146,7 @@ declare function honeytoken(options?: HoneytokenOptions): Honeytoken;
|
|
|
1109
1146
|
|
|
1110
1147
|
/**
|
|
1111
1148
|
* Site honeytoken — a stable, derivable trap the adapters can inject for you
|
|
1112
|
-
|
|
1149
|
+
*.
|
|
1113
1150
|
*
|
|
1114
1151
|
* WHY THIS EXISTS ALONGSIDE honeytoken()
|
|
1115
1152
|
*
|
|
@@ -1129,12 +1166,14 @@ declare function honeytoken(options?: HoneytokenOptions): Honeytoken;
|
|
|
1129
1166
|
* JavaScript, no fingerprint and no IP — the client asked for a path that exists
|
|
1130
1167
|
* nowhere and is linked only from an element no human can see.
|
|
1131
1168
|
*
|
|
1132
|
-
* That is not a stylistic preference, it is arithmetic.
|
|
1133
|
-
*
|
|
1134
|
-
* spoofed
|
|
1135
|
-
*
|
|
1136
|
-
*
|
|
1137
|
-
*
|
|
1169
|
+
* That is not a stylistic preference, it is arithmetic. Honeypot hits carry the
|
|
1170
|
+
* highest weight in the threat score and a User-Agent carries nearly none,
|
|
1171
|
+
* because a User-Agent is trivially spoofed — so the same client scores near
|
|
1172
|
+
* zero on a page view and very high on a trap.
|
|
1173
|
+
*
|
|
1174
|
+
* Which only pays off if the link is on the page. Generating a token and asking
|
|
1175
|
+
* the developer to place it is a step most installs never take, so the adapters
|
|
1176
|
+
* that own the response inject it themselves.
|
|
1138
1177
|
*/
|
|
1139
1178
|
/** Base path for honeytoken tripwires. Mirrors the WordPress plugin. */
|
|
1140
1179
|
declare const HONEYTOKEN_BASE_PATH = "/__wd";
|
|
@@ -1273,7 +1312,7 @@ declare function filter(config: FilterConfig): Rule;
|
|
|
1273
1312
|
*/
|
|
1274
1313
|
declare function tripwire(config?: TripwireConfig): Rule;
|
|
1275
1314
|
/**
|
|
1276
|
-
* Factory function to create a bot-category rule
|
|
1315
|
+
* Factory function to create a bot-category rule.
|
|
1277
1316
|
*
|
|
1278
1317
|
* Acts on agents that identify themselves in the User-Agent, matched against the
|
|
1279
1318
|
* registry generated from the same table the scoring pipeline uses — so
|
|
@@ -2093,4 +2132,4 @@ declare function createCaptchaEndpoints(options?: CaptchaEndpointsOptions): {
|
|
|
2093
2132
|
};
|
|
2094
2133
|
type CaptchaEndpoints = ReturnType<typeof createCaptchaEndpoints>;
|
|
2095
2134
|
|
|
2096
|
-
export { type AgentCategory, type AgentRequestInput, type AgentStatus, type AgentVerdict, AgentVerifier, type AgentVerifierOptions, BOT_CATEGORIES, BOT_REGISTRY, type BehavioralSignals, type BotAgent, type BotCategory, BotRule, type BotRuleConfig, type BotVerdict, Captcha, type CaptchaEndpoints, type CaptchaEndpointsOptions, type CaptchaHttpResponse, type CaptchaOptions, type CaptchaRequest, type CategoryScores, type ChallengeData, type ChallengeStore, DEFAULT_SIGNED_AGENT_DIRECTORIES, DEFAULT_TRIPWIRE_PATHS, DEFAULT_WEIGHTS, type Detection, type DetectionContext, DetectionEngine, type DetectionEngineOptions, DirectoryCache, EDGE_CLASS_HEADER, EDGE_CLEARANCE_HEADER, type EdgeClass, type EdgeVerdict, type EnvironmentalSignals, type FilterConfig, FilterRule, type FingerprintStore, type FormAnalysisSignals, HONEYTOKEN_BASE_PATH, type Honeytoken, type HoneytokenLinkProps, type HoneytokenOptions, type IPEnrichmentData, InMemoryChallengeStore, InMemoryFingerprintStore, InMemoryRateLimiter, InMemoryTokenStore, type LocalAnalysis, PoWManager, type PoWManagerOptions, type PoWOutcome, type PoWSolution, type PoWVerification, type ProtectOptions, type ProtectResult, type RateLimitConfig, RateLimitRule, type RateLimiter, type Recommendation, type RequestMetadata, type Rule, type RuleContext, RuleEngine, type RuleEngineResult, type RuleResult, type SDKDetectionRequest, type SDKDetectionResponse, type ScoreResult, type Signals, type SignedAgentDirectory, type SiteHoneytoken, type SiteHoneytokenOptions, type StoredChallenge, type TLSInfo, type TemporalSignals, type TextareaKeyboardStats, TokenManager, type TokenManagerOptions, type TokenStore, type TokenVerification, type TripwireConfig, TripwireRule, type Verdict, type VerifyInput, type VerifyResult, type ViolationEvent, type WebBotAuthConfig, WebBotAuthRule, WebDecoy, type WebDecoyConfig, bots, calculateCategoryScores, calculateFinalScore, classifyUserAgent, createAgentVerifier, createCaptchaEndpoints, filter, honeytoken, injectHoneytokenLink, isDatacenterIP, isInjectableHtml, isMobileUA, matchUserAgent, parseUserAgent, rateLimit, readEdgeVerdict, recommend, resolveSecret, siteHoneytoken, tripwire, webBotAuth };
|
|
2135
|
+
export { type AgentCategory, type AgentRequestInput, type AgentStatus, type AgentVerdict, AgentVerifier, type AgentVerifierOptions, BOT_CATEGORIES, BOT_REGISTRY, type BehavioralSignals, type BotAgent, type BotCategory, BotRule, type BotRuleConfig, type BotVerdict, Captcha, type CaptchaEndpoints, type CaptchaEndpointsOptions, type CaptchaHttpResponse, type CaptchaOptions, type CaptchaRequest, type CategoryScores, type ChallengeData, type ChallengeStore, DEFAULT_SIGNED_AGENT_DIRECTORIES, DEFAULT_TRIPWIRE_PATHS, DEFAULT_WEIGHTS, type Detection, type DetectionContext, DetectionEngine, type DetectionEngineOptions, DirectoryCache, EDGE_CLASS_HEADER, EDGE_CLEARANCE_HEADER, type EdgeClass, type EdgeVerdict, type EnvironmentalSignals, type FilterConfig, FilterRule, type FingerprintStore, type FormAnalysisSignals, HONEYTOKEN_BASE_PATH, type Honeytoken, type HoneytokenLinkProps, type HoneytokenOptions, type IPEnrichmentData, InMemoryChallengeStore, InMemoryFingerprintStore, InMemoryRateLimiter, InMemoryTokenStore, type LocalAnalysis, PoWManager, type PoWManagerOptions, type PoWOutcome, type PoWSolution, type PoWVerification, type ProtectOptions, type ProtectResult, type RateLimitConfig, RateLimitRule, type RateLimiter, type Recommendation, type RequestMetadata, type Rule, type RuleContext, RuleEngine, type RuleEngineResult, type RuleResult, type SDKDetectionRequest, type SDKDetectionResponse, type ScoreResult, type Signals, type SignedAgentDirectory, type SiteHoneytoken, type SiteHoneytokenOptions, type StoredChallenge, TEST_TRIGGER_UA_PREFIX, TEST_TRIGGER_USER_AGENT, type TLSInfo, type TemporalSignals, type TextareaKeyboardStats, TokenManager, type TokenManagerOptions, type TokenStore, type TokenVerification, type TripwireConfig, TripwireRule, type Verdict, type VerifyInput, type VerifyResult, type ViolationEvent, type WebBotAuthConfig, WebBotAuthRule, WebDecoy, type WebDecoyConfig, bots, calculateCategoryScores, calculateFinalScore, classifyUserAgent, createAgentVerifier, createCaptchaEndpoints, filter, honeytoken, injectHoneytokenLink, isDatacenterIP, isInjectableHtml, isMobileUA, isTestTriggerUserAgent, matchUserAgent, parseUserAgent, rateLimit, readEdgeVerdict, recommend, resolveSecret, siteHoneytoken, tripwire, webBotAuth };
|
package/dist/index.js
CHANGED
|
@@ -41,6 +41,8 @@ __export(index_exports, {
|
|
|
41
41
|
PoWManager: () => PoWManager,
|
|
42
42
|
RateLimitRule: () => RateLimitRule,
|
|
43
43
|
RuleEngine: () => RuleEngine,
|
|
44
|
+
TEST_TRIGGER_UA_PREFIX: () => TEST_TRIGGER_UA_PREFIX,
|
|
45
|
+
TEST_TRIGGER_USER_AGENT: () => TEST_TRIGGER_USER_AGENT,
|
|
44
46
|
TokenManager: () => TokenManager,
|
|
45
47
|
TripwireRule: () => TripwireRule,
|
|
46
48
|
WebBotAuthRule: () => WebBotAuthRule,
|
|
@@ -57,6 +59,7 @@ __export(index_exports, {
|
|
|
57
59
|
isDatacenterIP: () => isDatacenterIP2,
|
|
58
60
|
isInjectableHtml: () => isInjectableHtml,
|
|
59
61
|
isMobileUA: () => isMobileUA,
|
|
62
|
+
isTestTriggerUserAgent: () => isTestTriggerUserAgent,
|
|
60
63
|
matchUserAgent: () => matchUserAgent,
|
|
61
64
|
parseUserAgent: () => parseUserAgent,
|
|
62
65
|
rateLimit: () => rateLimit,
|
|
@@ -365,7 +368,7 @@ var RuleEngine = class {
|
|
|
365
368
|
* Append a rule after construction.
|
|
366
369
|
*
|
|
367
370
|
* Exists for signals that cannot be known synchronously at construction —
|
|
368
|
-
* currently the site honeytoken
|
|
371
|
+
* currently the site honeytoken, whose path is derived by async HMAC.
|
|
369
372
|
* Evaluation order is append order, matching the constructor.
|
|
370
373
|
*/
|
|
371
374
|
add(rule) {
|
|
@@ -2312,6 +2315,14 @@ function classifyUserAgent(userAgent) {
|
|
|
2312
2315
|
};
|
|
2313
2316
|
}
|
|
2314
2317
|
|
|
2318
|
+
// src/test-trigger.ts
|
|
2319
|
+
var TEST_TRIGGER_UA_PREFIX = "WebDecoy-Test/";
|
|
2320
|
+
var TEST_TRIGGER_USER_AGENT = "WebDecoy-Test/1.0";
|
|
2321
|
+
function isTestTriggerUserAgent(userAgent) {
|
|
2322
|
+
if (!userAgent) return false;
|
|
2323
|
+
return userAgent.trimStart().toLowerCase().startsWith(TEST_TRIGGER_UA_PREFIX.toLowerCase());
|
|
2324
|
+
}
|
|
2325
|
+
|
|
2315
2326
|
// src/sdk.ts
|
|
2316
2327
|
var WebDecoy = class {
|
|
2317
2328
|
constructor(config) {
|
|
@@ -2426,11 +2437,11 @@ var WebDecoy = class {
|
|
|
2426
2437
|
userAgent: metadata.user_agent,
|
|
2427
2438
|
headers: metadata.headers,
|
|
2428
2439
|
timestamp: metadata.timestamp || Date.now(),
|
|
2429
|
-
// Parsed synchronously and unconditionally
|
|
2440
|
+
// Parsed synchronously and unconditionally: it is two header reads,
|
|
2430
2441
|
// it needs no network, and a rule that has to check whether the edge
|
|
2431
2442
|
// verdict was populated is a rule people will get wrong.
|
|
2432
2443
|
edge: readEdgeVerdict(metadata.headers),
|
|
2433
|
-
// Same reasoning as `edge`, and the same cost profile
|
|
2444
|
+
// Same reasoning as `edge`, and the same cost profile: a memoised
|
|
2434
2445
|
// substring scan over a static table, no network, no async. Populating it
|
|
2435
2446
|
// unconditionally means a rule never has to ask whether classification
|
|
2436
2447
|
// ran.
|
|
@@ -2535,6 +2546,9 @@ var WebDecoy = class {
|
|
|
2535
2546
|
if (!metadata.timestamp) {
|
|
2536
2547
|
metadata.timestamp = Date.now();
|
|
2537
2548
|
}
|
|
2549
|
+
if (isTestTriggerUserAgent(metadata.user_agent)) {
|
|
2550
|
+
return this.reportTestTrigger(metadata);
|
|
2551
|
+
}
|
|
2538
2552
|
let ruleResult;
|
|
2539
2553
|
let agentVerdict;
|
|
2540
2554
|
if (this.ruleEngine && (this._hasFilterRules || this._hasAgentRules)) {
|
|
@@ -2655,6 +2669,55 @@ var WebDecoy = class {
|
|
|
2655
2669
|
};
|
|
2656
2670
|
}
|
|
2657
2671
|
}
|
|
2672
|
+
/**
|
|
2673
|
+
* Report a test-trigger request and return a blocking verdict.
|
|
2674
|
+
*
|
|
2675
|
+
* The verdict is `allowed: false` so an enforce-mode adapter answers the
|
|
2676
|
+
* curl with a 403 — a visibly different response that tells the developer
|
|
2677
|
+
* their middleware acted, Arcjet-quickstart style. (The default monitor
|
|
2678
|
+
* mode still serves the request; the dashboard row is the real receipt.)
|
|
2679
|
+
*
|
|
2680
|
+
* Without an API key nothing can reach the dashboard, so the verdict says
|
|
2681
|
+
* so via `error` instead of pretending the test ran.
|
|
2682
|
+
*/
|
|
2683
|
+
async reportTestTrigger(metadata) {
|
|
2684
|
+
const blocked = {
|
|
2685
|
+
decision: "block",
|
|
2686
|
+
confidence: 100,
|
|
2687
|
+
threat_level: "HIGH",
|
|
2688
|
+
bot_detected: true,
|
|
2689
|
+
bot_type: "test_trigger",
|
|
2690
|
+
detection_id: "test_" + Date.now(),
|
|
2691
|
+
rule_enforced: false
|
|
2692
|
+
};
|
|
2693
|
+
if (!this.client) {
|
|
2694
|
+
return {
|
|
2695
|
+
allowed: false,
|
|
2696
|
+
detection: blocked,
|
|
2697
|
+
error: "Test trigger recognized, but no apiKey is configured \u2014 nothing was reported to the dashboard."
|
|
2698
|
+
};
|
|
2699
|
+
}
|
|
2700
|
+
try {
|
|
2701
|
+
const detection = await this.client.detect({
|
|
2702
|
+
request_metadata: metadata,
|
|
2703
|
+
local_analysis: {
|
|
2704
|
+
suspicious_headers: false,
|
|
2705
|
+
missing_sec_ch_ua: false,
|
|
2706
|
+
datacenter_ip: false,
|
|
2707
|
+
local_score: 100,
|
|
2708
|
+
needs_verification: true,
|
|
2709
|
+
flags: ["test_trigger"]
|
|
2710
|
+
}
|
|
2711
|
+
});
|
|
2712
|
+
return { allowed: false, detection };
|
|
2713
|
+
} catch (error) {
|
|
2714
|
+
return {
|
|
2715
|
+
allowed: false,
|
|
2716
|
+
detection: blocked,
|
|
2717
|
+
error: error instanceof Error ? error.message : "Failed to report test detection"
|
|
2718
|
+
};
|
|
2719
|
+
}
|
|
2720
|
+
}
|
|
2658
2721
|
/**
|
|
2659
2722
|
* Validate the API key configuration
|
|
2660
2723
|
* Useful for testing integration during setup
|
|
@@ -4701,6 +4764,8 @@ function createCaptchaEndpoints(options = {}) {
|
|
|
4701
4764
|
PoWManager,
|
|
4702
4765
|
RateLimitRule,
|
|
4703
4766
|
RuleEngine,
|
|
4767
|
+
TEST_TRIGGER_UA_PREFIX,
|
|
4768
|
+
TEST_TRIGGER_USER_AGENT,
|
|
4704
4769
|
TokenManager,
|
|
4705
4770
|
TripwireRule,
|
|
4706
4771
|
WebBotAuthRule,
|
|
@@ -4717,6 +4782,7 @@ function createCaptchaEndpoints(options = {}) {
|
|
|
4717
4782
|
isDatacenterIP,
|
|
4718
4783
|
isInjectableHtml,
|
|
4719
4784
|
isMobileUA,
|
|
4785
|
+
isTestTriggerUserAgent,
|
|
4720
4786
|
matchUserAgent,
|
|
4721
4787
|
parseUserAgent,
|
|
4722
4788
|
rateLimit,
|
package/dist/index.mjs
CHANGED
|
@@ -294,7 +294,7 @@ var RuleEngine = class {
|
|
|
294
294
|
* Append a rule after construction.
|
|
295
295
|
*
|
|
296
296
|
* Exists for signals that cannot be known synchronously at construction —
|
|
297
|
-
* currently the site honeytoken
|
|
297
|
+
* currently the site honeytoken, whose path is derived by async HMAC.
|
|
298
298
|
* Evaluation order is append order, matching the constructor.
|
|
299
299
|
*/
|
|
300
300
|
add(rule) {
|
|
@@ -2241,6 +2241,14 @@ function classifyUserAgent(userAgent) {
|
|
|
2241
2241
|
};
|
|
2242
2242
|
}
|
|
2243
2243
|
|
|
2244
|
+
// src/test-trigger.ts
|
|
2245
|
+
var TEST_TRIGGER_UA_PREFIX = "WebDecoy-Test/";
|
|
2246
|
+
var TEST_TRIGGER_USER_AGENT = "WebDecoy-Test/1.0";
|
|
2247
|
+
function isTestTriggerUserAgent(userAgent) {
|
|
2248
|
+
if (!userAgent) return false;
|
|
2249
|
+
return userAgent.trimStart().toLowerCase().startsWith(TEST_TRIGGER_UA_PREFIX.toLowerCase());
|
|
2250
|
+
}
|
|
2251
|
+
|
|
2244
2252
|
// src/sdk.ts
|
|
2245
2253
|
var WebDecoy = class {
|
|
2246
2254
|
constructor(config) {
|
|
@@ -2355,11 +2363,11 @@ var WebDecoy = class {
|
|
|
2355
2363
|
userAgent: metadata.user_agent,
|
|
2356
2364
|
headers: metadata.headers,
|
|
2357
2365
|
timestamp: metadata.timestamp || Date.now(),
|
|
2358
|
-
// Parsed synchronously and unconditionally
|
|
2366
|
+
// Parsed synchronously and unconditionally: it is two header reads,
|
|
2359
2367
|
// it needs no network, and a rule that has to check whether the edge
|
|
2360
2368
|
// verdict was populated is a rule people will get wrong.
|
|
2361
2369
|
edge: readEdgeVerdict(metadata.headers),
|
|
2362
|
-
// Same reasoning as `edge`, and the same cost profile
|
|
2370
|
+
// Same reasoning as `edge`, and the same cost profile: a memoised
|
|
2363
2371
|
// substring scan over a static table, no network, no async. Populating it
|
|
2364
2372
|
// unconditionally means a rule never has to ask whether classification
|
|
2365
2373
|
// ran.
|
|
@@ -2464,6 +2472,9 @@ var WebDecoy = class {
|
|
|
2464
2472
|
if (!metadata.timestamp) {
|
|
2465
2473
|
metadata.timestamp = Date.now();
|
|
2466
2474
|
}
|
|
2475
|
+
if (isTestTriggerUserAgent(metadata.user_agent)) {
|
|
2476
|
+
return this.reportTestTrigger(metadata);
|
|
2477
|
+
}
|
|
2467
2478
|
let ruleResult;
|
|
2468
2479
|
let agentVerdict;
|
|
2469
2480
|
if (this.ruleEngine && (this._hasFilterRules || this._hasAgentRules)) {
|
|
@@ -2584,6 +2595,55 @@ var WebDecoy = class {
|
|
|
2584
2595
|
};
|
|
2585
2596
|
}
|
|
2586
2597
|
}
|
|
2598
|
+
/**
|
|
2599
|
+
* Report a test-trigger request and return a blocking verdict.
|
|
2600
|
+
*
|
|
2601
|
+
* The verdict is `allowed: false` so an enforce-mode adapter answers the
|
|
2602
|
+
* curl with a 403 — a visibly different response that tells the developer
|
|
2603
|
+
* their middleware acted, Arcjet-quickstart style. (The default monitor
|
|
2604
|
+
* mode still serves the request; the dashboard row is the real receipt.)
|
|
2605
|
+
*
|
|
2606
|
+
* Without an API key nothing can reach the dashboard, so the verdict says
|
|
2607
|
+
* so via `error` instead of pretending the test ran.
|
|
2608
|
+
*/
|
|
2609
|
+
async reportTestTrigger(metadata) {
|
|
2610
|
+
const blocked = {
|
|
2611
|
+
decision: "block",
|
|
2612
|
+
confidence: 100,
|
|
2613
|
+
threat_level: "HIGH",
|
|
2614
|
+
bot_detected: true,
|
|
2615
|
+
bot_type: "test_trigger",
|
|
2616
|
+
detection_id: "test_" + Date.now(),
|
|
2617
|
+
rule_enforced: false
|
|
2618
|
+
};
|
|
2619
|
+
if (!this.client) {
|
|
2620
|
+
return {
|
|
2621
|
+
allowed: false,
|
|
2622
|
+
detection: blocked,
|
|
2623
|
+
error: "Test trigger recognized, but no apiKey is configured \u2014 nothing was reported to the dashboard."
|
|
2624
|
+
};
|
|
2625
|
+
}
|
|
2626
|
+
try {
|
|
2627
|
+
const detection = await this.client.detect({
|
|
2628
|
+
request_metadata: metadata,
|
|
2629
|
+
local_analysis: {
|
|
2630
|
+
suspicious_headers: false,
|
|
2631
|
+
missing_sec_ch_ua: false,
|
|
2632
|
+
datacenter_ip: false,
|
|
2633
|
+
local_score: 100,
|
|
2634
|
+
needs_verification: true,
|
|
2635
|
+
flags: ["test_trigger"]
|
|
2636
|
+
}
|
|
2637
|
+
});
|
|
2638
|
+
return { allowed: false, detection };
|
|
2639
|
+
} catch (error) {
|
|
2640
|
+
return {
|
|
2641
|
+
allowed: false,
|
|
2642
|
+
detection: blocked,
|
|
2643
|
+
error: error instanceof Error ? error.message : "Failed to report test detection"
|
|
2644
|
+
};
|
|
2645
|
+
}
|
|
2646
|
+
}
|
|
2587
2647
|
/**
|
|
2588
2648
|
* Validate the API key configuration
|
|
2589
2649
|
* Useful for testing integration during setup
|
|
@@ -4629,6 +4689,8 @@ export {
|
|
|
4629
4689
|
PoWManager,
|
|
4630
4690
|
RateLimitRule,
|
|
4631
4691
|
RuleEngine,
|
|
4692
|
+
TEST_TRIGGER_UA_PREFIX,
|
|
4693
|
+
TEST_TRIGGER_USER_AGENT,
|
|
4632
4694
|
TokenManager,
|
|
4633
4695
|
TripwireRule,
|
|
4634
4696
|
WebBotAuthRule,
|
|
@@ -4645,6 +4707,7 @@ export {
|
|
|
4645
4707
|
isDatacenterIP2 as isDatacenterIP,
|
|
4646
4708
|
isInjectableHtml,
|
|
4647
4709
|
isMobileUA,
|
|
4710
|
+
isTestTriggerUserAgent,
|
|
4648
4711
|
matchUserAgent,
|
|
4649
4712
|
parseUserAgent,
|
|
4650
4713
|
rateLimit,
|