@webdecoy/node 0.11.1 → 0.12.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 +88 -1
- package/dist/index.d.ts +88 -1
- package/dist/index.js +151 -2
- package/dist/index.mjs +148 -2
- package/package.json +2 -5
package/dist/index.d.mts
CHANGED
|
@@ -923,6 +923,93 @@ declare const TEST_TRIGGER_USER_AGENT = "WebDecoy-Test/1.0";
|
|
|
923
923
|
/** Whether this User-Agent is the reserved test trigger. */
|
|
924
924
|
declare function isTestTriggerUserAgent(userAgent: string | undefined): boolean;
|
|
925
925
|
|
|
926
|
+
/**
|
|
927
|
+
* Resolving the client IP address behind a proxy.
|
|
928
|
+
*
|
|
929
|
+
* WHY THIS MODULE EXISTS
|
|
930
|
+
*
|
|
931
|
+
* Every adapter used to read the leftmost value of `X-Forwarded-For` and call it
|
|
932
|
+
* the client. That header is written by the client for the first hop, so the
|
|
933
|
+
* leftmost value is whatever the caller decided to put there. One
|
|
934
|
+
* `-H 'X-Forwarded-For: 1.2.3.4'` gave an attacker a fresh rate-limit bucket per
|
|
935
|
+
* forged address, put an address of their choosing on every violation we
|
|
936
|
+
* reported, and made `filter({ expression: 'ip.tor' })` an opt-in check.
|
|
937
|
+
*
|
|
938
|
+
* A forwarding header is only evidence if you know who wrote it. So the default
|
|
939
|
+
* here is to not read one at all: use the address the connection actually came
|
|
940
|
+
* from, and make the operator say how many proxies sit in front before we
|
|
941
|
+
* believe anything else. The WordPress plugin already works this way; this
|
|
942
|
+
* brings the Node adapters in line.
|
|
943
|
+
*
|
|
944
|
+
* THE MODEL
|
|
945
|
+
*
|
|
946
|
+
* Each proxy appends the address it received the connection from, so the
|
|
947
|
+
* observed chain outermost-first is `[...X-Forwarded-For, peer]` and the entries
|
|
948
|
+
* to the RIGHT are the ones added by infrastructure you control. Trust is
|
|
949
|
+
* therefore counted from the right: with one proxy in front of you, the client
|
|
950
|
+
* is the last `X-Forwarded-For` entry; with two, the second from last. Anything
|
|
951
|
+
* further left was supplied by someone you have no reason to believe.
|
|
952
|
+
*
|
|
953
|
+
* No `node:net` — this runs in Edge and Workers runtimes too, so the address
|
|
954
|
+
* parsing is hand-rolled and covered by tests.
|
|
955
|
+
*/
|
|
956
|
+
/**
|
|
957
|
+
* How much of the forwarding chain to believe.
|
|
958
|
+
*
|
|
959
|
+
* - `false` (default) — read no forwarding headers; the peer address is the
|
|
960
|
+
* client. Correct for an app exposed directly, and safe for one that isn't:
|
|
961
|
+
* it attributes traffic to your proxy rather than to a forged address.
|
|
962
|
+
* - `number` — the number of trusted proxies between the client and this
|
|
963
|
+
* process. The client is the Nth entry from the right of `X-Forwarded-For`.
|
|
964
|
+
* - `'cloudflare'` — use `CF-Connecting-IP`. Only meaningful if the origin is
|
|
965
|
+
* unreachable except through Cloudflare, since the header is otherwise just
|
|
966
|
+
* another thing a client can send.
|
|
967
|
+
* - `string[]` — CIDRs (or bare addresses) of the proxies you run. The chain is
|
|
968
|
+
* walked right to left and the first address that isn't one of yours is the
|
|
969
|
+
* client. Use this when the depth varies.
|
|
970
|
+
*/
|
|
971
|
+
type TrustedProxies = false | number | 'cloudflare' | string[];
|
|
972
|
+
/** Headers as either a Node-style bag or a WHATWG `Headers`. */
|
|
973
|
+
type HeaderSource = Record<string, string | string[] | undefined> | {
|
|
974
|
+
get(name: string): string | null;
|
|
975
|
+
};
|
|
976
|
+
interface ResolveClientIpOptions {
|
|
977
|
+
/** Request headers. */
|
|
978
|
+
headers: HeaderSource;
|
|
979
|
+
/** The address the connection came from, when the runtime exposes one. */
|
|
980
|
+
peer?: string;
|
|
981
|
+
/** How much of the forwarding chain to believe. Defaults to `false`. */
|
|
982
|
+
trustProxy?: TrustedProxies;
|
|
983
|
+
}
|
|
984
|
+
/**
|
|
985
|
+
* Strip the decoration real-world sources add to an address — brackets, a port,
|
|
986
|
+
* an IPv6 zone id — and return it in a canonical form, or null if what's left
|
|
987
|
+
* isn't an address at all.
|
|
988
|
+
*
|
|
989
|
+
* IPv4-mapped IPv6 (`::ffff:203.0.113.9`) collapses to the IPv4 form, so a
|
|
990
|
+
* dual-stack listener and an `X-Forwarded-For` entry for the same client
|
|
991
|
+
* produce the same key.
|
|
992
|
+
*/
|
|
993
|
+
declare function normalizeIp(raw: string | undefined | null): string | null;
|
|
994
|
+
/**
|
|
995
|
+
* Whether an address falls inside a CIDR range. A bare address is treated as a
|
|
996
|
+
* single-host range. Families never match across each other.
|
|
997
|
+
*/
|
|
998
|
+
declare function ipInCidr(ip: string, cidr: string): boolean;
|
|
999
|
+
/**
|
|
1000
|
+
* Resolve the client IP for a request.
|
|
1001
|
+
*
|
|
1002
|
+
* Returns `undefined` only when there is nothing to go on: no peer address and
|
|
1003
|
+
* no header the configuration says to believe. Callers supply their own last
|
|
1004
|
+
* resort, because what that should be is a per-framework question.
|
|
1005
|
+
*
|
|
1006
|
+
* Whenever the configured source is missing or malformed this falls back to the
|
|
1007
|
+
* peer address rather than reaching further left in the chain. The peer is the
|
|
1008
|
+
* one address on a request that cannot be forged, so a wrong-but-real proxy
|
|
1009
|
+
* address beats a plausible-looking value the caller chose.
|
|
1010
|
+
*/
|
|
1011
|
+
declare function resolveClientIp(options: ResolveClientIpOptions): string | undefined;
|
|
1012
|
+
|
|
926
1013
|
/**
|
|
927
1014
|
* Rule Engine
|
|
928
1015
|
* Evaluates rules in order — first DENY/THROTTLE wins
|
|
@@ -2132,4 +2219,4 @@ declare function createCaptchaEndpoints(options?: CaptchaEndpointsOptions): {
|
|
|
2132
2219
|
};
|
|
2133
2220
|
type CaptchaEndpoints = ReturnType<typeof createCaptchaEndpoints>;
|
|
2134
2221
|
|
|
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 };
|
|
2222
|
+
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 HeaderSource, 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 ResolveClientIpOptions, 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 TrustedProxies, type Verdict, type VerifyInput, type VerifyResult, type ViolationEvent, type WebBotAuthConfig, WebBotAuthRule, WebDecoy, type WebDecoyConfig, bots, calculateCategoryScores, calculateFinalScore, classifyUserAgent, createAgentVerifier, createCaptchaEndpoints, filter, honeytoken, injectHoneytokenLink, ipInCidr, isDatacenterIP, isInjectableHtml, isMobileUA, isTestTriggerUserAgent, matchUserAgent, normalizeIp, parseUserAgent, rateLimit, readEdgeVerdict, recommend, resolveClientIp, resolveSecret, siteHoneytoken, tripwire, webBotAuth };
|
package/dist/index.d.ts
CHANGED
|
@@ -923,6 +923,93 @@ declare const TEST_TRIGGER_USER_AGENT = "WebDecoy-Test/1.0";
|
|
|
923
923
|
/** Whether this User-Agent is the reserved test trigger. */
|
|
924
924
|
declare function isTestTriggerUserAgent(userAgent: string | undefined): boolean;
|
|
925
925
|
|
|
926
|
+
/**
|
|
927
|
+
* Resolving the client IP address behind a proxy.
|
|
928
|
+
*
|
|
929
|
+
* WHY THIS MODULE EXISTS
|
|
930
|
+
*
|
|
931
|
+
* Every adapter used to read the leftmost value of `X-Forwarded-For` and call it
|
|
932
|
+
* the client. That header is written by the client for the first hop, so the
|
|
933
|
+
* leftmost value is whatever the caller decided to put there. One
|
|
934
|
+
* `-H 'X-Forwarded-For: 1.2.3.4'` gave an attacker a fresh rate-limit bucket per
|
|
935
|
+
* forged address, put an address of their choosing on every violation we
|
|
936
|
+
* reported, and made `filter({ expression: 'ip.tor' })` an opt-in check.
|
|
937
|
+
*
|
|
938
|
+
* A forwarding header is only evidence if you know who wrote it. So the default
|
|
939
|
+
* here is to not read one at all: use the address the connection actually came
|
|
940
|
+
* from, and make the operator say how many proxies sit in front before we
|
|
941
|
+
* believe anything else. The WordPress plugin already works this way; this
|
|
942
|
+
* brings the Node adapters in line.
|
|
943
|
+
*
|
|
944
|
+
* THE MODEL
|
|
945
|
+
*
|
|
946
|
+
* Each proxy appends the address it received the connection from, so the
|
|
947
|
+
* observed chain outermost-first is `[...X-Forwarded-For, peer]` and the entries
|
|
948
|
+
* to the RIGHT are the ones added by infrastructure you control. Trust is
|
|
949
|
+
* therefore counted from the right: with one proxy in front of you, the client
|
|
950
|
+
* is the last `X-Forwarded-For` entry; with two, the second from last. Anything
|
|
951
|
+
* further left was supplied by someone you have no reason to believe.
|
|
952
|
+
*
|
|
953
|
+
* No `node:net` — this runs in Edge and Workers runtimes too, so the address
|
|
954
|
+
* parsing is hand-rolled and covered by tests.
|
|
955
|
+
*/
|
|
956
|
+
/**
|
|
957
|
+
* How much of the forwarding chain to believe.
|
|
958
|
+
*
|
|
959
|
+
* - `false` (default) — read no forwarding headers; the peer address is the
|
|
960
|
+
* client. Correct for an app exposed directly, and safe for one that isn't:
|
|
961
|
+
* it attributes traffic to your proxy rather than to a forged address.
|
|
962
|
+
* - `number` — the number of trusted proxies between the client and this
|
|
963
|
+
* process. The client is the Nth entry from the right of `X-Forwarded-For`.
|
|
964
|
+
* - `'cloudflare'` — use `CF-Connecting-IP`. Only meaningful if the origin is
|
|
965
|
+
* unreachable except through Cloudflare, since the header is otherwise just
|
|
966
|
+
* another thing a client can send.
|
|
967
|
+
* - `string[]` — CIDRs (or bare addresses) of the proxies you run. The chain is
|
|
968
|
+
* walked right to left and the first address that isn't one of yours is the
|
|
969
|
+
* client. Use this when the depth varies.
|
|
970
|
+
*/
|
|
971
|
+
type TrustedProxies = false | number | 'cloudflare' | string[];
|
|
972
|
+
/** Headers as either a Node-style bag or a WHATWG `Headers`. */
|
|
973
|
+
type HeaderSource = Record<string, string | string[] | undefined> | {
|
|
974
|
+
get(name: string): string | null;
|
|
975
|
+
};
|
|
976
|
+
interface ResolveClientIpOptions {
|
|
977
|
+
/** Request headers. */
|
|
978
|
+
headers: HeaderSource;
|
|
979
|
+
/** The address the connection came from, when the runtime exposes one. */
|
|
980
|
+
peer?: string;
|
|
981
|
+
/** How much of the forwarding chain to believe. Defaults to `false`. */
|
|
982
|
+
trustProxy?: TrustedProxies;
|
|
983
|
+
}
|
|
984
|
+
/**
|
|
985
|
+
* Strip the decoration real-world sources add to an address — brackets, a port,
|
|
986
|
+
* an IPv6 zone id — and return it in a canonical form, or null if what's left
|
|
987
|
+
* isn't an address at all.
|
|
988
|
+
*
|
|
989
|
+
* IPv4-mapped IPv6 (`::ffff:203.0.113.9`) collapses to the IPv4 form, so a
|
|
990
|
+
* dual-stack listener and an `X-Forwarded-For` entry for the same client
|
|
991
|
+
* produce the same key.
|
|
992
|
+
*/
|
|
993
|
+
declare function normalizeIp(raw: string | undefined | null): string | null;
|
|
994
|
+
/**
|
|
995
|
+
* Whether an address falls inside a CIDR range. A bare address is treated as a
|
|
996
|
+
* single-host range. Families never match across each other.
|
|
997
|
+
*/
|
|
998
|
+
declare function ipInCidr(ip: string, cidr: string): boolean;
|
|
999
|
+
/**
|
|
1000
|
+
* Resolve the client IP for a request.
|
|
1001
|
+
*
|
|
1002
|
+
* Returns `undefined` only when there is nothing to go on: no peer address and
|
|
1003
|
+
* no header the configuration says to believe. Callers supply their own last
|
|
1004
|
+
* resort, because what that should be is a per-framework question.
|
|
1005
|
+
*
|
|
1006
|
+
* Whenever the configured source is missing or malformed this falls back to the
|
|
1007
|
+
* peer address rather than reaching further left in the chain. The peer is the
|
|
1008
|
+
* one address on a request that cannot be forged, so a wrong-but-real proxy
|
|
1009
|
+
* address beats a plausible-looking value the caller chose.
|
|
1010
|
+
*/
|
|
1011
|
+
declare function resolveClientIp(options: ResolveClientIpOptions): string | undefined;
|
|
1012
|
+
|
|
926
1013
|
/**
|
|
927
1014
|
* Rule Engine
|
|
928
1015
|
* Evaluates rules in order — first DENY/THROTTLE wins
|
|
@@ -2132,4 +2219,4 @@ declare function createCaptchaEndpoints(options?: CaptchaEndpointsOptions): {
|
|
|
2132
2219
|
};
|
|
2133
2220
|
type CaptchaEndpoints = ReturnType<typeof createCaptchaEndpoints>;
|
|
2134
2221
|
|
|
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 };
|
|
2222
|
+
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 HeaderSource, 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 ResolveClientIpOptions, 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 TrustedProxies, type Verdict, type VerifyInput, type VerifyResult, type ViolationEvent, type WebBotAuthConfig, WebBotAuthRule, WebDecoy, type WebDecoyConfig, bots, calculateCategoryScores, calculateFinalScore, classifyUserAgent, createAgentVerifier, createCaptchaEndpoints, filter, honeytoken, injectHoneytokenLink, ipInCidr, isDatacenterIP, isInjectableHtml, isMobileUA, isTestTriggerUserAgent, matchUserAgent, normalizeIp, parseUserAgent, rateLimit, readEdgeVerdict, recommend, resolveClientIp, resolveSecret, siteHoneytoken, tripwire, webBotAuth };
|
package/dist/index.js
CHANGED
|
@@ -56,15 +56,18 @@ __export(index_exports, {
|
|
|
56
56
|
filter: () => filter,
|
|
57
57
|
honeytoken: () => honeytoken,
|
|
58
58
|
injectHoneytokenLink: () => injectHoneytokenLink,
|
|
59
|
+
ipInCidr: () => ipInCidr,
|
|
59
60
|
isDatacenterIP: () => isDatacenterIP2,
|
|
60
61
|
isInjectableHtml: () => isInjectableHtml,
|
|
61
62
|
isMobileUA: () => isMobileUA,
|
|
62
63
|
isTestTriggerUserAgent: () => isTestTriggerUserAgent,
|
|
63
64
|
matchUserAgent: () => matchUserAgent,
|
|
65
|
+
normalizeIp: () => normalizeIp,
|
|
64
66
|
parseUserAgent: () => parseUserAgent,
|
|
65
67
|
rateLimit: () => rateLimit,
|
|
66
68
|
readEdgeVerdict: () => readEdgeVerdict,
|
|
67
69
|
recommend: () => recommend,
|
|
70
|
+
resolveClientIp: () => resolveClientIp,
|
|
68
71
|
resolveSecret: () => resolveSecret,
|
|
69
72
|
siteHoneytoken: () => siteHoneytoken,
|
|
70
73
|
tripwire: () => tripwire,
|
|
@@ -756,7 +759,7 @@ var Parser = class {
|
|
|
756
759
|
return this.comparison();
|
|
757
760
|
}
|
|
758
761
|
comparison() {
|
|
759
|
-
|
|
762
|
+
const left = this.primary();
|
|
760
763
|
if (this.match("EQ" /* EQ */)) return { kind: "binary", op: "==", left, right: this.primary() };
|
|
761
764
|
if (this.match("NEQ" /* NEQ */)) return { kind: "binary", op: "!=", left, right: this.primary() };
|
|
762
765
|
if (this.match("GT" /* GT */)) return { kind: "binary", op: ">", left, right: this.primary() };
|
|
@@ -2785,6 +2788,149 @@ function agentInputFromMetadata(metadata) {
|
|
|
2785
2788
|
}
|
|
2786
2789
|
}
|
|
2787
2790
|
|
|
2791
|
+
// src/client-ip.ts
|
|
2792
|
+
var IPV4 = /^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/;
|
|
2793
|
+
function ipv4ToBytes(ip) {
|
|
2794
|
+
const m = IPV4.exec(ip);
|
|
2795
|
+
if (!m) return null;
|
|
2796
|
+
const out = new Uint8Array(4);
|
|
2797
|
+
for (let i = 0; i < 4; i++) {
|
|
2798
|
+
const part = m[i + 1];
|
|
2799
|
+
if (part.length > 1 && part[0] === "0") return null;
|
|
2800
|
+
const n = Number(part);
|
|
2801
|
+
if (n > 255) return null;
|
|
2802
|
+
out[i] = n;
|
|
2803
|
+
}
|
|
2804
|
+
return out;
|
|
2805
|
+
}
|
|
2806
|
+
function ipv6ToBytes(input) {
|
|
2807
|
+
let s = input.toLowerCase();
|
|
2808
|
+
const lastColon = s.lastIndexOf(":");
|
|
2809
|
+
if (lastColon !== -1 && s.slice(lastColon + 1).includes(".")) {
|
|
2810
|
+
const tail = ipv4ToBytes(s.slice(lastColon + 1));
|
|
2811
|
+
if (!tail) return null;
|
|
2812
|
+
const g1 = (tail[0] << 8 | tail[1]).toString(16);
|
|
2813
|
+
const g2 = (tail[2] << 8 | tail[3]).toString(16);
|
|
2814
|
+
s = `${s.slice(0, lastColon + 1)}${g1}:${g2}`;
|
|
2815
|
+
}
|
|
2816
|
+
const halves = s.split("::");
|
|
2817
|
+
if (halves.length > 2) return null;
|
|
2818
|
+
const parseGroups = (part) => {
|
|
2819
|
+
if (part === "") return [];
|
|
2820
|
+
const groups2 = part.split(":");
|
|
2821
|
+
const out = [];
|
|
2822
|
+
for (const g of groups2) {
|
|
2823
|
+
if (!/^[0-9a-f]{1,4}$/.test(g)) return null;
|
|
2824
|
+
out.push(parseInt(g, 16));
|
|
2825
|
+
}
|
|
2826
|
+
return out;
|
|
2827
|
+
};
|
|
2828
|
+
const head = parseGroups(halves[0]);
|
|
2829
|
+
if (head === null) return null;
|
|
2830
|
+
let groups;
|
|
2831
|
+
if (halves.length === 2) {
|
|
2832
|
+
const tail = parseGroups(halves[1]);
|
|
2833
|
+
if (tail === null) return null;
|
|
2834
|
+
const fill = 8 - head.length - tail.length;
|
|
2835
|
+
if (fill < 1) return null;
|
|
2836
|
+
groups = [...head, ...new Array(fill).fill(0), ...tail];
|
|
2837
|
+
} else {
|
|
2838
|
+
groups = head;
|
|
2839
|
+
}
|
|
2840
|
+
if (groups.length !== 8) return null;
|
|
2841
|
+
const bytes = new Uint8Array(16);
|
|
2842
|
+
for (let i = 0; i < 8; i++) {
|
|
2843
|
+
bytes[i * 2] = groups[i] >> 8;
|
|
2844
|
+
bytes[i * 2 + 1] = groups[i] & 255;
|
|
2845
|
+
}
|
|
2846
|
+
return bytes;
|
|
2847
|
+
}
|
|
2848
|
+
function ipToBytes(ip) {
|
|
2849
|
+
return ipv4ToBytes(ip) ?? ipv6ToBytes(ip);
|
|
2850
|
+
}
|
|
2851
|
+
function normalizeIp(raw) {
|
|
2852
|
+
if (!raw) return null;
|
|
2853
|
+
let v = raw.trim();
|
|
2854
|
+
if (!v) return null;
|
|
2855
|
+
if (v.startsWith("[")) {
|
|
2856
|
+
const close = v.indexOf("]");
|
|
2857
|
+
if (close === -1) return null;
|
|
2858
|
+
v = v.slice(1, close);
|
|
2859
|
+
} else if (v.includes(".") && v.split(":").length === 2) {
|
|
2860
|
+
v = v.slice(0, v.indexOf(":"));
|
|
2861
|
+
}
|
|
2862
|
+
const pct = v.indexOf("%");
|
|
2863
|
+
if (pct !== -1) v = v.slice(0, pct);
|
|
2864
|
+
if (ipv4ToBytes(v)) return v;
|
|
2865
|
+
const bytes = ipv6ToBytes(v);
|
|
2866
|
+
if (!bytes) return null;
|
|
2867
|
+
const mapped = bytes.subarray(0, 10).every((b) => b === 0) && bytes[10] === 255 && bytes[11] === 255;
|
|
2868
|
+
if (mapped) return `${bytes[12]}.${bytes[13]}.${bytes[14]}.${bytes[15]}`;
|
|
2869
|
+
return v.toLowerCase();
|
|
2870
|
+
}
|
|
2871
|
+
function ipInCidr(ip, cidr) {
|
|
2872
|
+
const slash = cidr.indexOf("/");
|
|
2873
|
+
const network = normalizeIp(slash === -1 ? cidr : cidr.slice(0, slash));
|
|
2874
|
+
const address = normalizeIp(ip);
|
|
2875
|
+
if (!network || !address) return false;
|
|
2876
|
+
const netBytes = ipToBytes(network);
|
|
2877
|
+
const addrBytes = ipToBytes(address);
|
|
2878
|
+
if (!netBytes || !addrBytes || netBytes.length !== addrBytes.length) return false;
|
|
2879
|
+
const totalBits = netBytes.length * 8;
|
|
2880
|
+
let bits = totalBits;
|
|
2881
|
+
if (slash !== -1) {
|
|
2882
|
+
const raw = cidr.slice(slash + 1);
|
|
2883
|
+
bits = Number(raw);
|
|
2884
|
+
if (raw === "" || !Number.isInteger(bits) || bits < 0 || bits > totalBits) return false;
|
|
2885
|
+
}
|
|
2886
|
+
const wholeBytes = bits >> 3;
|
|
2887
|
+
for (let i = 0; i < wholeBytes; i++) {
|
|
2888
|
+
if (netBytes[i] !== addrBytes[i]) return false;
|
|
2889
|
+
}
|
|
2890
|
+
const remainder = bits & 7;
|
|
2891
|
+
if (remainder) {
|
|
2892
|
+
const mask = 255 << 8 - remainder & 255;
|
|
2893
|
+
if ((netBytes[wholeBytes] & mask) !== (addrBytes[wholeBytes] & mask)) return false;
|
|
2894
|
+
}
|
|
2895
|
+
return true;
|
|
2896
|
+
}
|
|
2897
|
+
function readHeader(headers, name) {
|
|
2898
|
+
if (typeof headers.get === "function") {
|
|
2899
|
+
return headers.get(name) ?? void 0;
|
|
2900
|
+
}
|
|
2901
|
+
const bag = headers;
|
|
2902
|
+
const value = bag[name] ?? bag[name.toLowerCase()];
|
|
2903
|
+
if (Array.isArray(value)) return value.join(",");
|
|
2904
|
+
return value;
|
|
2905
|
+
}
|
|
2906
|
+
function forwardedChain(headers) {
|
|
2907
|
+
const raw = readHeader(headers, "x-forwarded-for");
|
|
2908
|
+
if (!raw) return [];
|
|
2909
|
+
return raw.split(",").map((part) => part.trim()).filter((part) => part !== "").map((part) => normalizeIp(part));
|
|
2910
|
+
}
|
|
2911
|
+
function resolveClientIp(options) {
|
|
2912
|
+
const { headers, trustProxy = false } = options;
|
|
2913
|
+
const peer = normalizeIp(options.peer) ?? void 0;
|
|
2914
|
+
if (trustProxy === false || trustProxy === 0) return peer;
|
|
2915
|
+
if (trustProxy === "cloudflare") {
|
|
2916
|
+
return normalizeIp(readHeader(headers, "cf-connecting-ip")) ?? peer;
|
|
2917
|
+
}
|
|
2918
|
+
const chain = forwardedChain(headers);
|
|
2919
|
+
if (typeof trustProxy === "number") {
|
|
2920
|
+
if (!Number.isInteger(trustProxy) || trustProxy < 0) return peer;
|
|
2921
|
+
const index = chain.length - trustProxy;
|
|
2922
|
+
if (index < 0 || index >= chain.length) return peer;
|
|
2923
|
+
return chain[index] ?? peer;
|
|
2924
|
+
}
|
|
2925
|
+
const full = peer ? [...chain, peer] : [...chain];
|
|
2926
|
+
for (let i = full.length - 1; i >= 0; i--) {
|
|
2927
|
+
const candidate = full[i];
|
|
2928
|
+
if (candidate === null) return peer;
|
|
2929
|
+
if (!trustProxy.some((range) => ipInCidr(candidate, range))) return candidate;
|
|
2930
|
+
}
|
|
2931
|
+
return full[0] ?? void 0 ?? peer;
|
|
2932
|
+
}
|
|
2933
|
+
|
|
2788
2934
|
// src/detection/weights.ts
|
|
2789
2935
|
var DEFAULT_WEIGHTS = {
|
|
2790
2936
|
vision_ai: 0.15,
|
|
@@ -2925,7 +3071,7 @@ var InMemoryRateLimiter2 = class {
|
|
|
2925
3071
|
check(key, windowSeconds = 60, maxRequests = 10) {
|
|
2926
3072
|
const now = Date.now();
|
|
2927
3073
|
const cutoff = now - windowSeconds * 1e3;
|
|
2928
|
-
|
|
3074
|
+
const timestamps = (this.requests.get(key) ?? []).filter((t) => t > cutoff);
|
|
2929
3075
|
const count = timestamps.length;
|
|
2930
3076
|
if (count >= maxRequests) {
|
|
2931
3077
|
this.requests.set(key, timestamps);
|
|
@@ -4780,15 +4926,18 @@ function createCaptchaEndpoints(options = {}) {
|
|
|
4780
4926
|
filter,
|
|
4781
4927
|
honeytoken,
|
|
4782
4928
|
injectHoneytokenLink,
|
|
4929
|
+
ipInCidr,
|
|
4783
4930
|
isDatacenterIP,
|
|
4784
4931
|
isInjectableHtml,
|
|
4785
4932
|
isMobileUA,
|
|
4786
4933
|
isTestTriggerUserAgent,
|
|
4787
4934
|
matchUserAgent,
|
|
4935
|
+
normalizeIp,
|
|
4788
4936
|
parseUserAgent,
|
|
4789
4937
|
rateLimit,
|
|
4790
4938
|
readEdgeVerdict,
|
|
4791
4939
|
recommend,
|
|
4940
|
+
resolveClientIp,
|
|
4792
4941
|
resolveSecret,
|
|
4793
4942
|
siteHoneytoken,
|
|
4794
4943
|
tripwire,
|
package/dist/index.mjs
CHANGED
|
@@ -682,7 +682,7 @@ var Parser = class {
|
|
|
682
682
|
return this.comparison();
|
|
683
683
|
}
|
|
684
684
|
comparison() {
|
|
685
|
-
|
|
685
|
+
const left = this.primary();
|
|
686
686
|
if (this.match("EQ" /* EQ */)) return { kind: "binary", op: "==", left, right: this.primary() };
|
|
687
687
|
if (this.match("NEQ" /* NEQ */)) return { kind: "binary", op: "!=", left, right: this.primary() };
|
|
688
688
|
if (this.match("GT" /* GT */)) return { kind: "binary", op: ">", left, right: this.primary() };
|
|
@@ -2711,6 +2711,149 @@ function agentInputFromMetadata(metadata) {
|
|
|
2711
2711
|
}
|
|
2712
2712
|
}
|
|
2713
2713
|
|
|
2714
|
+
// src/client-ip.ts
|
|
2715
|
+
var IPV4 = /^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/;
|
|
2716
|
+
function ipv4ToBytes(ip) {
|
|
2717
|
+
const m = IPV4.exec(ip);
|
|
2718
|
+
if (!m) return null;
|
|
2719
|
+
const out = new Uint8Array(4);
|
|
2720
|
+
for (let i = 0; i < 4; i++) {
|
|
2721
|
+
const part = m[i + 1];
|
|
2722
|
+
if (part.length > 1 && part[0] === "0") return null;
|
|
2723
|
+
const n = Number(part);
|
|
2724
|
+
if (n > 255) return null;
|
|
2725
|
+
out[i] = n;
|
|
2726
|
+
}
|
|
2727
|
+
return out;
|
|
2728
|
+
}
|
|
2729
|
+
function ipv6ToBytes(input) {
|
|
2730
|
+
let s = input.toLowerCase();
|
|
2731
|
+
const lastColon = s.lastIndexOf(":");
|
|
2732
|
+
if (lastColon !== -1 && s.slice(lastColon + 1).includes(".")) {
|
|
2733
|
+
const tail = ipv4ToBytes(s.slice(lastColon + 1));
|
|
2734
|
+
if (!tail) return null;
|
|
2735
|
+
const g1 = (tail[0] << 8 | tail[1]).toString(16);
|
|
2736
|
+
const g2 = (tail[2] << 8 | tail[3]).toString(16);
|
|
2737
|
+
s = `${s.slice(0, lastColon + 1)}${g1}:${g2}`;
|
|
2738
|
+
}
|
|
2739
|
+
const halves = s.split("::");
|
|
2740
|
+
if (halves.length > 2) return null;
|
|
2741
|
+
const parseGroups = (part) => {
|
|
2742
|
+
if (part === "") return [];
|
|
2743
|
+
const groups2 = part.split(":");
|
|
2744
|
+
const out = [];
|
|
2745
|
+
for (const g of groups2) {
|
|
2746
|
+
if (!/^[0-9a-f]{1,4}$/.test(g)) return null;
|
|
2747
|
+
out.push(parseInt(g, 16));
|
|
2748
|
+
}
|
|
2749
|
+
return out;
|
|
2750
|
+
};
|
|
2751
|
+
const head = parseGroups(halves[0]);
|
|
2752
|
+
if (head === null) return null;
|
|
2753
|
+
let groups;
|
|
2754
|
+
if (halves.length === 2) {
|
|
2755
|
+
const tail = parseGroups(halves[1]);
|
|
2756
|
+
if (tail === null) return null;
|
|
2757
|
+
const fill = 8 - head.length - tail.length;
|
|
2758
|
+
if (fill < 1) return null;
|
|
2759
|
+
groups = [...head, ...new Array(fill).fill(0), ...tail];
|
|
2760
|
+
} else {
|
|
2761
|
+
groups = head;
|
|
2762
|
+
}
|
|
2763
|
+
if (groups.length !== 8) return null;
|
|
2764
|
+
const bytes = new Uint8Array(16);
|
|
2765
|
+
for (let i = 0; i < 8; i++) {
|
|
2766
|
+
bytes[i * 2] = groups[i] >> 8;
|
|
2767
|
+
bytes[i * 2 + 1] = groups[i] & 255;
|
|
2768
|
+
}
|
|
2769
|
+
return bytes;
|
|
2770
|
+
}
|
|
2771
|
+
function ipToBytes(ip) {
|
|
2772
|
+
return ipv4ToBytes(ip) ?? ipv6ToBytes(ip);
|
|
2773
|
+
}
|
|
2774
|
+
function normalizeIp(raw) {
|
|
2775
|
+
if (!raw) return null;
|
|
2776
|
+
let v = raw.trim();
|
|
2777
|
+
if (!v) return null;
|
|
2778
|
+
if (v.startsWith("[")) {
|
|
2779
|
+
const close = v.indexOf("]");
|
|
2780
|
+
if (close === -1) return null;
|
|
2781
|
+
v = v.slice(1, close);
|
|
2782
|
+
} else if (v.includes(".") && v.split(":").length === 2) {
|
|
2783
|
+
v = v.slice(0, v.indexOf(":"));
|
|
2784
|
+
}
|
|
2785
|
+
const pct = v.indexOf("%");
|
|
2786
|
+
if (pct !== -1) v = v.slice(0, pct);
|
|
2787
|
+
if (ipv4ToBytes(v)) return v;
|
|
2788
|
+
const bytes = ipv6ToBytes(v);
|
|
2789
|
+
if (!bytes) return null;
|
|
2790
|
+
const mapped = bytes.subarray(0, 10).every((b) => b === 0) && bytes[10] === 255 && bytes[11] === 255;
|
|
2791
|
+
if (mapped) return `${bytes[12]}.${bytes[13]}.${bytes[14]}.${bytes[15]}`;
|
|
2792
|
+
return v.toLowerCase();
|
|
2793
|
+
}
|
|
2794
|
+
function ipInCidr(ip, cidr) {
|
|
2795
|
+
const slash = cidr.indexOf("/");
|
|
2796
|
+
const network = normalizeIp(slash === -1 ? cidr : cidr.slice(0, slash));
|
|
2797
|
+
const address = normalizeIp(ip);
|
|
2798
|
+
if (!network || !address) return false;
|
|
2799
|
+
const netBytes = ipToBytes(network);
|
|
2800
|
+
const addrBytes = ipToBytes(address);
|
|
2801
|
+
if (!netBytes || !addrBytes || netBytes.length !== addrBytes.length) return false;
|
|
2802
|
+
const totalBits = netBytes.length * 8;
|
|
2803
|
+
let bits = totalBits;
|
|
2804
|
+
if (slash !== -1) {
|
|
2805
|
+
const raw = cidr.slice(slash + 1);
|
|
2806
|
+
bits = Number(raw);
|
|
2807
|
+
if (raw === "" || !Number.isInteger(bits) || bits < 0 || bits > totalBits) return false;
|
|
2808
|
+
}
|
|
2809
|
+
const wholeBytes = bits >> 3;
|
|
2810
|
+
for (let i = 0; i < wholeBytes; i++) {
|
|
2811
|
+
if (netBytes[i] !== addrBytes[i]) return false;
|
|
2812
|
+
}
|
|
2813
|
+
const remainder = bits & 7;
|
|
2814
|
+
if (remainder) {
|
|
2815
|
+
const mask = 255 << 8 - remainder & 255;
|
|
2816
|
+
if ((netBytes[wholeBytes] & mask) !== (addrBytes[wholeBytes] & mask)) return false;
|
|
2817
|
+
}
|
|
2818
|
+
return true;
|
|
2819
|
+
}
|
|
2820
|
+
function readHeader(headers, name) {
|
|
2821
|
+
if (typeof headers.get === "function") {
|
|
2822
|
+
return headers.get(name) ?? void 0;
|
|
2823
|
+
}
|
|
2824
|
+
const bag = headers;
|
|
2825
|
+
const value = bag[name] ?? bag[name.toLowerCase()];
|
|
2826
|
+
if (Array.isArray(value)) return value.join(",");
|
|
2827
|
+
return value;
|
|
2828
|
+
}
|
|
2829
|
+
function forwardedChain(headers) {
|
|
2830
|
+
const raw = readHeader(headers, "x-forwarded-for");
|
|
2831
|
+
if (!raw) return [];
|
|
2832
|
+
return raw.split(",").map((part) => part.trim()).filter((part) => part !== "").map((part) => normalizeIp(part));
|
|
2833
|
+
}
|
|
2834
|
+
function resolveClientIp(options) {
|
|
2835
|
+
const { headers, trustProxy = false } = options;
|
|
2836
|
+
const peer = normalizeIp(options.peer) ?? void 0;
|
|
2837
|
+
if (trustProxy === false || trustProxy === 0) return peer;
|
|
2838
|
+
if (trustProxy === "cloudflare") {
|
|
2839
|
+
return normalizeIp(readHeader(headers, "cf-connecting-ip")) ?? peer;
|
|
2840
|
+
}
|
|
2841
|
+
const chain = forwardedChain(headers);
|
|
2842
|
+
if (typeof trustProxy === "number") {
|
|
2843
|
+
if (!Number.isInteger(trustProxy) || trustProxy < 0) return peer;
|
|
2844
|
+
const index = chain.length - trustProxy;
|
|
2845
|
+
if (index < 0 || index >= chain.length) return peer;
|
|
2846
|
+
return chain[index] ?? peer;
|
|
2847
|
+
}
|
|
2848
|
+
const full = peer ? [...chain, peer] : [...chain];
|
|
2849
|
+
for (let i = full.length - 1; i >= 0; i--) {
|
|
2850
|
+
const candidate = full[i];
|
|
2851
|
+
if (candidate === null) return peer;
|
|
2852
|
+
if (!trustProxy.some((range) => ipInCidr(candidate, range))) return candidate;
|
|
2853
|
+
}
|
|
2854
|
+
return full[0] ?? void 0 ?? peer;
|
|
2855
|
+
}
|
|
2856
|
+
|
|
2714
2857
|
// src/detection/weights.ts
|
|
2715
2858
|
var DEFAULT_WEIGHTS = {
|
|
2716
2859
|
vision_ai: 0.15,
|
|
@@ -2851,7 +2994,7 @@ var InMemoryRateLimiter2 = class {
|
|
|
2851
2994
|
check(key, windowSeconds = 60, maxRequests = 10) {
|
|
2852
2995
|
const now = Date.now();
|
|
2853
2996
|
const cutoff = now - windowSeconds * 1e3;
|
|
2854
|
-
|
|
2997
|
+
const timestamps = (this.requests.get(key) ?? []).filter((t) => t > cutoff);
|
|
2855
2998
|
const count = timestamps.length;
|
|
2856
2999
|
if (count >= maxRequests) {
|
|
2857
3000
|
this.requests.set(key, timestamps);
|
|
@@ -4705,15 +4848,18 @@ export {
|
|
|
4705
4848
|
filter,
|
|
4706
4849
|
honeytoken,
|
|
4707
4850
|
injectHoneytokenLink,
|
|
4851
|
+
ipInCidr,
|
|
4708
4852
|
isDatacenterIP2 as isDatacenterIP,
|
|
4709
4853
|
isInjectableHtml,
|
|
4710
4854
|
isMobileUA,
|
|
4711
4855
|
isTestTriggerUserAgent,
|
|
4712
4856
|
matchUserAgent,
|
|
4857
|
+
normalizeIp,
|
|
4713
4858
|
parseUserAgent,
|
|
4714
4859
|
rateLimit,
|
|
4715
4860
|
readEdgeVerdict,
|
|
4716
4861
|
recommend,
|
|
4862
|
+
resolveClientIp,
|
|
4717
4863
|
resolveSecret,
|
|
4718
4864
|
siteHoneytoken,
|
|
4719
4865
|
tripwire,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webdecoy/node",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.12.0",
|
|
4
4
|
"description": "Web Decoy SDK for Node.js - Bot detection with TLS fingerprinting",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"build": "tsup src/index.ts --format cjs,esm --dts --clean",
|
|
19
19
|
"dev": "tsup src/index.ts --format cjs,esm --dts --watch",
|
|
20
20
|
"test": "jest",
|
|
21
|
-
"lint": "eslint src
|
|
21
|
+
"lint": "eslint src --max-warnings 9",
|
|
22
22
|
"clean": "rm -rf dist",
|
|
23
23
|
"check:edge": "node ../../scripts/check-edge.mjs src/index.ts"
|
|
24
24
|
},
|
|
@@ -45,9 +45,6 @@
|
|
|
45
45
|
"devDependencies": {
|
|
46
46
|
"@types/jest": "^29.5.11",
|
|
47
47
|
"@types/node": "^20.11.0",
|
|
48
|
-
"@typescript-eslint/eslint-plugin": "^6.18.1",
|
|
49
|
-
"@typescript-eslint/parser": "^6.18.1",
|
|
50
|
-
"eslint": "^8.56.0",
|
|
51
48
|
"jest": "^29.7.0",
|
|
52
49
|
"ts-jest": "^29.1.1",
|
|
53
50
|
"tsup": "^8.0.1",
|