@webdecoy/node 0.21.3 → 0.22.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.ts CHANGED
@@ -1,7 +1,6 @@
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-C-gaFOT_.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-C-gaFOT_.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';
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, j as AgentVerifierOptions, k as AgentRequestInput, l as AgentVerdict, S as SignedAgentDirectory } from './sdk-B8M-WYTc.js';
2
+ export { m as AgentStatus, n as BOT_CATEGORIES, o as BOT_REGISTRY, p as BotVerdict, C as Characteristic, q as Conclusion, D as DEFAULT_CHARACTERISTICS, r as Decision, s as DecisionCache, t as DecisionCacheOptions, u as DecisionInit, E as EDGE_CLASS_HEADER, v as EDGE_CLEARANCE_HEADER, w as EdgeClass, x as EdgeVerdict, I as IPEnrichmentData, L as LocalAnalysis, y as LogFields, z as Logger, M as MemoryRateLimitStore, G as ProtectOptions, H as RequestMetadata, J as RuleOutcome, K as RuleState, N as SDKDetectionRequest, O as SDKDetectionResponse, Q as Span, U as SyncRateLimitStore, V as TLSInfo, X as Tracer, Y as ViolationEvent, Z as WebDecoyConfig, _ as classifyUserAgent, $ as consoleLogger, a0 as deriveKey, a1 as fromPino, a2 as matchUserAgent, a3 as newDecisionId, a4 as readEdgeVerdict, a5 as silentLogger } from './sdk-B8M-WYTc.js';
3
+ export { B as CLEARANCE_GATE_BUILD, C as ClearanceContext, a as ClearanceGateOptions, D as DetectAndGateOptions, b as DetectAndGateOutcome, F as FetchGuard, c as FetchGuardOptions, G as GateEnv, d as GateOutcome, e as GuardOutcome, H as HeaderSource, R as ResolveClientIpOptions, T as TrustedProxies, f as createClearanceGate, g as createDetectAndGate, h as createFetchGuard, i as ipInCidr, n as normalizeIp, r as resolveClientIp, j as resolveGateEnv } from './detect-and-gate-C7Uw14OR.js';
5
4
 
6
5
  /**
7
6
  * The reserved test trigger.
@@ -1305,92 +1304,6 @@ declare function armSiteHoneytoken(sdk: WebDecoy, options: HoneytokenArmingOptio
1305
1304
  */
1306
1305
  declare function deriveAndArm(sdk: WebDecoy, options: HoneytokenArmingOptions): Promise<SiteHoneytoken | null>;
1307
1306
 
1308
- /**
1309
- * One adapter, for every runtime that speaks `Request` and `Response`.
1310
- *
1311
- * WHY THIS EXISTS
1312
- *
1313
- * Express, Fastify and Next.js each grew their own copy of the same middleware:
1314
- * skip-path matching, monitor-versus-enforce, honeytoken arming, the 429 with a
1315
- * `Retry-After`, fail-open error handling. Three copies of a decision tree is
1316
- * three places for the branch that matters to be subtly different — and it
1317
- * already had been, which is how the leftmost-`X-Forwarded-For` bug survived in
1318
- * two adapters after the WordPress plugin fixed it.
1319
- *
1320
- * It is also the answer to "which framework do you support?". Hono, Bun, Deno,
1321
- * Astro, Nitro, SvelteKit and Remix all hand you a WHATWG `Request` and want a
1322
- * `Response` back. Written once here, each of those is a translation layer thin
1323
- * enough not to need a package — see the README recipe — and `@webdecoy/hono` is
1324
- * the one that does, because Hono has a middleware contract worth fitting.
1325
- *
1326
- * No `node:` imports: this is the code path that has to run on Workers.
1327
- */
1328
-
1329
- interface FetchGuardOptions extends WebDecoyConfig, ProtectOptions {
1330
- /**
1331
- * Whether a blocking verdict actually blocks. Defaults to `'monitor'`.
1332
- *
1333
- * Nobody adopts a defence by having it break their site on the first install.
1334
- * Watch what it would have done, then switch.
1335
- */
1336
- mode?: 'monitor' | 'enforce';
1337
- /** Paths to skip entirely — health checks, static assets. */
1338
- skipPaths?: (string | RegExp)[];
1339
- /**
1340
- * How much of the `X-Forwarded-For` chain to believe. Defaults to `1` trusted
1341
- * hop: a fetch handler has no socket to fall back on, so there is no
1342
- * believe-nothing default available. See `resolveClientIp`.
1343
- */
1344
- trustProxy?: TrustedProxies;
1345
- /** Override IP resolution entirely. */
1346
- getIP?: (request: Request) => string;
1347
- /**
1348
- * Inject a hidden honeytoken link into HTML responses, and arm the tripwire it
1349
- * points at. Defaults to on when an `apiKey` is present.
1350
- */
1351
- honeytoken?: boolean;
1352
- /** Build the blocking response. Defaults to 403, or 429 for a throttle. */
1353
- onBlocked?: (request: Request, decision: Decision) => Response | Promise<Response>;
1354
- }
1355
- interface GuardOutcome {
1356
- /** What the SDK concluded. Always present, in both modes. */
1357
- decision: Decision;
1358
- /**
1359
- * The response to return instead of calling the handler, or undefined to
1360
- * carry on. Undefined in monitor mode even when the decision is a denial.
1361
- */
1362
- response?: Response;
1363
- }
1364
- interface FetchGuard {
1365
- /** Evaluate one request. */
1366
- check(request: Request, peer?: string): Promise<GuardOutcome>;
1367
- /**
1368
- * Rewrite an HTML response to carry the honeytoken link. Returns the response
1369
- * unchanged when there is no token yet, or the body is not injectable HTML.
1370
- */
1371
- decorate(response: Response): Promise<Response>;
1372
- /** Whether this path is skipped. */
1373
- skips(pathname: string): boolean;
1374
- /** The underlying SDK, for `detectBot()` and friends. */
1375
- sdk: WebDecoy;
1376
- }
1377
- /**
1378
- * A guard over WHATWG `Request`/`Response`.
1379
- *
1380
- * ```ts
1381
- * const guard = createFetchGuard({ rules: [tripwire()] });
1382
- *
1383
- * export default {
1384
- * async fetch(request) {
1385
- * const { response } = await guard.check(request);
1386
- * if (response) return response;
1387
- * return guard.decorate(await handle(request));
1388
- * },
1389
- * };
1390
- * ```
1391
- */
1392
- declare function createFetchGuard(options?: FetchGuardOptions): FetchGuard;
1393
-
1394
1307
  /**
1395
1308
  * AgentVerifier — the public entry point for local Web Bot Auth verification.
1396
1309
  *
@@ -1787,4 +1700,4 @@ declare function createCaptchaEndpoints(options?: CaptchaEndpointsOptions): {
1787
1700
  };
1788
1701
  type CaptchaEndpoints = ReturnType<typeof createCaptchaEndpoints>;
1789
1702
 
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 };
1703
+ 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, type Detection, type DetectionContext, DetectionEngine, type DetectionEngineOptions, DirectoryCache, type EnvironmentalSignals, FilterConfig, FilterRule, type FingerprintStore, type FormAnalysisSignals, 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, 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, UpstashRateLimitStore, type UpstashStoreOptions, type Verdict, type VerifyInput, type VerifyResult, type WebBotAuthConfig, WebBotAuthRule, WebDecoy, armSiteHoneytoken, attackSignatures, botPolicy, bots, calculateCategoryScores, calculateFinalScore, clientSignals, createAgentVerifier, createCaptchaEndpoints, deriveAndArm, filter, honeytoken, injectHoneytokenLink, isDatacenterIP, isInjectableHtml, isMobileUA, isTestTriggerUserAgent, parseUserAgent, rateLimit, readClientSession, recommend, resolveSecret, ruleBlockResponse, shouldSkipPath, siteHoneytoken, tripwire, upstashRateLimitStore, webBotAuth };