perimeterx-js-core 0.32.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/context/DefaultContext.js +1 -0
- package/lib/cjs/flow/EnforceFlow.js +1 -2
- package/lib/cjs/phase/impl/index.js +0 -1
- package/lib/cjs/products/utils/ProductName.js +0 -1
- package/lib/cjs/products/utils/ProductPriorityOrder.js +0 -1
- package/lib/cjs/utils/constants.js +2 -5
- package/lib/esm/context/DefaultContext.js +2 -1
- package/lib/esm/flow/EnforceFlow.js +2 -3
- package/lib/esm/phase/impl/index.js +0 -1
- package/lib/esm/products/utils/ProductName.js +0 -1
- package/lib/esm/products/utils/ProductPriorityOrder.js +0 -1
- package/lib/esm/utils/constants.js +1 -4
- package/lib/types/flow/EnforceFlow.d.ts +2 -2
- package/lib/types/phase/impl/index.d.ts +0 -1
- package/lib/types/products/utils/ProductName.d.ts +0 -1
- package/lib/types/utils/constants.d.ts +1 -4
- package/package.json +1 -1
- package/lib/cjs/phase/impl/BlockByHeaderPhase.js +0 -76
- package/lib/esm/phase/impl/BlockByHeaderPhase.js +0 -72
- package/lib/types/phase/impl/BlockByHeaderPhase.d.ts +0 -40
|
@@ -150,6 +150,7 @@ var DefaultContext = /** @class */ (function () {
|
|
|
150
150
|
var vidValue = this.requestData.cookies[utils_1.PXVID_COOKIE_NAME];
|
|
151
151
|
if ((0, utils_1.isValidUuid)(vidValue)) {
|
|
152
152
|
this.vid = vidValue;
|
|
153
|
+
this.vidSource = utils_1.VidSource.VID_COOKIE;
|
|
153
154
|
}
|
|
154
155
|
var pxhdCookie = this.requestData.cookies[utils_1.PXHD_COOKIE_NAME];
|
|
155
156
|
if (pxhdCookie) {
|
|
@@ -21,9 +21,8 @@ var Flow_1 = require("./Flow.js");
|
|
|
21
21
|
var EnforceFlow = /** @class */ (function (_super) {
|
|
22
22
|
__extends(EnforceFlow, _super);
|
|
23
23
|
function EnforceFlow(config, _a) {
|
|
24
|
-
var dataEnrichment = _a.dataEnrichment, tokenParser = _a.tokenParser, riskApiClient = _a.riskApiClient, cors = _a.cors, products = _a.products, graphQLParser = _a.graphQLParser
|
|
24
|
+
var dataEnrichment = _a.dataEnrichment, tokenParser = _a.tokenParser, riskApiClient = _a.riskApiClient, cors = _a.cors, products = _a.products, graphQLParser = _a.graphQLParser;
|
|
25
25
|
return _super.call(this, [
|
|
26
|
-
new phase_1.BlockByHeaderPhase(config, base64Utils),
|
|
27
26
|
new phase_1.ParseTokenPhase(tokenParser),
|
|
28
27
|
new phase_1.EnrichContextFromRequestPhase(config, products, dataEnrichment, graphQLParser),
|
|
29
28
|
new phase_1.RiskApiPhase(products, riskApiClient),
|
|
@@ -14,7 +14,6 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./BlockByHeaderPhase.js"), exports);
|
|
18
17
|
__exportStar(require("./FirstPartyPhase.js"), exports);
|
|
19
18
|
__exportStar(require("./FilterPhase.js"), exports);
|
|
20
19
|
__exportStar(require("./PreflightPhase.js"), exports);
|
|
@@ -3,7 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.ProductName = void 0;
|
|
4
4
|
var ProductName;
|
|
5
5
|
(function (ProductName) {
|
|
6
|
-
ProductName["BLOCK_BY_HEADER"] = "block_by_header";
|
|
7
6
|
ProductName["BOT_DEFENDER"] = "bd";
|
|
8
7
|
ProductName["ACCOUNT_DEFENDER"] = "ad";
|
|
9
8
|
ProductName["CODE_DEFENDER"] = "cd";
|
|
@@ -3,7 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.PRODUCT_PRIORITY_ORDER = void 0;
|
|
4
4
|
var ProductName_1 = require("./ProductName.js");
|
|
5
5
|
exports.PRODUCT_PRIORITY_ORDER = [
|
|
6
|
-
ProductName_1.ProductName.BLOCK_BY_HEADER,
|
|
7
6
|
ProductName_1.ProductName.HYPE_SALE_CHALLENGE,
|
|
8
7
|
ProductName_1.ProductName.BOT_DEFENDER,
|
|
9
8
|
ProductName_1.ProductName.ACCOUNT_DEFENDER,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.CORE_MODULE_VERSION = exports.REGEX_STRUCTURE = exports.URL_REGEX = exports.EMAIL_ADDRESS_REGEX = exports.PUSH_DATA_FEATURE_HEADER_NAME = exports.PUSH_DATA_HMAC_HEADER_NAME = exports.X_PX_BYPASS_REASON_HEADER_NAME = exports.X_PX_ORIGINAL_TOKEN_HEADER_NAME = exports.X_PX_AUTHORIZATION_HEADER_NAME = exports.UNLIMITED_TIMEOUT = exports.BYPASS_MONITOR_HEADER_VALUE = exports.CD_PXVID_COOKIE_NAME = exports.PXDE_COOKIE_NAME = exports.PXHD_COOKIE_NAME = exports.PXVID_COOKIE_NAME = void 0;
|
|
4
4
|
exports.PXVID_COOKIE_NAME = '_pxvid';
|
|
5
5
|
exports.PXHD_COOKIE_NAME = '_pxhd';
|
|
6
6
|
exports.PXDE_COOKIE_NAME = '_pxde';
|
|
@@ -15,7 +15,4 @@ exports.PUSH_DATA_FEATURE_HEADER_NAME = 'x-px-feature';
|
|
|
15
15
|
exports.EMAIL_ADDRESS_REGEX = /^[a-zA-Z0-9_+&*-]+(?:\.[a-zA-Z0-9_+&*-]+)*@(?:[a-zA-Z0-9-]+\.)+[a-zA-Z]{2,7}$/;
|
|
16
16
|
exports.URL_REGEX = /^(https?:)\/\/(([^@\s:\/]+):?([^@\s\/]*)@)?(([^:\/?#]*)(?:\:([0-9]+))?)(\/?[^?#]*)(\?[^#]*|)(#.*|)$/;
|
|
17
17
|
exports.REGEX_STRUCTURE = /^\/(.+?)\/([gimsuyvd]*)$/;
|
|
18
|
-
exports.CORE_MODULE_VERSION = 'JS Core 0.32.
|
|
19
|
-
exports.BLOCK_BY_HEADER_NAME = 'x-px-block-by-header';
|
|
20
|
-
exports.BLOCK_BY_HEADER_REASON = 'block_by_header';
|
|
21
|
-
exports.BLOCK_BY_HEADER_TRUTHY_VALUES = ['1'];
|
|
18
|
+
exports.CORE_MODULE_VERSION = 'JS Core 0.32.1';
|
|
@@ -3,7 +3,7 @@ import { PXHDSource } from '../pxhd/index.js';
|
|
|
3
3
|
import { TokenOrigin, TokenParseResult } from '../risk_token/index.js';
|
|
4
4
|
import { RiskApiCallResult } from '../risk_api/index.js';
|
|
5
5
|
import { COOKIE_HEADER_NAME, toReadonlyHeaders, USER_AGENT_HEADER_NAME, } from '../http/index.js';
|
|
6
|
-
import { isValidUuid, PXHD_COOKIE_NAME, PXVID_COOKIE_NAME, StringSplitCookieParser, X_PX_AUTHORIZATION_HEADER_NAME, } from '../utils/index.js';
|
|
6
|
+
import { isValidUuid, PXHD_COOKIE_NAME, PXVID_COOKIE_NAME, StringSplitCookieParser, VidSource, X_PX_AUTHORIZATION_HEADER_NAME, } from '../utils/index.js';
|
|
7
7
|
import { Action } from '../action/index.js';
|
|
8
8
|
import { DefaultLogger, X_PX_ENFORCER_LOG_HEADER } from '../logger/index.js';
|
|
9
9
|
/**
|
|
@@ -152,6 +152,7 @@ export class DefaultContext {
|
|
|
152
152
|
const vidValue = this.requestData.cookies[PXVID_COOKIE_NAME];
|
|
153
153
|
if (isValidUuid(vidValue)) {
|
|
154
154
|
this.vid = vidValue;
|
|
155
|
+
this.vidSource = VidSource.VID_COOKIE;
|
|
155
156
|
}
|
|
156
157
|
const pxhdCookie = this.requestData.cookies[PXHD_COOKIE_NAME];
|
|
157
158
|
if (pxhdCookie) {
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import { AdditionalActivityHandlerPhase,
|
|
1
|
+
import { AdditionalActivityHandlerPhase, CreateBlockResponsePhase, EnrichContextFromRequestPhase, ModifyIncomingRequestPhase, ParseTokenPhase, RiskApiPhase, } from '../phase/index.js';
|
|
2
2
|
import { Flow } from './Flow.js';
|
|
3
3
|
export class EnforceFlow extends Flow {
|
|
4
|
-
constructor(config, { dataEnrichment, tokenParser, riskApiClient, cors, products, graphQLParser,
|
|
4
|
+
constructor(config, { dataEnrichment, tokenParser, riskApiClient, cors, products, graphQLParser, }) {
|
|
5
5
|
super([
|
|
6
|
-
new BlockByHeaderPhase(config, base64Utils),
|
|
7
6
|
new ParseTokenPhase(tokenParser),
|
|
8
7
|
new EnrichContextFromRequestPhase(config, products, dataEnrichment, graphQLParser),
|
|
9
8
|
new RiskApiPhase(products, riskApiClient),
|
|
@@ -12,7 +12,4 @@ export const PUSH_DATA_FEATURE_HEADER_NAME = 'x-px-feature';
|
|
|
12
12
|
export const EMAIL_ADDRESS_REGEX = /^[a-zA-Z0-9_+&*-]+(?:\.[a-zA-Z0-9_+&*-]+)*@(?:[a-zA-Z0-9-]+\.)+[a-zA-Z]{2,7}$/;
|
|
13
13
|
export const URL_REGEX = /^(https?:)\/\/(([^@\s:\/]+):?([^@\s\/]*)@)?(([^:\/?#]*)(?:\:([0-9]+))?)(\/?[^?#]*)(\?[^#]*|)(#.*|)$/;
|
|
14
14
|
export const REGEX_STRUCTURE = /^\/(.+?)\/([gimsuyvd]*)$/;
|
|
15
|
-
export const CORE_MODULE_VERSION = 'JS Core 0.32.
|
|
16
|
-
export const BLOCK_BY_HEADER_NAME = 'x-px-block-by-header';
|
|
17
|
-
export const BLOCK_BY_HEADER_REASON = 'block_by_header';
|
|
18
|
-
export const BLOCK_BY_HEADER_TRUTHY_VALUES = ['1'];
|
|
15
|
+
export const CORE_MODULE_VERSION = 'JS Core 0.32.1';
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { IConfiguration } from '../config';
|
|
2
2
|
import { EnforcerOptions } from '../enforcer';
|
|
3
3
|
import { Flow } from './Flow';
|
|
4
|
-
type RequiredEnforceFlowOptions = 'dataEnrichment' | 'tokenParser' | 'riskApiClient' | 'cors' | 'products' | 'graphQLParser'
|
|
4
|
+
type RequiredEnforceFlowOptions = 'dataEnrichment' | 'tokenParser' | 'riskApiClient' | 'cors' | 'products' | 'graphQLParser';
|
|
5
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,
|
|
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 {};
|
|
@@ -12,7 +12,4 @@ export declare const PUSH_DATA_FEATURE_HEADER_NAME = "x-px-feature";
|
|
|
12
12
|
export declare const EMAIL_ADDRESS_REGEX: RegExp;
|
|
13
13
|
export declare const URL_REGEX: RegExp;
|
|
14
14
|
export declare const REGEX_STRUCTURE: RegExp;
|
|
15
|
-
export declare const CORE_MODULE_VERSION = "JS Core 0.32.
|
|
16
|
-
export declare const BLOCK_BY_HEADER_NAME = "x-px-block-by-header";
|
|
17
|
-
export declare const BLOCK_BY_HEADER_REASON = "block_by_header";
|
|
18
|
-
export declare const BLOCK_BY_HEADER_TRUTHY_VALUES: string[];
|
|
15
|
+
export declare const CORE_MODULE_VERSION = "JS Core 0.32.1";
|
package/package.json
CHANGED
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.BlockByHeaderPhase = void 0;
|
|
4
|
-
var action_1 = require("../../action/index.js");
|
|
5
|
-
var blocker_1 = require("../../blocker/index.js");
|
|
6
|
-
var products_1 = require("../../products/index.js");
|
|
7
|
-
var captcha_1 = require("../../products/bot_defender/block/captcha/index.js");
|
|
8
|
-
var templates_1 = require("../../products/bot_defender/block/templates/index.js");
|
|
9
|
-
var utils_1 = require("../../utils/index.js");
|
|
10
|
-
/**
|
|
11
|
-
* `BlockByHeaderPhase` checks for the presence of the x-px-block-by-header header.
|
|
12
|
-
* If the header is present with a truthy value ("1", "true", "TRUE"), the request is immediately
|
|
13
|
-
* blocked with a captcha response and the flow is terminated. This feature overrides all other
|
|
14
|
-
* enforcer logic including monitor mode and whitelisting.
|
|
15
|
-
*/
|
|
16
|
-
var BlockByHeaderPhase = /** @class */ (function () {
|
|
17
|
-
function BlockByHeaderPhase(config, base64Utils) {
|
|
18
|
-
this.config = config;
|
|
19
|
-
this.base64Utils = base64Utils;
|
|
20
|
-
}
|
|
21
|
-
BlockByHeaderPhase.prototype.execute = function (context) {
|
|
22
|
-
var headerValue = this.getBlockByHeaderValue(context);
|
|
23
|
-
if (headerValue && this.isTruthyValue(headerValue)) {
|
|
24
|
-
context.logger.debug('block by header detected - creating immediate block response');
|
|
25
|
-
// Set context for proper activity reporting
|
|
26
|
-
this.setBlockingContext(context);
|
|
27
|
-
// Create and return block response immediately
|
|
28
|
-
var blockResponse = this.createBlockResponse(context);
|
|
29
|
-
return { done: true, response: blockResponse };
|
|
30
|
-
}
|
|
31
|
-
return { done: false };
|
|
32
|
-
};
|
|
33
|
-
/**
|
|
34
|
-
* Creates a captcha block response for the block-by-header feature.
|
|
35
|
-
* @param context - The request context.
|
|
36
|
-
* @returns The block response.
|
|
37
|
-
*/
|
|
38
|
-
BlockByHeaderPhase.prototype.createBlockResponse = function (context) {
|
|
39
|
-
// Use the existing CaptchaBlocker to generate a proper captcha page
|
|
40
|
-
var captchaBlocker = new captcha_1.CaptchaBlocker({
|
|
41
|
-
config: this.config,
|
|
42
|
-
base64Utils: this.base64Utils,
|
|
43
|
-
captchaTemplate: templates_1.CAPTCHA_TEMPLATE,
|
|
44
|
-
});
|
|
45
|
-
return captchaBlocker.createBlockResponse(context);
|
|
46
|
-
};
|
|
47
|
-
/**
|
|
48
|
-
* Gets the value of the x-px-block-by-header header from the request.
|
|
49
|
-
* @param context - The request context.
|
|
50
|
-
* @returns The header value or null if not present.
|
|
51
|
-
*/
|
|
52
|
-
BlockByHeaderPhase.prototype.getBlockByHeaderValue = function (context) {
|
|
53
|
-
return context.requestData.request.headers.get(utils_1.BLOCK_BY_HEADER_NAME) || null;
|
|
54
|
-
};
|
|
55
|
-
/**
|
|
56
|
-
* Checks if the header value is considered truthy for blocking.
|
|
57
|
-
* @param value - The header value to check.
|
|
58
|
-
* @returns True if the value should trigger blocking.
|
|
59
|
-
*/
|
|
60
|
-
BlockByHeaderPhase.prototype.isTruthyValue = function (value) {
|
|
61
|
-
return utils_1.BLOCK_BY_HEADER_TRUTHY_VALUES.includes(value);
|
|
62
|
-
};
|
|
63
|
-
/**
|
|
64
|
-
* Sets the context properties needed for proper activity reporting.
|
|
65
|
-
* @param context - The request context to modify.
|
|
66
|
-
*/
|
|
67
|
-
BlockByHeaderPhase.prototype.setBlockingContext = function (context) {
|
|
68
|
-
var _a;
|
|
69
|
-
context.action = action_1.Action.BLOCK;
|
|
70
|
-
context.reasons = (_a = {}, _a[products_1.ProductName.BLOCK_BY_HEADER] = utils_1.BLOCK_BY_HEADER_REASON, _a);
|
|
71
|
-
context.score = 100; // Maximum risk score
|
|
72
|
-
context.blockAction = blocker_1.BlockAction.CAPTCHA;
|
|
73
|
-
};
|
|
74
|
-
return BlockByHeaderPhase;
|
|
75
|
-
}());
|
|
76
|
-
exports.BlockByHeaderPhase = BlockByHeaderPhase;
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
import { Action } from '../../action/index.js';
|
|
2
|
-
import { BlockAction } from '../../blocker/index.js';
|
|
3
|
-
import { ProductName } from '../../products/index.js';
|
|
4
|
-
import { CaptchaBlocker } from '../../products/bot_defender/block/captcha/index.js';
|
|
5
|
-
import { CAPTCHA_TEMPLATE } from '../../products/bot_defender/block/templates/index.js';
|
|
6
|
-
import { BLOCK_BY_HEADER_NAME, BLOCK_BY_HEADER_REASON, BLOCK_BY_HEADER_TRUTHY_VALUES } from '../../utils/index.js';
|
|
7
|
-
/**
|
|
8
|
-
* `BlockByHeaderPhase` checks for the presence of the x-px-block-by-header header.
|
|
9
|
-
* If the header is present with a truthy value ("1", "true", "TRUE"), the request is immediately
|
|
10
|
-
* blocked with a captcha response and the flow is terminated. This feature overrides all other
|
|
11
|
-
* enforcer logic including monitor mode and whitelisting.
|
|
12
|
-
*/
|
|
13
|
-
export class BlockByHeaderPhase {
|
|
14
|
-
config;
|
|
15
|
-
base64Utils;
|
|
16
|
-
constructor(config, base64Utils) {
|
|
17
|
-
this.config = config;
|
|
18
|
-
this.base64Utils = base64Utils;
|
|
19
|
-
}
|
|
20
|
-
execute(context) {
|
|
21
|
-
const headerValue = this.getBlockByHeaderValue(context);
|
|
22
|
-
if (headerValue && this.isTruthyValue(headerValue)) {
|
|
23
|
-
context.logger.debug('block by header detected - creating immediate block response');
|
|
24
|
-
// Set context for proper activity reporting
|
|
25
|
-
this.setBlockingContext(context);
|
|
26
|
-
// Create and return block response immediately
|
|
27
|
-
const blockResponse = this.createBlockResponse(context);
|
|
28
|
-
return { done: true, response: blockResponse };
|
|
29
|
-
}
|
|
30
|
-
return { done: false };
|
|
31
|
-
}
|
|
32
|
-
/**
|
|
33
|
-
* Creates a captcha block response for the block-by-header feature.
|
|
34
|
-
* @param context - The request context.
|
|
35
|
-
* @returns The block response.
|
|
36
|
-
*/
|
|
37
|
-
createBlockResponse(context) {
|
|
38
|
-
// Use the existing CaptchaBlocker to generate a proper captcha page
|
|
39
|
-
const captchaBlocker = new CaptchaBlocker({
|
|
40
|
-
config: this.config,
|
|
41
|
-
base64Utils: this.base64Utils,
|
|
42
|
-
captchaTemplate: CAPTCHA_TEMPLATE,
|
|
43
|
-
});
|
|
44
|
-
return captchaBlocker.createBlockResponse(context);
|
|
45
|
-
}
|
|
46
|
-
/**
|
|
47
|
-
* Gets the value of the x-px-block-by-header header from the request.
|
|
48
|
-
* @param context - The request context.
|
|
49
|
-
* @returns The header value or null if not present.
|
|
50
|
-
*/
|
|
51
|
-
getBlockByHeaderValue(context) {
|
|
52
|
-
return context.requestData.request.headers.get(BLOCK_BY_HEADER_NAME) || null;
|
|
53
|
-
}
|
|
54
|
-
/**
|
|
55
|
-
* Checks if the header value is considered truthy for blocking.
|
|
56
|
-
* @param value - The header value to check.
|
|
57
|
-
* @returns True if the value should trigger blocking.
|
|
58
|
-
*/
|
|
59
|
-
isTruthyValue(value) {
|
|
60
|
-
return BLOCK_BY_HEADER_TRUTHY_VALUES.includes(value);
|
|
61
|
-
}
|
|
62
|
-
/**
|
|
63
|
-
* Sets the context properties needed for proper activity reporting.
|
|
64
|
-
* @param context - The request context to modify.
|
|
65
|
-
*/
|
|
66
|
-
setBlockingContext(context) {
|
|
67
|
-
context.action = Action.BLOCK;
|
|
68
|
-
context.reasons = { [ProductName.BLOCK_BY_HEADER]: BLOCK_BY_HEADER_REASON };
|
|
69
|
-
context.score = 100; // Maximum risk score
|
|
70
|
-
context.blockAction = BlockAction.CAPTCHA;
|
|
71
|
-
}
|
|
72
|
-
}
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { IContext } from '../../context';
|
|
2
|
-
import { IPhase } from '../IPhase';
|
|
3
|
-
import { PhaseResult } from '../PhaseResult';
|
|
4
|
-
import { IConfiguration } from '../../config';
|
|
5
|
-
import { IBase64Utils } from '../../utils';
|
|
6
|
-
/**
|
|
7
|
-
* `BlockByHeaderPhase` checks for the presence of the x-px-block-by-header header.
|
|
8
|
-
* If the header is present with a truthy value ("1", "true", "TRUE"), the request is immediately
|
|
9
|
-
* blocked with a captcha response and the flow is terminated. This feature overrides all other
|
|
10
|
-
* enforcer logic including monitor mode and whitelisting.
|
|
11
|
-
*/
|
|
12
|
-
export declare class BlockByHeaderPhase<Req, Res, Supported extends string, Added> implements IPhase<Req, Res> {
|
|
13
|
-
protected readonly config: IConfiguration<Req, Res, Supported, Added>;
|
|
14
|
-
protected readonly base64Utils: IBase64Utils;
|
|
15
|
-
constructor(config: IConfiguration<Req, Res, Supported, Added>, base64Utils: IBase64Utils);
|
|
16
|
-
execute(context: IContext<Req, Res>): PhaseResult;
|
|
17
|
-
/**
|
|
18
|
-
* Creates a captcha block response for the block-by-header feature.
|
|
19
|
-
* @param context - The request context.
|
|
20
|
-
* @returns The block response.
|
|
21
|
-
*/
|
|
22
|
-
private createBlockResponse;
|
|
23
|
-
/**
|
|
24
|
-
* Gets the value of the x-px-block-by-header header from the request.
|
|
25
|
-
* @param context - The request context.
|
|
26
|
-
* @returns The header value or null if not present.
|
|
27
|
-
*/
|
|
28
|
-
private getBlockByHeaderValue;
|
|
29
|
-
/**
|
|
30
|
-
* Checks if the header value is considered truthy for blocking.
|
|
31
|
-
* @param value - The header value to check.
|
|
32
|
-
* @returns True if the value should trigger blocking.
|
|
33
|
-
*/
|
|
34
|
-
private isTruthyValue;
|
|
35
|
-
/**
|
|
36
|
-
* Sets the context properties needed for proper activity reporting.
|
|
37
|
-
* @param context - The request context to modify.
|
|
38
|
-
*/
|
|
39
|
-
private setBlockingContext;
|
|
40
|
-
}
|