perimeterx-js-core 0.31.0 → 0.32.1
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/lib/cjs/config/ConfigurationBase.js +1 -0
- package/lib/cjs/config/params/CreateHumanSecurityConfigurationParams.js +2 -0
- package/lib/cjs/config/params/index.js +1 -0
- package/lib/cjs/context/DefaultContext.js +1 -0
- package/lib/cjs/utils/constants.js +1 -1
- package/lib/esm/config/ConfigurationBase.js +1 -0
- package/lib/esm/config/params/CreateHumanSecurityConfigurationParams.js +1 -0
- package/lib/esm/config/params/index.js +1 -0
- package/lib/esm/context/DefaultContext.js +2 -1
- package/lib/esm/utils/constants.js +1 -1
- package/lib/types/activities/HttpActivityClient.d.ts +3 -3
- package/lib/types/activities/HttpBatchedActivityClient.d.ts +2 -2
- package/lib/types/activities/utils.d.ts +5 -5
- package/lib/types/additional_activity_handler/AdditionalActivityHandler.d.ts +1 -1
- package/lib/types/additional_activity_handler/AdditionalActivityHandlerUtils.d.ts +1 -1
- package/lib/types/blocker/MobileBlocker.d.ts +3 -3
- package/lib/types/blocker/utils.d.ts +1 -1
- package/lib/types/config/ConfigurationBase.d.ts +22 -22
- package/lib/types/config/IConfiguration.d.ts +9 -9
- package/lib/types/config/defaults/DefaultConfigurationParams.d.ts +1 -1
- package/lib/types/config/params/ActiveConfigurationParams.d.ts +8 -2
- package/lib/types/config/params/AllConfigurationParams.d.ts +6 -3
- package/lib/types/config/params/CoreConfigurationParams.d.ts +24 -7
- package/lib/types/config/params/CreateHumanSecurityConfigurationParams.d.ts +2 -0
- package/lib/types/config/params/RemoteConfigurationParams.d.ts +3 -2
- package/lib/types/config/params/StaticConfigurationParams.d.ts +5 -3
- package/lib/types/config/params/index.d.ts +1 -0
- package/lib/types/config/remote_config/RemoteConfigUtils.d.ts +1 -1
- package/lib/types/config/remote_config/manager/DefaultRemoteConfigManager.d.ts +10 -10
- package/lib/types/config/remote_config/model/RemoteConfigData.d.ts +2 -2
- package/lib/types/config/remote_config/service_client/HttpRemoteConfigServiceClient.d.ts +5 -5
- package/lib/types/config/remote_config/service_client/IRemoteConfigServiceClient.d.ts +2 -2
- package/lib/types/config/remote_config/storage_client/IRemoteConfigStorageClient.d.ts +3 -3
- package/lib/types/config/remote_config/update_parser/DefaultNotifyRemoteConfigUpdateParser.d.ts +3 -3
- package/lib/types/context/DefaultContext.d.ts +8 -8
- package/lib/types/context/SerializedContext.d.ts +4 -4
- package/lib/types/cors/DefaultCors.d.ts +2 -2
- package/lib/types/custom_parameters/CustomParametersFunction.d.ts +2 -2
- package/lib/types/custom_parameters/CustomParametersUtils.d.ts +2 -2
- package/lib/types/enforcer/EnforcerBase.d.ts +8 -8
- package/lib/types/enforcer/EnforcerOptions.d.ts +3 -3
- package/lib/types/enforcer/utils.d.ts +6 -6
- package/lib/types/flow/EndEnforcerFlow.d.ts +2 -2
- package/lib/types/flow/EnforceFlow.d.ts +2 -2
- package/lib/types/flow/FilterFlow.d.ts +2 -2
- package/lib/types/flow/PostEnforceFlow.d.ts +2 -2
- package/lib/types/graphql/DefaultGraphQLParser.d.ts +3 -3
- package/lib/types/logger/HttpLogServiceClient.d.ts +3 -3
- package/lib/types/monitored_request/MonitoredRequestUtils.d.ts +3 -3
- package/lib/types/phase/impl/AdditionalActivityHandlerPhase.d.ts +3 -3
- package/lib/types/phase/impl/CreateBlockResponsePhase.d.ts +3 -3
- package/lib/types/phase/impl/EnrichContextFromRequestPhase.d.ts +3 -3
- package/lib/types/phase/impl/EnrichContextFromResponsePhase.d.ts +3 -3
- package/lib/types/phase/impl/FirstPartyPhase.d.ts +3 -3
- package/lib/types/phase/impl/ModifyOutgoingResponsePhase.d.ts +3 -3
- package/lib/types/phase/impl/PreflightPhase.d.ts +2 -2
- package/lib/types/phase/impl/SendAsyncActivitiesPhase.d.ts +3 -3
- package/lib/types/phase/impl/SendLogsPhase.d.ts +2 -2
- package/lib/types/phase/impl/SendTelemetryActivityPhase.d.ts +3 -3
- package/lib/types/phase/impl/UpdateRemoteConfigPhase.d.ts +3 -3
- package/lib/types/products/account_defender/AccountDefender.d.ts +3 -3
- package/lib/types/products/bot_defender/BotDefender.d.ts +3 -3
- package/lib/types/products/bot_defender/block/DefaultBotDefenderBlocker.d.ts +3 -3
- package/lib/types/products/bot_defender/block/captcha/CaptchaBlocker.d.ts +12 -12
- package/lib/types/products/bot_defender/block/captcha/HtmlCaptchaBlocker.d.ts +5 -5
- package/lib/types/products/bot_defender/block/captcha/JsonCaptchaBlocker.d.ts +5 -5
- package/lib/types/products/bot_defender/block/captcha/MobileCaptchaBlocker.d.ts +4 -4
- package/lib/types/products/bot_defender/filter/DefaultBotDefenderFilter.d.ts +2 -2
- package/lib/types/products/bot_defender/first_party/DefaultBotDefenderFirstParty.d.ts +3 -3
- package/lib/types/products/bot_defender/first_party/utils.d.ts +7 -7
- package/lib/types/products/credential_intelligence/CredentialIntelligence.d.ts +4 -4
- package/lib/types/products/credential_intelligence/endpoint/login_successful/LoginSuccessfulParserFactory.d.ts +1 -1
- package/lib/types/products/hype_sale_challenge/HypeSaleChallenge.d.ts +3 -3
- package/lib/types/products/hype_sale_challenge/block/JsonHypeSaleChallengeBlocker.d.ts +3 -3
- package/lib/types/products/hype_sale_challenge/block/MobileHypeSaleChallengeBlocker.d.ts +2 -2
- package/lib/types/pxde/DefaultDataEnrichment.d.ts +2 -2
- package/lib/types/pxhd/PXHDUtils.d.ts +2 -2
- package/lib/types/risk_api/client/GetRiskApiClientV2.d.ts +2 -2
- package/lib/types/risk_api/client/PostRiskApiClientV2.d.ts +3 -3
- package/lib/types/risk_api/client/PostRiskApiClientV3.d.ts +3 -3
- package/lib/types/risk_api/client/abstract/PostRiskApiClientBase.d.ts +2 -1
- package/lib/types/risk_api/client/abstract/RiskApiClientBase.d.ts +3 -3
- package/lib/types/risk_api/utils.d.ts +2 -2
- package/lib/types/risk_token/parser/DefaultTokenV2Parser.d.ts +4 -4
- package/lib/types/risk_token/parser/DefaultTokenV3Parser.d.ts +4 -4
- package/lib/types/risk_token/parser/TokenParserBase.d.ts +5 -5
- package/lib/types/risk_token/token/TokenBase.d.ts +3 -3
- package/lib/types/risk_token/token/serialize/SerializedToken.d.ts +2 -2
- package/lib/types/risk_token/token/v2/DefaultTokenV2.d.ts +2 -2
- package/lib/types/risk_token/token/v3/DefaultTokenV3.d.ts +2 -2
- package/lib/types/sensitive_request/SensitiveRequestUtils.d.ts +2 -2
- package/lib/types/snippet_injection/CustomSnippetFunction.d.ts +1 -1
- package/lib/types/snippet_injection/snippet_retriever/DefaultSnippetRetriever.d.ts +3 -3
- package/lib/types/telemetry/DefaultTelemetry.d.ts +5 -5
- package/lib/types/telemetry/model/TelemetryActivity.d.ts +9 -9
- package/lib/types/utils/constants.d.ts +1 -1
- package/lib/types/utils/timestamp_hmac_header_validator/DefaultTimestampHmacHeaderValidator.d.ts +3 -3
- package/package.json +1 -1
|
@@ -21,7 +21,7 @@ export type DefaultContextOptions = {
|
|
|
21
21
|
* The default implementation of the request context which uses the incoming HTTP request and enforcer configuration
|
|
22
22
|
* to populate the context with relevant data.
|
|
23
23
|
*/
|
|
24
|
-
export declare class DefaultContext<Req, Res,
|
|
24
|
+
export declare class DefaultContext<Req, Res, Supported extends string, Added> implements IContext<Req, Res> {
|
|
25
25
|
readonly requestId: string;
|
|
26
26
|
readonly tokenOrigin: TokenOrigin;
|
|
27
27
|
readonly remoteConfigUpdateData: RemoteConfigUpdateData;
|
|
@@ -49,19 +49,19 @@ export declare class DefaultContext<Req, Res, Added, Removed> implements IContex
|
|
|
49
49
|
usedCookieSecret?: string;
|
|
50
50
|
shouldSendTelemetry: boolean;
|
|
51
51
|
protected _shouldSendLogs: boolean;
|
|
52
|
-
protected readonly config: IConfiguration<Req, Res,
|
|
52
|
+
protected readonly config: IConfiguration<Req, Res, Supported, Added>;
|
|
53
53
|
protected readonly urlUtils: IUrlUtils;
|
|
54
|
-
constructor(config: IConfiguration<Req, Res,
|
|
54
|
+
constructor(config: IConfiguration<Req, Res, Supported, Added>, request: IIncomingRequest<Req>, options: DefaultContextOptions);
|
|
55
55
|
get shouldSendLogs(): boolean;
|
|
56
56
|
set shouldSendLogs(shouldSendLogs: boolean);
|
|
57
57
|
get isMobile(): boolean;
|
|
58
|
-
protected createContextLogger(config: IConfiguration<Req, Res,
|
|
59
|
-
protected createRequestData(config: IConfiguration<Req, Res,
|
|
58
|
+
protected createContextLogger(config: IConfiguration<Req, Res, Supported, Added>, shouldSaveLogs: boolean): ILogger;
|
|
59
|
+
protected createRequestData(config: IConfiguration<Req, Res, Supported, Added>, request: IIncomingRequest<Req>, cookieParser?: ICookieParser): RequestData<Req>;
|
|
60
60
|
protected normalizeUrl(rawUrl: string): IUrl;
|
|
61
|
-
protected extractUserAgentFromHeader(config: IConfiguration<Req, Res,
|
|
62
|
-
protected extractIpFromHeader(config: IConfiguration<Req, Res,
|
|
61
|
+
protected extractUserAgentFromHeader(config: IConfiguration<Req, Res, Supported, Added>, headers: ReadonlyHeaders): string;
|
|
62
|
+
protected extractIpFromHeader(config: IConfiguration<Req, Res, Supported, Added>, headers: ReadonlyHeaders): string | null;
|
|
63
63
|
protected getTokenOrigin(request: IIncomingRequest<Req>): TokenOrigin;
|
|
64
64
|
protected setCookiesOnContext(): void;
|
|
65
|
-
protected isHeaderBasedLoggerRequest(config: IConfiguration<Req, Res,
|
|
65
|
+
protected isHeaderBasedLoggerRequest(config: IConfiguration<Req, Res, Supported, Added>, request: IIncomingRequest<Req>): boolean;
|
|
66
66
|
toJSON(): ContextJson<Req, Res>;
|
|
67
67
|
}
|
|
@@ -17,7 +17,7 @@ import { ContextJson } from './ContextJson';
|
|
|
17
17
|
* incoming request, but rather uses already-extracted data from the `ContextJson` (likely returned from the `DefaultContext.toJSON()`
|
|
18
18
|
* function) and fills in the gaps using the other parameters.
|
|
19
19
|
*/
|
|
20
|
-
export declare class SerializedContext<Req, Res,
|
|
20
|
+
export declare class SerializedContext<Req, Res, Supported extends string, Added> implements IContext<Req, Res> {
|
|
21
21
|
readonly isMobile: boolean;
|
|
22
22
|
readonly remoteConfigUpdateData: RemoteConfigUpdateData;
|
|
23
23
|
readonly logger: ILogger;
|
|
@@ -44,9 +44,9 @@ export declare class SerializedContext<Req, Res, Added, Removed> implements ICon
|
|
|
44
44
|
tokenOrigin: TokenOrigin;
|
|
45
45
|
uuid?: string;
|
|
46
46
|
shouldSendTelemetry: boolean;
|
|
47
|
-
constructor(config: IConfiguration<Req, Res,
|
|
47
|
+
constructor(config: IConfiguration<Req, Res, Supported, Added>, contextJson: ContextJson<Req, Res>, request: IIncomingRequest<Req>, urlUtils: IUrlUtils);
|
|
48
48
|
protected createRequestData({ requestData }: ContextJson<Req, Res>, request: IIncomingRequest<Req>, urlUtils: IUrlUtils): RequestData<Req>;
|
|
49
|
-
protected createTokenData({ tokenData }: ContextJson<Req, Res>, config: IConfiguration<Req, Res,
|
|
49
|
+
protected createTokenData({ tokenData }: ContextJson<Req, Res>, config: IConfiguration<Req, Res, Supported, Added>): TokenData<Req, Res>;
|
|
50
50
|
protected createRiskApiData({ riskApiData }: ContextJson<Req, Res>): RiskApiData;
|
|
51
|
-
protected createLogger(config: IConfiguration<Req, Res,
|
|
51
|
+
protected createLogger(config: IConfiguration<Req, Res, Supported, Added>, shouldSendLogs: boolean, logs?: LogRecord[]): ILogger;
|
|
52
52
|
}
|
|
@@ -2,11 +2,11 @@ import { ICors } from './ICors';
|
|
|
2
2
|
import { IConfiguration } from '../config';
|
|
3
3
|
import { ReadonlyContext } from '../context';
|
|
4
4
|
import { ReadonlyHeaders, IMinimalResponse } from '../http';
|
|
5
|
-
export declare class DefaultCors<Req, Res,
|
|
5
|
+
export declare class DefaultCors<Req, Res, Supported extends string, Added> implements ICors<Req, Res> {
|
|
6
6
|
private readonly customBlockResponseHeaders;
|
|
7
7
|
private readonly customPreflightHandler;
|
|
8
8
|
private readonly logger;
|
|
9
|
-
constructor(config: IConfiguration<Req, Res,
|
|
9
|
+
constructor(config: IConfiguration<Req, Res, Supported, Added>);
|
|
10
10
|
isPreflightRequest(context: ReadonlyContext<Req, Res>): boolean;
|
|
11
11
|
runPreflightCustomHandler(context: ReadonlyContext<Req, Res>): Promise<IMinimalResponse | null>;
|
|
12
12
|
isCorsRequest(context: ReadonlyContext<Req, Res>): boolean;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { CustomParameters, ResponseCustomParameters } from './CustomParameters';
|
|
2
2
|
import { ActiveConfigurationParams } from '../config';
|
|
3
|
-
export type CustomParametersFunction<Req, Res,
|
|
4
|
-
export type ResponseCustomParametersFunction<Req, Res,
|
|
3
|
+
export type CustomParametersFunction<Req, Res, Supported extends string, Added> = (config: ActiveConfigurationParams<Req, Res, Supported, Added>, request: Req) => CustomParameters | Promise<CustomParameters>;
|
|
4
|
+
export type ResponseCustomParametersFunction<Req, Res, Supported extends string, Added> = (config: ActiveConfigurationParams<Req, Res, Supported, Added>, response: Res) => ResponseCustomParameters | Promise<ResponseCustomParameters>;
|
|
@@ -2,8 +2,8 @@ import { IConfiguration } from '../config';
|
|
|
2
2
|
import { ReadonlyContext } from '../context';
|
|
3
3
|
import { CustomParameters, ResponseCustomParameters } from './CustomParameters';
|
|
4
4
|
export declare namespace CustomParametersUtils {
|
|
5
|
-
const createCustomParameters: <Req, Res,
|
|
6
|
-
const createResponseCustomParameters: <Req, Res,
|
|
5
|
+
const createCustomParameters: <Req, Res, Supported extends string, Added>(config: IConfiguration<Req, Res, Supported, Added>, context: ReadonlyContext<Req, Res>) => Promise<CustomParameters | null>;
|
|
6
|
+
const createResponseCustomParameters: <Req, Res, Supported extends string, Added>(config: IConfiguration<Req, Res, Supported, Added>, context: ReadonlyContext<Req, Res>) => Promise<ResponseCustomParameters | null>;
|
|
7
7
|
const normalizeCustomParams: (customParameters: Record<string, any>) => CustomParameters | null;
|
|
8
8
|
const normalizeResponseCustomParams: (customParameters: Record<string, any>) => ResponseCustomParameters | null;
|
|
9
9
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { AsyncOrSync } from 'ts-essentials';
|
|
2
|
-
import { IConfiguration, IRemoteConfigManager } from '../config';
|
|
2
|
+
import { IConfiguration, IRemoteConfigManager, CoreConfigurationParamsKeys } from '../config';
|
|
3
3
|
import { IContext } from '../context';
|
|
4
4
|
import { IMinimalResponse, IOutgoingResponse } from '../http';
|
|
5
5
|
import { IFlow } from '../flow';
|
|
@@ -10,8 +10,8 @@ import { IPostEnforcer } from './IPostEnforcer';
|
|
|
10
10
|
/**
|
|
11
11
|
* The base class for fundamental enforcer logic.
|
|
12
12
|
*/
|
|
13
|
-
export declare abstract class EnforcerBase<Req, Res, EnforceArgs extends any[], PostEnforceArgs extends any[],
|
|
14
|
-
protected readonly config: IConfiguration<Req, Res,
|
|
13
|
+
export declare abstract class EnforcerBase<Req, Res, EnforceArgs extends any[], PostEnforceArgs extends any[], Supported extends CoreConfigurationParamsKeys, Added> implements IEnforcer<EnforceArgs, Promise<Res | null>>, IPostEnforcer<PostEnforceArgs, Promise<void>> {
|
|
14
|
+
protected readonly config: IConfiguration<Req, Res, Supported, Added>;
|
|
15
15
|
protected readonly filterFlow: IFlow<Req, Res>;
|
|
16
16
|
protected readonly enforceFlow: IFlow<Req, Res>;
|
|
17
17
|
protected readonly postEnforceFlow: IFlow<Req, Res> | null;
|
|
@@ -61,7 +61,7 @@ export declare abstract class EnforcerBase<Req, Res, EnforceArgs extends any[],
|
|
|
61
61
|
* @param options - An EnforcerOptions object that allows for overriding any functional building blocks in the enforcer.
|
|
62
62
|
* @protected
|
|
63
63
|
*/
|
|
64
|
-
protected constructor(config: IConfiguration<Req, Res,
|
|
64
|
+
protected constructor(config: IConfiguration<Req, Res, Supported, Added>, options: EnforcerOptions<Req, Res, Supported, Added>);
|
|
65
65
|
/**
|
|
66
66
|
* Creates the filter flow for the enforcer. The filter flow is responsible for filtering out requests that should not undergo the usual enforcement flow.
|
|
67
67
|
* For example, first party, filtered, CORS preflight, and telemetry requests are filtered out.
|
|
@@ -70,7 +70,7 @@ export declare abstract class EnforcerBase<Req, Res, EnforceArgs extends any[],
|
|
|
70
70
|
* @protected
|
|
71
71
|
* @returns - The filter flow for the enforcer.
|
|
72
72
|
*/
|
|
73
|
-
protected createFilterFlow(config: IConfiguration<Req, Res,
|
|
73
|
+
protected createFilterFlow(config: IConfiguration<Req, Res, Supported, Added>, initializationBlock: Required<EnforcerOptions<Req, Res, Supported, Added>>): IFlow<Req, Res>;
|
|
74
74
|
/**
|
|
75
75
|
* Creates the post enforce flow for the enforcer. The post enforce flow is responsible for any logic that requires the origin response in the case of passed requests.
|
|
76
76
|
* For example, enriching the context with response data (status, login successful information) and modifying the origin response (snippet injection, PXHD) are part of the post enforce flow.
|
|
@@ -79,7 +79,7 @@ export declare abstract class EnforcerBase<Req, Res, EnforceArgs extends any[],
|
|
|
79
79
|
* @protected
|
|
80
80
|
* @returns - The post enforce flow for the enforcer or null if post enforce is not enabled.
|
|
81
81
|
*/
|
|
82
|
-
protected createPostEnforceFlow(config: IConfiguration<Req, Res,
|
|
82
|
+
protected createPostEnforceFlow(config: IConfiguration<Req, Res, Supported, Added>, initializationBlock: Required<EnforcerOptions<Req, Res, Supported, Added>>): IFlow<Req, Res> | null;
|
|
83
83
|
/**
|
|
84
84
|
* Creates the enforce flow for the enforcer. The enforce flow is responsible for the core functionality of HUMAN enforcement.
|
|
85
85
|
* For example, parsing HUMAN cookies, performing Risk API, invoking the additional activity handler, and returning a block response are part of the enforce flow.
|
|
@@ -88,7 +88,7 @@ export declare abstract class EnforcerBase<Req, Res, EnforceArgs extends any[],
|
|
|
88
88
|
* @protected
|
|
89
89
|
* @returns - The enforce flow for the enforcer.
|
|
90
90
|
*/
|
|
91
|
-
protected createEnforceFlow(config: IConfiguration<Req, Res,
|
|
91
|
+
protected createEnforceFlow(config: IConfiguration<Req, Res, Supported, Added>, initializationBlock: Required<EnforcerOptions<Req, Res, Supported, Added>>): IFlow<Req, Res>;
|
|
92
92
|
/**
|
|
93
93
|
* Creates the end enforce flow for the enforcer. The end enforce flow is responsible for all actions that must be done after every incoming request.
|
|
94
94
|
* For example, sending the async activities, sending the telemetry activity, or updating the remote config, sending and clearing the enforcer logs, are parts of the end enforce flow.
|
|
@@ -97,7 +97,7 @@ export declare abstract class EnforcerBase<Req, Res, EnforceArgs extends any[],
|
|
|
97
97
|
* @protected
|
|
98
98
|
* @returns - The end enforce flow for the enforcer.
|
|
99
99
|
*/
|
|
100
|
-
protected createEndEnforcerFlow(config: IConfiguration<Req, Res,
|
|
100
|
+
protected createEndEnforcerFlow(config: IConfiguration<Req, Res, Supported, Added>, initializationBlock: Required<EnforcerOptions<Req, Res, Supported, Added>>): IFlow<Req, Res>;
|
|
101
101
|
/**
|
|
102
102
|
* The central function that triggers enforcement on the incoming request.
|
|
103
103
|
* @param args - The EnforceArgs required to enforce the incoming request.
|
|
@@ -11,7 +11,7 @@ import { IGraphQLParser } from '../graphql';
|
|
|
11
11
|
import { ILogServiceClient } from '../logger';
|
|
12
12
|
import { IRemoteConfigStorageClient, IRemoteConfigServiceClient, IRemoteConfigManager, IRemoteConfigUpdateParser } from '../config';
|
|
13
13
|
import { ISnippetInjector, ISnippetRetriever } from '../snippet_injection';
|
|
14
|
-
export type EnforcerOptions<Req, Res,
|
|
14
|
+
export type EnforcerOptions<Req, Res, Supported extends string, Added> = {
|
|
15
15
|
httpClient: IHttpClient;
|
|
16
16
|
base64Utils: IBase64Utils;
|
|
17
17
|
hmacUtils: IHmacUtils;
|
|
@@ -30,8 +30,8 @@ export type EnforcerOptions<Req, Res, Added, Removed> = {
|
|
|
30
30
|
logServiceClient?: ILogServiceClient<Req, Res> | null;
|
|
31
31
|
remoteConfigManager?: IRemoteConfigManager<Req, Res> | null;
|
|
32
32
|
remoteConfigUpdateParser?: IRemoteConfigUpdateParser<Req, Res> | null;
|
|
33
|
-
remoteConfigStorageClient?: IRemoteConfigStorageClient<Req, Res,
|
|
34
|
-
remoteConfigServiceClient?: IRemoteConfigServiceClient<Req, Res,
|
|
33
|
+
remoteConfigStorageClient?: IRemoteConfigStorageClient<Req, Res, Supported, Added> | null;
|
|
34
|
+
remoteConfigServiceClient?: IRemoteConfigServiceClient<Req, Res, Supported, Added> | null;
|
|
35
35
|
snippetRetriever?: ISnippetRetriever<Req, Res> | null;
|
|
36
36
|
snippetInjector?: ISnippetInjector<Res> | null;
|
|
37
37
|
};
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { IConfiguration, IRemoteConfigManager, IRemoteConfigServiceClient, IRemoteConfigStorageClient, IRemoteConfigUpdateParser } from '../config';
|
|
1
|
+
import { IConfiguration, IRemoteConfigManager, IRemoteConfigServiceClient, IRemoteConfigStorageClient, IRemoteConfigUpdateParser, CoreConfigurationParamsKeys } from '../config';
|
|
2
2
|
import { EnforcerOptions } from './EnforcerOptions';
|
|
3
3
|
import { Products } from '../products';
|
|
4
4
|
import { IBase64Utils, IHashUtils, IIpRangeChecker, IUrlUtils } from '../utils';
|
|
5
|
-
export declare const createEnforcerInitializationBlock: <Req, Res,
|
|
6
|
-
export declare const createEnforcerProducts: <Req, Res,
|
|
7
|
-
export declare const createRemoteConfigClients: <Req, Res,
|
|
8
|
-
remoteConfigServiceClient: IRemoteConfigServiceClient<Req, Res,
|
|
5
|
+
export declare const createEnforcerInitializationBlock: <Req, Res, Supported extends CoreConfigurationParamsKeys, Added>(config: IConfiguration<Req, Res, Supported, Added>, options: EnforcerOptions<Req, Res, Supported, Added>) => Required<EnforcerOptions<Req, Res, Supported, Added>>;
|
|
6
|
+
export declare const createEnforcerProducts: <Req, Res, Supported extends string, Added>(config: IConfiguration<Req, Res, Supported, Added>, products: Products<Req, Res> | undefined, base64Utils: IBase64Utils, hashUtils: IHashUtils, urlUtils: IUrlUtils, ipRangeChecker: IIpRangeChecker) => Products<Req, Res>;
|
|
7
|
+
export declare const createRemoteConfigClients: <Req, Res, Supported extends string, Added>(config: IConfiguration<Req, Res, Supported, Added>, options: EnforcerOptions<Req, Res, Supported, Added>) => {
|
|
8
|
+
remoteConfigServiceClient: IRemoteConfigServiceClient<Req, Res, Supported, Added> | null;
|
|
9
9
|
remoteConfigManager: IRemoteConfigManager<Req, Res> | null;
|
|
10
10
|
remoteConfigUpdateParser: IRemoteConfigUpdateParser<Req, Res> | null;
|
|
11
|
-
remoteConfigStorageClient: IRemoteConfigStorageClient<Req, Res,
|
|
11
|
+
remoteConfigStorageClient: IRemoteConfigStorageClient<Req, Res, Supported, Added> | null;
|
|
12
12
|
};
|
|
@@ -2,7 +2,7 @@ import { IConfiguration } from '../config';
|
|
|
2
2
|
import { EnforcerOptions } from '../enforcer';
|
|
3
3
|
import { Flow } from './Flow';
|
|
4
4
|
type RequiredEndEnforcerFlowOptions = 'activityClient' | 'logServiceClient' | 'telemetry' | 'remoteConfigManager';
|
|
5
|
-
export declare class EndEnforcerFlow<Req, Res,
|
|
6
|
-
constructor(config: IConfiguration<Req, Res,
|
|
5
|
+
export declare class EndEnforcerFlow<Req, Res, Supported extends string, Added> extends Flow<Req, Res> {
|
|
6
|
+
constructor(config: IConfiguration<Req, Res, Supported, Added>, { logServiceClient, telemetry, remoteConfigManager, activityClient, }: Pick<Required<EnforcerOptions<Req, Res, Supported, Added>>, RequiredEndEnforcerFlowOptions>);
|
|
7
7
|
}
|
|
8
8
|
export {};
|
|
@@ -2,7 +2,7 @@ import { IConfiguration } from '../config';
|
|
|
2
2
|
import { EnforcerOptions } from '../enforcer';
|
|
3
3
|
import { Flow } from './Flow';
|
|
4
4
|
type RequiredEnforceFlowOptions = 'dataEnrichment' | 'tokenParser' | 'riskApiClient' | 'cors' | 'products' | 'graphQLParser';
|
|
5
|
-
export declare class EnforceFlow<Req, Res,
|
|
6
|
-
constructor(config: IConfiguration<Req, Res,
|
|
5
|
+
export declare class EnforceFlow<Req, Res, Supported extends string, Added> extends Flow<Req, Res> {
|
|
6
|
+
constructor(config: IConfiguration<Req, Res, Supported, Added>, { dataEnrichment, tokenParser, riskApiClient, cors, products, graphQLParser, }: Pick<Required<EnforcerOptions<Req, Res, Supported, Added>>, RequiredEnforceFlowOptions>);
|
|
7
7
|
}
|
|
8
8
|
export {};
|
|
@@ -4,8 +4,8 @@ import { Products } from '../products';
|
|
|
4
4
|
import { IFirstParty } from '../first_party';
|
|
5
5
|
import { IFilter } from '../filter';
|
|
6
6
|
import { Flow } from './Flow';
|
|
7
|
-
export declare class FilterFlow<Req, Res,
|
|
8
|
-
constructor(config: IConfiguration<Req, Res,
|
|
7
|
+
export declare class FilterFlow<Req, Res, Supported extends string, Added> extends Flow<Req, Res> {
|
|
8
|
+
constructor(config: IConfiguration<Req, Res, Supported, Added>, { httpClient, products, cors, telemetry, remoteConfigUpdateParser, }: Required<EnforcerOptions<Req, Res, Supported, Added>>);
|
|
9
9
|
protected static getFirstPartyProducts<Req, Res>(products: Products<Req, Res>): IFirstParty<Req, Res>[];
|
|
10
10
|
protected static getFilterProducts<Req, Res>(products: Products<Req, Res>): IFilter<Req, Res>[];
|
|
11
11
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { IConfiguration } from '../config';
|
|
2
2
|
import { EnforcerOptions } from '../enforcer';
|
|
3
3
|
import { Flow } from './Flow';
|
|
4
|
-
export declare class PostEnforceFlow<Req, Res,
|
|
5
|
-
constructor(config: IConfiguration<Req, Res,
|
|
4
|
+
export declare class PostEnforceFlow<Req, Res, Supported extends string, Added> extends Flow<Req, Res> {
|
|
5
|
+
constructor(config: IConfiguration<Req, Res, Supported, Added>, { products, snippetRetriever, snippetInjector, }: Pick<Required<EnforcerOptions<Req, Res, Supported, Added>>, 'products' | 'snippetRetriever' | 'snippetInjector'>);
|
|
6
6
|
}
|
|
@@ -4,11 +4,11 @@ import { IIncomingRequest } from '../http';
|
|
|
4
4
|
import { IGraphQLParser } from './IGraphQLParser';
|
|
5
5
|
import { GraphQLData, GraphQLOperation, GraphQLOperationType } from './model';
|
|
6
6
|
import { ExtractGraphQLKeywordsFunction } from './ExtractGraphQLKeywordsFunction';
|
|
7
|
-
export declare class DefaultGraphQLParser<Req, Res,
|
|
8
|
-
protected readonly config: IConfiguration<Req, Res,
|
|
7
|
+
export declare class DefaultGraphQLParser<Req, Res, Supported extends string, Added> implements IGraphQLParser<Req, Res> {
|
|
8
|
+
protected readonly config: IConfiguration<Req, Res, Supported, Added>;
|
|
9
9
|
protected readonly maxCharactersInGraphqlKeyword: number;
|
|
10
10
|
protected readonly maxGraphqlKeywordCount: number;
|
|
11
|
-
constructor(config: IConfiguration<Req, Res,
|
|
11
|
+
constructor(config: IConfiguration<Req, Res, Supported, Added>);
|
|
12
12
|
isGraphQLRequest({ requestData }: ReadonlyContext<Req, Res>): boolean;
|
|
13
13
|
parseGraphQLRequest(context: ReadonlyContext<Req, Res>): Promise<GraphQLData[] | null>;
|
|
14
14
|
protected getGraphQLOperationsFromBody(request: IIncomingRequest<Req>, context: ReadonlyContext<Req, Res>): Promise<Array<GraphQLOperation> | null>;
|
|
@@ -3,10 +3,10 @@ import { ReadonlyContext } from '../context';
|
|
|
3
3
|
import { IConfiguration } from '../config';
|
|
4
4
|
import { IHttpClient } from '../http';
|
|
5
5
|
import { ILogServiceClient } from './ILogServiceClient';
|
|
6
|
-
export declare class HttpLogServiceClient<Req, Res,
|
|
7
|
-
protected readonly config: IConfiguration<Req, Res,
|
|
6
|
+
export declare class HttpLogServiceClient<Req, Res, Supported extends string, Added> implements ILogServiceClient<Req, Res> {
|
|
7
|
+
protected readonly config: IConfiguration<Req, Res, Supported, Added>;
|
|
8
8
|
protected readonly httpClient: IHttpClient;
|
|
9
|
-
constructor(config: IConfiguration<Req, Res,
|
|
9
|
+
constructor(config: IConfiguration<Req, Res, Supported, Added>, httpClient: IHttpClient);
|
|
10
10
|
sendLogs(context: ReadonlyContext<Req, Res>): Promise<void>;
|
|
11
11
|
protected getLogMetadata(context: ReadonlyContext<Req, Res>): LogMetadata;
|
|
12
12
|
protected enrichLogRecord(log: LogRecord, logMetadata: LogMetadata): EnrichedLogRecord;
|
|
@@ -3,10 +3,10 @@ import { ReadonlyContext } from '../context';
|
|
|
3
3
|
import { IIncomingRequest } from '../http';
|
|
4
4
|
import { IUrl } from '../utils';
|
|
5
5
|
export declare namespace MonitoredRequestUtils {
|
|
6
|
-
const isMonitoredRequest: <Req, Res,
|
|
6
|
+
const isMonitoredRequest: <Req, Res, Supported extends string, Added>(config: IConfiguration<Req, Res, Supported, Added>, context: ReadonlyContext<Req, Res>) => Promise<boolean>;
|
|
7
7
|
const isMonitoredRoute: (url: IUrl, isMonitoredRoute: Array<string | RegExp>) => boolean;
|
|
8
8
|
const isEnforcedRoute: (url: IUrl, enforcedRoutes: Array<string | RegExp>) => boolean;
|
|
9
|
-
const invokeCustomIsEnforcedRequest: <Req, Res,
|
|
10
|
-
const invokeCustomIsMonitoredRequest: <Req, Res,
|
|
9
|
+
const invokeCustomIsEnforcedRequest: <Req, Res, Supported extends string, Added>(config: IConfiguration<Req, Res, Supported, Added>, context: ReadonlyContext<Req, Res>) => Promise<boolean>;
|
|
10
|
+
const invokeCustomIsMonitoredRequest: <Req, Res, Supported extends string, Added>(config: IConfiguration<Req, Res, Supported, Added>, context: ReadonlyContext<Req, Res>) => Promise<boolean>;
|
|
11
11
|
const isAllowedToBypassMonitor: <Req>(bypassMonitorHeader: string, request: IIncomingRequest<Req>) => boolean;
|
|
12
12
|
}
|
|
@@ -5,8 +5,8 @@ import { PhaseResult } from '../PhaseResult';
|
|
|
5
5
|
/**
|
|
6
6
|
* The `AdditionalActivityHandlerPhase` invokes the additional activity handler defined in the configuration.
|
|
7
7
|
*/
|
|
8
|
-
export declare class AdditionalActivityHandlerPhase<Req, Res,
|
|
9
|
-
protected config: IConfiguration<Req, Res,
|
|
10
|
-
constructor(config: IConfiguration<Req, Res,
|
|
8
|
+
export declare class AdditionalActivityHandlerPhase<Req, Res, Supported extends string, Added> implements IPhase<Req, Res> {
|
|
9
|
+
protected config: IConfiguration<Req, Res, Supported, Added>;
|
|
10
|
+
constructor(config: IConfiguration<Req, Res, Supported, Added>);
|
|
11
11
|
execute(context: IContext<Req, Res>): Promise<PhaseResult>;
|
|
12
12
|
}
|
|
@@ -10,11 +10,11 @@ import { PhaseResult } from '../PhaseResult';
|
|
|
10
10
|
* `CreateBlockResponsePhase` is a phase that creates a block response for the product that recommended a block action.
|
|
11
11
|
* If multiple products recommended block, it will return the block response for the highest priority product.
|
|
12
12
|
*/
|
|
13
|
-
export declare class CreateBlockResponsePhase<Req, Res,
|
|
14
|
-
protected readonly config: IConfiguration<Req, Res,
|
|
13
|
+
export declare class CreateBlockResponsePhase<Req, Res, Supported extends string, Added> implements IPhase<Req, Res> {
|
|
14
|
+
protected readonly config: IConfiguration<Req, Res, Supported, Added>;
|
|
15
15
|
protected readonly blockers: Partial<Record<ProductName, IConditionalBlocker<Req, Res>>>;
|
|
16
16
|
protected readonly cors?: ICors<Req, Res>;
|
|
17
|
-
constructor(config: IConfiguration<Req, Res,
|
|
17
|
+
constructor(config: IConfiguration<Req, Res, Supported, Added>, blockers: Partial<Record<ProductName, IConditionalBlocker<Req, Res>>>, cors?: ICors<Req, Res>);
|
|
18
18
|
/**
|
|
19
19
|
* A static method that identifies those products that can block incoming requests and returns a map of the product name to the product instance.
|
|
20
20
|
* @param products - All supported products.
|
|
@@ -14,12 +14,12 @@ import { DecideActionPhase } from './DecideActionPhase';
|
|
|
14
14
|
*
|
|
15
15
|
* Note: This phase should come after the `ParseTokenPhase`, since the Bot Defender product uses the parsed token to determine its recommended action.
|
|
16
16
|
*/
|
|
17
|
-
export declare class EnrichContextFromRequestPhase<Req, Res,
|
|
18
|
-
protected readonly config: IConfiguration<Req, Res,
|
|
17
|
+
export declare class EnrichContextFromRequestPhase<Req, Res, Supported extends string, Added> extends DecideActionPhase<Req, Res> {
|
|
18
|
+
protected readonly config: IConfiguration<Req, Res, Supported, Added>;
|
|
19
19
|
protected readonly products: Products<Req, Res>;
|
|
20
20
|
protected readonly dataEnrichment: IDataEnrichment<Req, Res>;
|
|
21
21
|
protected readonly graphQLParser: IGraphQLParser<Req, Res>;
|
|
22
|
-
constructor(config: IConfiguration<Req, Res,
|
|
22
|
+
constructor(config: IConfiguration<Req, Res, Supported, Added>, products: Products<Req, Res>, dataEnrichment: IDataEnrichment<Req, Res>, graphQLParser: IGraphQLParser<Req, Res>);
|
|
23
23
|
execute(context: IContext<Req, Res>): Promise<PhaseResult>;
|
|
24
24
|
protected addPxdeToContext(context: IContext<Req, Res>): Promise<void>;
|
|
25
25
|
protected addGraphQLDataToContext(context: IContext<Req, Res>): Promise<void>;
|
|
@@ -7,10 +7,10 @@ import { IConfiguration } from '../../config';
|
|
|
7
7
|
* `EnrichContextFromResponsePhase` enriches the context with response data. Each product's `enrichContextFromResponse`
|
|
8
8
|
* method is called since every product may use the response data differently.
|
|
9
9
|
*/
|
|
10
|
-
export declare class EnrichContextFromResponsePhase<Req, Res,
|
|
11
|
-
protected readonly config: IConfiguration<Req, Res,
|
|
10
|
+
export declare class EnrichContextFromResponsePhase<Req, Res, Supported extends string, Added> implements IPhase<Req, Res> {
|
|
11
|
+
protected readonly config: IConfiguration<Req, Res, Supported, Added>;
|
|
12
12
|
protected readonly products: Products<Req, Res>;
|
|
13
|
-
constructor(config: IConfiguration<Req, Res,
|
|
13
|
+
constructor(config: IConfiguration<Req, Res, Supported, Added>, products: Products<Req, Res>);
|
|
14
14
|
execute(context: IContext<Req, Res>): Promise<PhaseResult>;
|
|
15
15
|
protected addProductDataToContext(context: IContext<Req, Res>): Promise<void>;
|
|
16
16
|
protected addResponseCustomParametersToContext(context: IContext<Req, Res>): Promise<void>;
|
|
@@ -9,11 +9,11 @@ import { IConfiguration } from '../../config';
|
|
|
9
9
|
* it will create the `FirstPartyData`, send the request to the configured endpoint using the provided HTTP client, and return
|
|
10
10
|
* a done status with the response. If an error occurs, it will return the default response.
|
|
11
11
|
*/
|
|
12
|
-
export declare class FirstPartyPhase<Req, Res,
|
|
13
|
-
protected readonly config: IConfiguration<Req, Res,
|
|
12
|
+
export declare class FirstPartyPhase<Req, Res, Supported extends string, Added> implements IPhase<Req, Res> {
|
|
13
|
+
protected readonly config: IConfiguration<Req, Res, Supported, Added>;
|
|
14
14
|
protected readonly httpClient: IHttpClient;
|
|
15
15
|
protected readonly firstParties: IFirstParty<Req, Res>[];
|
|
16
|
-
constructor(config: IConfiguration<Req, Res,
|
|
16
|
+
constructor(config: IConfiguration<Req, Res, Supported, Added>, httpClient: IHttpClient, firstParties: IFirstParty<Req, Res>[]);
|
|
17
17
|
execute(context: IContext<Req, Res>): Promise<PhaseResult>;
|
|
18
18
|
protected sendFirstPartyRequest({ request, defaultResponse }: FirstPartyData, context: IContext<Req, Res>): Promise<IMinimalResponse>;
|
|
19
19
|
}
|
|
@@ -9,12 +9,12 @@ import { ISnippetInjector, ISnippetRetriever } from '../../snippet_injection';
|
|
|
9
9
|
* to the end user. This phase invokes each product's `modifyOutgoingResponse` method, as well as adding the PXHD cookie.
|
|
10
10
|
* If snippet injection is supported and enabled, it also occurs in this phase.
|
|
11
11
|
*/
|
|
12
|
-
export declare class ModifyOutgoingResponsePhase<Req, Res,
|
|
13
|
-
protected readonly config: IConfiguration<Req, Res,
|
|
12
|
+
export declare class ModifyOutgoingResponsePhase<Req, Res, Supported extends string, Added> implements IPhase<Req, Res> {
|
|
13
|
+
protected readonly config: IConfiguration<Req, Res, Supported, Added>;
|
|
14
14
|
protected readonly products: IProduct<any, Req, Res>[];
|
|
15
15
|
protected readonly snippetRetriever?: ISnippetRetriever<Req, Res> | null;
|
|
16
16
|
protected readonly snippetInjector?: ISnippetInjector<Res> | null;
|
|
17
|
-
constructor(config: IConfiguration<Req, Res,
|
|
17
|
+
constructor(config: IConfiguration<Req, Res, Supported, Added>, products: IProduct<any, Req, Res>[], snippetRetriever?: ISnippetRetriever<Req, Res> | null, snippetInjector?: ISnippetInjector<Res> | null);
|
|
18
18
|
execute(context: IContext<Req, Res>): Promise<PhaseResult>;
|
|
19
19
|
protected handleSnippetInjection(context: IContext<Req, Res>): Promise<void>;
|
|
20
20
|
}
|
|
@@ -7,10 +7,10 @@ import { IConfiguration } from '../../config';
|
|
|
7
7
|
* The `PreflightPhase` class is responsible for handling preflight requests in CORS (Cross-Origin Resource Sharing).
|
|
8
8
|
* This includes filtering preflight requests or invoking the preflight custom handler if configured.
|
|
9
9
|
*/
|
|
10
|
-
export declare class PreflightPhase<Req, Res,
|
|
10
|
+
export declare class PreflightPhase<Req, Res, Supported extends string, Added> implements IPhase<Req, Res> {
|
|
11
11
|
protected readonly corsSupportEnabled: boolean;
|
|
12
12
|
protected readonly filterPreflightRequestsEnabled: boolean;
|
|
13
13
|
protected readonly cors: ICors<Req, Res>;
|
|
14
|
-
constructor(config: IConfiguration<Req, Res,
|
|
14
|
+
constructor(config: IConfiguration<Req, Res, Supported, Added>, cors: ICors<Req, Res>);
|
|
15
15
|
execute(context: IContext<Req, Res>): Promise<PhaseResult>;
|
|
16
16
|
}
|
|
@@ -6,9 +6,9 @@ import { IPhase } from '../IPhase';
|
|
|
6
6
|
/**
|
|
7
7
|
* The `SendAsyncActivitiesPhase` class is responsible for sending all necessary asynchronous activities based on the context.
|
|
8
8
|
*/
|
|
9
|
-
export declare class SendAsyncActivitiesPhase<Req, Res,
|
|
10
|
-
protected readonly config: IConfiguration<Req, Res,
|
|
9
|
+
export declare class SendAsyncActivitiesPhase<Req, Res, Supported extends string, Added> implements IPhase<Req, Res> {
|
|
10
|
+
protected readonly config: IConfiguration<Req, Res, Supported, Added>;
|
|
11
11
|
protected readonly activityClient: IActivityClient<Req, Res>;
|
|
12
|
-
constructor(config: IConfiguration<Req, Res,
|
|
12
|
+
constructor(config: IConfiguration<Req, Res, Supported, Added>, activityClient: IActivityClient<Req, Res>);
|
|
13
13
|
execute(context: IContext<Req, Res>): Promise<PhaseResult>;
|
|
14
14
|
}
|
|
@@ -6,9 +6,9 @@ import { ILogServiceClient } from '../../logger';
|
|
|
6
6
|
/**
|
|
7
7
|
* The `SendLogsPhase` class is responsible for sending logs to the HUMAN logging service.
|
|
8
8
|
*/
|
|
9
|
-
export declare class SendLogsPhase<Req, Res,
|
|
9
|
+
export declare class SendLogsPhase<Req, Res, Supported extends string, Added> implements IPhase<Req, Res> {
|
|
10
10
|
private readonly config;
|
|
11
11
|
private readonly logServiceClient;
|
|
12
|
-
constructor(config: IConfiguration<Req, Res,
|
|
12
|
+
constructor(config: IConfiguration<Req, Res, Supported, Added>, logServiceClient: ILogServiceClient<Req, Res>);
|
|
13
13
|
execute(context: IContext<Req, Res>): Promise<PhaseResult>;
|
|
14
14
|
}
|
|
@@ -6,10 +6,10 @@ import { IConfiguration } from '../../config';
|
|
|
6
6
|
/**
|
|
7
7
|
* The `SendTelemetryActivityPhase` class is responsible for sending the telemetry activity if necessary.
|
|
8
8
|
*/
|
|
9
|
-
export declare class SendTelemetryActivityPhase<Req, Res,
|
|
10
|
-
protected readonly config: IConfiguration<Req, Res,
|
|
9
|
+
export declare class SendTelemetryActivityPhase<Req, Res, Supported extends string, Added> implements IPhase<Req, Res> {
|
|
10
|
+
protected readonly config: IConfiguration<Req, Res, Supported, Added>;
|
|
11
11
|
protected readonly telemetry: ITelemetry<Req, Res>;
|
|
12
|
-
constructor(config: IConfiguration<Req, Res,
|
|
12
|
+
constructor(config: IConfiguration<Req, Res, Supported, Added>, telemetry: ITelemetry<Req, Res>);
|
|
13
13
|
execute(context: IContext<Req, Res>): Promise<PhaseResult>;
|
|
14
14
|
protected sendTelemetry(context: IContext<Req, Res>): Promise<void>;
|
|
15
15
|
}
|
|
@@ -5,9 +5,9 @@ import { PhaseResult } from '../PhaseResult';
|
|
|
5
5
|
/**
|
|
6
6
|
* The `UpdateRemoteConfigPhase` class is responsible for updating the remote configuration if necessary.
|
|
7
7
|
*/
|
|
8
|
-
export declare class UpdateRemoteConfigPhase<Req, Res,
|
|
9
|
-
protected readonly config: IConfiguration<Req, Res,
|
|
8
|
+
export declare class UpdateRemoteConfigPhase<Req, Res, Supported extends string, Added> implements IPhase<Req, Res> {
|
|
9
|
+
protected readonly config: IConfiguration<Req, Res, Supported, Added>;
|
|
10
10
|
protected readonly remoteConfigManager: IRemoteConfigManager<Req, Res>;
|
|
11
|
-
constructor(config: IConfiguration<Req, Res,
|
|
11
|
+
constructor(config: IConfiguration<Req, Res, Supported, Added>, remoteConfigManager: IRemoteConfigManager<Req, Res>);
|
|
12
12
|
execute(context: IContext<Req, Res>): Promise<PhaseResult>;
|
|
13
13
|
}
|
|
@@ -7,10 +7,10 @@ import { JwtData } from './JwtData';
|
|
|
7
7
|
export type AccountDefenderOptions = {
|
|
8
8
|
base64Utils: IBase64Utils;
|
|
9
9
|
};
|
|
10
|
-
export declare class AccountDefender<Req, Res,
|
|
11
|
-
protected readonly config: IConfiguration<Req, Res,
|
|
10
|
+
export declare class AccountDefender<Req, Res, Supported extends string, Added> implements IAccountDefender<Req, Res> {
|
|
11
|
+
protected readonly config: IConfiguration<Req, Res, Supported, Added>;
|
|
12
12
|
protected readonly base64Utils: IBase64Utils;
|
|
13
|
-
constructor(config: IConfiguration<Req, Res,
|
|
13
|
+
constructor(config: IConfiguration<Req, Res, Supported, Added>, options: AccountDefenderOptions);
|
|
14
14
|
enrichContextFromRequest(context: ReadonlyContext<Req, Res>): Promise<AccountDefenderData>;
|
|
15
15
|
enrichContextFromRiskApi(_context: ReadonlyContext<Req, Res>): Promise<AccountDefenderData | null>;
|
|
16
16
|
enrichContextFromResponse(_context: ReadonlyContext<Req, Res>): Promise<AccountDefenderData | null>;
|
|
@@ -28,12 +28,12 @@ export type BotDefenderOptions<Req, Res> = {
|
|
|
28
28
|
firstParty: IFirstParty<Req, Res>;
|
|
29
29
|
urlUtils?: never;
|
|
30
30
|
});
|
|
31
|
-
export declare class BotDefender<Req, Res,
|
|
32
|
-
protected readonly config: IConfiguration<Req, Res,
|
|
31
|
+
export declare class BotDefender<Req, Res, Supported extends string, Added> implements IBotDefender<Req, Res> {
|
|
32
|
+
protected readonly config: IConfiguration<Req, Res, Supported, Added>;
|
|
33
33
|
protected readonly firstParty: IFirstParty<Req, Res>;
|
|
34
34
|
protected readonly filter: IFilter<Req, Res>;
|
|
35
35
|
protected readonly blocker: IConditionalBlocker<Req, Res>;
|
|
36
|
-
constructor(config: IConfiguration<Req, Res,
|
|
36
|
+
constructor(config: IConfiguration<Req, Res, Supported, Added>, options: BotDefenderOptions<Req, Res>);
|
|
37
37
|
handleFirstPartyRequest(context: ReadonlyContext<Req, Res>): Promise<FirstPartyData | null>;
|
|
38
38
|
shouldFilter(context: ReadonlyContext<Req, Res>): Promise<boolean>;
|
|
39
39
|
enrichContextFromRequest(context: ReadonlyContext<Req, Res>): Promise<BotDefenderData>;
|
|
@@ -8,10 +8,10 @@ export type DefaultBotDefenderBlockerConstructorOptions<Req, Res> = {
|
|
|
8
8
|
} | {
|
|
9
9
|
captchaBlocker: IBlocker<Req, Res>;
|
|
10
10
|
};
|
|
11
|
-
export declare class DefaultBotDefenderBlocker<Req, Res,
|
|
12
|
-
protected readonly config: IConfiguration<Req, Res,
|
|
11
|
+
export declare class DefaultBotDefenderBlocker<Req, Res, Supported extends string, Added> implements IConditionalBlocker<Req, Res> {
|
|
12
|
+
protected readonly config: IConfiguration<Req, Res, Supported, Added>;
|
|
13
13
|
protected readonly captchaBlocker: IBlocker<Req, Res>;
|
|
14
|
-
constructor(config: IConfiguration<Req, Res,
|
|
14
|
+
constructor(config: IConfiguration<Req, Res, Supported, Added>, options: DefaultBotDefenderBlockerConstructorOptions<Req, Res>);
|
|
15
15
|
shouldBlock({ action, reasons }: ReadonlyContext<Req, Res>): boolean;
|
|
16
16
|
createBlockResponse(context: ReadonlyContext<Req, Res>): IMinimalResponse;
|
|
17
17
|
protected createRateLimitResponse(): IMinimalResponse;
|
|
@@ -5,24 +5,24 @@ import { IMinimalResponse } from '../../../../http';
|
|
|
5
5
|
import { JsonCaptchaBlockerConstructorOptions } from './JsonCaptchaBlocker';
|
|
6
6
|
import { MobileCaptchaBlockerConstructorOptions } from './MobileCaptchaBlocker';
|
|
7
7
|
import { HtmlCaptchaBlockerConstructorOptions } from './HtmlCaptchaBlocker';
|
|
8
|
-
type JsonBlockerOptions<Req, Res,
|
|
8
|
+
type JsonBlockerOptions<Req, Res, Supported extends string, Added> = {
|
|
9
9
|
jsonCaptchaBlocker: IConditionalBlocker<Req, Res>;
|
|
10
|
-
} | JsonCaptchaBlockerConstructorOptions<Req, Res,
|
|
11
|
-
type MobileCaptchaBlockerOptions<Req, Res,
|
|
10
|
+
} | JsonCaptchaBlockerConstructorOptions<Req, Res, Supported, Added>;
|
|
11
|
+
type MobileCaptchaBlockerOptions<Req, Res, Supported extends string, Added> = {
|
|
12
12
|
mobileCaptchaBlocker: IConditionalBlocker<Req, Res>;
|
|
13
|
-
} | MobileCaptchaBlockerConstructorOptions<Req, Res,
|
|
14
|
-
type HtmlCaptchaBlockerOptions<Req, Res,
|
|
13
|
+
} | MobileCaptchaBlockerConstructorOptions<Req, Res, Supported, Added>;
|
|
14
|
+
type HtmlCaptchaBlockerOptions<Req, Res, Supported extends string, Added> = {
|
|
15
15
|
htmlCaptchaBlocker: IBlocker<Req, Res>;
|
|
16
|
-
} | HtmlCaptchaBlockerConstructorOptions<Req, Res,
|
|
17
|
-
export type CaptchaBlockerConstructorOptions<Req, Res,
|
|
18
|
-
config: IConfiguration<Req, Res,
|
|
19
|
-
} & JsonBlockerOptions<Req, Res,
|
|
20
|
-
export declare class CaptchaBlocker<Req, Res,
|
|
21
|
-
protected readonly config: IConfiguration<Req, Res,
|
|
16
|
+
} | HtmlCaptchaBlockerConstructorOptions<Req, Res, Supported, Added>;
|
|
17
|
+
export type CaptchaBlockerConstructorOptions<Req, Res, Supported extends string, Added> = {
|
|
18
|
+
config: IConfiguration<Req, Res, Supported, Added>;
|
|
19
|
+
} & JsonBlockerOptions<Req, Res, Supported, Added> & MobileCaptchaBlockerOptions<Req, Res, Supported, Added> & HtmlCaptchaBlockerOptions<Req, Res, Supported, Added>;
|
|
20
|
+
export declare class CaptchaBlocker<Req, Res, Supported extends string, Added> implements IBlocker<Req, Res> {
|
|
21
|
+
protected readonly config: IConfiguration<Req, Res, Supported, Added>;
|
|
22
22
|
protected readonly jsonCaptchaBlocker: IConditionalBlocker<Req, Res>;
|
|
23
23
|
protected readonly mobileCaptchaBlocker: IConditionalBlocker<Req, Res>;
|
|
24
24
|
protected readonly htmlCaptchaBlocker: IBlocker<Req, Res>;
|
|
25
|
-
constructor(options: CaptchaBlockerConstructorOptions<Req, Res,
|
|
25
|
+
constructor(options: CaptchaBlockerConstructorOptions<Req, Res, Supported, Added>);
|
|
26
26
|
createBlockResponse(context: ReadonlyContext<Req, Res>): IMinimalResponse;
|
|
27
27
|
}
|
|
28
28
|
export {};
|
|
@@ -2,15 +2,15 @@ import { IConfiguration } from '../../../../config';
|
|
|
2
2
|
import { ReadonlyContext } from '../../../../context';
|
|
3
3
|
import { IBase64Utils } from '../../../../utils';
|
|
4
4
|
import { BlockerBase } from '../../../../blocker';
|
|
5
|
-
export type HtmlCaptchaBlockerConstructorOptions<Req, Res,
|
|
6
|
-
config: IConfiguration<Req, Res,
|
|
5
|
+
export type HtmlCaptchaBlockerConstructorOptions<Req, Res, Supported extends string, Added> = {
|
|
6
|
+
config: IConfiguration<Req, Res, Supported, Added>;
|
|
7
7
|
base64Utils: IBase64Utils;
|
|
8
8
|
captchaTemplate?: string;
|
|
9
9
|
};
|
|
10
|
-
export declare class HtmlCaptchaBlocker<Req, Res,
|
|
11
|
-
protected readonly config: IConfiguration<Req, Res,
|
|
10
|
+
export declare class HtmlCaptchaBlocker<Req, Res, Supported extends string, Added> extends BlockerBase<Req, Res> {
|
|
11
|
+
protected readonly config: IConfiguration<Req, Res, Supported, Added>;
|
|
12
12
|
protected readonly base64Utils: IBase64Utils;
|
|
13
13
|
protected readonly captchaTemplate: string;
|
|
14
|
-
constructor(options: HtmlCaptchaBlockerConstructorOptions<Req, Res,
|
|
14
|
+
constructor(options: HtmlCaptchaBlockerConstructorOptions<Req, Res, Supported, Added>);
|
|
15
15
|
protected createBlockBody(context: ReadonlyContext<Req, Res>): string;
|
|
16
16
|
}
|