perimeterx-js-core 0.21.3 → 0.21.4
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/blocker/utils.js +5 -2
- package/lib/cjs/config/ConfigurationBase.js +7 -0
- package/lib/cjs/utils/constants.js +1 -1
- package/lib/esm/blocker/utils.js +5 -2
- package/lib/esm/config/ConfigurationBase.js +3 -0
- package/lib/esm/utils/constants.js +1 -1
- package/lib/types/config/ConfigurationBase.d.ts +1 -0
- package/lib/types/config/IConfiguration.d.ts +4 -0
- package/lib/types/utils/constants.d.ts +1 -1
- package/package.json +1 -1
package/lib/cjs/blocker/utils.js
CHANGED
|
@@ -17,9 +17,12 @@ var renderHtml = function (htmlTemplate, blockData) {
|
|
|
17
17
|
exports.renderHtml = renderHtml;
|
|
18
18
|
var createBlockData = function (config, context, base64Utils) {
|
|
19
19
|
var captchaScriptSuffix = '/captcha.js';
|
|
20
|
-
var b64EncodedUrl =
|
|
20
|
+
var b64EncodedUrl = config.enableBlockedUrlOnCaptchaBlockPage
|
|
21
|
+
? base64Utils.base64Encode(context.requestData.rawUrl)
|
|
22
|
+
: '';
|
|
23
|
+
var bParam = b64EncodedUrl && "&b=".concat(b64EncodedUrl);
|
|
21
24
|
var b64HttpMethod = base64Utils.base64Encode(context.requestData.method);
|
|
22
|
-
var captchaParams = "?a=".concat(context.blockAction, "&u=").concat(context.uuid, "&v=").concat(context.vid || '', "&m=").concat(context.isMobile ? '1' : '0'
|
|
25
|
+
var captchaParams = "?a=".concat(context.blockAction, "&u=").concat(context.uuid, "&v=").concat(context.vid || '', "&m=").concat(context.isMobile ? '1' : '0').concat(bParam, "&h=").concat(b64HttpMethod);
|
|
23
26
|
var jsClientSrc = "".concat(config.backendClientUrl, "/").concat(config.appId, "/main.min.js");
|
|
24
27
|
var blockScript = "".concat(config.backendCaptchaUrl, "/").concat(config.appId).concat(captchaScriptSuffix).concat(captchaParams);
|
|
25
28
|
var hostUrl = config.backendCollectorUrl;
|
|
@@ -695,6 +695,13 @@ var ConfigurationBase = /** @class */ (function () {
|
|
|
695
695
|
enumerable: false,
|
|
696
696
|
configurable: true
|
|
697
697
|
});
|
|
698
|
+
Object.defineProperty(ConfigurationBase.prototype, "enableBlockedUrlOnCaptchaBlockPage", {
|
|
699
|
+
get: function () {
|
|
700
|
+
return true;
|
|
701
|
+
},
|
|
702
|
+
enumerable: false,
|
|
703
|
+
configurable: true
|
|
704
|
+
});
|
|
698
705
|
return ConfigurationBase;
|
|
699
706
|
}());
|
|
700
707
|
exports.ConfigurationBase = ConfigurationBase;
|
|
@@ -14,4 +14,4 @@ exports.PUSH_DATA_FEATURE_HEADER_NAME = 'x-px-feature';
|
|
|
14
14
|
exports.EMAIL_ADDRESS_REGEX = /^[a-zA-Z0-9_+&*-]+(?:\.[a-zA-Z0-9_+&*-]+)*@(?:[a-zA-Z0-9-]+\.)+[a-zA-Z]{2,7}$/;
|
|
15
15
|
exports.URL_REGEX = /^(https?\:)\/\/(([^@\s:]+):?([^@\s]*)@)?(([^:\/?#]*)(?:\:([0-9]+))?)([\/]{0,1}[^?#]*)(\?[^#]*|)(#.*|)$/;
|
|
16
16
|
exports.REGEX_STRUCTURE = /^\/(.+?)\/([gimsuyvd]*)$/;
|
|
17
|
-
exports.CORE_MODULE_VERSION = 'JS Core 0.21.
|
|
17
|
+
exports.CORE_MODULE_VERSION = 'JS Core 0.21.4';
|
package/lib/esm/blocker/utils.js
CHANGED
|
@@ -12,9 +12,12 @@ export const renderHtml = (htmlTemplate, blockData) => {
|
|
|
12
12
|
};
|
|
13
13
|
export const createBlockData = (config, context, base64Utils) => {
|
|
14
14
|
const captchaScriptSuffix = '/captcha.js';
|
|
15
|
-
const b64EncodedUrl =
|
|
15
|
+
const b64EncodedUrl = config.enableBlockedUrlOnCaptchaBlockPage
|
|
16
|
+
? base64Utils.base64Encode(context.requestData.rawUrl)
|
|
17
|
+
: '';
|
|
18
|
+
const bParam = b64EncodedUrl && `&b=${b64EncodedUrl}`;
|
|
16
19
|
const b64HttpMethod = base64Utils.base64Encode(context.requestData.method);
|
|
17
|
-
const captchaParams = `?a=${context.blockAction}&u=${context.uuid}&v=${context.vid || ''}&m=${context.isMobile ? '1' : '0'}
|
|
20
|
+
const captchaParams = `?a=${context.blockAction}&u=${context.uuid}&v=${context.vid || ''}&m=${context.isMobile ? '1' : '0'}${bParam}&h=${b64HttpMethod}`;
|
|
18
21
|
let jsClientSrc = `${config.backendClientUrl}/${config.appId}/main.min.js`;
|
|
19
22
|
let blockScript = `${config.backendCaptchaUrl}/${config.appId}${captchaScriptSuffix}${captchaParams}`;
|
|
20
23
|
let hostUrl = config.backendCollectorUrl;
|
|
@@ -11,4 +11,4 @@ export const PUSH_DATA_FEATURE_HEADER_NAME = 'x-px-feature';
|
|
|
11
11
|
export const EMAIL_ADDRESS_REGEX = /^[a-zA-Z0-9_+&*-]+(?:\.[a-zA-Z0-9_+&*-]+)*@(?:[a-zA-Z0-9-]+\.)+[a-zA-Z]{2,7}$/;
|
|
12
12
|
export const URL_REGEX = /^(https?\:)\/\/(([^@\s:]+):?([^@\s]*)@)?(([^:\/?#]*)(?:\:([0-9]+))?)([\/]{0,1}[^?#]*)(\?[^#]*|)(#.*|)$/;
|
|
13
13
|
export const REGEX_STRUCTURE = /^\/(.+?)\/([gimsuyvd]*)$/;
|
|
14
|
-
export const CORE_MODULE_VERSION = 'JS Core 0.21.
|
|
14
|
+
export const CORE_MODULE_VERSION = 'JS Core 0.21.4';
|
|
@@ -112,4 +112,5 @@ export declare abstract class ConfigurationBase<Req, Res, ParamsType extends Con
|
|
|
112
112
|
get remoteConfigMaxFetchAttempts(): number;
|
|
113
113
|
get urlDecodeReservedCharacters(): boolean;
|
|
114
114
|
get securedPxhdEnabled(): boolean;
|
|
115
|
+
get enableBlockedUrlOnCaptchaBlockPage(): boolean;
|
|
115
116
|
}
|
|
@@ -369,6 +369,10 @@ export interface IConfiguration<Req, Res, ParamsType extends ConfigurationParams
|
|
|
369
369
|
* Whether to add the Secure attribute when setting the PXHD cookie.
|
|
370
370
|
*/
|
|
371
371
|
readonly securedPxhdEnabled: boolean;
|
|
372
|
+
/**
|
|
373
|
+
* Whether to include the request url in captcha block page
|
|
374
|
+
*/
|
|
375
|
+
readonly enableBlockedUrlOnCaptchaBlockPage: boolean;
|
|
372
376
|
/**
|
|
373
377
|
* Returns an object representation of the current configuration.
|
|
374
378
|
*/
|
|
@@ -11,4 +11,4 @@ export declare const PUSH_DATA_FEATURE_HEADER_NAME = "x-px-feature";
|
|
|
11
11
|
export declare const EMAIL_ADDRESS_REGEX: RegExp;
|
|
12
12
|
export declare const URL_REGEX: RegExp;
|
|
13
13
|
export declare const REGEX_STRUCTURE: RegExp;
|
|
14
|
-
export declare const CORE_MODULE_VERSION = "JS Core 0.21.
|
|
14
|
+
export declare const CORE_MODULE_VERSION = "JS Core 0.21.4";
|