@frontmcp/adapters 1.8.4 → 1.8.5
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/esm/index.mjs +26 -14
- package/esm/openapi/index.mjs +26 -14
- package/esm/package.json +6 -6
- package/index.js +26 -14
- package/openapi/index.js +26 -14
- package/openapi/openapi.adapter.d.ts +3 -2
- package/openapi/openapi.adapter.d.ts.map +1 -1
- package/openapi/openapi.security.d.ts +6 -0
- package/openapi/openapi.security.d.ts.map +1 -1
- package/package.json +6 -6
package/esm/index.mjs
CHANGED
|
@@ -420,11 +420,16 @@ function assertRequestHasCredential(tool2, url, headers) {
|
|
|
420
420
|
}
|
|
421
421
|
function validateSecurityConfiguration(tools, options) {
|
|
422
422
|
const result = validateCredentialSources(tools, options);
|
|
423
|
-
const schemesInInput = options
|
|
424
|
-
if (
|
|
423
|
+
const schemesInInput = inputSecuritySchemes(options);
|
|
424
|
+
if (schemesInInput !== "all" && schemesInInput.size > 0) {
|
|
425
|
+
const include = options.generateOptions?.includeSecurityInInput;
|
|
426
|
+
const sources = [
|
|
427
|
+
(options.securitySchemesInInput?.length ?? 0) > 0 ? "securitySchemesInInput" : void 0,
|
|
428
|
+
Array.isArray(include) && include.length > 0 ? "an includeSecurityInInput list" : void 0
|
|
429
|
+
].filter((source) => source !== void 0);
|
|
425
430
|
result.securityRiskScore = "high";
|
|
426
431
|
result.warnings.push(
|
|
427
|
-
`SECURITY WARNING:
|
|
432
|
+
`SECURITY WARNING: ${sources.join(" and ")} ${sources.length > 1 ? "are" : "is"} enabled. The model provides the credential for security schemes ${[...schemesInInput].join(", ")} in tool inputs, used when the server supplies none. Credentials may be logged or exposed, and the model chooses whose account a call uses.`
|
|
428
433
|
);
|
|
429
434
|
}
|
|
430
435
|
return result;
|
|
@@ -437,8 +442,8 @@ function validateCredentialSources(tools, options) {
|
|
|
437
442
|
securityRiskScore: "low"
|
|
438
443
|
};
|
|
439
444
|
const securitySchemes = describeSecuritySchemes(tools);
|
|
440
|
-
const
|
|
441
|
-
if (
|
|
445
|
+
const inputSchemes = inputSecuritySchemes(options);
|
|
446
|
+
if (inputSchemes === "all") {
|
|
442
447
|
result.securityRiskScore = "high";
|
|
443
448
|
result.warnings.push(
|
|
444
449
|
"SECURITY WARNING: includeSecurityInInput is enabled. Users will provide authentication directly in tool inputs (used for a scheme when the server supplies none). This increases security risk as credentials may be logged or exposed."
|
|
@@ -459,7 +464,7 @@ function validateCredentialSources(tools, options) {
|
|
|
459
464
|
);
|
|
460
465
|
return withPassthroughRisk(result, securitySchemes, options);
|
|
461
466
|
}
|
|
462
|
-
const schemesInInput =
|
|
467
|
+
const schemesInInput = inputSchemes;
|
|
463
468
|
if (options.authProviderMapper || schemesInInput.size > 0) {
|
|
464
469
|
result.securityRiskScore = "low";
|
|
465
470
|
const passthroughFallback = [];
|
|
@@ -552,8 +557,14 @@ async function resolveToolSecurity(tool2, ctx, options, request = {}) {
|
|
|
552
557
|
cookies: { ...fromInput.cookies, ...resolved.cookies }
|
|
553
558
|
};
|
|
554
559
|
}
|
|
560
|
+
function inputSecuritySchemes(options) {
|
|
561
|
+
const include = options.generateOptions?.includeSecurityInInput;
|
|
562
|
+
if (include === true) return "all";
|
|
563
|
+
return /* @__PURE__ */ new Set([...Array.isArray(include) ? include : [], ...options.securitySchemesInInput ?? []]);
|
|
564
|
+
}
|
|
555
565
|
function isInputScheme(scheme, options) {
|
|
556
|
-
|
|
566
|
+
const schemes = inputSecuritySchemes(options);
|
|
567
|
+
return schemes === "all" || schemes.has(scheme);
|
|
557
568
|
}
|
|
558
569
|
function inputCredentialContext(security, value) {
|
|
559
570
|
const bare = value.replace(/^(?:bearer|basic)\s+/i, "");
|
|
@@ -1341,8 +1352,9 @@ var OpenapiAdapter = class extends DynamicAdapter {
|
|
|
1341
1352
|
if (!this.generator) {
|
|
1342
1353
|
this.generator = await this.initializeGenerator();
|
|
1343
1354
|
}
|
|
1344
|
-
const
|
|
1345
|
-
const
|
|
1355
|
+
const inputSchemes = inputSecuritySchemes(this.options);
|
|
1356
|
+
const hasPerSchemeControl = inputSchemes !== "all" && inputSchemes.size > 0;
|
|
1357
|
+
const includeSecurityInInput = inputSchemes === "all" || hasPerSchemeControl;
|
|
1346
1358
|
let openapiTools = await this.generator.generateTools({
|
|
1347
1359
|
includeOperations: this.options.generateOptions?.includeOperations,
|
|
1348
1360
|
excludeOperations: this.options.generateOptions?.excludeOperations,
|
|
@@ -1358,7 +1370,7 @@ var OpenapiAdapter = class extends DynamicAdapter {
|
|
|
1358
1370
|
formatResolvers: this.options.generateOptions?.formatResolvers
|
|
1359
1371
|
});
|
|
1360
1372
|
if (hasPerSchemeControl) {
|
|
1361
|
-
openapiTools = openapiTools.map((tool2) => this.filterSecuritySchemes(tool2));
|
|
1373
|
+
openapiTools = openapiTools.map((tool2) => this.filterSecuritySchemes(tool2, inputSchemes));
|
|
1362
1374
|
}
|
|
1363
1375
|
const validation = validateSecurityConfiguration(openapiTools, this.options);
|
|
1364
1376
|
this.logger.info("Security Analysis:");
|
|
@@ -1669,12 +1681,12 @@ ${opDescription}`;
|
|
|
1669
1681
|
};
|
|
1670
1682
|
}
|
|
1671
1683
|
/**
|
|
1672
|
-
* Filter security schemes in tool input
|
|
1673
|
-
* Removes security inputs that should be resolved from context
|
|
1684
|
+
* Filter security schemes in tool input to the ones named for it (`securitySchemesInInput`, or an
|
|
1685
|
+
* `includeSecurityInInput` list). Removes security inputs that should be resolved from context
|
|
1686
|
+
* instead of user input.
|
|
1674
1687
|
* @private
|
|
1675
1688
|
*/
|
|
1676
|
-
filterSecuritySchemes(tool2) {
|
|
1677
|
-
const allowedSchemes = new Set(this.options.securitySchemesInInput || []);
|
|
1689
|
+
filterSecuritySchemes(tool2, allowedSchemes) {
|
|
1678
1690
|
if (allowedSchemes.size === 0) return tool2;
|
|
1679
1691
|
const schemesToRemove = /* @__PURE__ */ new Set();
|
|
1680
1692
|
const inputKeysToRemove = /* @__PURE__ */ new Set();
|
package/esm/openapi/index.mjs
CHANGED
|
@@ -420,11 +420,16 @@ function assertRequestHasCredential(tool2, url, headers) {
|
|
|
420
420
|
}
|
|
421
421
|
function validateSecurityConfiguration(tools, options) {
|
|
422
422
|
const result = validateCredentialSources(tools, options);
|
|
423
|
-
const schemesInInput = options
|
|
424
|
-
if (
|
|
423
|
+
const schemesInInput = inputSecuritySchemes(options);
|
|
424
|
+
if (schemesInInput !== "all" && schemesInInput.size > 0) {
|
|
425
|
+
const include = options.generateOptions?.includeSecurityInInput;
|
|
426
|
+
const sources = [
|
|
427
|
+
(options.securitySchemesInInput?.length ?? 0) > 0 ? "securitySchemesInInput" : void 0,
|
|
428
|
+
Array.isArray(include) && include.length > 0 ? "an includeSecurityInInput list" : void 0
|
|
429
|
+
].filter((source) => source !== void 0);
|
|
425
430
|
result.securityRiskScore = "high";
|
|
426
431
|
result.warnings.push(
|
|
427
|
-
`SECURITY WARNING:
|
|
432
|
+
`SECURITY WARNING: ${sources.join(" and ")} ${sources.length > 1 ? "are" : "is"} enabled. The model provides the credential for security schemes ${[...schemesInInput].join(", ")} in tool inputs, used when the server supplies none. Credentials may be logged or exposed, and the model chooses whose account a call uses.`
|
|
428
433
|
);
|
|
429
434
|
}
|
|
430
435
|
return result;
|
|
@@ -437,8 +442,8 @@ function validateCredentialSources(tools, options) {
|
|
|
437
442
|
securityRiskScore: "low"
|
|
438
443
|
};
|
|
439
444
|
const securitySchemes = describeSecuritySchemes(tools);
|
|
440
|
-
const
|
|
441
|
-
if (
|
|
445
|
+
const inputSchemes = inputSecuritySchemes(options);
|
|
446
|
+
if (inputSchemes === "all") {
|
|
442
447
|
result.securityRiskScore = "high";
|
|
443
448
|
result.warnings.push(
|
|
444
449
|
"SECURITY WARNING: includeSecurityInInput is enabled. Users will provide authentication directly in tool inputs (used for a scheme when the server supplies none). This increases security risk as credentials may be logged or exposed."
|
|
@@ -459,7 +464,7 @@ function validateCredentialSources(tools, options) {
|
|
|
459
464
|
);
|
|
460
465
|
return withPassthroughRisk(result, securitySchemes, options);
|
|
461
466
|
}
|
|
462
|
-
const schemesInInput =
|
|
467
|
+
const schemesInInput = inputSchemes;
|
|
463
468
|
if (options.authProviderMapper || schemesInInput.size > 0) {
|
|
464
469
|
result.securityRiskScore = "low";
|
|
465
470
|
const passthroughFallback = [];
|
|
@@ -552,8 +557,14 @@ async function resolveToolSecurity(tool2, ctx, options, request = {}) {
|
|
|
552
557
|
cookies: { ...fromInput.cookies, ...resolved.cookies }
|
|
553
558
|
};
|
|
554
559
|
}
|
|
560
|
+
function inputSecuritySchemes(options) {
|
|
561
|
+
const include = options.generateOptions?.includeSecurityInInput;
|
|
562
|
+
if (include === true) return "all";
|
|
563
|
+
return /* @__PURE__ */ new Set([...Array.isArray(include) ? include : [], ...options.securitySchemesInInput ?? []]);
|
|
564
|
+
}
|
|
555
565
|
function isInputScheme(scheme, options) {
|
|
556
|
-
|
|
566
|
+
const schemes = inputSecuritySchemes(options);
|
|
567
|
+
return schemes === "all" || schemes.has(scheme);
|
|
557
568
|
}
|
|
558
569
|
function inputCredentialContext(security, value) {
|
|
559
570
|
const bare = value.replace(/^(?:bearer|basic)\s+/i, "");
|
|
@@ -1341,8 +1352,9 @@ var OpenapiAdapter = class extends DynamicAdapter {
|
|
|
1341
1352
|
if (!this.generator) {
|
|
1342
1353
|
this.generator = await this.initializeGenerator();
|
|
1343
1354
|
}
|
|
1344
|
-
const
|
|
1345
|
-
const
|
|
1355
|
+
const inputSchemes = inputSecuritySchemes(this.options);
|
|
1356
|
+
const hasPerSchemeControl = inputSchemes !== "all" && inputSchemes.size > 0;
|
|
1357
|
+
const includeSecurityInInput = inputSchemes === "all" || hasPerSchemeControl;
|
|
1346
1358
|
let openapiTools = await this.generator.generateTools({
|
|
1347
1359
|
includeOperations: this.options.generateOptions?.includeOperations,
|
|
1348
1360
|
excludeOperations: this.options.generateOptions?.excludeOperations,
|
|
@@ -1358,7 +1370,7 @@ var OpenapiAdapter = class extends DynamicAdapter {
|
|
|
1358
1370
|
formatResolvers: this.options.generateOptions?.formatResolvers
|
|
1359
1371
|
});
|
|
1360
1372
|
if (hasPerSchemeControl) {
|
|
1361
|
-
openapiTools = openapiTools.map((tool2) => this.filterSecuritySchemes(tool2));
|
|
1373
|
+
openapiTools = openapiTools.map((tool2) => this.filterSecuritySchemes(tool2, inputSchemes));
|
|
1362
1374
|
}
|
|
1363
1375
|
const validation = validateSecurityConfiguration(openapiTools, this.options);
|
|
1364
1376
|
this.logger.info("Security Analysis:");
|
|
@@ -1669,12 +1681,12 @@ ${opDescription}`;
|
|
|
1669
1681
|
};
|
|
1670
1682
|
}
|
|
1671
1683
|
/**
|
|
1672
|
-
* Filter security schemes in tool input
|
|
1673
|
-
* Removes security inputs that should be resolved from context
|
|
1684
|
+
* Filter security schemes in tool input to the ones named for it (`securitySchemesInInput`, or an
|
|
1685
|
+
* `includeSecurityInInput` list). Removes security inputs that should be resolved from context
|
|
1686
|
+
* instead of user input.
|
|
1674
1687
|
* @private
|
|
1675
1688
|
*/
|
|
1676
|
-
filterSecuritySchemes(tool2) {
|
|
1677
|
-
const allowedSchemes = new Set(this.options.securitySchemesInInput || []);
|
|
1689
|
+
filterSecuritySchemes(tool2, allowedSchemes) {
|
|
1678
1690
|
if (allowedSchemes.size === 0) return tool2;
|
|
1679
1691
|
const schemesToRemove = /* @__PURE__ */ new Set();
|
|
1680
1692
|
const inputKeysToRemove = /* @__PURE__ */ new Set();
|
package/esm/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@frontmcp/adapters",
|
|
3
|
-
"version": "1.8.
|
|
3
|
+
"version": "1.8.5",
|
|
4
4
|
"description": "Adapters for the FrontMCP framework",
|
|
5
5
|
"author": "AgentFront <info@agentfront.dev>",
|
|
6
6
|
"homepage": "https://docs.agentfront.dev",
|
|
@@ -64,15 +64,15 @@
|
|
|
64
64
|
"node": ">=24.0.0"
|
|
65
65
|
},
|
|
66
66
|
"dependencies": {
|
|
67
|
-
"@frontmcp/auth": "1.8.
|
|
68
|
-
"@frontmcp/di": "1.8.
|
|
69
|
-
"@frontmcp/sdk": "1.8.
|
|
70
|
-
"@frontmcp/utils": "1.8.
|
|
67
|
+
"@frontmcp/auth": "1.8.5",
|
|
68
|
+
"@frontmcp/di": "1.8.5",
|
|
69
|
+
"@frontmcp/sdk": "1.8.5",
|
|
70
|
+
"@frontmcp/utils": "1.8.5",
|
|
71
71
|
"js-yaml": "^4.1.0",
|
|
72
72
|
"mcp-from-openapi": "2.8.0",
|
|
73
73
|
"openapi-types": "^12.1.3"
|
|
74
74
|
},
|
|
75
75
|
"peerDependencies": {
|
|
76
|
-
"@frontmcp/lazy-zod": "1.8.
|
|
76
|
+
"@frontmcp/lazy-zod": "1.8.5"
|
|
77
77
|
}
|
|
78
78
|
}
|
package/index.js
CHANGED
|
@@ -452,11 +452,16 @@ function assertRequestHasCredential(tool2, url, headers) {
|
|
|
452
452
|
}
|
|
453
453
|
function validateSecurityConfiguration(tools, options) {
|
|
454
454
|
const result = validateCredentialSources(tools, options);
|
|
455
|
-
const schemesInInput = options
|
|
456
|
-
if (
|
|
455
|
+
const schemesInInput = inputSecuritySchemes(options);
|
|
456
|
+
if (schemesInInput !== "all" && schemesInInput.size > 0) {
|
|
457
|
+
const include = options.generateOptions?.includeSecurityInInput;
|
|
458
|
+
const sources = [
|
|
459
|
+
(options.securitySchemesInInput?.length ?? 0) > 0 ? "securitySchemesInInput" : void 0,
|
|
460
|
+
Array.isArray(include) && include.length > 0 ? "an includeSecurityInInput list" : void 0
|
|
461
|
+
].filter((source) => source !== void 0);
|
|
457
462
|
result.securityRiskScore = "high";
|
|
458
463
|
result.warnings.push(
|
|
459
|
-
`SECURITY WARNING:
|
|
464
|
+
`SECURITY WARNING: ${sources.join(" and ")} ${sources.length > 1 ? "are" : "is"} enabled. The model provides the credential for security schemes ${[...schemesInInput].join(", ")} in tool inputs, used when the server supplies none. Credentials may be logged or exposed, and the model chooses whose account a call uses.`
|
|
460
465
|
);
|
|
461
466
|
}
|
|
462
467
|
return result;
|
|
@@ -469,8 +474,8 @@ function validateCredentialSources(tools, options) {
|
|
|
469
474
|
securityRiskScore: "low"
|
|
470
475
|
};
|
|
471
476
|
const securitySchemes = describeSecuritySchemes(tools);
|
|
472
|
-
const
|
|
473
|
-
if (
|
|
477
|
+
const inputSchemes = inputSecuritySchemes(options);
|
|
478
|
+
if (inputSchemes === "all") {
|
|
474
479
|
result.securityRiskScore = "high";
|
|
475
480
|
result.warnings.push(
|
|
476
481
|
"SECURITY WARNING: includeSecurityInInput is enabled. Users will provide authentication directly in tool inputs (used for a scheme when the server supplies none). This increases security risk as credentials may be logged or exposed."
|
|
@@ -491,7 +496,7 @@ function validateCredentialSources(tools, options) {
|
|
|
491
496
|
);
|
|
492
497
|
return withPassthroughRisk(result, securitySchemes, options);
|
|
493
498
|
}
|
|
494
|
-
const schemesInInput =
|
|
499
|
+
const schemesInInput = inputSchemes;
|
|
495
500
|
if (options.authProviderMapper || schemesInInput.size > 0) {
|
|
496
501
|
result.securityRiskScore = "low";
|
|
497
502
|
const passthroughFallback = [];
|
|
@@ -584,8 +589,14 @@ async function resolveToolSecurity(tool2, ctx, options, request = {}) {
|
|
|
584
589
|
cookies: { ...fromInput.cookies, ...resolved.cookies }
|
|
585
590
|
};
|
|
586
591
|
}
|
|
592
|
+
function inputSecuritySchemes(options) {
|
|
593
|
+
const include = options.generateOptions?.includeSecurityInInput;
|
|
594
|
+
if (include === true) return "all";
|
|
595
|
+
return /* @__PURE__ */ new Set([...Array.isArray(include) ? include : [], ...options.securitySchemesInInput ?? []]);
|
|
596
|
+
}
|
|
587
597
|
function isInputScheme(scheme, options) {
|
|
588
|
-
|
|
598
|
+
const schemes = inputSecuritySchemes(options);
|
|
599
|
+
return schemes === "all" || schemes.has(scheme);
|
|
589
600
|
}
|
|
590
601
|
function inputCredentialContext(security, value) {
|
|
591
602
|
const bare = value.replace(/^(?:bearer|basic)\s+/i, "");
|
|
@@ -1373,8 +1384,9 @@ var OpenapiAdapter = class extends import_sdk5.DynamicAdapter {
|
|
|
1373
1384
|
if (!this.generator) {
|
|
1374
1385
|
this.generator = await this.initializeGenerator();
|
|
1375
1386
|
}
|
|
1376
|
-
const
|
|
1377
|
-
const
|
|
1387
|
+
const inputSchemes = inputSecuritySchemes(this.options);
|
|
1388
|
+
const hasPerSchemeControl = inputSchemes !== "all" && inputSchemes.size > 0;
|
|
1389
|
+
const includeSecurityInInput = inputSchemes === "all" || hasPerSchemeControl;
|
|
1378
1390
|
let openapiTools = await this.generator.generateTools({
|
|
1379
1391
|
includeOperations: this.options.generateOptions?.includeOperations,
|
|
1380
1392
|
excludeOperations: this.options.generateOptions?.excludeOperations,
|
|
@@ -1390,7 +1402,7 @@ var OpenapiAdapter = class extends import_sdk5.DynamicAdapter {
|
|
|
1390
1402
|
formatResolvers: this.options.generateOptions?.formatResolvers
|
|
1391
1403
|
});
|
|
1392
1404
|
if (hasPerSchemeControl) {
|
|
1393
|
-
openapiTools = openapiTools.map((tool2) => this.filterSecuritySchemes(tool2));
|
|
1405
|
+
openapiTools = openapiTools.map((tool2) => this.filterSecuritySchemes(tool2, inputSchemes));
|
|
1394
1406
|
}
|
|
1395
1407
|
const validation = validateSecurityConfiguration(openapiTools, this.options);
|
|
1396
1408
|
this.logger.info("Security Analysis:");
|
|
@@ -1701,12 +1713,12 @@ ${opDescription}`;
|
|
|
1701
1713
|
};
|
|
1702
1714
|
}
|
|
1703
1715
|
/**
|
|
1704
|
-
* Filter security schemes in tool input
|
|
1705
|
-
* Removes security inputs that should be resolved from context
|
|
1716
|
+
* Filter security schemes in tool input to the ones named for it (`securitySchemesInInput`, or an
|
|
1717
|
+
* `includeSecurityInInput` list). Removes security inputs that should be resolved from context
|
|
1718
|
+
* instead of user input.
|
|
1706
1719
|
* @private
|
|
1707
1720
|
*/
|
|
1708
|
-
filterSecuritySchemes(tool2) {
|
|
1709
|
-
const allowedSchemes = new Set(this.options.securitySchemesInInput || []);
|
|
1721
|
+
filterSecuritySchemes(tool2, allowedSchemes) {
|
|
1710
1722
|
if (allowedSchemes.size === 0) return tool2;
|
|
1711
1723
|
const schemesToRemove = /* @__PURE__ */ new Set();
|
|
1712
1724
|
const inputKeysToRemove = /* @__PURE__ */ new Set();
|
package/openapi/index.js
CHANGED
|
@@ -452,11 +452,16 @@ function assertRequestHasCredential(tool2, url, headers) {
|
|
|
452
452
|
}
|
|
453
453
|
function validateSecurityConfiguration(tools, options) {
|
|
454
454
|
const result = validateCredentialSources(tools, options);
|
|
455
|
-
const schemesInInput = options
|
|
456
|
-
if (
|
|
455
|
+
const schemesInInput = inputSecuritySchemes(options);
|
|
456
|
+
if (schemesInInput !== "all" && schemesInInput.size > 0) {
|
|
457
|
+
const include = options.generateOptions?.includeSecurityInInput;
|
|
458
|
+
const sources = [
|
|
459
|
+
(options.securitySchemesInInput?.length ?? 0) > 0 ? "securitySchemesInInput" : void 0,
|
|
460
|
+
Array.isArray(include) && include.length > 0 ? "an includeSecurityInInput list" : void 0
|
|
461
|
+
].filter((source) => source !== void 0);
|
|
457
462
|
result.securityRiskScore = "high";
|
|
458
463
|
result.warnings.push(
|
|
459
|
-
`SECURITY WARNING:
|
|
464
|
+
`SECURITY WARNING: ${sources.join(" and ")} ${sources.length > 1 ? "are" : "is"} enabled. The model provides the credential for security schemes ${[...schemesInInput].join(", ")} in tool inputs, used when the server supplies none. Credentials may be logged or exposed, and the model chooses whose account a call uses.`
|
|
460
465
|
);
|
|
461
466
|
}
|
|
462
467
|
return result;
|
|
@@ -469,8 +474,8 @@ function validateCredentialSources(tools, options) {
|
|
|
469
474
|
securityRiskScore: "low"
|
|
470
475
|
};
|
|
471
476
|
const securitySchemes = describeSecuritySchemes(tools);
|
|
472
|
-
const
|
|
473
|
-
if (
|
|
477
|
+
const inputSchemes = inputSecuritySchemes(options);
|
|
478
|
+
if (inputSchemes === "all") {
|
|
474
479
|
result.securityRiskScore = "high";
|
|
475
480
|
result.warnings.push(
|
|
476
481
|
"SECURITY WARNING: includeSecurityInInput is enabled. Users will provide authentication directly in tool inputs (used for a scheme when the server supplies none). This increases security risk as credentials may be logged or exposed."
|
|
@@ -491,7 +496,7 @@ function validateCredentialSources(tools, options) {
|
|
|
491
496
|
);
|
|
492
497
|
return withPassthroughRisk(result, securitySchemes, options);
|
|
493
498
|
}
|
|
494
|
-
const schemesInInput =
|
|
499
|
+
const schemesInInput = inputSchemes;
|
|
495
500
|
if (options.authProviderMapper || schemesInInput.size > 0) {
|
|
496
501
|
result.securityRiskScore = "low";
|
|
497
502
|
const passthroughFallback = [];
|
|
@@ -584,8 +589,14 @@ async function resolveToolSecurity(tool2, ctx, options, request = {}) {
|
|
|
584
589
|
cookies: { ...fromInput.cookies, ...resolved.cookies }
|
|
585
590
|
};
|
|
586
591
|
}
|
|
592
|
+
function inputSecuritySchemes(options) {
|
|
593
|
+
const include = options.generateOptions?.includeSecurityInInput;
|
|
594
|
+
if (include === true) return "all";
|
|
595
|
+
return /* @__PURE__ */ new Set([...Array.isArray(include) ? include : [], ...options.securitySchemesInInput ?? []]);
|
|
596
|
+
}
|
|
587
597
|
function isInputScheme(scheme, options) {
|
|
588
|
-
|
|
598
|
+
const schemes = inputSecuritySchemes(options);
|
|
599
|
+
return schemes === "all" || schemes.has(scheme);
|
|
589
600
|
}
|
|
590
601
|
function inputCredentialContext(security, value) {
|
|
591
602
|
const bare = value.replace(/^(?:bearer|basic)\s+/i, "");
|
|
@@ -1373,8 +1384,9 @@ var OpenapiAdapter = class extends import_sdk5.DynamicAdapter {
|
|
|
1373
1384
|
if (!this.generator) {
|
|
1374
1385
|
this.generator = await this.initializeGenerator();
|
|
1375
1386
|
}
|
|
1376
|
-
const
|
|
1377
|
-
const
|
|
1387
|
+
const inputSchemes = inputSecuritySchemes(this.options);
|
|
1388
|
+
const hasPerSchemeControl = inputSchemes !== "all" && inputSchemes.size > 0;
|
|
1389
|
+
const includeSecurityInInput = inputSchemes === "all" || hasPerSchemeControl;
|
|
1378
1390
|
let openapiTools = await this.generator.generateTools({
|
|
1379
1391
|
includeOperations: this.options.generateOptions?.includeOperations,
|
|
1380
1392
|
excludeOperations: this.options.generateOptions?.excludeOperations,
|
|
@@ -1390,7 +1402,7 @@ var OpenapiAdapter = class extends import_sdk5.DynamicAdapter {
|
|
|
1390
1402
|
formatResolvers: this.options.generateOptions?.formatResolvers
|
|
1391
1403
|
});
|
|
1392
1404
|
if (hasPerSchemeControl) {
|
|
1393
|
-
openapiTools = openapiTools.map((tool2) => this.filterSecuritySchemes(tool2));
|
|
1405
|
+
openapiTools = openapiTools.map((tool2) => this.filterSecuritySchemes(tool2, inputSchemes));
|
|
1394
1406
|
}
|
|
1395
1407
|
const validation = validateSecurityConfiguration(openapiTools, this.options);
|
|
1396
1408
|
this.logger.info("Security Analysis:");
|
|
@@ -1701,12 +1713,12 @@ ${opDescription}`;
|
|
|
1701
1713
|
};
|
|
1702
1714
|
}
|
|
1703
1715
|
/**
|
|
1704
|
-
* Filter security schemes in tool input
|
|
1705
|
-
* Removes security inputs that should be resolved from context
|
|
1716
|
+
* Filter security schemes in tool input to the ones named for it (`securitySchemesInInput`, or an
|
|
1717
|
+
* `includeSecurityInInput` list). Removes security inputs that should be resolved from context
|
|
1718
|
+
* instead of user input.
|
|
1706
1719
|
* @private
|
|
1707
1720
|
*/
|
|
1708
|
-
filterSecuritySchemes(tool2) {
|
|
1709
|
-
const allowedSchemes = new Set(this.options.securitySchemesInInput || []);
|
|
1721
|
+
filterSecuritySchemes(tool2, allowedSchemes) {
|
|
1710
1722
|
if (allowedSchemes.size === 0) return tool2;
|
|
1711
1723
|
const schemesToRemove = /* @__PURE__ */ new Set();
|
|
1712
1724
|
const inputKeysToRemove = /* @__PURE__ */ new Set();
|
|
@@ -63,8 +63,9 @@ export default class OpenapiAdapter extends DynamicAdapter<OpenApiAdapterOptions
|
|
|
63
63
|
*/
|
|
64
64
|
private applyInputTransforms;
|
|
65
65
|
/**
|
|
66
|
-
* Filter security schemes in tool input
|
|
67
|
-
* Removes security inputs that should be resolved from context
|
|
66
|
+
* Filter security schemes in tool input to the ones named for it (`securitySchemesInInput`, or an
|
|
67
|
+
* `includeSecurityInInput` list). Removes security inputs that should be resolved from context
|
|
68
|
+
* instead of user input.
|
|
68
69
|
* @private
|
|
69
70
|
*/
|
|
70
71
|
private filterSecuritySchemes;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"openapi.adapter.d.ts","sourceRoot":"","sources":["../../src/openapi/openapi.adapter.ts"],"names":[],"mappings":"AAEA,OAAO,EAAW,cAAc,EAAE,KAAK,uBAAuB,EAAE,KAAK,cAAc,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"openapi.adapter.d.ts","sourceRoot":"","sources":["../../src/openapi/openapi.adapter.ts"],"names":[],"mappings":"AAEA,OAAO,EAAW,cAAc,EAAE,KAAK,uBAAuB,EAAE,KAAK,cAAc,EAAE,MAAM,eAAe,CAAC;AAS3G,OAAO,EAIL,KAAK,qBAAqB,EAQ3B,MAAM,iBAAiB,CAAC;AAwBzB,MAAM,CAAC,OAAO,OAAO,cAAe,SAAQ,cAAc,CAAC,qBAAqB,CAAC;IAC/E,OAAO,CAAC,SAAS,CAAC,CAAuB;IACzC,OAAO,CAAC,MAAM,CAAiB;IACxB,OAAO,EAAE,qBAAqB,CAAC;IACtC,OAAO,CAAC,MAAM,CAAkC;IAChD,OAAO,CAAC,eAAe,CAA0D;IACjF,OAAO,CAAC,YAAY,CAAoC;gBAE5C,OAAO,EAAE,qBAAqB;IAc1C;;OAEG;IACH,SAAS,CAAC,MAAM,EAAE,cAAc,GAAG,IAAI;IAIjC,KAAK,IAAI,OAAO,CAAC,uBAAuB,CAAC;IAuH/C;;;OAGG;IACH;;;;;;;;;;OAUG;IACH,OAAO,CAAC,oBAAoB;YAId,mBAAmB;IA4BjC;;;OAGG;IACH,OAAO,CAAC,oBAAoB;IA0C5B;;;OAGG;IACH,OAAO,CAAC,cAAc;IAMtB;;;OAGG;IACH,OAAO,CAAC,qBAAqB;IA6D7B;;;OAGG;IACH,OAAO,CAAC,mBAAmB;IAsC3B;;;OAGG;IACH,OAAO,CAAC,wBAAwB;IAwBhC;;;;;OAKG;IACH,OAAO,CAAC,oBAAoB;IAoD5B;;;;;OAKG;IACH,OAAO,CAAC,qBAAqB;IA0D7B;;;;OAIG;IACH,OAAO,CAAC,qBAAqB;IA0C7B;;;OAGG;IACH,OAAO,CAAC,2BAA2B;IAkBnC;;;OAGG;IACH,OAAO,CAAC,4BAA4B;IAoBpC;;;;OAIG;YACW,wBAAwB;IAiFtC;;;OAGG;IACH,OAAO,CAAC,0BAA0B;IAgBlC;;;OAGG;IACH,OAAO,CAAC,0CAA0C;IA+BlD;;;OAGG;IACH,OAAO,CAAC,2CAA2C;IAyCnD;;;OAGG;IACH,OAAO,CAAC,qBAAqB;IAuB7B;;;OAGG;IACH,OAAO,CAAC,mBAAmB;IAiB3B;;;OAGG;IACH,QAAQ,CAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE,uBAAuB,KAAK,IAAI,GAAG,MAAM,IAAI;IAO3E;;;;OAIG;IACH,YAAY,IAAI,IAAI;IA6CpB;;OAEG;IACH,WAAW,IAAI,IAAI;CAOpB"}
|
|
@@ -93,4 +93,10 @@ export interface ResolveToolSecurityRequest {
|
|
|
93
93
|
* @throws Error if security cannot be resolved
|
|
94
94
|
*/
|
|
95
95
|
export declare function resolveToolSecurity(tool: McpOpenAPITool, ctx: FrontMcpContext, options: Pick<OpenApiAdapterOptions, 'securityResolver' | 'authProviderMapper' | 'staticAuth' | 'passthroughCallerToken' | 'generateOptions' | 'securitySchemesInInput'>, request?: ResolveToolSecurityRequest): Promise<ResolvedSecurity>;
|
|
96
|
+
/**
|
|
97
|
+
* The security schemes whose credential the tool input carries: `'all'` for
|
|
98
|
+
* `generateOptions.includeSecurityInInput: true`, otherwise the schemes an `includeSecurityInInput`
|
|
99
|
+
* list and `securitySchemesInInput` name (possibly none).
|
|
100
|
+
*/
|
|
101
|
+
export declare function inputSecuritySchemes(options: Pick<OpenApiAdapterOptions, 'generateOptions' | 'securitySchemesInInput'>): 'all' | ReadonlySet<string>;
|
|
96
102
|
//# sourceMappingURL=openapi.security.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"openapi.security.d.ts","sourceRoot":"","sources":["../../src/openapi/openapi.security.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,cAAc,EAEnB,KAAK,gBAAgB,EACrB,KAAK,eAAe,EAErB,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EAAkB,KAAK,eAAe,EAAE,MAAM,eAAe,CAAC;AAErE,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AAE7D;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED;;GAEG;AACH,MAAM,WAAW,wBAAwB;IACvC,KAAK,EAAE,OAAO,CAAC;IACf,eAAe,EAAE,MAAM,EAAE,CAAC;IAC1B,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,iBAAiB,EAAE,KAAK,GAAG,QAAQ,GAAG,MAAM,CAAC;CAC9C;AAED;;;;;;;GAOG;AACH,wBAAsB,6BAA6B,CACjD,IAAI,EAAE,cAAc,EACpB,GAAG,EAAE,eAAe,EACpB,OAAO,EAAE,IAAI,CACX,qBAAqB,EACrB,kBAAkB,GAAG,oBAAoB,GAAG,YAAY,GAAG,wBAAwB,CACpF,GACA,OAAO,CAAC,eAAe,CAAC,CA+G1B;AAwBD;;;;;GAKG;AACH,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,cAAc,EAAE,GAAG,GAAG,CAAC,MAAM,CAAC,CAY3E;AA8DD;;;;GAIG;AACH,wBAAgB,kCAAkC,CAChD,WAAW,EAAE,MAAM,EACnB,KAAK,EAAE,cAAc,EAAE,EACvB,eAAe,EAAE,MAAM,EAAE,GACxB,MAAM,CAgCR;AAqED;;;;;;;;;;;;GAYG;AACH,wBAAgB,0BAA0B,CAAC,IAAI,EAAE,cAAc,EAAE,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,GAAG,IAAI,CAOpG;AAED;;;;;;GAMG;AACH,wBAAgB,6BAA6B,CAC3C,KAAK,EAAE,cAAc,EAAE,EACvB,OAAO,EAAE,IAAI,CACX,qBAAqB,EACnB,kBAAkB,GAClB,oBAAoB,GACpB,YAAY,GACZ,iBAAiB,GACjB,wBAAwB,GACxB,wBAAwB,GACxB,mBAAmB,GACnB,eAAe,CAClB,GACA,wBAAwB,
|
|
1
|
+
{"version":3,"file":"openapi.security.d.ts","sourceRoot":"","sources":["../../src/openapi/openapi.security.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,cAAc,EAEnB,KAAK,gBAAgB,EACrB,KAAK,eAAe,EAErB,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EAAkB,KAAK,eAAe,EAAE,MAAM,eAAe,CAAC;AAErE,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AAE7D;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED;;GAEG;AACH,MAAM,WAAW,wBAAwB;IACvC,KAAK,EAAE,OAAO,CAAC;IACf,eAAe,EAAE,MAAM,EAAE,CAAC;IAC1B,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,iBAAiB,EAAE,KAAK,GAAG,QAAQ,GAAG,MAAM,CAAC;CAC9C;AAED;;;;;;;GAOG;AACH,wBAAsB,6BAA6B,CACjD,IAAI,EAAE,cAAc,EACpB,GAAG,EAAE,eAAe,EACpB,OAAO,EAAE,IAAI,CACX,qBAAqB,EACrB,kBAAkB,GAAG,oBAAoB,GAAG,YAAY,GAAG,wBAAwB,CACpF,GACA,OAAO,CAAC,eAAe,CAAC,CA+G1B;AAwBD;;;;;GAKG;AACH,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,cAAc,EAAE,GAAG,GAAG,CAAC,MAAM,CAAC,CAY3E;AA8DD;;;;GAIG;AACH,wBAAgB,kCAAkC,CAChD,WAAW,EAAE,MAAM,EACnB,KAAK,EAAE,cAAc,EAAE,EACvB,eAAe,EAAE,MAAM,EAAE,GACxB,MAAM,CAgCR;AAqED;;;;;;;;;;;;GAYG;AACH,wBAAgB,0BAA0B,CAAC,IAAI,EAAE,cAAc,EAAE,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,GAAG,IAAI,CAOpG;AAED;;;;;;GAMG;AACH,wBAAgB,6BAA6B,CAC3C,KAAK,EAAE,cAAc,EAAE,EACvB,OAAO,EAAE,IAAI,CACX,qBAAqB,EACnB,kBAAkB,GAClB,oBAAoB,GACpB,YAAY,GACZ,iBAAiB,GACjB,wBAAwB,GACxB,wBAAwB,GACxB,mBAAmB,GACnB,eAAe,CAClB,GACA,wBAAwB,CAiB1B;AAmLD;;GAEG;AACH,MAAM,WAAW,0BAA0B;IACzC;;;;;OAKG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAChC;;;;OAIG;IACH,oBAAoB,CAAC,EAAE,OAAO,CAAC;CAChC;AAED;;;;;;;;;GASG;AACH,wBAAsB,mBAAmB,CACvC,IAAI,EAAE,cAAc,EACpB,GAAG,EAAE,eAAe,EACpB,OAAO,EAAE,IAAI,CACX,qBAAqB,EACnB,kBAAkB,GAClB,oBAAoB,GACpB,YAAY,GACZ,wBAAwB,GACxB,iBAAiB,GACjB,wBAAwB,CAC3B,EACD,OAAO,GAAE,0BAA+B,GACvC,OAAO,CAAC,gBAAgB,CAAC,CA8C3B;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,CAClC,OAAO,EAAE,IAAI,CAAC,qBAAqB,EAAE,iBAAiB,GAAG,wBAAwB,CAAC,GACjF,KAAK,GAAG,WAAW,CAAC,MAAM,CAAC,CAI7B"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@frontmcp/adapters",
|
|
3
|
-
"version": "1.8.
|
|
3
|
+
"version": "1.8.5",
|
|
4
4
|
"description": "Adapters for the FrontMCP framework",
|
|
5
5
|
"author": "AgentFront <info@agentfront.dev>",
|
|
6
6
|
"homepage": "https://docs.agentfront.dev",
|
|
@@ -64,15 +64,15 @@
|
|
|
64
64
|
"node": ">=24.0.0"
|
|
65
65
|
},
|
|
66
66
|
"dependencies": {
|
|
67
|
-
"@frontmcp/auth": "1.8.
|
|
68
|
-
"@frontmcp/di": "1.8.
|
|
69
|
-
"@frontmcp/sdk": "1.8.
|
|
70
|
-
"@frontmcp/utils": "1.8.
|
|
67
|
+
"@frontmcp/auth": "1.8.5",
|
|
68
|
+
"@frontmcp/di": "1.8.5",
|
|
69
|
+
"@frontmcp/sdk": "1.8.5",
|
|
70
|
+
"@frontmcp/utils": "1.8.5",
|
|
71
71
|
"js-yaml": "^4.1.0",
|
|
72
72
|
"mcp-from-openapi": "2.8.0",
|
|
73
73
|
"openapi-types": "^12.1.3"
|
|
74
74
|
},
|
|
75
75
|
"peerDependencies": {
|
|
76
|
-
"@frontmcp/lazy-zod": "1.8.
|
|
76
|
+
"@frontmcp/lazy-zod": "1.8.5"
|
|
77
77
|
}
|
|
78
78
|
}
|