perimeterx-js-core 0.35.1 → 0.37.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/activities/utils.js +20 -0
- package/lib/cjs/blocker/model/BlockAction.js +1 -0
- package/lib/cjs/blocker/model/BlockActionToWordMap.js +1 -0
- package/lib/cjs/config/ConfigurationBase.js +14 -0
- package/lib/cjs/config/defaults/DefaultConfigurationParams.js +2 -0
- package/lib/cjs/context/DefaultContext.js +4 -0
- package/lib/cjs/context/SerializedContext.js +1 -0
- package/lib/cjs/enforcer/utils.js +2 -0
- package/lib/cjs/products/agentic_trust/AgenticTrust.js +163 -0
- package/lib/cjs/products/agentic_trust/IAgenticTrust.js +2 -0
- package/lib/cjs/products/agentic_trust/index.js +19 -0
- package/lib/cjs/products/agentic_trust/model/AgenticTrustData.js +2 -0
- package/lib/cjs/products/agentic_trust/model/index.js +17 -0
- package/lib/cjs/products/bot_defender/block/DefaultBotDefenderBlocker.js +15 -0
- package/lib/cjs/products/bot_defender/block/captcha/JsonCaptchaBlocker.js +3 -1
- package/lib/cjs/products/bot_defender/block/templates/hard_block_template.js +4 -0
- package/lib/cjs/products/bot_defender/block/templates/index.js +1 -0
- package/lib/cjs/products/index.js +1 -0
- package/lib/cjs/products/utils/ProductName.js +1 -0
- package/lib/cjs/products/utils/ProductPriorityOrder.js +1 -0
- package/lib/cjs/risk_api/model/GetRiskRequestHeaders.js +18 -0
- package/lib/cjs/utils/constants.js +1 -1
- package/lib/esm/activities/utils.js +20 -0
- package/lib/esm/blocker/model/BlockAction.js +1 -0
- package/lib/esm/blocker/model/BlockActionToWordMap.js +1 -0
- package/lib/esm/config/ConfigurationBase.js +6 -0
- package/lib/esm/config/defaults/DefaultConfigurationParams.js +2 -0
- package/lib/esm/context/DefaultContext.js +5 -0
- package/lib/esm/context/SerializedContext.js +2 -0
- package/lib/esm/enforcer/utils.js +3 -1
- package/lib/esm/products/agentic_trust/AgenticTrust.js +84 -0
- package/lib/esm/products/agentic_trust/IAgenticTrust.js +1 -0
- package/lib/esm/products/agentic_trust/index.js +3 -0
- package/lib/esm/products/agentic_trust/model/AgenticTrustData.js +1 -0
- package/lib/esm/products/agentic_trust/model/index.js +1 -0
- package/lib/esm/products/bot_defender/block/DefaultBotDefenderBlocker.js +17 -2
- package/lib/esm/products/bot_defender/block/captcha/JsonCaptchaBlocker.js +3 -1
- package/lib/esm/products/bot_defender/block/templates/hard_block_template.js +109 -0
- package/lib/esm/products/bot_defender/block/templates/index.js +1 -0
- package/lib/esm/products/index.js +1 -0
- package/lib/esm/products/utils/ProductName.js +1 -0
- package/lib/esm/products/utils/ProductPriorityOrder.js +1 -0
- package/lib/esm/risk_api/model/GetRiskRequestHeaders.js +18 -0
- package/lib/esm/utils/constants.js +1 -1
- package/lib/types/activities/model/CommonActivityDetails.d.ts +6 -0
- package/lib/types/blocker/model/BlockAction.d.ts +1 -0
- package/lib/types/config/ConfigurationBase.d.ts +2 -0
- package/lib/types/config/IConfiguration.d.ts +8 -0
- package/lib/types/config/params/CoreConfigurationParams.d.ts +2 -0
- package/lib/types/context/ContextJson.d.ts +1 -0
- package/lib/types/context/DefaultContext.d.ts +1 -0
- package/lib/types/context/SerializedContext.d.ts +1 -0
- package/lib/types/context/interfaces/IContext.d.ts +4 -0
- package/lib/types/products/agentic_trust/AgenticTrust.d.ts +15 -0
- package/lib/types/products/agentic_trust/IAgenticTrust.d.ts +4 -0
- package/lib/types/products/agentic_trust/index.d.ts +3 -0
- package/lib/types/products/agentic_trust/model/AgenticTrustData.d.ts +7 -0
- package/lib/types/products/agentic_trust/model/index.d.ts +1 -0
- package/lib/types/products/bot_defender/block/DefaultBotDefenderBlocker.d.ts +2 -0
- package/lib/types/products/bot_defender/block/templates/hard_block_template.d.ts +1 -0
- package/lib/types/products/bot_defender/block/templates/index.d.ts +1 -0
- package/lib/types/products/index.d.ts +1 -0
- package/lib/types/products/interfaces/ProductDataType.d.ts +2 -1
- package/lib/types/products/interfaces/ProductType.d.ts +2 -1
- package/lib/types/products/utils/ProductName.d.ts +2 -1
- package/lib/types/risk_api/utils.d.ts +6 -0
- package/lib/types/utils/constants.d.ts +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { HttpMethod } from '../../http/index.js';
|
|
2
|
+
const MCP_SESSION_ID_HEADER = 'mcp-session-id';
|
|
3
|
+
export class AgenticTrust {
|
|
4
|
+
config;
|
|
5
|
+
constructor(config) {
|
|
6
|
+
this.config = config;
|
|
7
|
+
}
|
|
8
|
+
async enrichContextFromRequest(context) {
|
|
9
|
+
if (!this.config.agenticTrustEnabled) {
|
|
10
|
+
return null;
|
|
11
|
+
}
|
|
12
|
+
if (!this.isMatchingEndpoint(context)) {
|
|
13
|
+
return null;
|
|
14
|
+
}
|
|
15
|
+
const data = {
|
|
16
|
+
mcpHttpMethod: context.requestData.method,
|
|
17
|
+
};
|
|
18
|
+
const sessionId = context.requestData.request.headers.get(MCP_SESSION_ID_HEADER);
|
|
19
|
+
if (sessionId) {
|
|
20
|
+
data.mcpSessionId = sessionId;
|
|
21
|
+
}
|
|
22
|
+
if (context.requestData.method === HttpMethod.POST) {
|
|
23
|
+
await this.extractFromBody(context, data);
|
|
24
|
+
}
|
|
25
|
+
return data;
|
|
26
|
+
}
|
|
27
|
+
async enrichContextFromRiskApi(_context) {
|
|
28
|
+
return null;
|
|
29
|
+
}
|
|
30
|
+
async modifyIncomingRequest(_context) {
|
|
31
|
+
// no-op
|
|
32
|
+
}
|
|
33
|
+
async enrichContextFromResponse(context) {
|
|
34
|
+
if (!context.productData.at) {
|
|
35
|
+
return null;
|
|
36
|
+
}
|
|
37
|
+
if (context.productData.at.mcpSessionId) {
|
|
38
|
+
return null;
|
|
39
|
+
}
|
|
40
|
+
const responseHeaders = context.response?.headers;
|
|
41
|
+
if (!responseHeaders) {
|
|
42
|
+
return null;
|
|
43
|
+
}
|
|
44
|
+
const sessionId = responseHeaders.get(MCP_SESSION_ID_HEADER);
|
|
45
|
+
if (sessionId) {
|
|
46
|
+
return { mcpSessionId: sessionId };
|
|
47
|
+
}
|
|
48
|
+
return null;
|
|
49
|
+
}
|
|
50
|
+
async modifyOutgoingResponse(_context) {
|
|
51
|
+
// no-op
|
|
52
|
+
}
|
|
53
|
+
isMatchingEndpoint(context) {
|
|
54
|
+
const pathname = context.requestData.url.pathname.replace(/\/+$/, '');
|
|
55
|
+
const configuredPath = this.config.agenticTrustMcpEndpointPath.replace(/\/+$/, '');
|
|
56
|
+
return pathname === configuredPath;
|
|
57
|
+
}
|
|
58
|
+
async extractFromBody(context, data) {
|
|
59
|
+
try {
|
|
60
|
+
const body = await context.requestData.request.json();
|
|
61
|
+
if (!body) {
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
const jsonRpcMessage = Array.isArray(body) ? body[0] : body;
|
|
65
|
+
if (!jsonRpcMessage) {
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
if (typeof jsonRpcMessage.method === 'string') {
|
|
69
|
+
data.mcpMethod = jsonRpcMessage.method;
|
|
70
|
+
}
|
|
71
|
+
if (jsonRpcMessage.params) {
|
|
72
|
+
if (typeof jsonRpcMessage.params.name === 'string') {
|
|
73
|
+
data.mcpToolName = jsonRpcMessage.params.name;
|
|
74
|
+
}
|
|
75
|
+
if (jsonRpcMessage.params.arguments && typeof jsonRpcMessage.params.arguments === 'object') {
|
|
76
|
+
data.mcpToolArgumentKeys = Object.keys(jsonRpcMessage.params.arguments).join(',');
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
catch {
|
|
81
|
+
// failed to parse request body
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './AgenticTrustData.js';
|
|
@@ -1,18 +1,20 @@
|
|
|
1
1
|
import { Action } from '../../../action/index.js';
|
|
2
|
-
import { BlockAction } from '../../../blocker/index.js';
|
|
2
|
+
import { BlockAction, createBlockData, renderHtml } from '../../../blocker/index.js';
|
|
3
3
|
import { ContentType, CONTENT_TYPE_HEADER_NAME, MinimalResponseImpl } from '../../../http/index.js';
|
|
4
4
|
import { ProductName } from '../../utils/index.js';
|
|
5
5
|
import { CaptchaBlocker } from './captcha/index.js';
|
|
6
|
-
import { CAPTCHA_TEMPLATE, RATE_LIMIT_TEMPLATE } from './templates/index.js';
|
|
6
|
+
import { CAPTCHA_TEMPLATE, HARD_BLOCK_TEMPLATE, RATE_LIMIT_TEMPLATE } from './templates/index.js';
|
|
7
7
|
export class DefaultBotDefenderBlocker {
|
|
8
8
|
config;
|
|
9
9
|
captchaBlocker;
|
|
10
|
+
base64Utils;
|
|
10
11
|
constructor(config, options) {
|
|
11
12
|
this.config = config;
|
|
12
13
|
if ('captchaBlocker' in options) {
|
|
13
14
|
this.captchaBlocker = options.captchaBlocker;
|
|
14
15
|
}
|
|
15
16
|
else {
|
|
17
|
+
this.base64Utils = options.base64Utils;
|
|
16
18
|
this.captchaBlocker = new CaptchaBlocker({
|
|
17
19
|
config,
|
|
18
20
|
base64Utils: options.base64Utils,
|
|
@@ -25,6 +27,8 @@ export class DefaultBotDefenderBlocker {
|
|
|
25
27
|
}
|
|
26
28
|
createBlockResponse(context) {
|
|
27
29
|
switch (context.blockAction) {
|
|
30
|
+
case BlockAction.BLOCK:
|
|
31
|
+
return this.createHardBlockResponse(context);
|
|
28
32
|
case BlockAction.RATE_LIMIT:
|
|
29
33
|
return this.createRateLimitResponse();
|
|
30
34
|
case BlockAction.CHALLENGE:
|
|
@@ -33,6 +37,17 @@ export class DefaultBotDefenderBlocker {
|
|
|
33
37
|
return this.createCaptchaResponse(context);
|
|
34
38
|
}
|
|
35
39
|
}
|
|
40
|
+
createHardBlockResponse(context) {
|
|
41
|
+
const blockData = this.base64Utils ? createBlockData(this.config, context, this.base64Utils) : undefined;
|
|
42
|
+
const body = renderHtml(HARD_BLOCK_TEMPLATE, blockData);
|
|
43
|
+
return new MinimalResponseImpl({
|
|
44
|
+
body,
|
|
45
|
+
status: 403,
|
|
46
|
+
headers: {
|
|
47
|
+
[CONTENT_TYPE_HEADER_NAME]: [ContentType.TEXT_HTML],
|
|
48
|
+
},
|
|
49
|
+
});
|
|
50
|
+
}
|
|
36
51
|
createRateLimitResponse() {
|
|
37
52
|
const status = 429;
|
|
38
53
|
const headers = {
|
|
@@ -11,7 +11,9 @@ export class JsonCaptchaBlocker extends JsonBlockerBase {
|
|
|
11
11
|
if (!this.config.advancedBlockingResponseEnabled) {
|
|
12
12
|
return false;
|
|
13
13
|
}
|
|
14
|
-
return context.blockAction !== BlockAction.RATE_LIMIT &&
|
|
14
|
+
return (context.blockAction !== BlockAction.RATE_LIMIT &&
|
|
15
|
+
context.blockAction !== BlockAction.BLOCK &&
|
|
16
|
+
super.shouldBlock(context));
|
|
15
17
|
}
|
|
16
18
|
createJsonPayload(context) {
|
|
17
19
|
const blockData = createBlockData(this.config, context, this.base64Utils);
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
export const HARD_BLOCK_TEMPLATE = `<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8">
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
6
|
+
<meta name="description" content="px-hard-block">
|
|
7
|
+
<title>Access Denied</title>
|
|
8
|
+
{{cssRef}}
|
|
9
|
+
<style>
|
|
10
|
+
@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;500&display=swap');
|
|
11
|
+
body {
|
|
12
|
+
background-color: #fafbfc;
|
|
13
|
+
margin: 0;
|
|
14
|
+
padding: 0;
|
|
15
|
+
}
|
|
16
|
+
.px-hard-block-container {
|
|
17
|
+
position: fixed;
|
|
18
|
+
background-color: #fff;
|
|
19
|
+
font-family: Roboto, sans-serif;
|
|
20
|
+
}
|
|
21
|
+
.px-hard-block-logo {
|
|
22
|
+
text-align: center;
|
|
23
|
+
margin: 30px 0 0;
|
|
24
|
+
}
|
|
25
|
+
.px-hard-block-logo img {
|
|
26
|
+
max-height: 50px;
|
|
27
|
+
}
|
|
28
|
+
.px-hard-block-logo img[src=""] {
|
|
29
|
+
display: none;
|
|
30
|
+
}
|
|
31
|
+
.px-hard-block-header {
|
|
32
|
+
color: #000;
|
|
33
|
+
font-size: 29px;
|
|
34
|
+
margin: 35px 0 20px;
|
|
35
|
+
font-weight: 500;
|
|
36
|
+
line-height: 1;
|
|
37
|
+
text-align: center;
|
|
38
|
+
}
|
|
39
|
+
.px-hard-block-message {
|
|
40
|
+
color: #646464;
|
|
41
|
+
font-size: 16px;
|
|
42
|
+
margin: 0 30px 25px;
|
|
43
|
+
line-height: 1.4;
|
|
44
|
+
text-align: center;
|
|
45
|
+
}
|
|
46
|
+
.px-hard-block-refid {
|
|
47
|
+
border-top: solid 1px #f0eeee;
|
|
48
|
+
height: 27px;
|
|
49
|
+
margin: 15px 0 0;
|
|
50
|
+
border-radius: 0 0 3px 3px;
|
|
51
|
+
background-color: #fafbfc;
|
|
52
|
+
font-size: 10px;
|
|
53
|
+
line-height: 2.5;
|
|
54
|
+
text-align: center;
|
|
55
|
+
color: #b1b5b8;
|
|
56
|
+
}
|
|
57
|
+
@media (min-width: 620px) {
|
|
58
|
+
.px-hard-block-container {
|
|
59
|
+
width: 530px;
|
|
60
|
+
top: 50%;
|
|
61
|
+
left: 50%;
|
|
62
|
+
margin-top: -150px;
|
|
63
|
+
margin-left: -265px;
|
|
64
|
+
border-radius: 3px;
|
|
65
|
+
box-shadow: 0 2px 9px -1px rgba(0,0,0,.13);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
@media (min-width: 481px) and (max-width: 619px) {
|
|
69
|
+
.px-hard-block-container {
|
|
70
|
+
width: 85%;
|
|
71
|
+
top: 50%;
|
|
72
|
+
left: 50%;
|
|
73
|
+
margin-top: -150px;
|
|
74
|
+
margin-left: -42.5%;
|
|
75
|
+
border-radius: 3px;
|
|
76
|
+
box-shadow: 0 2px 9px -1px rgba(0,0,0,.13);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
@media (max-width: 480px) {
|
|
80
|
+
body { background-color: #fff; }
|
|
81
|
+
.px-hard-block-container {
|
|
82
|
+
width: 100%;
|
|
83
|
+
top: 50%;
|
|
84
|
+
left: 0;
|
|
85
|
+
margin-top: -150px;
|
|
86
|
+
}
|
|
87
|
+
.px-hard-block-refid {
|
|
88
|
+
position: fixed;
|
|
89
|
+
width: 100%;
|
|
90
|
+
left: 0;
|
|
91
|
+
bottom: 0;
|
|
92
|
+
border-radius: 0;
|
|
93
|
+
font-size: 14px;
|
|
94
|
+
line-height: 2;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
</style>
|
|
98
|
+
</head>
|
|
99
|
+
<body>
|
|
100
|
+
<div class="px-hard-block-container">
|
|
101
|
+
<div class="px-hard-block-logo"><img src="{{customLogo}}" alt=""></div>
|
|
102
|
+
<div class="px-hard-block-header">Access Denied</div>
|
|
103
|
+
<div class="px-hard-block-message">Access to this page has been denied.<br>Please contact the site administrator if you believe this is an error.</div>
|
|
104
|
+
<div class="px-hard-block-refid">Reference ID: {{uuid}}</div>
|
|
105
|
+
</div>
|
|
106
|
+
{{jsRef}}
|
|
107
|
+
</body>
|
|
108
|
+
</html>
|
|
109
|
+
`;
|
|
@@ -94,6 +94,9 @@ export const RISK_ACTIVITY_ADDITIONAL_FIELDS_TO_HEADER_NAMES = {
|
|
|
94
94
|
enforcer_vid_source: {
|
|
95
95
|
header: 'x-px-add-enforcer-vid-source',
|
|
96
96
|
},
|
|
97
|
+
orig_cookie_vid: {
|
|
98
|
+
header: 'x-px-add-orig-cookie-vid',
|
|
99
|
+
},
|
|
97
100
|
server_info_datacenter: {
|
|
98
101
|
header: 'x-px-add-server-info-datacenter',
|
|
99
102
|
},
|
|
@@ -183,4 +186,19 @@ export const RISK_ACTIVITY_ADDITIONAL_FIELDS_TO_HEADER_NAMES = {
|
|
|
183
186
|
header: 'x-px-add-is-sensitive-route',
|
|
184
187
|
convertToString: (value) => `${value}`,
|
|
185
188
|
},
|
|
189
|
+
mcp_method: {
|
|
190
|
+
header: 'x-px-add-mcp-method',
|
|
191
|
+
},
|
|
192
|
+
mcp_tool_name: {
|
|
193
|
+
header: 'x-px-add-mcp-tool-name',
|
|
194
|
+
},
|
|
195
|
+
mcp_tool_argument_keys: {
|
|
196
|
+
header: 'x-px-add-mcp-tool-argument-keys',
|
|
197
|
+
},
|
|
198
|
+
mcp_session_id: {
|
|
199
|
+
header: 'x-px-add-mcp-session-id',
|
|
200
|
+
},
|
|
201
|
+
mcp_http_method: {
|
|
202
|
+
header: 'x-px-add-mcp-http-method',
|
|
203
|
+
},
|
|
186
204
|
};
|
|
@@ -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.37.0';
|
|
@@ -24,6 +24,7 @@ export type CommonActivityDetails = {
|
|
|
24
24
|
tls_preferred_ciphers?: string;
|
|
25
25
|
tls_ja3_fingerprint?: string;
|
|
26
26
|
enforcer_vid_source?: VidSource;
|
|
27
|
+
orig_cookie_vid?: string;
|
|
27
28
|
original_uuid?: string;
|
|
28
29
|
original_token_error?: string;
|
|
29
30
|
original_token?: string;
|
|
@@ -47,4 +48,9 @@ export type CommonActivityDetails = {
|
|
|
47
48
|
raw_url?: string;
|
|
48
49
|
used_cookie_secret?: string;
|
|
49
50
|
is_sensitive_route?: boolean;
|
|
51
|
+
mcp_method?: string;
|
|
52
|
+
mcp_tool_name?: string;
|
|
53
|
+
mcp_tool_argument_keys?: string;
|
|
54
|
+
mcp_session_id?: string;
|
|
55
|
+
mcp_http_method?: string;
|
|
50
56
|
} & CustomParameters;
|
|
@@ -150,6 +150,8 @@ export declare abstract class ConfigurationBase<Req, Res, Supported extends stri
|
|
|
150
150
|
get createCustomSnippet(): CustomSnippetFunction<Req, Res, Supported, Added> | null;
|
|
151
151
|
get dataEnrichmentHeaderName(): string;
|
|
152
152
|
get proxyUrl(): string;
|
|
153
|
+
get agenticTrustEnabled(): boolean;
|
|
154
|
+
get agenticTrustMcpEndpointPath(): string;
|
|
153
155
|
get enableBlockedUrlOnCaptchaBlockPage(): boolean;
|
|
154
156
|
get awaitAsyncHttpRequests(): boolean;
|
|
155
157
|
get isPostEnforceEnabled(): boolean;
|
|
@@ -348,6 +348,14 @@ export interface IConfiguration<Req, Res, Supported extends string, Added> {
|
|
|
348
348
|
* The default login successful custom callback to use if none is defined for an endpoint.
|
|
349
349
|
*/
|
|
350
350
|
readonly ciDefaultLoginSuccessfulCustomCallback: CustomLoginSuccessfulCallback<Res> | null;
|
|
351
|
+
/**
|
|
352
|
+
* Whether to enable Agentic Trust.
|
|
353
|
+
*/
|
|
354
|
+
readonly agenticTrustEnabled: boolean;
|
|
355
|
+
/**
|
|
356
|
+
* The endpoint path used for MCP requests.
|
|
357
|
+
*/
|
|
358
|
+
readonly agenticTrustMcpEndpointPath: string;
|
|
351
359
|
/**
|
|
352
360
|
* The authentication token for the logging service.
|
|
353
361
|
*/
|
|
@@ -122,6 +122,8 @@ export type CommonConfigurationParams<Req, Res, Supported extends string, Added>
|
|
|
122
122
|
px_secured_pxhd_enabled?: boolean;
|
|
123
123
|
px_data_enrichment_header_name?: string;
|
|
124
124
|
px_proxy_url?: string;
|
|
125
|
+
px_agentic_trust_enabled?: boolean;
|
|
126
|
+
px_agentic_trust_mcp_endpoint_path?: string;
|
|
125
127
|
px_additional_activity_handler?: AdditionalActivityHandler<Req, Res, Supported, Added> | null;
|
|
126
128
|
px_enrich_custom_parameters?: CustomParametersFunction<Req, Res, Supported, Added> | null;
|
|
127
129
|
px_enrich_response_custom_parameters?: ResponseCustomParametersFunction<Req, Res, Supported, Added> | null;
|
|
@@ -34,6 +34,7 @@ export declare class DefaultContext<Req, Res, Supported extends string, Added> i
|
|
|
34
34
|
readonly productData: ProductData;
|
|
35
35
|
uuid?: string;
|
|
36
36
|
vid?: string;
|
|
37
|
+
origCookieVid?: string;
|
|
37
38
|
vidSource?: VidSource;
|
|
38
39
|
action: Action;
|
|
39
40
|
reasons: Partial<Record<ProductName, string>>;
|
|
@@ -41,6 +41,7 @@ export declare class SerializedContext<Req, Res, Supported extends string, Added
|
|
|
41
41
|
customParameters?: CustomParameters;
|
|
42
42
|
graphqlData?: GraphQLData[];
|
|
43
43
|
vid?: string;
|
|
44
|
+
origCookieVid?: string;
|
|
44
45
|
vidSource?: VidSource;
|
|
45
46
|
tokenOrigin: TokenOrigin;
|
|
46
47
|
uuid?: string;
|
|
@@ -61,6 +61,10 @@ export interface IContext<Req, Res> {
|
|
|
61
61
|
* The visitor ID, unique to the end-user.
|
|
62
62
|
*/
|
|
63
63
|
vid?: string;
|
|
64
|
+
/**
|
|
65
|
+
* The raw `_pxvid` cookie value when it fails UUID validation.
|
|
66
|
+
*/
|
|
67
|
+
origCookieVid?: string;
|
|
64
68
|
/**
|
|
65
69
|
* The secret used to decrypt the risk cookie.
|
|
66
70
|
*/
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { IConfiguration } from '../../config';
|
|
2
|
+
import { ReadonlyContext } from '../../context';
|
|
3
|
+
import { IAgenticTrust } from './IAgenticTrust';
|
|
4
|
+
import { AgenticTrustData } from './model';
|
|
5
|
+
export declare class AgenticTrust<Req, Res, Supported extends string, Added> implements IAgenticTrust<Req, Res> {
|
|
6
|
+
protected readonly config: IConfiguration<Req, Res, Supported, Added>;
|
|
7
|
+
constructor(config: IConfiguration<Req, Res, Supported, Added>);
|
|
8
|
+
enrichContextFromRequest(context: ReadonlyContext<Req, Res>): Promise<AgenticTrustData | null>;
|
|
9
|
+
enrichContextFromRiskApi(_context: ReadonlyContext<Req, Res>): Promise<Partial<AgenticTrustData> | null>;
|
|
10
|
+
modifyIncomingRequest(_context: ReadonlyContext<Req, Res>): Promise<void>;
|
|
11
|
+
enrichContextFromResponse(context: ReadonlyContext<Req, Res>): Promise<Partial<AgenticTrustData> | null>;
|
|
12
|
+
modifyOutgoingResponse(_context: ReadonlyContext<Req, Res>): Promise<void>;
|
|
13
|
+
protected isMatchingEndpoint(context: ReadonlyContext<Req, Res>): boolean;
|
|
14
|
+
protected extractFromBody(context: ReadonlyContext<Req, Res>, data: AgenticTrustData): Promise<void>;
|
|
15
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './AgenticTrustData';
|
|
@@ -11,9 +11,11 @@ export type DefaultBotDefenderBlockerConstructorOptions<Req, Res> = {
|
|
|
11
11
|
export declare class DefaultBotDefenderBlocker<Req, Res, Supported extends string, Added> implements IConditionalBlocker<Req, Res> {
|
|
12
12
|
protected readonly config: IConfiguration<Req, Res, Supported, Added>;
|
|
13
13
|
protected readonly captchaBlocker: IBlocker<Req, Res>;
|
|
14
|
+
protected readonly base64Utils?: IBase64Utils;
|
|
14
15
|
constructor(config: IConfiguration<Req, Res, Supported, Added>, options: DefaultBotDefenderBlockerConstructorOptions<Req, Res>);
|
|
15
16
|
shouldBlock({ action, reasons }: ReadonlyContext<Req, Res>): boolean;
|
|
16
17
|
createBlockResponse(context: ReadonlyContext<Req, Res>): IMinimalResponse;
|
|
18
|
+
protected createHardBlockResponse(context: ReadonlyContext<Req, Res>): IMinimalResponse;
|
|
17
19
|
protected createRateLimitResponse(): IMinimalResponse;
|
|
18
20
|
private createCaptchaResponse;
|
|
19
21
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const HARD_BLOCK_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-hard-block\">\n <title>Access Denied</title>\n {{cssRef}}\n <style>\n @import url('https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;500&display=swap');\n body {\n background-color: #fafbfc;\n margin: 0;\n padding: 0;\n }\n .px-hard-block-container {\n position: fixed;\n background-color: #fff;\n font-family: Roboto, sans-serif;\n }\n .px-hard-block-logo {\n text-align: center;\n margin: 30px 0 0;\n }\n .px-hard-block-logo img {\n max-height: 50px;\n }\n .px-hard-block-logo img[src=\"\"] {\n display: none;\n }\n .px-hard-block-header {\n color: #000;\n font-size: 29px;\n margin: 35px 0 20px;\n font-weight: 500;\n line-height: 1;\n text-align: center;\n }\n .px-hard-block-message {\n color: #646464;\n font-size: 16px;\n margin: 0 30px 25px;\n line-height: 1.4;\n text-align: center;\n }\n .px-hard-block-refid {\n border-top: solid 1px #f0eeee;\n height: 27px;\n margin: 15px 0 0;\n border-radius: 0 0 3px 3px;\n background-color: #fafbfc;\n font-size: 10px;\n line-height: 2.5;\n text-align: center;\n color: #b1b5b8;\n }\n @media (min-width: 620px) {\n .px-hard-block-container {\n width: 530px;\n top: 50%;\n left: 50%;\n margin-top: -150px;\n margin-left: -265px;\n border-radius: 3px;\n box-shadow: 0 2px 9px -1px rgba(0,0,0,.13);\n }\n }\n @media (min-width: 481px) and (max-width: 619px) {\n .px-hard-block-container {\n width: 85%;\n top: 50%;\n left: 50%;\n margin-top: -150px;\n margin-left: -42.5%;\n border-radius: 3px;\n box-shadow: 0 2px 9px -1px rgba(0,0,0,.13);\n }\n }\n @media (max-width: 480px) {\n body { background-color: #fff; }\n .px-hard-block-container {\n width: 100%;\n top: 50%;\n left: 0;\n margin-top: -150px;\n }\n .px-hard-block-refid {\n position: fixed;\n width: 100%;\n left: 0;\n bottom: 0;\n border-radius: 0;\n font-size: 14px;\n line-height: 2;\n }\n }\n </style>\n</head>\n<body>\n <div class=\"px-hard-block-container\">\n <div class=\"px-hard-block-logo\"><img src=\"{{customLogo}}\" alt=\"\"></div>\n <div class=\"px-hard-block-header\">Access Denied</div>\n <div class=\"px-hard-block-message\">Access to this page has been denied.<br>Please contact the site administrator if you believe this is an error.</div>\n <div class=\"px-hard-block-refid\">Reference ID: {{uuid}}</div>\n </div>\n {{jsRef}}\n</body>\n</html>\n";
|
|
@@ -3,4 +3,5 @@ import { BotDefenderData } from '../bot_defender';
|
|
|
3
3
|
import { CredentialIntelligenceData } from '../credential_intelligence';
|
|
4
4
|
import { AccountDefenderData } from '../account_defender';
|
|
5
5
|
import { HypeSaleChallengeData } from '../hype_sale_challenge';
|
|
6
|
-
|
|
6
|
+
import { AgenticTrustData } from '../agentic_trust';
|
|
7
|
+
export type ProductDataType<Name extends ProductName> = Name extends ProductName.BOT_DEFENDER ? BotDefenderData : Name extends ProductName.CREDENTIAL_INTELLIGENCE ? CredentialIntelligenceData : Name extends ProductName.ACCOUNT_DEFENDER ? AccountDefenderData : Name extends ProductName.HYPE_SALE_CHALLENGE ? HypeSaleChallengeData : Name extends ProductName.AGENTIC_TRUST ? AgenticTrustData : never;
|
|
@@ -3,4 +3,5 @@ import { IBotDefender } from '../bot_defender';
|
|
|
3
3
|
import { ICredentialIntelligence } from '../credential_intelligence';
|
|
4
4
|
import { IAccountDefender } from '../account_defender';
|
|
5
5
|
import { IHypeSaleChallenge } from '../hype_sale_challenge';
|
|
6
|
-
|
|
6
|
+
import { IAgenticTrust } from '../agentic_trust';
|
|
7
|
+
export type ProductType<Name extends ProductName, Req, Res> = Name extends ProductName.BOT_DEFENDER ? IBotDefender<Req, Res> : Name extends ProductName.CREDENTIAL_INTELLIGENCE ? ICredentialIntelligence<Req, Res> : Name extends ProductName.ACCOUNT_DEFENDER ? IAccountDefender<Req, Res> : Name extends ProductName.HYPE_SALE_CHALLENGE ? IHypeSaleChallenge<Req, Res> : Name extends ProductName.AGENTIC_TRUST ? IAgenticTrust<Req, Res> : never;
|
|
@@ -31,6 +31,7 @@ export declare const createRiskApiActivity: <Req, Res, Supported extends string,
|
|
|
31
31
|
tls_preferred_ciphers?: string;
|
|
32
32
|
tls_ja3_fingerprint?: string;
|
|
33
33
|
enforcer_vid_source?: import("../utils").VidSource;
|
|
34
|
+
orig_cookie_vid?: string;
|
|
34
35
|
original_uuid?: string;
|
|
35
36
|
original_token_error?: string;
|
|
36
37
|
original_token?: string;
|
|
@@ -54,6 +55,11 @@ export declare const createRiskApiActivity: <Req, Res, Supported extends string,
|
|
|
54
55
|
raw_url?: string;
|
|
55
56
|
used_cookie_secret?: string;
|
|
56
57
|
is_sensitive_route?: boolean;
|
|
58
|
+
mcp_method?: string;
|
|
59
|
+
mcp_tool_name?: string;
|
|
60
|
+
mcp_tool_argument_keys?: string;
|
|
61
|
+
mcp_session_id?: string;
|
|
62
|
+
mcp_http_method?: string;
|
|
57
63
|
custom_param1?: any;
|
|
58
64
|
custom_param2?: any;
|
|
59
65
|
custom_param3?: any;
|
|
@@ -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.37.0";
|