perimeterx-js-core 0.37.1 → 0.38.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/lib/cjs/blocker/utils.js +1 -0
- package/lib/cjs/config/ConfigurationBase.js +7 -0
- package/lib/cjs/config/defaults/DefaultConfigurationParams.js +1 -0
- package/lib/cjs/products/account_defender/AccountDefender.js +12 -7
- package/lib/cjs/products/bot_defender/block/templates/captcha_template.js +1 -1
- package/lib/cjs/utils/constants.js +1 -1
- package/lib/esm/blocker/utils.js +1 -0
- package/lib/esm/config/ConfigurationBase.js +3 -0
- package/lib/esm/config/defaults/DefaultConfigurationParams.js +1 -0
- package/lib/esm/products/account_defender/AccountDefender.js +11 -7
- package/lib/esm/products/bot_defender/block/templates/captcha_template.js +2 -1
- package/lib/esm/utils/constants.js +1 -1
- package/lib/types/blocker/model/BlockData.d.ts +1 -0
- package/lib/types/config/ConfigurationBase.d.ts +1 -0
- package/lib/types/config/IConfiguration.d.ts +5 -0
- package/lib/types/config/params/CoreConfigurationParams.d.ts +1 -0
- package/lib/types/products/account_defender/AccountDefender.d.ts +4 -0
- package/lib/types/products/bot_defender/block/templates/captcha_template.d.ts +1 -1
- package/lib/types/utils/constants.d.ts +1 -1
- package/package.json +1 -1
package/lib/cjs/blocker/utils.js
CHANGED
|
@@ -54,6 +54,7 @@ var createBlockData = function (config, context, base64Utils) {
|
|
|
54
54
|
uuid: context.uuid || '',
|
|
55
55
|
isMobile: context.isMobile,
|
|
56
56
|
customLogo: config.customLogo || '',
|
|
57
|
+
customBlockOnErrorMessage: config.customBlockOnErrorMessage || '',
|
|
57
58
|
blockAction: context.blockAction,
|
|
58
59
|
hostUrl: hostUrl,
|
|
59
60
|
cssRef: cssRef,
|
|
@@ -200,6 +200,13 @@ var ConfigurationBase = /** @class */ (function () {
|
|
|
200
200
|
enumerable: false,
|
|
201
201
|
configurable: true
|
|
202
202
|
});
|
|
203
|
+
Object.defineProperty(ConfigurationBase.prototype, "customBlockOnErrorMessage", {
|
|
204
|
+
get: function () {
|
|
205
|
+
return this.configParams.px_custom_block_on_error_message;
|
|
206
|
+
},
|
|
207
|
+
enumerable: false,
|
|
208
|
+
configurable: true
|
|
209
|
+
});
|
|
203
210
|
Object.defineProperty(ConfigurationBase.prototype, "enforcedRoutes", {
|
|
204
211
|
get: function () {
|
|
205
212
|
return this.configParams.px_enforced_routes;
|
|
@@ -111,6 +111,7 @@ var defaultConfigurationParams = function () { return ({
|
|
|
111
111
|
px_js_ref: '',
|
|
112
112
|
px_custom_cookie_header: 'x-px-cookies',
|
|
113
113
|
px_custom_logo: '',
|
|
114
|
+
px_custom_block_on_error_message: '',
|
|
114
115
|
px_graphql_enabled: true,
|
|
115
116
|
px_graphql_routes: ['/graphql'],
|
|
116
117
|
px_graphql_keywords: [],
|
|
@@ -127,18 +127,15 @@ var AccountDefender = /** @class */ (function () {
|
|
|
127
127
|
: null;
|
|
128
128
|
};
|
|
129
129
|
AccountDefender.prototype.extractJwtData = function (jwt, userIdFieldName, additionalFieldNames, context) {
|
|
130
|
+
var _this = this;
|
|
130
131
|
try {
|
|
131
132
|
var decodedJwt_1 = this.getDecodedJwt(jwt, context);
|
|
132
133
|
if (decodedJwt_1) {
|
|
133
|
-
var appUserId =
|
|
134
|
+
var appUserId = this.lookupJwtField(decodedJwt_1, userIdFieldName).value;
|
|
134
135
|
var additionalFields = additionalFieldNames.reduce(function (matchedFields, fieldName) {
|
|
135
|
-
var
|
|
136
|
-
var value = utils_1.getPropertyFromObject.apply(void 0, __spreadArray([decodedJwt_1], fieldNameParts, false));
|
|
136
|
+
var _a = _this.lookupJwtField(decodedJwt_1, fieldName), value = _a.value, key = _a.key;
|
|
137
137
|
if (value) {
|
|
138
|
-
|
|
139
|
-
if (key !== undefined) {
|
|
140
|
-
matchedFields[key] = value;
|
|
141
|
-
}
|
|
138
|
+
matchedFields[key] = value;
|
|
142
139
|
}
|
|
143
140
|
return matchedFields;
|
|
144
141
|
}, {});
|
|
@@ -150,6 +147,14 @@ var AccountDefender = /** @class */ (function () {
|
|
|
150
147
|
}
|
|
151
148
|
return null;
|
|
152
149
|
};
|
|
150
|
+
AccountDefender.prototype.lookupJwtField = function (decodedJwt, fieldName) {
|
|
151
|
+
if (Object.prototype.hasOwnProperty.call(decodedJwt, fieldName)) {
|
|
152
|
+
return { value: decodedJwt[fieldName], key: fieldName };
|
|
153
|
+
}
|
|
154
|
+
var parts = fieldName.split('.');
|
|
155
|
+
var value = utils_1.getPropertyFromObject.apply(void 0, __spreadArray([decodedJwt], parts, false));
|
|
156
|
+
return { value: value, key: fieldName };
|
|
157
|
+
};
|
|
153
158
|
AccountDefender.prototype.getDecodedJwt = function (jwt, context) {
|
|
154
159
|
var _a, _b;
|
|
155
160
|
try {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.CAPTCHA_TEMPLATE = void 0;
|
|
4
|
-
exports.CAPTCHA_TEMPLATE = "<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n <meta charset=\"utf-8\">\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">\n <meta name=\"description\" content=\"px-captcha\">\n <title>Access to this page has been denied</title>\n {{cssRef}}\n</head>\n<body>\n <script>\n /* PerimeterX assignments */\n window._pxVid = '{{vid}}';\n window._pxUuid = '{{uuid}}';\n window._pxAppId = '{{appId}}';\n window._pxHostUrl = '{{hostUrl}}';\n window._pxCustomLogo = '{{customLogo}}';\n window._pxJsClientSrc = '{{jsClientSrc}}';\n window._pxMobile = {{isMobile}};\n window._pxFirstPartyEnabled = {{firstPartyEnabled}};\n\n var pxCaptchaSrc = '{{blockScript}}';\n var script = document.createElement('script');\n script.src = pxCaptchaSrc;\n script.onload = onScriptLoad;\n script.onerror = onScriptError;\n var onScriptErrorCalled;\n document.head.appendChild(script);\n var timeoutID = setTimeout(onScriptError, 5000);\n function onScriptLoad() {\n clearTimeout(timeoutID);\n setTimeout(function() {\n if (!isContentLoaded()) {\n onScriptError();\n }\n }, 2500);\n }\n function onScriptError() {\n if (onScriptErrorCalled) {\n return;\n }\n onScriptErrorCalled = true;\n script = document.createElement('script');\n script.src = '{{altBlockScript}}';\n script.onload = function() {\n clearTimeout(timeoutID);\n };\n script.onerror = window._pxOnError;\n document.head.appendChild(script);\n timeoutID = setTimeout(function() {\n if (!isContentLoaded()) {\n window._pxOnError();\n }\n }, 5000);\n }\n function isContentLoaded() {\n return !!document.querySelector('div,span');\n }\n window._pxOnError = function () {\n var style = document.createElement('style');\n style.innerText = '@import url(https://fonts.googleapis.com/css2?family=Roboto:ital,wght@0,100;0,300;0,400;0,500;0,700;0,900;1,100;1,300;1,400;1,500;1,700;1,900&display=swap);body{background-color:#fafbfc}.px-captcha-error-container{position:fixed;height:340px;background-color:#fff;font-family:Roboto,sans-serif}.px-captcha-error-header{color:#f0f1f2;font-size:29px;margin:67px 0 33px;font-weight:500;line-height:.83;text-align:center}.px-captcha-error-message{color:#f0f1f2;font-size:18px;margin:0 0 29px;line-height:1.33;text-align:center}.px-captcha-error-button{text-align:center;line-height:48px;width:253px;margin:auto;border-radius:50px;border:solid 1px #f0f1f2;font-size:20px;color:#f0f1f2}.px-captcha-error-wrapper{margin:18px 0 0}div.px-captcha-error{margin:auto;text-align:center;width:400px;height:30px;font-size:12px;background-color:#fcf0f2;color:#ce0e2d}img.px-captcha-error{margin:6px 8px -2px 0}.px-captcha-error-refid{border-top:solid 1px #f0eeee;height:27px;margin:13px 0 0;border-radius:0 0 3px 3px;background-color:#fafbfc;font-size:10px;line-height:2.5;text-align:center;color:#b1b5b8}@media (min-width:620px){.px-captcha-error-container{width:530px;top:50%;left:50%;margin-top:-170px;margin-left:-265px;border-radius:3px;box-shadow:0 2px 9px -1px rgba(0,0,0,.13)}}@media (min-width:481px) and (max-width:620px){.px-captcha-error-container{width:85%;top:50%;left:50%;margin-top:-170px;margin-left:-42.5%;border-radius:3px;box-shadow:0 2px 9px -1px rgba(0,0,0,.13)}}@media (max-width:480px){body{background-color:#fff}.px-captcha-error-header{color:#f0f1f2;font-size:29px;margin:55px 0 33px}.px-captcha-error-container{width:530px;top:50%;left:50%;margin-top:-170px;margin-left:-265px}.px-captcha-error-refid{position:fixed;width:100%;left:0;bottom:0;border-radius:0;font-size:14px;line-height:2}}@media (max-width:390px){div.px-captcha-error{font-size:10px}.px-captcha-error-refid{font-size:11px;line-height:2.5}}';\n document.head.appendChild(style);\n var div = document.createElement('div');\n div.className = 'px-captcha-error-container';\n div.innerHTML = '<div class=\"px-captcha-error-header\">Before we continue...</div><div class=\"px-captcha-error-message\">Press & Hold to confirm you are<br>a human (and not a bot).</div><div class=\"px-captcha-error-button\">Press & Hold</div><div class=\"px-captcha-error-wrapper\"><div class=\"px-captcha-error\"><img class=\"px-captcha-error\" src=\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABMAAAAQCAMAAADDGrRQAAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAABFUExURUdwTNYELOEGONQILd0AONwALtwEL+AAL9MFLfkJSNQGLdMJLdQJLdQGLdQKLtYFLNcELdUGLdcBL9gFL88OLdUFLNEOLglBhT4AAAAXdFJOUwC8CqgNIRgRoAS1dWWuR4RTjzgryZpYblfkcAAAAI9JREFUGNNdj+sWhCAIhAdvqGVa1r7/oy6RZ7eaH3D4ZACBIed9wlOOMtUnSrEmZ6cHa9YAIfsbCkWrdpi/c50Bk2CO9mNLdMAu03wJA3HpEnfpxbyOg6ruyx8JJi6KNstnslp1dbPd9GnqmuYq7mmcv1zjnbQw8cV0xzkqo+fX1zkjUOO7wnrInUTxJiruC3vtBNRoQQn2AAAAAElFTkSuQmCC\">Please check your internet connection' + (window._pxMobile ? '' : ' or disable your ad-blocker') + '
|
|
4
|
+
exports.CAPTCHA_TEMPLATE = "<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n <meta charset=\"utf-8\">\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">\n <meta name=\"description\" content=\"px-captcha\">\n <title>Access to this page has been denied</title>\n {{cssRef}}\n</head>\n<body>\n <script>\n /* PerimeterX assignments */\n window._pxVid = '{{vid}}';\n window._pxUuid = '{{uuid}}';\n window._pxAppId = '{{appId}}';\n window._pxHostUrl = '{{hostUrl}}';\n window._pxCustomLogo = '{{customLogo}}';\n window._pxCustomOnErrorMessage = '{{customBlockOnErrorMessage}}';\n window._pxJsClientSrc = '{{jsClientSrc}}';\n window._pxMobile = {{isMobile}};\n window._pxFirstPartyEnabled = {{firstPartyEnabled}};\n\n var pxCaptchaSrc = '{{blockScript}}';\n var script = document.createElement('script');\n script.src = pxCaptchaSrc;\n script.onload = onScriptLoad;\n script.onerror = onScriptError;\n var onScriptErrorCalled;\n document.head.appendChild(script);\n var timeoutID = setTimeout(onScriptError, 5000);\n function onScriptLoad() {\n clearTimeout(timeoutID);\n setTimeout(function() {\n if (!isContentLoaded()) {\n onScriptError();\n }\n }, 2500);\n }\n function onScriptError() {\n if (onScriptErrorCalled) {\n return;\n }\n onScriptErrorCalled = true;\n script = document.createElement('script');\n script.src = '{{altBlockScript}}';\n script.onload = function() {\n clearTimeout(timeoutID);\n };\n script.onerror = window._pxOnError;\n document.head.appendChild(script);\n timeoutID = setTimeout(function() {\n if (!isContentLoaded()) {\n window._pxOnError();\n }\n }, 5000);\n }\n function isContentLoaded() {\n return !!document.querySelector('div,span');\n }\n window._pxOnError = function () {\n var style = document.createElement('style');\n style.innerText = '@import url(https://fonts.googleapis.com/css2?family=Roboto:ital,wght@0,100;0,300;0,400;0,500;0,700;0,900;1,100;1,300;1,400;1,500;1,700;1,900&display=swap);body{background-color:#fafbfc}.px-captcha-error-container{position:fixed;height:340px;background-color:#fff;font-family:Roboto,sans-serif}.px-captcha-error-header{color:#f0f1f2;font-size:29px;margin:67px 0 33px;font-weight:500;line-height:.83;text-align:center}.px-captcha-error-message{color:#f0f1f2;font-size:18px;margin:0 0 29px;line-height:1.33;text-align:center}.px-captcha-error-button{text-align:center;line-height:48px;width:253px;margin:auto;border-radius:50px;border:solid 1px #f0f1f2;font-size:20px;color:#f0f1f2}.px-captcha-error-wrapper{margin:18px 0 0}div.px-captcha-error{margin:auto;text-align:center;width:400px;height:30px;font-size:12px;background-color:#fcf0f2;color:#ce0e2d}img.px-captcha-error{margin:6px 8px -2px 0}.px-captcha-error-refid{border-top:solid 1px #f0eeee;height:27px;margin:13px 0 0;border-radius:0 0 3px 3px;background-color:#fafbfc;font-size:10px;line-height:2.5;text-align:center;color:#b1b5b8}@media (min-width:620px){.px-captcha-error-container{width:530px;top:50%;left:50%;margin-top:-170px;margin-left:-265px;border-radius:3px;box-shadow:0 2px 9px -1px rgba(0,0,0,.13)}}@media (min-width:481px) and (max-width:620px){.px-captcha-error-container{width:85%;top:50%;left:50%;margin-top:-170px;margin-left:-42.5%;border-radius:3px;box-shadow:0 2px 9px -1px rgba(0,0,0,.13)}}@media (max-width:480px){body{background-color:#fff}.px-captcha-error-header{color:#f0f1f2;font-size:29px;margin:55px 0 33px}.px-captcha-error-container{width:530px;top:50%;left:50%;margin-top:-170px;margin-left:-265px}.px-captcha-error-refid{position:fixed;width:100%;left:0;bottom:0;border-radius:0;font-size:14px;line-height:2}}@media (max-width:390px){div.px-captcha-error{font-size:10px}.px-captcha-error-refid{font-size:11px;line-height:2.5}}';\n document.head.appendChild(style);\n var div = document.createElement('div');\n div.className = 'px-captcha-error-container';\n div.innerHTML = '<div class=\"px-captcha-error-header\">Before we continue...</div><div class=\"px-captcha-error-message\">Press & Hold to confirm you are<br>a human (and not a bot).</div><div class=\"px-captcha-error-button\">Press & Hold</div><div class=\"px-captcha-error-wrapper\"><div class=\"px-captcha-error\"><img class=\"px-captcha-error\" src=\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABMAAAAQCAMAAADDGrRQAAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAABFUExURUdwTNYELOEGONQILd0AONwALtwEL+AAL9MFLfkJSNQGLdMJLdQJLdQGLdQKLtYFLNcELdUGLdcBL9gFL88OLdUFLNEOLglBhT4AAAAXdFJOUwC8CqgNIRgRoAS1dWWuR4RTjzgryZpYblfkcAAAAI9JREFUGNNdj+sWhCAIhAdvqGVa1r7/oy6RZ7eaH3D4ZACBIed9wlOOMtUnSrEmZ6cHa9YAIfsbCkWrdpi/c50Bk2CO9mNLdMAu03wJA3HpEnfpxbyOg6ruyx8JJi6KNstnslp1dbPd9GnqmuYq7mmcv1zjnbQw8cV0xzkqo+fX1zkjUOO7wnrInUTxJiruC3vtBNRoQQn2AAAAAElFTkSuQmCC\">' + (window._pxCustomOnErrorMessage || ('Please check your internet connection' + (window._pxMobile ? '' : ' or disable your ad-blocker') + '.')) + '</div></div><div class=\"px-captcha-error-refid\">Reference ID ' + window._pxUuid + '</div>';\n document.body.appendChild(div);\n if (window._pxMobile) {\n setTimeout(function() {\n location.href = '/px/captcha_close?status=-1';\n }, 5000);\n }\n };\n </script>\n {{jsRef}}\n</body>\n</html>\n";
|
|
@@ -15,4 +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.
|
|
18
|
+
exports.CORE_MODULE_VERSION = 'JS Core 0.38.0';
|
package/lib/esm/blocker/utils.js
CHANGED
|
@@ -49,6 +49,7 @@ export const createBlockData = (config, context, base64Utils) => {
|
|
|
49
49
|
uuid: context.uuid || '',
|
|
50
50
|
isMobile: context.isMobile,
|
|
51
51
|
customLogo: config.customLogo || '',
|
|
52
|
+
customBlockOnErrorMessage: config.customBlockOnErrorMessage || '',
|
|
52
53
|
blockAction: context.blockAction,
|
|
53
54
|
hostUrl,
|
|
54
55
|
cssRef,
|
|
@@ -158,6 +158,9 @@ export class ConfigurationBase {
|
|
|
158
158
|
get customLogo() {
|
|
159
159
|
return this.configParams.px_custom_logo;
|
|
160
160
|
}
|
|
161
|
+
get customBlockOnErrorMessage() {
|
|
162
|
+
return this.configParams.px_custom_block_on_error_message;
|
|
163
|
+
}
|
|
161
164
|
get enforcedRoutes() {
|
|
162
165
|
return this.configParams.px_enforced_routes;
|
|
163
166
|
}
|
|
@@ -108,6 +108,7 @@ export const defaultConfigurationParams = () => ({
|
|
|
108
108
|
px_js_ref: '',
|
|
109
109
|
px_custom_cookie_header: 'x-px-cookies',
|
|
110
110
|
px_custom_logo: '',
|
|
111
|
+
px_custom_block_on_error_message: '',
|
|
111
112
|
px_graphql_enabled: true,
|
|
112
113
|
px_graphql_routes: ['/graphql'],
|
|
113
114
|
px_graphql_keywords: [],
|
|
@@ -51,15 +51,11 @@ export class AccountDefender {
|
|
|
51
51
|
try {
|
|
52
52
|
const decodedJwt = this.getDecodedJwt(jwt, context);
|
|
53
53
|
if (decodedJwt) {
|
|
54
|
-
const appUserId =
|
|
54
|
+
const { value: appUserId } = this.lookupJwtField(decodedJwt, userIdFieldName);
|
|
55
55
|
const additionalFields = additionalFieldNames.reduce((matchedFields, fieldName) => {
|
|
56
|
-
const
|
|
57
|
-
const value = getPropertyFromObject(decodedJwt, ...fieldNameParts);
|
|
56
|
+
const { value, key } = this.lookupJwtField(decodedJwt, fieldName);
|
|
58
57
|
if (value) {
|
|
59
|
-
|
|
60
|
-
if (key !== undefined) {
|
|
61
|
-
matchedFields[key] = value;
|
|
62
|
-
}
|
|
58
|
+
matchedFields[key] = value;
|
|
63
59
|
}
|
|
64
60
|
return matchedFields;
|
|
65
61
|
}, {});
|
|
@@ -71,6 +67,14 @@ export class AccountDefender {
|
|
|
71
67
|
}
|
|
72
68
|
return null;
|
|
73
69
|
}
|
|
70
|
+
lookupJwtField(decodedJwt, fieldName) {
|
|
71
|
+
if (Object.prototype.hasOwnProperty.call(decodedJwt, fieldName)) {
|
|
72
|
+
return { value: decodedJwt[fieldName], key: fieldName };
|
|
73
|
+
}
|
|
74
|
+
const parts = fieldName.split('.');
|
|
75
|
+
const value = getPropertyFromObject(decodedJwt, ...parts);
|
|
76
|
+
return { value, key: fieldName };
|
|
77
|
+
}
|
|
74
78
|
getDecodedJwt(jwt, context) {
|
|
75
79
|
try {
|
|
76
80
|
const encodedPayload = jwt.split('.')?.[1];
|
|
@@ -15,6 +15,7 @@ export const CAPTCHA_TEMPLATE = `<!DOCTYPE html>
|
|
|
15
15
|
window._pxAppId = '{{appId}}';
|
|
16
16
|
window._pxHostUrl = '{{hostUrl}}';
|
|
17
17
|
window._pxCustomLogo = '{{customLogo}}';
|
|
18
|
+
window._pxCustomOnErrorMessage = '{{customBlockOnErrorMessage}}';
|
|
18
19
|
window._pxJsClientSrc = '{{jsClientSrc}}';
|
|
19
20
|
window._pxMobile = {{isMobile}};
|
|
20
21
|
window._pxFirstPartyEnabled = {{firstPartyEnabled}};
|
|
@@ -62,7 +63,7 @@ export const CAPTCHA_TEMPLATE = `<!DOCTYPE html>
|
|
|
62
63
|
document.head.appendChild(style);
|
|
63
64
|
var div = document.createElement('div');
|
|
64
65
|
div.className = 'px-captcha-error-container';
|
|
65
|
-
div.innerHTML = '<div class="px-captcha-error-header">Before we continue...</div><div class="px-captcha-error-message">Press & Hold to confirm you are<br>a human (and not a bot).</div><div class="px-captcha-error-button">Press & Hold</div><div class="px-captcha-error-wrapper"><div class="px-captcha-error"><img class="px-captcha-error" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABMAAAAQCAMAAADDGrRQAAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAABFUExURUdwTNYELOEGONQILd0AONwALtwEL+AAL9MFLfkJSNQGLdMJLdQJLdQGLdQKLtYFLNcELdUGLdcBL9gFL88OLdUFLNEOLglBhT4AAAAXdFJOUwC8CqgNIRgRoAS1dWWuR4RTjzgryZpYblfkcAAAAI9JREFUGNNdj+sWhCAIhAdvqGVa1r7/oy6RZ7eaH3D4ZACBIed9wlOOMtUnSrEmZ6cHa9YAIfsbCkWrdpi/c50Bk2CO9mNLdMAu03wJA3HpEnfpxbyOg6ruyx8JJi6KNstnslp1dbPd9GnqmuYq7mmcv1zjnbQw8cV0xzkqo+fX1zkjUOO7wnrInUTxJiruC3vtBNRoQQn2AAAAAElFTkSuQmCC">Please check your internet connection' + (window._pxMobile ? '' : ' or disable your ad-blocker') + '
|
|
66
|
+
div.innerHTML = '<div class="px-captcha-error-header">Before we continue...</div><div class="px-captcha-error-message">Press & Hold to confirm you are<br>a human (and not a bot).</div><div class="px-captcha-error-button">Press & Hold</div><div class="px-captcha-error-wrapper"><div class="px-captcha-error"><img class="px-captcha-error" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABMAAAAQCAMAAADDGrRQAAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAABFUExURUdwTNYELOEGONQILd0AONwALtwEL+AAL9MFLfkJSNQGLdMJLdQJLdQGLdQKLtYFLNcELdUGLdcBL9gFL88OLdUFLNEOLglBhT4AAAAXdFJOUwC8CqgNIRgRoAS1dWWuR4RTjzgryZpYblfkcAAAAI9JREFUGNNdj+sWhCAIhAdvqGVa1r7/oy6RZ7eaH3D4ZACBIed9wlOOMtUnSrEmZ6cHa9YAIfsbCkWrdpi/c50Bk2CO9mNLdMAu03wJA3HpEnfpxbyOg6ruyx8JJi6KNstnslp1dbPd9GnqmuYq7mmcv1zjnbQw8cV0xzkqo+fX1zkjUOO7wnrInUTxJiruC3vtBNRoQQn2AAAAAElFTkSuQmCC">' + (window._pxCustomOnErrorMessage || ('Please check your internet connection' + (window._pxMobile ? '' : ' or disable your ad-blocker') + '.')) + '</div></div><div class="px-captcha-error-refid">Reference ID ' + window._pxUuid + '</div>';
|
|
66
67
|
document.body.appendChild(div);
|
|
67
68
|
if (window._pxMobile) {
|
|
68
69
|
setTimeout(function() {
|
|
@@ -12,4 +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.
|
|
15
|
+
export const CORE_MODULE_VERSION = 'JS Core 0.38.0';
|
|
@@ -66,6 +66,7 @@ export declare abstract class ConfigurationBase<Req, Res, Supported extends stri
|
|
|
66
66
|
get bypassMonitorHeader(): string;
|
|
67
67
|
get customCookieHeader(): string;
|
|
68
68
|
get customLogo(): string;
|
|
69
|
+
get customBlockOnErrorMessage(): string;
|
|
69
70
|
get enforcedRoutes(): Array<string | RegExp>;
|
|
70
71
|
get customIsEnforcedRequest(): CustomRequestFunction<Req> | null;
|
|
71
72
|
get filteredExtensions(): string[];
|
|
@@ -190,6 +190,11 @@ export interface IConfiguration<Req, Res, Supported extends string, Added> {
|
|
|
190
190
|
* A URL to a custom logo that should be added to the block page.
|
|
191
191
|
*/
|
|
192
192
|
readonly customLogo: string;
|
|
193
|
+
/**
|
|
194
|
+
* A custom error message to display in the block page fallback UI when the captcha script fails to load.
|
|
195
|
+
* When set, overrides the default "Please check your internet connection or disable your ad-blocker" message.
|
|
196
|
+
*/
|
|
197
|
+
readonly customBlockOnErrorMessage: string;
|
|
193
198
|
/**
|
|
194
199
|
* The maximum expected iterations for PBKDF2. Used for Cookie v3 only.
|
|
195
200
|
*/
|
|
@@ -103,6 +103,7 @@ export type CommonConfigurationParams<Req, Res, Supported extends string, Added>
|
|
|
103
103
|
px_js_ref?: string;
|
|
104
104
|
px_custom_cookie_header?: string;
|
|
105
105
|
px_custom_logo?: string;
|
|
106
|
+
px_custom_block_on_error_message?: string;
|
|
106
107
|
px_jwt_cookie_name?: string;
|
|
107
108
|
px_jwt_cookie_user_id_field_name?: string;
|
|
108
109
|
px_jwt_cookie_additional_field_names?: string[];
|
|
@@ -18,5 +18,9 @@ export declare class AccountDefender<Req, Res, Supported extends string, Added>
|
|
|
18
18
|
modifyOutgoingResponse(_context: ReadonlyContext<Req, Res>): Promise<void>;
|
|
19
19
|
protected getJwtData(context: ReadonlyContext<Req, Res>): JwtData | null;
|
|
20
20
|
protected extractJwtData(jwt: string, userIdFieldName: string, additionalFieldNames: string[], context: ReadonlyContext<Req, Res>): JwtData | null;
|
|
21
|
+
protected lookupJwtField(decodedJwt: any, fieldName: string): {
|
|
22
|
+
value: any;
|
|
23
|
+
key: string;
|
|
24
|
+
};
|
|
21
25
|
protected getDecodedJwt(jwt: string, context: ReadonlyContext<Req, Res>): any | null;
|
|
22
26
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const CAPTCHA_TEMPLATE = "<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n <meta charset=\"utf-8\">\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">\n <meta name=\"description\" content=\"px-captcha\">\n <title>Access to this page has been denied</title>\n {{cssRef}}\n</head>\n<body>\n <script>\n /* PerimeterX assignments */\n window._pxVid = '{{vid}}';\n window._pxUuid = '{{uuid}}';\n window._pxAppId = '{{appId}}';\n window._pxHostUrl = '{{hostUrl}}';\n window._pxCustomLogo = '{{customLogo}}';\n window._pxJsClientSrc = '{{jsClientSrc}}';\n window._pxMobile = {{isMobile}};\n window._pxFirstPartyEnabled = {{firstPartyEnabled}};\n\n var pxCaptchaSrc = '{{blockScript}}';\n var script = document.createElement('script');\n script.src = pxCaptchaSrc;\n script.onload = onScriptLoad;\n script.onerror = onScriptError;\n var onScriptErrorCalled;\n document.head.appendChild(script);\n var timeoutID = setTimeout(onScriptError, 5000);\n function onScriptLoad() {\n clearTimeout(timeoutID);\n setTimeout(function() {\n if (!isContentLoaded()) {\n onScriptError();\n }\n }, 2500);\n }\n function onScriptError() {\n if (onScriptErrorCalled) {\n return;\n }\n onScriptErrorCalled = true;\n script = document.createElement('script');\n script.src = '{{altBlockScript}}';\n script.onload = function() {\n clearTimeout(timeoutID);\n };\n script.onerror = window._pxOnError;\n document.head.appendChild(script);\n timeoutID = setTimeout(function() {\n if (!isContentLoaded()) {\n window._pxOnError();\n }\n }, 5000);\n }\n function isContentLoaded() {\n return !!document.querySelector('div,span');\n }\n window._pxOnError = function () {\n var style = document.createElement('style');\n style.innerText = '@import url(https://fonts.googleapis.com/css2?family=Roboto:ital,wght@0,100;0,300;0,400;0,500;0,700;0,900;1,100;1,300;1,400;1,500;1,700;1,900&display=swap);body{background-color:#fafbfc}.px-captcha-error-container{position:fixed;height:340px;background-color:#fff;font-family:Roboto,sans-serif}.px-captcha-error-header{color:#f0f1f2;font-size:29px;margin:67px 0 33px;font-weight:500;line-height:.83;text-align:center}.px-captcha-error-message{color:#f0f1f2;font-size:18px;margin:0 0 29px;line-height:1.33;text-align:center}.px-captcha-error-button{text-align:center;line-height:48px;width:253px;margin:auto;border-radius:50px;border:solid 1px #f0f1f2;font-size:20px;color:#f0f1f2}.px-captcha-error-wrapper{margin:18px 0 0}div.px-captcha-error{margin:auto;text-align:center;width:400px;height:30px;font-size:12px;background-color:#fcf0f2;color:#ce0e2d}img.px-captcha-error{margin:6px 8px -2px 0}.px-captcha-error-refid{border-top:solid 1px #f0eeee;height:27px;margin:13px 0 0;border-radius:0 0 3px 3px;background-color:#fafbfc;font-size:10px;line-height:2.5;text-align:center;color:#b1b5b8}@media (min-width:620px){.px-captcha-error-container{width:530px;top:50%;left:50%;margin-top:-170px;margin-left:-265px;border-radius:3px;box-shadow:0 2px 9px -1px rgba(0,0,0,.13)}}@media (min-width:481px) and (max-width:620px){.px-captcha-error-container{width:85%;top:50%;left:50%;margin-top:-170px;margin-left:-42.5%;border-radius:3px;box-shadow:0 2px 9px -1px rgba(0,0,0,.13)}}@media (max-width:480px){body{background-color:#fff}.px-captcha-error-header{color:#f0f1f2;font-size:29px;margin:55px 0 33px}.px-captcha-error-container{width:530px;top:50%;left:50%;margin-top:-170px;margin-left:-265px}.px-captcha-error-refid{position:fixed;width:100%;left:0;bottom:0;border-radius:0;font-size:14px;line-height:2}}@media (max-width:390px){div.px-captcha-error{font-size:10px}.px-captcha-error-refid{font-size:11px;line-height:2.5}}';\n document.head.appendChild(style);\n var div = document.createElement('div');\n div.className = 'px-captcha-error-container';\n div.innerHTML = '<div class=\"px-captcha-error-header\">Before we continue...</div><div class=\"px-captcha-error-message\">Press & Hold to confirm you are<br>a human (and not a bot).</div><div class=\"px-captcha-error-button\">Press & Hold</div><div class=\"px-captcha-error-wrapper\"><div class=\"px-captcha-error\"><img class=\"px-captcha-error\" src=\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABMAAAAQCAMAAADDGrRQAAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAABFUExURUdwTNYELOEGONQILd0AONwALtwEL+AAL9MFLfkJSNQGLdMJLdQJLdQGLdQKLtYFLNcELdUGLdcBL9gFL88OLdUFLNEOLglBhT4AAAAXdFJOUwC8CqgNIRgRoAS1dWWuR4RTjzgryZpYblfkcAAAAI9JREFUGNNdj+sWhCAIhAdvqGVa1r7/oy6RZ7eaH3D4ZACBIed9wlOOMtUnSrEmZ6cHa9YAIfsbCkWrdpi/c50Bk2CO9mNLdMAu03wJA3HpEnfpxbyOg6ruyx8JJi6KNstnslp1dbPd9GnqmuYq7mmcv1zjnbQw8cV0xzkqo+fX1zkjUOO7wnrInUTxJiruC3vtBNRoQQn2AAAAAElFTkSuQmCC\">Please check your internet connection' + (window._pxMobile ? '' : ' or disable your ad-blocker') + '
|
|
1
|
+
export declare const CAPTCHA_TEMPLATE = "<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n <meta charset=\"utf-8\">\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">\n <meta name=\"description\" content=\"px-captcha\">\n <title>Access to this page has been denied</title>\n {{cssRef}}\n</head>\n<body>\n <script>\n /* PerimeterX assignments */\n window._pxVid = '{{vid}}';\n window._pxUuid = '{{uuid}}';\n window._pxAppId = '{{appId}}';\n window._pxHostUrl = '{{hostUrl}}';\n window._pxCustomLogo = '{{customLogo}}';\n window._pxCustomOnErrorMessage = '{{customBlockOnErrorMessage}}';\n window._pxJsClientSrc = '{{jsClientSrc}}';\n window._pxMobile = {{isMobile}};\n window._pxFirstPartyEnabled = {{firstPartyEnabled}};\n\n var pxCaptchaSrc = '{{blockScript}}';\n var script = document.createElement('script');\n script.src = pxCaptchaSrc;\n script.onload = onScriptLoad;\n script.onerror = onScriptError;\n var onScriptErrorCalled;\n document.head.appendChild(script);\n var timeoutID = setTimeout(onScriptError, 5000);\n function onScriptLoad() {\n clearTimeout(timeoutID);\n setTimeout(function() {\n if (!isContentLoaded()) {\n onScriptError();\n }\n }, 2500);\n }\n function onScriptError() {\n if (onScriptErrorCalled) {\n return;\n }\n onScriptErrorCalled = true;\n script = document.createElement('script');\n script.src = '{{altBlockScript}}';\n script.onload = function() {\n clearTimeout(timeoutID);\n };\n script.onerror = window._pxOnError;\n document.head.appendChild(script);\n timeoutID = setTimeout(function() {\n if (!isContentLoaded()) {\n window._pxOnError();\n }\n }, 5000);\n }\n function isContentLoaded() {\n return !!document.querySelector('div,span');\n }\n window._pxOnError = function () {\n var style = document.createElement('style');\n style.innerText = '@import url(https://fonts.googleapis.com/css2?family=Roboto:ital,wght@0,100;0,300;0,400;0,500;0,700;0,900;1,100;1,300;1,400;1,500;1,700;1,900&display=swap);body{background-color:#fafbfc}.px-captcha-error-container{position:fixed;height:340px;background-color:#fff;font-family:Roboto,sans-serif}.px-captcha-error-header{color:#f0f1f2;font-size:29px;margin:67px 0 33px;font-weight:500;line-height:.83;text-align:center}.px-captcha-error-message{color:#f0f1f2;font-size:18px;margin:0 0 29px;line-height:1.33;text-align:center}.px-captcha-error-button{text-align:center;line-height:48px;width:253px;margin:auto;border-radius:50px;border:solid 1px #f0f1f2;font-size:20px;color:#f0f1f2}.px-captcha-error-wrapper{margin:18px 0 0}div.px-captcha-error{margin:auto;text-align:center;width:400px;height:30px;font-size:12px;background-color:#fcf0f2;color:#ce0e2d}img.px-captcha-error{margin:6px 8px -2px 0}.px-captcha-error-refid{border-top:solid 1px #f0eeee;height:27px;margin:13px 0 0;border-radius:0 0 3px 3px;background-color:#fafbfc;font-size:10px;line-height:2.5;text-align:center;color:#b1b5b8}@media (min-width:620px){.px-captcha-error-container{width:530px;top:50%;left:50%;margin-top:-170px;margin-left:-265px;border-radius:3px;box-shadow:0 2px 9px -1px rgba(0,0,0,.13)}}@media (min-width:481px) and (max-width:620px){.px-captcha-error-container{width:85%;top:50%;left:50%;margin-top:-170px;margin-left:-42.5%;border-radius:3px;box-shadow:0 2px 9px -1px rgba(0,0,0,.13)}}@media (max-width:480px){body{background-color:#fff}.px-captcha-error-header{color:#f0f1f2;font-size:29px;margin:55px 0 33px}.px-captcha-error-container{width:530px;top:50%;left:50%;margin-top:-170px;margin-left:-265px}.px-captcha-error-refid{position:fixed;width:100%;left:0;bottom:0;border-radius:0;font-size:14px;line-height:2}}@media (max-width:390px){div.px-captcha-error{font-size:10px}.px-captcha-error-refid{font-size:11px;line-height:2.5}}';\n document.head.appendChild(style);\n var div = document.createElement('div');\n div.className = 'px-captcha-error-container';\n div.innerHTML = '<div class=\"px-captcha-error-header\">Before we continue...</div><div class=\"px-captcha-error-message\">Press & Hold to confirm you are<br>a human (and not a bot).</div><div class=\"px-captcha-error-button\">Press & Hold</div><div class=\"px-captcha-error-wrapper\"><div class=\"px-captcha-error\"><img class=\"px-captcha-error\" src=\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABMAAAAQCAMAAADDGrRQAAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAABFUExURUdwTNYELOEGONQILd0AONwALtwEL+AAL9MFLfkJSNQGLdMJLdQJLdQGLdQKLtYFLNcELdUGLdcBL9gFL88OLdUFLNEOLglBhT4AAAAXdFJOUwC8CqgNIRgRoAS1dWWuR4RTjzgryZpYblfkcAAAAI9JREFUGNNdj+sWhCAIhAdvqGVa1r7/oy6RZ7eaH3D4ZACBIed9wlOOMtUnSrEmZ6cHa9YAIfsbCkWrdpi/c50Bk2CO9mNLdMAu03wJA3HpEnfpxbyOg6ruyx8JJi6KNstnslp1dbPd9GnqmuYq7mmcv1zjnbQw8cV0xzkqo+fX1zkjUOO7wnrInUTxJiruC3vtBNRoQQn2AAAAAElFTkSuQmCC\">' + (window._pxCustomOnErrorMessage || ('Please check your internet connection' + (window._pxMobile ? '' : ' or disable your ad-blocker') + '.')) + '</div></div><div class=\"px-captcha-error-refid\">Reference ID ' + window._pxUuid + '</div>';\n document.body.appendChild(div);\n if (window._pxMobile) {\n setTimeout(function() {\n location.href = '/px/captcha_close?status=-1';\n }, 5000);\n }\n };\n </script>\n {{jsRef}}\n</body>\n</html>\n";
|
|
@@ -12,4 +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.
|
|
15
|
+
export declare const CORE_MODULE_VERSION = "JS Core 0.38.0";
|