@webdecoy/node 0.19.0 → 0.20.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.
@@ -2502,6 +2502,24 @@ function isTestTriggerUserAgent(userAgent) {
2502
2502
  return userAgent.trimStart().toLowerCase().startsWith(TEST_TRIGGER_UA_PREFIX.toLowerCase());
2503
2503
  }
2504
2504
 
2505
+ // src/report-headers.ts
2506
+ var CREDENTIAL_HEADER = /cookie|auth|token|secret|passw|session|credential|csrf|xsrf|api[-_]?key|access[-_]?key|private[-_]?key/i;
2507
+ var CLEARANCE_COOKIE = "wd_clearance";
2508
+ function reportableHeaders(headers) {
2509
+ const out = {};
2510
+ for (const [name, value] of Object.entries(headers)) {
2511
+ if (!CREDENTIAL_HEADER.test(name)) {
2512
+ out[name] = value;
2513
+ continue;
2514
+ }
2515
+ out[name] = name.toLowerCase() === "cookie" ? clearanceCookieOnly(value) : "";
2516
+ }
2517
+ return out;
2518
+ }
2519
+ function clearanceCookieOnly(cookie) {
2520
+ return String(cookie ?? "").split(";").map((pair) => pair.trim()).filter((pair) => pair.slice(0, pair.indexOf("=")).trim() === CLEARANCE_COOKIE).join("; ");
2521
+ }
2522
+
2505
2523
  // src/client.ts
2506
2524
  var WebDecoyUnavailableError = class extends Error {
2507
2525
  constructor(retryAt) {
@@ -2715,16 +2733,16 @@ var WebDecoyClient = class {
2715
2733
  }
2716
2734
  };
2717
2735
  function toWireDetectionRequest(request) {
2718
- const tls = request.request_metadata.tls_info;
2719
- if (!tls || tls.alpn_protocols === void 0) return request;
2720
- const { alpn_protocols, ...rest } = tls;
2721
- return {
2722
- ...request,
2723
- request_metadata: {
2724
- ...request.request_metadata,
2725
- tls_info: { ...rest, alpn: rest.alpn ?? alpn_protocols }
2726
- }
2736
+ const metadata = {
2737
+ ...request.request_metadata,
2738
+ headers: reportableHeaders(request.request_metadata.headers ?? {})
2727
2739
  };
2740
+ const tls = metadata.tls_info;
2741
+ if (tls && tls.alpn_protocols !== void 0) {
2742
+ const { alpn_protocols, ...rest } = tls;
2743
+ metadata.tls_info = { ...rest, alpn: rest.alpn ?? alpn_protocols };
2744
+ }
2745
+ return { ...request, request_metadata: metadata };
2728
2746
  }
2729
2747
 
2730
2748
  // src/local-analysis.ts
@@ -0,0 +1,168 @@
1
+ /**
2
+ * Resolving the client IP address behind a proxy.
3
+ *
4
+ * WHY THIS MODULE EXISTS
5
+ *
6
+ * Every adapter used to read the leftmost value of `X-Forwarded-For` and call it
7
+ * the client. That header is written by the client for the first hop, so the
8
+ * leftmost value is whatever the caller decided to put there. One
9
+ * `-H 'X-Forwarded-For: 1.2.3.4'` gave an attacker a fresh rate-limit bucket per
10
+ * forged address, put an address of their choosing on every violation we
11
+ * reported, and made `filter({ expression: 'ip.tor' })` an opt-in check.
12
+ *
13
+ * A forwarding header is only evidence if you know who wrote it. So the default
14
+ * here is to not read one at all: use the address the connection actually came
15
+ * from, and make the operator say how many proxies sit in front before we
16
+ * believe anything else. The WordPress plugin already works this way; this
17
+ * brings the Node adapters in line.
18
+ *
19
+ * THE MODEL
20
+ *
21
+ * Each proxy appends the address it received the connection from, so the
22
+ * observed chain outermost-first is `[...X-Forwarded-For, peer]` and the entries
23
+ * to the RIGHT are the ones added by infrastructure you control. Trust is
24
+ * therefore counted from the right: with one proxy in front of you, the client
25
+ * is the last `X-Forwarded-For` entry; with two, the second from last. Anything
26
+ * further left was supplied by someone you have no reason to believe.
27
+ *
28
+ * No `node:net` — this runs in Edge and Workers runtimes too, so the address
29
+ * parsing is hand-rolled and covered by tests.
30
+ */
31
+ /**
32
+ * How much of the forwarding chain to believe.
33
+ *
34
+ * - `false` (default) — read no forwarding headers; the peer address is the
35
+ * client. Correct for an app exposed directly, and safe for one that isn't:
36
+ * it attributes traffic to your proxy rather than to a forged address.
37
+ * - `number` — the number of trusted proxies between the client and this
38
+ * process. The client is the Nth entry from the right of `X-Forwarded-For`.
39
+ * - `'cloudflare'` — use `CF-Connecting-IP`. Only meaningful if the origin is
40
+ * unreachable except through Cloudflare, since the header is otherwise just
41
+ * another thing a client can send.
42
+ * - `'railway'` — the app runs on Railway with nothing else in front. Railway's
43
+ * edge replaces any `X-Forwarded-For` the client sent with exactly
44
+ * `<client>, <edge>`, so the client is two entries from the right. The
45
+ * common guess of `1` names Railway's edge for every visitor. With a CDN in
46
+ * front of Railway, configure for the CDN instead (`'cloudflare'`).
47
+ * - `string[]` — CIDRs (or bare addresses) of the proxies you run. The chain is
48
+ * walked right to left and the first address that isn't one of yours is the
49
+ * client. Use this when the depth varies.
50
+ */
51
+ type TrustedProxies = false | number | 'cloudflare' | 'railway' | string[];
52
+ /** Headers as either a Node-style bag or a WHATWG `Headers`. */
53
+ type HeaderSource = Record<string, string | string[] | undefined> | {
54
+ get(name: string): string | null;
55
+ };
56
+ interface ResolveClientIpOptions {
57
+ /** Request headers. */
58
+ headers: HeaderSource;
59
+ /** The address the connection came from, when the runtime exposes one. */
60
+ peer?: string;
61
+ /** How much of the forwarding chain to believe. Defaults to `false`. */
62
+ trustProxy?: TrustedProxies;
63
+ }
64
+ /**
65
+ * Strip the decoration real-world sources add to an address — brackets, a port,
66
+ * an IPv6 zone id — and return it in a canonical form, or null if what's left
67
+ * isn't an address at all.
68
+ *
69
+ * IPv4-mapped IPv6 (`::ffff:203.0.113.9`) collapses to the IPv4 form, so a
70
+ * dual-stack listener and an `X-Forwarded-For` entry for the same client
71
+ * produce the same key.
72
+ */
73
+ declare function normalizeIp(raw: string | undefined | null): string | null;
74
+ /**
75
+ * Whether an address falls inside a CIDR range. A bare address is treated as a
76
+ * single-host range. Families never match across each other.
77
+ */
78
+ declare function ipInCidr(ip: string, cidr: string): boolean;
79
+ /**
80
+ * Resolve the client IP for a request.
81
+ *
82
+ * Returns `undefined` only when there is nothing to go on: no peer address and
83
+ * no header the configuration says to believe. Callers supply their own last
84
+ * resort, because what that should be is a per-framework question.
85
+ *
86
+ * Whenever the configured source is missing or malformed this falls back to the
87
+ * peer address rather than reaching further left in the chain. The peer is the
88
+ * one address on a request that cannot be forged, so a wrong-but-real proxy
89
+ * address beats a plausible-looking value the caller chose.
90
+ */
91
+ declare function resolveClientIp(options: ResolveClientIpOptions): string | undefined;
92
+
93
+ // GENERATED by WebDecoy edge/vercel-validator/scripts/bundle.mjs. DO NOT EDIT.
94
+ /** What the gate needs to know about the site. */
95
+ interface GateEnv {
96
+ /** The organization the site belongs to (WEBDECOY_SITE_KEY). */
97
+ siteKey: string;
98
+ /** The site's scanner (WEBDECOY_SCANNER_ID). */
99
+ scannerId: string;
100
+ /** Proves the reports come from a validator WebDecoy issued (WEBDECOY_SENSOR_KEY). */
101
+ sensorKey: string;
102
+ /** WebDecoy ingest; defaults to DEFAULT_INGEST. */
103
+ ingest?: string;
104
+ }
105
+ /**
106
+ * `respond`: send this response instead of the page.
107
+ * `continue`: serve the page with exactly these request headers; `null` means untouched.
108
+ */
109
+ type GateOutcome =
110
+ | { action: 'respond'; response: Response }
111
+ | { action: 'continue'; headers: Headers | null; verdict: string | null };
112
+ /** This bundle's build name, reported with every verdict. */
113
+ declare const BUILD: string;
114
+
115
+ /**
116
+ * The clearance gate, for middleware that runs in front of the page.
117
+ *
118
+ * The same decision the Cloudflare, AWS and Netlify validators make, from the
119
+ * same source: `gate.generated.js` is built from WebDecoy's validator code and
120
+ * is never edited here. This file is the part an adapter needs around it, the
121
+ * site's identity from the environment and one client-IP answer.
122
+ *
123
+ * What it does with a request, in order:
124
+ *
125
+ * 1. Credentials, verified crawlers (forward-confirmed reverse DNS) and
126
+ * validly signed agents pass before any token is asked for.
127
+ * 2. A page no protected path covers passes.
128
+ * 3. On a protected path, a valid `wd_clearance` cookie passes. A missing,
129
+ * invalid or revoked one is labelled; in monitor mode the request still
130
+ * passes, in enforce mode it gets the challenge: a real browser earns the
131
+ * cookie and is sent back, a client that runs no JavaScript stays there.
132
+ *
133
+ * Which paths are protected, and whether the site monitors or enforces, is
134
+ * set in WebDecoy, not here. Every failure, WebDecoy unreachable included,
135
+ * lets the request through.
136
+ */
137
+
138
+ interface ClearanceGateOptions {
139
+ /** WEBDECOY_SITE_KEY by default. */
140
+ siteKey?: string;
141
+ /** WEBDECOY_SCANNER_ID by default. */
142
+ scannerId?: string;
143
+ /** WEBDECOY_SENSOR_KEY by default. A secret: set it in the platform's environment, never in code. */
144
+ sensorKey?: string;
145
+ /** WEBDECOY_INGEST, else WebDecoy's ingest. */
146
+ ingest?: string;
147
+ /**
148
+ * How many proxies sit in front of the middleware. Defaults to `1`, the
149
+ * hosting platform, which is right on Vercel. See resolveClientIp.
150
+ */
151
+ trustProxy?: TrustedProxies;
152
+ }
153
+ /** What a platform passes with each request. */
154
+ interface ClearanceContext {
155
+ waitUntil?: (promise: Promise<unknown>) => void;
156
+ }
157
+ /** The site's identity, from options first and the environment second; null when incomplete. */
158
+ declare function resolveGateEnv(options?: ClearanceGateOptions): GateEnv | null;
159
+ /**
160
+ * A gate bound to one site: call it with each request.
161
+ *
162
+ * Missing configuration turns it into a pass-through that says so once,
163
+ * rather than an unproven gate: a site that forgot its sensor key must keep
164
+ * serving pages.
165
+ */
166
+ declare function createClearanceGate(options?: ClearanceGateOptions): (request: Request, context?: ClearanceContext) => Promise<GateOutcome>;
167
+
168
+ export { BUILD as B, type ClearanceContext as C, type GateEnv as G, type HeaderSource as H, type ResolveClientIpOptions as R, type TrustedProxies as T, type ClearanceGateOptions as a, type GateOutcome as b, createClearanceGate as c, resolveGateEnv as d, ipInCidr as i, normalizeIp as n, resolveClientIp as r };
@@ -0,0 +1,168 @@
1
+ /**
2
+ * Resolving the client IP address behind a proxy.
3
+ *
4
+ * WHY THIS MODULE EXISTS
5
+ *
6
+ * Every adapter used to read the leftmost value of `X-Forwarded-For` and call it
7
+ * the client. That header is written by the client for the first hop, so the
8
+ * leftmost value is whatever the caller decided to put there. One
9
+ * `-H 'X-Forwarded-For: 1.2.3.4'` gave an attacker a fresh rate-limit bucket per
10
+ * forged address, put an address of their choosing on every violation we
11
+ * reported, and made `filter({ expression: 'ip.tor' })` an opt-in check.
12
+ *
13
+ * A forwarding header is only evidence if you know who wrote it. So the default
14
+ * here is to not read one at all: use the address the connection actually came
15
+ * from, and make the operator say how many proxies sit in front before we
16
+ * believe anything else. The WordPress plugin already works this way; this
17
+ * brings the Node adapters in line.
18
+ *
19
+ * THE MODEL
20
+ *
21
+ * Each proxy appends the address it received the connection from, so the
22
+ * observed chain outermost-first is `[...X-Forwarded-For, peer]` and the entries
23
+ * to the RIGHT are the ones added by infrastructure you control. Trust is
24
+ * therefore counted from the right: with one proxy in front of you, the client
25
+ * is the last `X-Forwarded-For` entry; with two, the second from last. Anything
26
+ * further left was supplied by someone you have no reason to believe.
27
+ *
28
+ * No `node:net` — this runs in Edge and Workers runtimes too, so the address
29
+ * parsing is hand-rolled and covered by tests.
30
+ */
31
+ /**
32
+ * How much of the forwarding chain to believe.
33
+ *
34
+ * - `false` (default) — read no forwarding headers; the peer address is the
35
+ * client. Correct for an app exposed directly, and safe for one that isn't:
36
+ * it attributes traffic to your proxy rather than to a forged address.
37
+ * - `number` — the number of trusted proxies between the client and this
38
+ * process. The client is the Nth entry from the right of `X-Forwarded-For`.
39
+ * - `'cloudflare'` — use `CF-Connecting-IP`. Only meaningful if the origin is
40
+ * unreachable except through Cloudflare, since the header is otherwise just
41
+ * another thing a client can send.
42
+ * - `'railway'` — the app runs on Railway with nothing else in front. Railway's
43
+ * edge replaces any `X-Forwarded-For` the client sent with exactly
44
+ * `<client>, <edge>`, so the client is two entries from the right. The
45
+ * common guess of `1` names Railway's edge for every visitor. With a CDN in
46
+ * front of Railway, configure for the CDN instead (`'cloudflare'`).
47
+ * - `string[]` — CIDRs (or bare addresses) of the proxies you run. The chain is
48
+ * walked right to left and the first address that isn't one of yours is the
49
+ * client. Use this when the depth varies.
50
+ */
51
+ type TrustedProxies = false | number | 'cloudflare' | 'railway' | string[];
52
+ /** Headers as either a Node-style bag or a WHATWG `Headers`. */
53
+ type HeaderSource = Record<string, string | string[] | undefined> | {
54
+ get(name: string): string | null;
55
+ };
56
+ interface ResolveClientIpOptions {
57
+ /** Request headers. */
58
+ headers: HeaderSource;
59
+ /** The address the connection came from, when the runtime exposes one. */
60
+ peer?: string;
61
+ /** How much of the forwarding chain to believe. Defaults to `false`. */
62
+ trustProxy?: TrustedProxies;
63
+ }
64
+ /**
65
+ * Strip the decoration real-world sources add to an address — brackets, a port,
66
+ * an IPv6 zone id — and return it in a canonical form, or null if what's left
67
+ * isn't an address at all.
68
+ *
69
+ * IPv4-mapped IPv6 (`::ffff:203.0.113.9`) collapses to the IPv4 form, so a
70
+ * dual-stack listener and an `X-Forwarded-For` entry for the same client
71
+ * produce the same key.
72
+ */
73
+ declare function normalizeIp(raw: string | undefined | null): string | null;
74
+ /**
75
+ * Whether an address falls inside a CIDR range. A bare address is treated as a
76
+ * single-host range. Families never match across each other.
77
+ */
78
+ declare function ipInCidr(ip: string, cidr: string): boolean;
79
+ /**
80
+ * Resolve the client IP for a request.
81
+ *
82
+ * Returns `undefined` only when there is nothing to go on: no peer address and
83
+ * no header the configuration says to believe. Callers supply their own last
84
+ * resort, because what that should be is a per-framework question.
85
+ *
86
+ * Whenever the configured source is missing or malformed this falls back to the
87
+ * peer address rather than reaching further left in the chain. The peer is the
88
+ * one address on a request that cannot be forged, so a wrong-but-real proxy
89
+ * address beats a plausible-looking value the caller chose.
90
+ */
91
+ declare function resolveClientIp(options: ResolveClientIpOptions): string | undefined;
92
+
93
+ // GENERATED by WebDecoy edge/vercel-validator/scripts/bundle.mjs. DO NOT EDIT.
94
+ /** What the gate needs to know about the site. */
95
+ interface GateEnv {
96
+ /** The organization the site belongs to (WEBDECOY_SITE_KEY). */
97
+ siteKey: string;
98
+ /** The site's scanner (WEBDECOY_SCANNER_ID). */
99
+ scannerId: string;
100
+ /** Proves the reports come from a validator WebDecoy issued (WEBDECOY_SENSOR_KEY). */
101
+ sensorKey: string;
102
+ /** WebDecoy ingest; defaults to DEFAULT_INGEST. */
103
+ ingest?: string;
104
+ }
105
+ /**
106
+ * `respond`: send this response instead of the page.
107
+ * `continue`: serve the page with exactly these request headers; `null` means untouched.
108
+ */
109
+ type GateOutcome =
110
+ | { action: 'respond'; response: Response }
111
+ | { action: 'continue'; headers: Headers | null; verdict: string | null };
112
+ /** This bundle's build name, reported with every verdict. */
113
+ declare const BUILD: string;
114
+
115
+ /**
116
+ * The clearance gate, for middleware that runs in front of the page.
117
+ *
118
+ * The same decision the Cloudflare, AWS and Netlify validators make, from the
119
+ * same source: `gate.generated.js` is built from WebDecoy's validator code and
120
+ * is never edited here. This file is the part an adapter needs around it, the
121
+ * site's identity from the environment and one client-IP answer.
122
+ *
123
+ * What it does with a request, in order:
124
+ *
125
+ * 1. Credentials, verified crawlers (forward-confirmed reverse DNS) and
126
+ * validly signed agents pass before any token is asked for.
127
+ * 2. A page no protected path covers passes.
128
+ * 3. On a protected path, a valid `wd_clearance` cookie passes. A missing,
129
+ * invalid or revoked one is labelled; in monitor mode the request still
130
+ * passes, in enforce mode it gets the challenge: a real browser earns the
131
+ * cookie and is sent back, a client that runs no JavaScript stays there.
132
+ *
133
+ * Which paths are protected, and whether the site monitors or enforces, is
134
+ * set in WebDecoy, not here. Every failure, WebDecoy unreachable included,
135
+ * lets the request through.
136
+ */
137
+
138
+ interface ClearanceGateOptions {
139
+ /** WEBDECOY_SITE_KEY by default. */
140
+ siteKey?: string;
141
+ /** WEBDECOY_SCANNER_ID by default. */
142
+ scannerId?: string;
143
+ /** WEBDECOY_SENSOR_KEY by default. A secret: set it in the platform's environment, never in code. */
144
+ sensorKey?: string;
145
+ /** WEBDECOY_INGEST, else WebDecoy's ingest. */
146
+ ingest?: string;
147
+ /**
148
+ * How many proxies sit in front of the middleware. Defaults to `1`, the
149
+ * hosting platform, which is right on Vercel. See resolveClientIp.
150
+ */
151
+ trustProxy?: TrustedProxies;
152
+ }
153
+ /** What a platform passes with each request. */
154
+ interface ClearanceContext {
155
+ waitUntil?: (promise: Promise<unknown>) => void;
156
+ }
157
+ /** The site's identity, from options first and the environment second; null when incomplete. */
158
+ declare function resolveGateEnv(options?: ClearanceGateOptions): GateEnv | null;
159
+ /**
160
+ * A gate bound to one site: call it with each request.
161
+ *
162
+ * Missing configuration turns it into a pass-through that says so once,
163
+ * rather than an unproven gate: a site that forgot its sensor key must keep
164
+ * serving pages.
165
+ */
166
+ declare function createClearanceGate(options?: ClearanceGateOptions): (request: Request, context?: ClearanceContext) => Promise<GateOutcome>;
167
+
168
+ export { BUILD as B, type ClearanceContext as C, type GateEnv as G, type HeaderSource as H, type ResolveClientIpOptions as R, type TrustedProxies as T, type ClearanceGateOptions as a, type GateOutcome as b, createClearanceGate as c, resolveGateEnv as d, ipInCidr as i, normalizeIp as n, resolveClientIp as r };
package/dist/index.d.mts CHANGED
@@ -1,5 +1,7 @@
1
- import { R as Rule, a as RuleContext, b as RuleResult, c as RuleEngineResult, d as RateLimitConfig, F as FilterConfig, T as TripwireConfig, B as BotRuleConfig, e as BotAgent, f as BotCategory, A as AgentCategory, g as RateLimitStore, h as RateLimitConsume, i as RateLimitOutcome, W as WebDecoy, P as ProtectResult, D as Decision, j as WebDecoyConfig, k as ProtectOptions, l as AgentVerifierOptions, m as AgentRequestInput, n as AgentVerdict, S as SignedAgentDirectory } from './sdk-CSHYCT9a.mjs';
2
- export { o as AgentStatus, p as BOT_CATEGORIES, q as BOT_REGISTRY, r as BotVerdict, C as Characteristic, s as Conclusion, t as DEFAULT_CHARACTERISTICS, u as DecisionCache, v as DecisionCacheOptions, w as DecisionInit, E as EDGE_CLASS_HEADER, x as EDGE_CLEARANCE_HEADER, y as EdgeClass, z as EdgeVerdict, I as IPEnrichmentData, L as LocalAnalysis, G as LogFields, H as Logger, M as MemoryRateLimitStore, J as RequestMetadata, K as RuleOutcome, N as RuleState, O as SDKDetectionRequest, Q as SDKDetectionResponse, U as Span, V as SyncRateLimitStore, X as TLSInfo, Y as Tracer, Z as ViolationEvent, _ as classifyUserAgent, $ as consoleLogger, a0 as deriveKey, a1 as fromPino, a2 as matchUserAgent, a3 as newDecisionId, a4 as readEdgeVerdict, a5 as silentLogger } from './sdk-CSHYCT9a.mjs';
1
+ import { R as Rule, a as RuleContext, b as RuleResult, c as RuleEngineResult, d as RateLimitConfig, F as FilterConfig, T as TripwireConfig, B as BotRuleConfig, e as BotAgent, f as BotCategory, A as AgentCategory, g as RateLimitStore, h as RateLimitConsume, i as RateLimitOutcome, W as WebDecoy, P as ProtectResult, D as Decision, j as WebDecoyConfig, k as ProtectOptions, l as AgentVerifierOptions, m as AgentRequestInput, n as AgentVerdict, S as SignedAgentDirectory } from './sdk--ub6PNZO.mjs';
2
+ export { o as AgentStatus, p as BOT_CATEGORIES, q as BOT_REGISTRY, r as BotVerdict, C as Characteristic, s as Conclusion, t as DEFAULT_CHARACTERISTICS, u as DecisionCache, v as DecisionCacheOptions, w as DecisionInit, E as EDGE_CLASS_HEADER, x as EDGE_CLEARANCE_HEADER, y as EdgeClass, z as EdgeVerdict, I as IPEnrichmentData, L as LocalAnalysis, G as LogFields, H as Logger, M as MemoryRateLimitStore, J as RequestMetadata, K as RuleOutcome, N as RuleState, O as SDKDetectionRequest, Q as SDKDetectionResponse, U as Span, V as SyncRateLimitStore, X as TLSInfo, Y as Tracer, Z as ViolationEvent, _ as classifyUserAgent, $ as consoleLogger, a0 as deriveKey, a1 as fromPino, a2 as matchUserAgent, a3 as newDecisionId, a4 as readEdgeVerdict, a5 as silentLogger } from './sdk--ub6PNZO.mjs';
3
+ import { T as TrustedProxies } from './index-GXXXr_mb.mjs';
4
+ export { B as CLEARANCE_GATE_BUILD, C as ClearanceContext, a as ClearanceGateOptions, G as GateEnv, b as GateOutcome, H as HeaderSource, R as ResolveClientIpOptions, c as createClearanceGate, i as ipInCidr, n as normalizeIp, r as resolveClientIp, d as resolveGateEnv } from './index-GXXXr_mb.mjs';
3
5
 
4
6
  /**
5
7
  * The reserved test trigger.
@@ -26,98 +28,6 @@ declare const TEST_TRIGGER_USER_AGENT = "WebDecoy-Test/1.0";
26
28
  /** Whether this User-Agent is the reserved test trigger. */
27
29
  declare function isTestTriggerUserAgent(userAgent: string | undefined): boolean;
28
30
 
29
- /**
30
- * Resolving the client IP address behind a proxy.
31
- *
32
- * WHY THIS MODULE EXISTS
33
- *
34
- * Every adapter used to read the leftmost value of `X-Forwarded-For` and call it
35
- * the client. That header is written by the client for the first hop, so the
36
- * leftmost value is whatever the caller decided to put there. One
37
- * `-H 'X-Forwarded-For: 1.2.3.4'` gave an attacker a fresh rate-limit bucket per
38
- * forged address, put an address of their choosing on every violation we
39
- * reported, and made `filter({ expression: 'ip.tor' })` an opt-in check.
40
- *
41
- * A forwarding header is only evidence if you know who wrote it. So the default
42
- * here is to not read one at all: use the address the connection actually came
43
- * from, and make the operator say how many proxies sit in front before we
44
- * believe anything else. The WordPress plugin already works this way; this
45
- * brings the Node adapters in line.
46
- *
47
- * THE MODEL
48
- *
49
- * Each proxy appends the address it received the connection from, so the
50
- * observed chain outermost-first is `[...X-Forwarded-For, peer]` and the entries
51
- * to the RIGHT are the ones added by infrastructure you control. Trust is
52
- * therefore counted from the right: with one proxy in front of you, the client
53
- * is the last `X-Forwarded-For` entry; with two, the second from last. Anything
54
- * further left was supplied by someone you have no reason to believe.
55
- *
56
- * No `node:net` — this runs in Edge and Workers runtimes too, so the address
57
- * parsing is hand-rolled and covered by tests.
58
- */
59
- /**
60
- * How much of the forwarding chain to believe.
61
- *
62
- * - `false` (default) — read no forwarding headers; the peer address is the
63
- * client. Correct for an app exposed directly, and safe for one that isn't:
64
- * it attributes traffic to your proxy rather than to a forged address.
65
- * - `number` — the number of trusted proxies between the client and this
66
- * process. The client is the Nth entry from the right of `X-Forwarded-For`.
67
- * - `'cloudflare'` — use `CF-Connecting-IP`. Only meaningful if the origin is
68
- * unreachable except through Cloudflare, since the header is otherwise just
69
- * another thing a client can send.
70
- * - `'railway'` — the app runs on Railway with nothing else in front. Railway's
71
- * edge replaces any `X-Forwarded-For` the client sent with exactly
72
- * `<client>, <edge>`, so the client is two entries from the right. The
73
- * common guess of `1` names Railway's edge for every visitor. With a CDN in
74
- * front of Railway, configure for the CDN instead (`'cloudflare'`).
75
- * - `string[]` — CIDRs (or bare addresses) of the proxies you run. The chain is
76
- * walked right to left and the first address that isn't one of yours is the
77
- * client. Use this when the depth varies.
78
- */
79
- type TrustedProxies = false | number | 'cloudflare' | 'railway' | string[];
80
- /** Headers as either a Node-style bag or a WHATWG `Headers`. */
81
- type HeaderSource = Record<string, string | string[] | undefined> | {
82
- get(name: string): string | null;
83
- };
84
- interface ResolveClientIpOptions {
85
- /** Request headers. */
86
- headers: HeaderSource;
87
- /** The address the connection came from, when the runtime exposes one. */
88
- peer?: string;
89
- /** How much of the forwarding chain to believe. Defaults to `false`. */
90
- trustProxy?: TrustedProxies;
91
- }
92
- /**
93
- * Strip the decoration real-world sources add to an address — brackets, a port,
94
- * an IPv6 zone id — and return it in a canonical form, or null if what's left
95
- * isn't an address at all.
96
- *
97
- * IPv4-mapped IPv6 (`::ffff:203.0.113.9`) collapses to the IPv4 form, so a
98
- * dual-stack listener and an `X-Forwarded-For` entry for the same client
99
- * produce the same key.
100
- */
101
- declare function normalizeIp(raw: string | undefined | null): string | null;
102
- /**
103
- * Whether an address falls inside a CIDR range. A bare address is treated as a
104
- * single-host range. Families never match across each other.
105
- */
106
- declare function ipInCidr(ip: string, cidr: string): boolean;
107
- /**
108
- * Resolve the client IP for a request.
109
- *
110
- * Returns `undefined` only when there is nothing to go on: no peer address and
111
- * no header the configuration says to believe. Callers supply their own last
112
- * resort, because what that should be is a per-framework question.
113
- *
114
- * Whenever the configured source is missing or malformed this falls back to the
115
- * peer address rather than reaching further left in the chain. The peer is the
116
- * one address on a request that cannot be forged, so a wrong-but-real proxy
117
- * address beats a plausible-looking value the caller chose.
118
- */
119
- declare function resolveClientIp(options: ResolveClientIpOptions): string | undefined;
120
-
121
31
  /**
122
32
  * Detection engine types.
123
33
  *
@@ -1877,4 +1787,4 @@ declare function createCaptchaEndpoints(options?: CaptchaEndpointsOptions): {
1877
1787
  };
1878
1788
  type CaptchaEndpoints = ReturnType<typeof createCaptchaEndpoints>;
1879
1789
 
1880
- export { ATTACK_SIGNATURE_IDS, AgentCategory, AgentRequestInput, AgentVerdict, AgentVerifier, AgentVerifierOptions, type AttackSignatureConfig, AttackSignatureRule, type BehavioralSignals, type BlockResponse, BotAgent, BotCategory, BotPolicy, type BotPolicyOptions, BotRule, BotRuleConfig, CLIENT_SESSION_COOKIE, CLIENT_SESSION_HEADER, Captcha, type CaptchaEndpoints, type CaptchaEndpointsOptions, type CaptchaHttpResponse, type CaptchaOptions, type CaptchaRequest, type CategoryScores, type ChallengeData, type ChallengeStore, type ClientSignalConfig, ClientSignalRule, type ClientSignalStore, type ClientVerdict, DEFAULT_SIGNED_AGENT_DIRECTORIES, DEFAULT_TRIPWIRE_PATHS, DEFAULT_WEIGHTS, Decision, type Detection, type DetectionContext, DetectionEngine, type DetectionEngineOptions, DirectoryCache, type EnvironmentalSignals, type FetchGuard, type FetchGuardOptions, FilterConfig, FilterRule, type FingerprintStore, type FormAnalysisSignals, type GuardOutcome, HONEYTOKEN_BASE_PATH, type HeaderSource, type Honeytoken, type HoneytokenArmingOptions, type HoneytokenLinkProps, type HoneytokenOptions, InMemoryChallengeStore, InMemoryFingerprintStore, InMemoryRateLimiter, InMemoryTokenStore, MemoryClientSignalStore, type MemoryClientSignalStoreOptions, PoWManager, type PoWManagerOptions, type PoWOutcome, type PoWSolution, type PoWVerification, ProtectOptions, ProtectResult, RateLimitConfig, RateLimitConsume, RateLimitOutcome, RateLimitRule, RateLimitStore, type RateLimiter, type Recommendation, type ResolveClientIpOptions, type RobotsTxtOptions, Rule, RuleContext, RuleEngine, RuleEngineResult, RuleResult, type ScoreResult, type Signals, SignedAgentDirectory, type SiteHoneytoken, type SiteHoneytokenOptions, type StoredChallenge, TEST_TRIGGER_UA_PREFIX, TEST_TRIGGER_USER_AGENT, type TemporalSignals, type TextareaKeyboardStats, TokenManager, type TokenManagerOptions, type TokenStore, type TokenVerification, TripwireConfig, TripwireRule, type TrustedProxies, UpstashRateLimitStore, type UpstashStoreOptions, type Verdict, type VerifyInput, type VerifyResult, type WebBotAuthConfig, WebBotAuthRule, WebDecoy, WebDecoyConfig, armSiteHoneytoken, attackSignatures, botPolicy, bots, calculateCategoryScores, calculateFinalScore, clientSignals, createAgentVerifier, createCaptchaEndpoints, createFetchGuard, deriveAndArm, filter, honeytoken, injectHoneytokenLink, ipInCidr, isDatacenterIP, isInjectableHtml, isMobileUA, isTestTriggerUserAgent, normalizeIp, parseUserAgent, rateLimit, readClientSession, recommend, resolveClientIp, resolveSecret, ruleBlockResponse, shouldSkipPath, siteHoneytoken, tripwire, upstashRateLimitStore, webBotAuth };
1790
+ export { ATTACK_SIGNATURE_IDS, AgentCategory, AgentRequestInput, AgentVerdict, AgentVerifier, AgentVerifierOptions, type AttackSignatureConfig, AttackSignatureRule, type BehavioralSignals, type BlockResponse, BotAgent, BotCategory, BotPolicy, type BotPolicyOptions, BotRule, BotRuleConfig, CLIENT_SESSION_COOKIE, CLIENT_SESSION_HEADER, Captcha, type CaptchaEndpoints, type CaptchaEndpointsOptions, type CaptchaHttpResponse, type CaptchaOptions, type CaptchaRequest, type CategoryScores, type ChallengeData, type ChallengeStore, type ClientSignalConfig, ClientSignalRule, type ClientSignalStore, type ClientVerdict, DEFAULT_SIGNED_AGENT_DIRECTORIES, DEFAULT_TRIPWIRE_PATHS, DEFAULT_WEIGHTS, Decision, type Detection, type DetectionContext, DetectionEngine, type DetectionEngineOptions, DirectoryCache, type EnvironmentalSignals, type FetchGuard, type FetchGuardOptions, FilterConfig, FilterRule, type FingerprintStore, type FormAnalysisSignals, type GuardOutcome, HONEYTOKEN_BASE_PATH, type Honeytoken, type HoneytokenArmingOptions, type HoneytokenLinkProps, type HoneytokenOptions, InMemoryChallengeStore, InMemoryFingerprintStore, InMemoryRateLimiter, InMemoryTokenStore, MemoryClientSignalStore, type MemoryClientSignalStoreOptions, PoWManager, type PoWManagerOptions, type PoWOutcome, type PoWSolution, type PoWVerification, ProtectOptions, ProtectResult, RateLimitConfig, RateLimitConsume, RateLimitOutcome, RateLimitRule, RateLimitStore, type RateLimiter, type Recommendation, type RobotsTxtOptions, Rule, RuleContext, RuleEngine, RuleEngineResult, RuleResult, type ScoreResult, type Signals, SignedAgentDirectory, type SiteHoneytoken, type SiteHoneytokenOptions, type StoredChallenge, TEST_TRIGGER_UA_PREFIX, TEST_TRIGGER_USER_AGENT, type TemporalSignals, type TextareaKeyboardStats, TokenManager, type TokenManagerOptions, type TokenStore, type TokenVerification, TripwireConfig, TripwireRule, TrustedProxies, UpstashRateLimitStore, type UpstashStoreOptions, type Verdict, type VerifyInput, type VerifyResult, type WebBotAuthConfig, WebBotAuthRule, WebDecoy, WebDecoyConfig, armSiteHoneytoken, attackSignatures, botPolicy, bots, calculateCategoryScores, calculateFinalScore, clientSignals, createAgentVerifier, createCaptchaEndpoints, createFetchGuard, deriveAndArm, filter, honeytoken, injectHoneytokenLink, isDatacenterIP, isInjectableHtml, isMobileUA, isTestTriggerUserAgent, parseUserAgent, rateLimit, readClientSession, recommend, resolveSecret, ruleBlockResponse, shouldSkipPath, siteHoneytoken, tripwire, upstashRateLimitStore, webBotAuth };
package/dist/index.d.ts CHANGED
@@ -1,5 +1,7 @@
1
- import { R as Rule, a as RuleContext, b as RuleResult, c as RuleEngineResult, d as RateLimitConfig, F as FilterConfig, T as TripwireConfig, B as BotRuleConfig, e as BotAgent, f as BotCategory, A as AgentCategory, g as RateLimitStore, h as RateLimitConsume, i as RateLimitOutcome, W as WebDecoy, P as ProtectResult, D as Decision, j as WebDecoyConfig, k as ProtectOptions, l as AgentVerifierOptions, m as AgentRequestInput, n as AgentVerdict, S as SignedAgentDirectory } from './sdk-CSHYCT9a.js';
2
- export { o as AgentStatus, p as BOT_CATEGORIES, q as BOT_REGISTRY, r as BotVerdict, C as Characteristic, s as Conclusion, t as DEFAULT_CHARACTERISTICS, u as DecisionCache, v as DecisionCacheOptions, w as DecisionInit, E as EDGE_CLASS_HEADER, x as EDGE_CLEARANCE_HEADER, y as EdgeClass, z as EdgeVerdict, I as IPEnrichmentData, L as LocalAnalysis, G as LogFields, H as Logger, M as MemoryRateLimitStore, J as RequestMetadata, K as RuleOutcome, N as RuleState, O as SDKDetectionRequest, Q as SDKDetectionResponse, U as Span, V as SyncRateLimitStore, X as TLSInfo, Y as Tracer, Z as ViolationEvent, _ as classifyUserAgent, $ as consoleLogger, a0 as deriveKey, a1 as fromPino, a2 as matchUserAgent, a3 as newDecisionId, a4 as readEdgeVerdict, a5 as silentLogger } from './sdk-CSHYCT9a.js';
1
+ import { R as Rule, a as RuleContext, b as RuleResult, c as RuleEngineResult, d as RateLimitConfig, F as FilterConfig, T as TripwireConfig, B as BotRuleConfig, e as BotAgent, f as BotCategory, A as AgentCategory, g as RateLimitStore, h as RateLimitConsume, i as RateLimitOutcome, W as WebDecoy, P as ProtectResult, D as Decision, j as WebDecoyConfig, k as ProtectOptions, l as AgentVerifierOptions, m as AgentRequestInput, n as AgentVerdict, S as SignedAgentDirectory } from './sdk--ub6PNZO.js';
2
+ export { o as AgentStatus, p as BOT_CATEGORIES, q as BOT_REGISTRY, r as BotVerdict, C as Characteristic, s as Conclusion, t as DEFAULT_CHARACTERISTICS, u as DecisionCache, v as DecisionCacheOptions, w as DecisionInit, E as EDGE_CLASS_HEADER, x as EDGE_CLEARANCE_HEADER, y as EdgeClass, z as EdgeVerdict, I as IPEnrichmentData, L as LocalAnalysis, G as LogFields, H as Logger, M as MemoryRateLimitStore, J as RequestMetadata, K as RuleOutcome, N as RuleState, O as SDKDetectionRequest, Q as SDKDetectionResponse, U as Span, V as SyncRateLimitStore, X as TLSInfo, Y as Tracer, Z as ViolationEvent, _ as classifyUserAgent, $ as consoleLogger, a0 as deriveKey, a1 as fromPino, a2 as matchUserAgent, a3 as newDecisionId, a4 as readEdgeVerdict, a5 as silentLogger } from './sdk--ub6PNZO.js';
3
+ import { T as TrustedProxies } from './index-GXXXr_mb.js';
4
+ export { B as CLEARANCE_GATE_BUILD, C as ClearanceContext, a as ClearanceGateOptions, G as GateEnv, b as GateOutcome, H as HeaderSource, R as ResolveClientIpOptions, c as createClearanceGate, i as ipInCidr, n as normalizeIp, r as resolveClientIp, d as resolveGateEnv } from './index-GXXXr_mb.js';
3
5
 
4
6
  /**
5
7
  * The reserved test trigger.
@@ -26,98 +28,6 @@ declare const TEST_TRIGGER_USER_AGENT = "WebDecoy-Test/1.0";
26
28
  /** Whether this User-Agent is the reserved test trigger. */
27
29
  declare function isTestTriggerUserAgent(userAgent: string | undefined): boolean;
28
30
 
29
- /**
30
- * Resolving the client IP address behind a proxy.
31
- *
32
- * WHY THIS MODULE EXISTS
33
- *
34
- * Every adapter used to read the leftmost value of `X-Forwarded-For` and call it
35
- * the client. That header is written by the client for the first hop, so the
36
- * leftmost value is whatever the caller decided to put there. One
37
- * `-H 'X-Forwarded-For: 1.2.3.4'` gave an attacker a fresh rate-limit bucket per
38
- * forged address, put an address of their choosing on every violation we
39
- * reported, and made `filter({ expression: 'ip.tor' })` an opt-in check.
40
- *
41
- * A forwarding header is only evidence if you know who wrote it. So the default
42
- * here is to not read one at all: use the address the connection actually came
43
- * from, and make the operator say how many proxies sit in front before we
44
- * believe anything else. The WordPress plugin already works this way; this
45
- * brings the Node adapters in line.
46
- *
47
- * THE MODEL
48
- *
49
- * Each proxy appends the address it received the connection from, so the
50
- * observed chain outermost-first is `[...X-Forwarded-For, peer]` and the entries
51
- * to the RIGHT are the ones added by infrastructure you control. Trust is
52
- * therefore counted from the right: with one proxy in front of you, the client
53
- * is the last `X-Forwarded-For` entry; with two, the second from last. Anything
54
- * further left was supplied by someone you have no reason to believe.
55
- *
56
- * No `node:net` — this runs in Edge and Workers runtimes too, so the address
57
- * parsing is hand-rolled and covered by tests.
58
- */
59
- /**
60
- * How much of the forwarding chain to believe.
61
- *
62
- * - `false` (default) — read no forwarding headers; the peer address is the
63
- * client. Correct for an app exposed directly, and safe for one that isn't:
64
- * it attributes traffic to your proxy rather than to a forged address.
65
- * - `number` — the number of trusted proxies between the client and this
66
- * process. The client is the Nth entry from the right of `X-Forwarded-For`.
67
- * - `'cloudflare'` — use `CF-Connecting-IP`. Only meaningful if the origin is
68
- * unreachable except through Cloudflare, since the header is otherwise just
69
- * another thing a client can send.
70
- * - `'railway'` — the app runs on Railway with nothing else in front. Railway's
71
- * edge replaces any `X-Forwarded-For` the client sent with exactly
72
- * `<client>, <edge>`, so the client is two entries from the right. The
73
- * common guess of `1` names Railway's edge for every visitor. With a CDN in
74
- * front of Railway, configure for the CDN instead (`'cloudflare'`).
75
- * - `string[]` — CIDRs (or bare addresses) of the proxies you run. The chain is
76
- * walked right to left and the first address that isn't one of yours is the
77
- * client. Use this when the depth varies.
78
- */
79
- type TrustedProxies = false | number | 'cloudflare' | 'railway' | string[];
80
- /** Headers as either a Node-style bag or a WHATWG `Headers`. */
81
- type HeaderSource = Record<string, string | string[] | undefined> | {
82
- get(name: string): string | null;
83
- };
84
- interface ResolveClientIpOptions {
85
- /** Request headers. */
86
- headers: HeaderSource;
87
- /** The address the connection came from, when the runtime exposes one. */
88
- peer?: string;
89
- /** How much of the forwarding chain to believe. Defaults to `false`. */
90
- trustProxy?: TrustedProxies;
91
- }
92
- /**
93
- * Strip the decoration real-world sources add to an address — brackets, a port,
94
- * an IPv6 zone id — and return it in a canonical form, or null if what's left
95
- * isn't an address at all.
96
- *
97
- * IPv4-mapped IPv6 (`::ffff:203.0.113.9`) collapses to the IPv4 form, so a
98
- * dual-stack listener and an `X-Forwarded-For` entry for the same client
99
- * produce the same key.
100
- */
101
- declare function normalizeIp(raw: string | undefined | null): string | null;
102
- /**
103
- * Whether an address falls inside a CIDR range. A bare address is treated as a
104
- * single-host range. Families never match across each other.
105
- */
106
- declare function ipInCidr(ip: string, cidr: string): boolean;
107
- /**
108
- * Resolve the client IP for a request.
109
- *
110
- * Returns `undefined` only when there is nothing to go on: no peer address and
111
- * no header the configuration says to believe. Callers supply their own last
112
- * resort, because what that should be is a per-framework question.
113
- *
114
- * Whenever the configured source is missing or malformed this falls back to the
115
- * peer address rather than reaching further left in the chain. The peer is the
116
- * one address on a request that cannot be forged, so a wrong-but-real proxy
117
- * address beats a plausible-looking value the caller chose.
118
- */
119
- declare function resolveClientIp(options: ResolveClientIpOptions): string | undefined;
120
-
121
31
  /**
122
32
  * Detection engine types.
123
33
  *
@@ -1877,4 +1787,4 @@ declare function createCaptchaEndpoints(options?: CaptchaEndpointsOptions): {
1877
1787
  };
1878
1788
  type CaptchaEndpoints = ReturnType<typeof createCaptchaEndpoints>;
1879
1789
 
1880
- export { ATTACK_SIGNATURE_IDS, AgentCategory, AgentRequestInput, AgentVerdict, AgentVerifier, AgentVerifierOptions, type AttackSignatureConfig, AttackSignatureRule, type BehavioralSignals, type BlockResponse, BotAgent, BotCategory, BotPolicy, type BotPolicyOptions, BotRule, BotRuleConfig, CLIENT_SESSION_COOKIE, CLIENT_SESSION_HEADER, Captcha, type CaptchaEndpoints, type CaptchaEndpointsOptions, type CaptchaHttpResponse, type CaptchaOptions, type CaptchaRequest, type CategoryScores, type ChallengeData, type ChallengeStore, type ClientSignalConfig, ClientSignalRule, type ClientSignalStore, type ClientVerdict, DEFAULT_SIGNED_AGENT_DIRECTORIES, DEFAULT_TRIPWIRE_PATHS, DEFAULT_WEIGHTS, Decision, type Detection, type DetectionContext, DetectionEngine, type DetectionEngineOptions, DirectoryCache, type EnvironmentalSignals, type FetchGuard, type FetchGuardOptions, FilterConfig, FilterRule, type FingerprintStore, type FormAnalysisSignals, type GuardOutcome, HONEYTOKEN_BASE_PATH, type HeaderSource, type Honeytoken, type HoneytokenArmingOptions, type HoneytokenLinkProps, type HoneytokenOptions, InMemoryChallengeStore, InMemoryFingerprintStore, InMemoryRateLimiter, InMemoryTokenStore, MemoryClientSignalStore, type MemoryClientSignalStoreOptions, PoWManager, type PoWManagerOptions, type PoWOutcome, type PoWSolution, type PoWVerification, ProtectOptions, ProtectResult, RateLimitConfig, RateLimitConsume, RateLimitOutcome, RateLimitRule, RateLimitStore, type RateLimiter, type Recommendation, type ResolveClientIpOptions, type RobotsTxtOptions, Rule, RuleContext, RuleEngine, RuleEngineResult, RuleResult, type ScoreResult, type Signals, SignedAgentDirectory, type SiteHoneytoken, type SiteHoneytokenOptions, type StoredChallenge, TEST_TRIGGER_UA_PREFIX, TEST_TRIGGER_USER_AGENT, type TemporalSignals, type TextareaKeyboardStats, TokenManager, type TokenManagerOptions, type TokenStore, type TokenVerification, TripwireConfig, TripwireRule, type TrustedProxies, UpstashRateLimitStore, type UpstashStoreOptions, type Verdict, type VerifyInput, type VerifyResult, type WebBotAuthConfig, WebBotAuthRule, WebDecoy, WebDecoyConfig, armSiteHoneytoken, attackSignatures, botPolicy, bots, calculateCategoryScores, calculateFinalScore, clientSignals, createAgentVerifier, createCaptchaEndpoints, createFetchGuard, deriveAndArm, filter, honeytoken, injectHoneytokenLink, ipInCidr, isDatacenterIP, isInjectableHtml, isMobileUA, isTestTriggerUserAgent, normalizeIp, parseUserAgent, rateLimit, readClientSession, recommend, resolveClientIp, resolveSecret, ruleBlockResponse, shouldSkipPath, siteHoneytoken, tripwire, upstashRateLimitStore, webBotAuth };
1790
+ export { ATTACK_SIGNATURE_IDS, AgentCategory, AgentRequestInput, AgentVerdict, AgentVerifier, AgentVerifierOptions, type AttackSignatureConfig, AttackSignatureRule, type BehavioralSignals, type BlockResponse, BotAgent, BotCategory, BotPolicy, type BotPolicyOptions, BotRule, BotRuleConfig, CLIENT_SESSION_COOKIE, CLIENT_SESSION_HEADER, Captcha, type CaptchaEndpoints, type CaptchaEndpointsOptions, type CaptchaHttpResponse, type CaptchaOptions, type CaptchaRequest, type CategoryScores, type ChallengeData, type ChallengeStore, type ClientSignalConfig, ClientSignalRule, type ClientSignalStore, type ClientVerdict, DEFAULT_SIGNED_AGENT_DIRECTORIES, DEFAULT_TRIPWIRE_PATHS, DEFAULT_WEIGHTS, Decision, type Detection, type DetectionContext, DetectionEngine, type DetectionEngineOptions, DirectoryCache, type EnvironmentalSignals, type FetchGuard, type FetchGuardOptions, FilterConfig, FilterRule, type FingerprintStore, type FormAnalysisSignals, type GuardOutcome, HONEYTOKEN_BASE_PATH, type Honeytoken, type HoneytokenArmingOptions, type HoneytokenLinkProps, type HoneytokenOptions, InMemoryChallengeStore, InMemoryFingerprintStore, InMemoryRateLimiter, InMemoryTokenStore, MemoryClientSignalStore, type MemoryClientSignalStoreOptions, PoWManager, type PoWManagerOptions, type PoWOutcome, type PoWSolution, type PoWVerification, ProtectOptions, ProtectResult, RateLimitConfig, RateLimitConsume, RateLimitOutcome, RateLimitRule, RateLimitStore, type RateLimiter, type Recommendation, type RobotsTxtOptions, Rule, RuleContext, RuleEngine, RuleEngineResult, RuleResult, type ScoreResult, type Signals, SignedAgentDirectory, type SiteHoneytoken, type SiteHoneytokenOptions, type StoredChallenge, TEST_TRIGGER_UA_PREFIX, TEST_TRIGGER_USER_AGENT, type TemporalSignals, type TextareaKeyboardStats, TokenManager, type TokenManagerOptions, type TokenStore, type TokenVerification, TripwireConfig, TripwireRule, TrustedProxies, UpstashRateLimitStore, type UpstashStoreOptions, type Verdict, type VerifyInput, type VerifyResult, type WebBotAuthConfig, WebBotAuthRule, WebDecoy, WebDecoyConfig, armSiteHoneytoken, attackSignatures, botPolicy, bots, calculateCategoryScores, calculateFinalScore, clientSignals, createAgentVerifier, createCaptchaEndpoints, createFetchGuard, deriveAndArm, filter, honeytoken, injectHoneytokenLink, isDatacenterIP, isInjectableHtml, isMobileUA, isTestTriggerUserAgent, parseUserAgent, rateLimit, readClientSession, recommend, resolveSecret, ruleBlockResponse, shouldSkipPath, siteHoneytoken, tripwire, upstashRateLimitStore, webBotAuth };