@webdecoy/node 0.9.0 → 0.10.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 +23 -21
- package/dist/index.d.ts +23 -21
- package/dist/index.js +3 -3
- package/dist/index.mjs +3 -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
|
|
@@ -898,7 +898,7 @@ declare class RuleEngine {
|
|
|
898
898
|
* Append a rule after construction.
|
|
899
899
|
*
|
|
900
900
|
* Exists for signals that cannot be known synchronously at construction —
|
|
901
|
-
* currently the site honeytoken
|
|
901
|
+
* currently the site honeytoken, whose path is derived by async HMAC.
|
|
902
902
|
* Evaluation order is append order, matching the constructor.
|
|
903
903
|
*/
|
|
904
904
|
add(rule: Rule): void;
|
|
@@ -975,7 +975,7 @@ declare class TripwireRule implements Rule {
|
|
|
975
975
|
}
|
|
976
976
|
|
|
977
977
|
/**
|
|
978
|
-
* Bot-category rule
|
|
978
|
+
* Bot-category rule.
|
|
979
979
|
*
|
|
980
980
|
* The one-liner for the policy this product category exists to express:
|
|
981
981
|
*
|
|
@@ -1010,7 +1010,7 @@ declare class BotRule implements Rule {
|
|
|
1010
1010
|
}
|
|
1011
1011
|
|
|
1012
1012
|
/**
|
|
1013
|
-
* Web Bot Auth rule (
|
|
1013
|
+
* Web Bot Auth rule (the main application repo).
|
|
1014
1014
|
*
|
|
1015
1015
|
* Acts on the Web Bot Auth verdict the SDK computes before rule evaluation
|
|
1016
1016
|
* (`context.agent`). Its headline job is to make **impersonation deny-able in
|
|
@@ -1109,7 +1109,7 @@ declare function honeytoken(options?: HoneytokenOptions): Honeytoken;
|
|
|
1109
1109
|
|
|
1110
1110
|
/**
|
|
1111
1111
|
* Site honeytoken — a stable, derivable trap the adapters can inject for you
|
|
1112
|
-
|
|
1112
|
+
*.
|
|
1113
1113
|
*
|
|
1114
1114
|
* WHY THIS EXISTS ALONGSIDE honeytoken()
|
|
1115
1115
|
*
|
|
@@ -1129,12 +1129,14 @@ declare function honeytoken(options?: HoneytokenOptions): Honeytoken;
|
|
|
1129
1129
|
* JavaScript, no fingerprint and no IP — the client asked for a path that exists
|
|
1130
1130
|
* nowhere and is linked only from an element no human can see.
|
|
1131
1131
|
*
|
|
1132
|
-
* That is not a stylistic preference, it is arithmetic.
|
|
1133
|
-
*
|
|
1134
|
-
* spoofed
|
|
1135
|
-
*
|
|
1136
|
-
*
|
|
1137
|
-
*
|
|
1132
|
+
* That is not a stylistic preference, it is arithmetic. Honeypot hits carry the
|
|
1133
|
+
* highest weight in the threat score and a User-Agent carries nearly none,
|
|
1134
|
+
* because a User-Agent is trivially spoofed — so the same client scores near
|
|
1135
|
+
* zero on a page view and very high on a trap.
|
|
1136
|
+
*
|
|
1137
|
+
* Which only pays off if the link is on the page. Generating a token and asking
|
|
1138
|
+
* the developer to place it is a step most installs never take, so the adapters
|
|
1139
|
+
* that own the response inject it themselves.
|
|
1138
1140
|
*/
|
|
1139
1141
|
/** Base path for honeytoken tripwires. Mirrors the WordPress plugin. */
|
|
1140
1142
|
declare const HONEYTOKEN_BASE_PATH = "/__wd";
|
|
@@ -1273,7 +1275,7 @@ declare function filter(config: FilterConfig): Rule;
|
|
|
1273
1275
|
*/
|
|
1274
1276
|
declare function tripwire(config?: TripwireConfig): Rule;
|
|
1275
1277
|
/**
|
|
1276
|
-
* Factory function to create a bot-category rule
|
|
1278
|
+
* Factory function to create a bot-category rule.
|
|
1277
1279
|
*
|
|
1278
1280
|
* Acts on agents that identify themselves in the User-Agent, matched against the
|
|
1279
1281
|
* registry generated from the same table the scoring pipeline uses — so
|
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
|
|
@@ -898,7 +898,7 @@ declare class RuleEngine {
|
|
|
898
898
|
* Append a rule after construction.
|
|
899
899
|
*
|
|
900
900
|
* Exists for signals that cannot be known synchronously at construction —
|
|
901
|
-
* currently the site honeytoken
|
|
901
|
+
* currently the site honeytoken, whose path is derived by async HMAC.
|
|
902
902
|
* Evaluation order is append order, matching the constructor.
|
|
903
903
|
*/
|
|
904
904
|
add(rule: Rule): void;
|
|
@@ -975,7 +975,7 @@ declare class TripwireRule implements Rule {
|
|
|
975
975
|
}
|
|
976
976
|
|
|
977
977
|
/**
|
|
978
|
-
* Bot-category rule
|
|
978
|
+
* Bot-category rule.
|
|
979
979
|
*
|
|
980
980
|
* The one-liner for the policy this product category exists to express:
|
|
981
981
|
*
|
|
@@ -1010,7 +1010,7 @@ declare class BotRule implements Rule {
|
|
|
1010
1010
|
}
|
|
1011
1011
|
|
|
1012
1012
|
/**
|
|
1013
|
-
* Web Bot Auth rule (
|
|
1013
|
+
* Web Bot Auth rule (the main application repo).
|
|
1014
1014
|
*
|
|
1015
1015
|
* Acts on the Web Bot Auth verdict the SDK computes before rule evaluation
|
|
1016
1016
|
* (`context.agent`). Its headline job is to make **impersonation deny-able in
|
|
@@ -1109,7 +1109,7 @@ declare function honeytoken(options?: HoneytokenOptions): Honeytoken;
|
|
|
1109
1109
|
|
|
1110
1110
|
/**
|
|
1111
1111
|
* Site honeytoken — a stable, derivable trap the adapters can inject for you
|
|
1112
|
-
|
|
1112
|
+
*.
|
|
1113
1113
|
*
|
|
1114
1114
|
* WHY THIS EXISTS ALONGSIDE honeytoken()
|
|
1115
1115
|
*
|
|
@@ -1129,12 +1129,14 @@ declare function honeytoken(options?: HoneytokenOptions): Honeytoken;
|
|
|
1129
1129
|
* JavaScript, no fingerprint and no IP — the client asked for a path that exists
|
|
1130
1130
|
* nowhere and is linked only from an element no human can see.
|
|
1131
1131
|
*
|
|
1132
|
-
* That is not a stylistic preference, it is arithmetic.
|
|
1133
|
-
*
|
|
1134
|
-
* spoofed
|
|
1135
|
-
*
|
|
1136
|
-
*
|
|
1137
|
-
*
|
|
1132
|
+
* That is not a stylistic preference, it is arithmetic. Honeypot hits carry the
|
|
1133
|
+
* highest weight in the threat score and a User-Agent carries nearly none,
|
|
1134
|
+
* because a User-Agent is trivially spoofed — so the same client scores near
|
|
1135
|
+
* zero on a page view and very high on a trap.
|
|
1136
|
+
*
|
|
1137
|
+
* Which only pays off if the link is on the page. Generating a token and asking
|
|
1138
|
+
* the developer to place it is a step most installs never take, so the adapters
|
|
1139
|
+
* that own the response inject it themselves.
|
|
1138
1140
|
*/
|
|
1139
1141
|
/** Base path for honeytoken tripwires. Mirrors the WordPress plugin. */
|
|
1140
1142
|
declare const HONEYTOKEN_BASE_PATH = "/__wd";
|
|
@@ -1273,7 +1275,7 @@ declare function filter(config: FilterConfig): Rule;
|
|
|
1273
1275
|
*/
|
|
1274
1276
|
declare function tripwire(config?: TripwireConfig): Rule;
|
|
1275
1277
|
/**
|
|
1276
|
-
* Factory function to create a bot-category rule
|
|
1278
|
+
* Factory function to create a bot-category rule.
|
|
1277
1279
|
*
|
|
1278
1280
|
* Acts on agents that identify themselves in the User-Agent, matched against the
|
|
1279
1281
|
* registry generated from the same table the scoring pipeline uses — so
|
package/dist/index.js
CHANGED
|
@@ -365,7 +365,7 @@ var RuleEngine = class {
|
|
|
365
365
|
* Append a rule after construction.
|
|
366
366
|
*
|
|
367
367
|
* Exists for signals that cannot be known synchronously at construction —
|
|
368
|
-
* currently the site honeytoken
|
|
368
|
+
* currently the site honeytoken, whose path is derived by async HMAC.
|
|
369
369
|
* Evaluation order is append order, matching the constructor.
|
|
370
370
|
*/
|
|
371
371
|
add(rule) {
|
|
@@ -2426,11 +2426,11 @@ var WebDecoy = class {
|
|
|
2426
2426
|
userAgent: metadata.user_agent,
|
|
2427
2427
|
headers: metadata.headers,
|
|
2428
2428
|
timestamp: metadata.timestamp || Date.now(),
|
|
2429
|
-
// Parsed synchronously and unconditionally
|
|
2429
|
+
// Parsed synchronously and unconditionally: it is two header reads,
|
|
2430
2430
|
// it needs no network, and a rule that has to check whether the edge
|
|
2431
2431
|
// verdict was populated is a rule people will get wrong.
|
|
2432
2432
|
edge: readEdgeVerdict(metadata.headers),
|
|
2433
|
-
// Same reasoning as `edge`, and the same cost profile
|
|
2433
|
+
// Same reasoning as `edge`, and the same cost profile: a memoised
|
|
2434
2434
|
// substring scan over a static table, no network, no async. Populating it
|
|
2435
2435
|
// unconditionally means a rule never has to ask whether classification
|
|
2436
2436
|
// ran.
|
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) {
|
|
@@ -2355,11 +2355,11 @@ var WebDecoy = class {
|
|
|
2355
2355
|
userAgent: metadata.user_agent,
|
|
2356
2356
|
headers: metadata.headers,
|
|
2357
2357
|
timestamp: metadata.timestamp || Date.now(),
|
|
2358
|
-
// Parsed synchronously and unconditionally
|
|
2358
|
+
// Parsed synchronously and unconditionally: it is two header reads,
|
|
2359
2359
|
// it needs no network, and a rule that has to check whether the edge
|
|
2360
2360
|
// verdict was populated is a rule people will get wrong.
|
|
2361
2361
|
edge: readEdgeVerdict(metadata.headers),
|
|
2362
|
-
// Same reasoning as `edge`, and the same cost profile
|
|
2362
|
+
// Same reasoning as `edge`, and the same cost profile: a memoised
|
|
2363
2363
|
// substring scan over a static table, no network, no async. Populating it
|
|
2364
2364
|
// unconditionally means a rule never has to ask whether classification
|
|
2365
2365
|
// ran.
|