@kaitranntt/ccs 7.79.1-dev.16 → 7.79.1-dev.18
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.
|
@@ -83,6 +83,16 @@ const TOOL_HOVER = 'browser_hover';
|
|
|
83
83
|
const TOOL_QUERY = 'browser_query';
|
|
84
84
|
const TOOL_TAKE_ELEMENT_SCREENSHOT = 'browser_take_element_screenshot';
|
|
85
85
|
const TOOL_WAIT_FOR_EVENT = 'browser_wait_for_event';
|
|
86
|
+
const SENSITIVE_INTERCEPT_HEADER_NAMES = new Set([
|
|
87
|
+
'authorization',
|
|
88
|
+
'cookie',
|
|
89
|
+
'cookie2',
|
|
90
|
+
'proxy-authorization',
|
|
91
|
+
'x-api-key',
|
|
92
|
+
'x-api-token',
|
|
93
|
+
'x-auth-token',
|
|
94
|
+
]);
|
|
95
|
+
|
|
86
96
|
const TOOL_NAMES = [
|
|
87
97
|
TOOL_SESSION_INFO,
|
|
88
98
|
TOOL_URL_TITLE,
|
|
@@ -612,10 +622,15 @@ function getTools() {
|
|
|
612
622
|
urlRegex: { type: 'string' },
|
|
613
623
|
headerMatchers: {
|
|
614
624
|
type: 'array',
|
|
625
|
+
description:
|
|
626
|
+
'Match non-sensitive request headers. Cookie, Authorization, and token headers are not allowed.',
|
|
615
627
|
items: {
|
|
616
628
|
type: 'object',
|
|
617
629
|
properties: {
|
|
618
|
-
name: {
|
|
630
|
+
name: {
|
|
631
|
+
type: 'string',
|
|
632
|
+
description: 'Non-sensitive request header name to match.',
|
|
633
|
+
},
|
|
619
634
|
valueIncludes: { type: 'string' },
|
|
620
635
|
valueRegex: { type: 'string' },
|
|
621
636
|
},
|
|
@@ -624,7 +639,7 @@ function getTools() {
|
|
|
624
639
|
},
|
|
625
640
|
},
|
|
626
641
|
priority: { type: 'integer' },
|
|
627
|
-
action: { type: 'string', enum:
|
|
642
|
+
action: { type: 'string', enum: getInterceptActionEnum() },
|
|
628
643
|
statusCode: { type: 'integer', minimum: 100, maximum: 599 },
|
|
629
644
|
responseHeaders: {
|
|
630
645
|
type: 'array',
|
|
@@ -1277,9 +1292,30 @@ function parseOptionalPageId(toolArgs) {
|
|
|
1277
1292
|
: '';
|
|
1278
1293
|
}
|
|
1279
1294
|
|
|
1295
|
+
function getBrowserInterceptFulfillMode() {
|
|
1296
|
+
return String(process.env.CCS_BROWSER_INTERCEPT_FULFILL_MODE || 'disabled').trim() === 'enabled'
|
|
1297
|
+
? 'enabled'
|
|
1298
|
+
: 'disabled';
|
|
1299
|
+
}
|
|
1300
|
+
|
|
1301
|
+
function isBrowserInterceptFulfillEnabled() {
|
|
1302
|
+
return getBrowserInterceptFulfillMode() === 'enabled';
|
|
1303
|
+
}
|
|
1304
|
+
|
|
1305
|
+
function getInterceptActionEnum() {
|
|
1306
|
+
return isBrowserInterceptFulfillEnabled()
|
|
1307
|
+
? ['continue', 'fail', 'fulfill']
|
|
1308
|
+
: ['continue', 'fail'];
|
|
1309
|
+
}
|
|
1310
|
+
|
|
1280
1311
|
function parseInterceptAction(value) {
|
|
1312
|
+
if (value === 'fulfill' && !isBrowserInterceptFulfillEnabled()) {
|
|
1313
|
+
throw new Error(
|
|
1314
|
+
'action fulfill is disabled by CCS_BROWSER_INTERCEPT_FULFILL_MODE=disabled; set it to enabled only for trusted local testing'
|
|
1315
|
+
);
|
|
1316
|
+
}
|
|
1281
1317
|
if (value !== 'continue' && value !== 'fail' && value !== 'fulfill') {
|
|
1282
|
-
throw new Error(
|
|
1318
|
+
throw new Error(`action must be one of: ${getInterceptActionEnum().join(', ')}`);
|
|
1283
1319
|
}
|
|
1284
1320
|
return value;
|
|
1285
1321
|
}
|
|
@@ -1379,6 +1415,10 @@ function parseOptionalPriority(value) {
|
|
|
1379
1415
|
return value;
|
|
1380
1416
|
}
|
|
1381
1417
|
|
|
1418
|
+
function isSensitiveInterceptHeaderName(name) {
|
|
1419
|
+
return SENSITIVE_INTERCEPT_HEADER_NAMES.has(name.toLowerCase());
|
|
1420
|
+
}
|
|
1421
|
+
|
|
1382
1422
|
function parseOptionalHeaderMatchers(value) {
|
|
1383
1423
|
if (value === undefined) {
|
|
1384
1424
|
return [];
|
|
@@ -1391,6 +1431,9 @@ function parseOptionalHeaderMatchers(value) {
|
|
|
1391
1431
|
throw new Error('headerMatchers entries must be objects');
|
|
1392
1432
|
}
|
|
1393
1433
|
const name = requireNonEmptyString(entry.name, 'headerMatchers.name');
|
|
1434
|
+
if (isSensitiveInterceptHeaderName(name)) {
|
|
1435
|
+
throw new Error(`headerMatchers.name cannot target sensitive request header: ${name}`);
|
|
1436
|
+
}
|
|
1394
1437
|
const valueIncludes =
|
|
1395
1438
|
entry.valueIncludes === undefined
|
|
1396
1439
|
? ''
|