mcp4openapi 0.2.8 → 0.3.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/README.md +143 -63
- package/dist/scripts/validate-profile.js +3 -3
- package/dist/scripts/validate-profile.js.map +1 -1
- package/dist/src/{oauth-provider.d.ts → auth/oauth-provider.d.ts} +7 -2
- package/dist/src/auth/oauth-provider.d.ts.map +1 -0
- package/dist/src/{oauth-provider.js → auth/oauth-provider.js} +30 -2
- package/dist/src/auth/oauth-provider.js.map +1 -0
- package/dist/src/core/cli-config.d.ts +9 -0
- package/dist/src/core/cli-config.d.ts.map +1 -0
- package/dist/src/core/cli-config.js +124 -0
- package/dist/src/core/cli-config.js.map +1 -0
- package/dist/src/{constants.d.ts → core/constants.d.ts} +1 -0
- package/dist/src/core/constants.d.ts.map +1 -0
- package/dist/src/{constants.js → core/constants.js} +1 -0
- package/dist/src/core/constants.js.map +1 -0
- package/dist/src/{errors.d.ts → core/errors.d.ts} +6 -0
- package/dist/src/core/errors.d.ts.map +1 -0
- package/dist/src/{errors.js → core/errors.js} +15 -6
- package/dist/src/core/errors.js.map +1 -0
- package/dist/src/core/filtering.d.ts +19 -0
- package/dist/src/core/filtering.d.ts.map +1 -0
- package/dist/src/core/filtering.js +292 -0
- package/dist/src/core/filtering.js.map +1 -0
- package/dist/src/core/index.d.ts +26 -0
- package/dist/src/core/index.d.ts.map +1 -0
- package/dist/src/core/index.js +275 -0
- package/dist/src/core/index.js.map +1 -0
- package/dist/src/core/lib.d.ts +8 -0
- package/dist/src/core/lib.d.ts.map +1 -0
- package/dist/src/core/lib.js +7 -0
- package/dist/src/core/lib.js.map +1 -0
- package/dist/src/{logger.d.ts → core/logger.d.ts} +6 -1
- package/dist/src/core/logger.d.ts.map +1 -0
- package/dist/src/{logger.js → core/logger.js} +30 -2
- package/dist/src/core/logger.js.map +1 -0
- package/dist/src/{metrics.d.ts → core/metrics.d.ts} +11 -0
- package/dist/src/core/metrics.d.ts.map +1 -0
- package/dist/src/{metrics.js → core/metrics.js} +61 -0
- package/dist/src/core/metrics.js.map +1 -0
- package/dist/src/core/naming-warnings.d.ts.map +1 -0
- package/dist/src/core/naming-warnings.js.map +1 -0
- package/dist/src/core/naming.d.ts.map +1 -0
- package/dist/src/core/naming.js.map +1 -0
- package/dist/src/generated-schemas.d.ts +245 -79
- package/dist/src/generated-schemas.d.ts.map +1 -1
- package/dist/src/generated-schemas.js +14 -2
- package/dist/src/generated-schemas.js.map +1 -1
- package/dist/src/index.d.ts +1 -6
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +1 -170
- package/dist/src/index.js.map +1 -1
- package/dist/src/lib.d.ts +1 -7
- package/dist/src/lib.d.ts.map +1 -1
- package/dist/src/lib.js +1 -6
- package/dist/src/lib.js.map +1 -1
- package/dist/src/mcp/mcp-server-manager.d.ts +20 -0
- package/dist/src/mcp/mcp-server-manager.d.ts.map +1 -0
- package/dist/src/mcp/mcp-server-manager.js +38 -0
- package/dist/src/mcp/mcp-server-manager.js.map +1 -0
- package/dist/src/{mcp-server.d.ts → mcp/mcp-server.d.ts} +31 -1
- package/dist/src/mcp/mcp-server.d.ts.map +1 -0
- package/dist/src/{mcp-server.js → mcp/mcp-server.js} +547 -146
- package/dist/src/mcp/mcp-server.js.map +1 -0
- package/dist/src/{openapi-parser.d.ts → openapi/openapi-parser.d.ts} +1 -1
- package/dist/src/openapi/openapi-parser.d.ts.map +1 -0
- package/dist/src/{openapi-parser.js → openapi/openapi-parser.js} +2 -2
- package/dist/src/openapi/openapi-parser.js.map +1 -0
- package/dist/src/{profile-loader.d.ts → profile/profile-loader.d.ts} +3 -2
- package/dist/src/profile/profile-loader.d.ts.map +1 -0
- package/dist/src/{profile-loader.js → profile/profile-loader.js} +17 -6
- package/dist/src/profile/profile-loader.js.map +1 -0
- package/dist/src/profile/profile-registry.d.ts +18 -0
- package/dist/src/profile/profile-registry.d.ts.map +1 -0
- package/dist/src/profile/profile-registry.js +26 -0
- package/dist/src/profile/profile-registry.js.map +1 -0
- package/dist/src/profile/profile-resolver.d.ts +25 -0
- package/dist/src/profile/profile-resolver.d.ts.map +1 -0
- package/dist/src/profile/profile-resolver.js +204 -0
- package/dist/src/profile/profile-resolver.js.map +1 -0
- package/dist/src/profile/startup-profile.d.ts +17 -0
- package/dist/src/profile/startup-profile.d.ts.map +1 -0
- package/dist/src/profile/startup-profile.js +30 -0
- package/dist/src/profile/startup-profile.js.map +1 -0
- package/dist/src/profile/startup-validation.d.ts +11 -0
- package/dist/src/profile/startup-validation.d.ts.map +1 -0
- package/dist/src/profile/startup-validation.js +21 -0
- package/dist/src/profile/startup-validation.js.map +1 -0
- package/dist/src/testing/dynamic-mock-server.d.ts +24 -0
- package/dist/src/testing/dynamic-mock-server.d.ts.map +1 -0
- package/dist/src/testing/dynamic-mock-server.js +138 -0
- package/dist/src/testing/dynamic-mock-server.js.map +1 -0
- package/dist/src/testing/request-assertions.d.ts +5 -0
- package/dist/src/testing/request-assertions.d.ts.map +1 -0
- package/dist/src/testing/request-assertions.js +165 -0
- package/dist/src/testing/request-assertions.js.map +1 -0
- package/dist/src/testing/template-utils.d.ts +10 -0
- package/dist/src/testing/template-utils.d.ts.map +1 -0
- package/dist/src/testing/template-utils.js +72 -0
- package/dist/src/testing/template-utils.js.map +1 -0
- package/dist/src/testing/test-http-utils.d.ts +1 -1
- package/dist/src/testing/test-http-utils.d.ts.map +1 -1
- package/dist/src/testing/test-http-utils.js +1 -1
- package/dist/src/testing/test-http-utils.js.map +1 -1
- package/dist/src/testing/test-loader.d.ts +6 -0
- package/dist/src/testing/test-loader.d.ts.map +1 -0
- package/dist/src/testing/test-loader.js +212 -0
- package/dist/src/testing/test-loader.js.map +1 -0
- package/dist/src/testing/test-schema.d.ts +1270 -0
- package/dist/src/testing/test-schema.d.ts.map +1 -0
- package/dist/src/testing/test-schema.js +76 -0
- package/dist/src/testing/test-schema.js.map +1 -0
- package/dist/src/tool-filter/compat.d.ts +49 -0
- package/dist/src/tool-filter/compat.d.ts.map +1 -0
- package/dist/src/tool-filter/compat.js +72 -0
- package/dist/src/tool-filter/compat.js.map +1 -0
- package/dist/src/tool-filter/config/env-config-parser.d.ts +38 -0
- package/dist/src/tool-filter/config/env-config-parser.d.ts.map +1 -0
- package/dist/src/tool-filter/config/env-config-parser.js +103 -0
- package/dist/src/tool-filter/config/env-config-parser.js.map +1 -0
- package/dist/src/tool-filter/config/header-config-parser.d.ts +37 -0
- package/dist/src/tool-filter/config/header-config-parser.d.ts.map +1 -0
- package/dist/src/tool-filter/config/header-config-parser.js +118 -0
- package/dist/src/tool-filter/config/header-config-parser.js.map +1 -0
- package/dist/src/tool-filter/errors.d.ts +18 -0
- package/dist/src/tool-filter/errors.d.ts.map +1 -0
- package/dist/src/tool-filter/errors.js +21 -0
- package/dist/src/tool-filter/errors.js.map +1 -0
- package/dist/src/tool-filter/filter/filter-engine.d.ts +45 -0
- package/dist/src/tool-filter/filter/filter-engine.d.ts.map +1 -0
- package/dist/src/tool-filter/filter/filter-engine.js +94 -0
- package/dist/src/tool-filter/filter/filter-engine.js.map +1 -0
- package/dist/src/tool-filter/filter/filter-rules.d.ts +44 -0
- package/dist/src/tool-filter/filter/filter-rules.d.ts.map +1 -0
- package/dist/src/tool-filter/filter/filter-rules.js +72 -0
- package/dist/src/tool-filter/filter/filter-rules.js.map +1 -0
- package/dist/src/tool-filter/filter/global-tool-filter.d.ts +40 -0
- package/dist/src/tool-filter/filter/global-tool-filter.d.ts.map +1 -0
- package/dist/src/tool-filter/filter/global-tool-filter.js +92 -0
- package/dist/src/tool-filter/filter/global-tool-filter.js.map +1 -0
- package/dist/src/tool-filter/filter/session-tool-filter.d.ts +29 -0
- package/dist/src/tool-filter/filter/session-tool-filter.d.ts.map +1 -0
- package/dist/src/tool-filter/filter/session-tool-filter.js +69 -0
- package/dist/src/tool-filter/filter/session-tool-filter.js.map +1 -0
- package/dist/src/tool-filter/index.d.ts +25 -0
- package/dist/src/tool-filter/index.d.ts.map +1 -0
- package/dist/src/tool-filter/index.js +30 -0
- package/dist/src/tool-filter/index.js.map +1 -0
- package/dist/src/tool-filter/integration/tool-filter-service.d.ts +44 -0
- package/dist/src/tool-filter/integration/tool-filter-service.d.ts.map +1 -0
- package/dist/src/tool-filter/integration/tool-filter-service.js +68 -0
- package/dist/src/tool-filter/integration/tool-filter-service.js.map +1 -0
- package/dist/src/tool-filter/operation/operation-classifier.d.ts +20 -0
- package/dist/src/tool-filter/operation/operation-classifier.d.ts.map +1 -0
- package/dist/src/tool-filter/operation/operation-classifier.js +26 -0
- package/dist/src/tool-filter/operation/operation-classifier.js.map +1 -0
- package/dist/src/tool-filter/operation/operation-detector.d.ts +30 -0
- package/dist/src/tool-filter/operation/operation-detector.d.ts.map +1 -0
- package/dist/src/tool-filter/operation/operation-detector.js +96 -0
- package/dist/src/tool-filter/operation/operation-detector.js.map +1 -0
- package/dist/src/tool-filter/operation/operation-resolver.d.ts +22 -0
- package/dist/src/tool-filter/operation/operation-resolver.d.ts.map +1 -0
- package/dist/src/tool-filter/operation/operation-resolver.js +32 -0
- package/dist/src/tool-filter/operation/operation-resolver.js.map +1 -0
- package/dist/src/tool-filter/regex/regex-compiler.d.ts +22 -0
- package/dist/src/tool-filter/regex/regex-compiler.d.ts.map +1 -0
- package/dist/src/tool-filter/regex/regex-compiler.js +56 -0
- package/dist/src/tool-filter/regex/regex-compiler.js.map +1 -0
- package/dist/src/tool-filter/regex/regex-validator.d.ts +24 -0
- package/dist/src/tool-filter/regex/regex-validator.d.ts.map +1 -0
- package/dist/src/tool-filter/regex/regex-validator.js +58 -0
- package/dist/src/tool-filter/regex/regex-validator.js.map +1 -0
- package/dist/src/tool-filter/types.d.ts +92 -0
- package/dist/src/tool-filter/types.d.ts.map +1 -0
- package/dist/src/tool-filter/types.js +5 -0
- package/dist/src/tool-filter/types.js.map +1 -0
- package/dist/src/tool-filter/utils.d.ts +11 -0
- package/dist/src/tool-filter/utils.d.ts.map +1 -0
- package/dist/src/tool-filter/utils.js +13 -0
- package/dist/src/tool-filter/utils.js.map +1 -0
- package/dist/src/{composite-executor.d.ts → tooling/composite-executor.d.ts} +3 -3
- package/dist/src/tooling/composite-executor.d.ts.map +1 -0
- package/dist/src/{composite-executor.js → tooling/composite-executor.js} +1 -1
- package/dist/src/tooling/composite-executor.js.map +1 -0
- package/dist/src/{dag-executor.d.ts → tooling/dag-executor.d.ts} +1 -1
- package/dist/src/tooling/dag-executor.d.ts.map +1 -0
- package/dist/src/tooling/dag-executor.js.map +1 -0
- package/dist/src/{proxy-executor.d.ts → tooling/proxy-executor.d.ts} +2 -2
- package/dist/src/tooling/proxy-executor.d.ts.map +1 -0
- package/dist/src/{proxy-executor.js → tooling/proxy-executor.js} +8 -1
- package/dist/src/tooling/proxy-executor.js.map +1 -0
- package/dist/src/{tool-generator.d.ts → tooling/tool-generator.d.ts} +4 -3
- package/dist/src/tooling/tool-generator.d.ts.map +1 -0
- package/dist/src/{tool-generator.js → tooling/tool-generator.js} +23 -7
- package/dist/src/tooling/tool-generator.js.map +1 -0
- package/dist/src/{http-client-factory.d.ts → transport/http-client-factory.d.ts} +4 -1
- package/dist/src/transport/http-client-factory.d.ts.map +1 -0
- package/dist/src/{http-client-factory.js → transport/http-client-factory.js} +13 -3
- package/dist/src/transport/http-client-factory.js.map +1 -0
- package/dist/src/transport/http-transport-config.d.ts +6 -0
- package/dist/src/transport/http-transport-config.d.ts.map +1 -0
- package/dist/src/transport/http-transport-config.js +62 -0
- package/dist/src/transport/http-transport-config.js.map +1 -0
- package/dist/src/{http-transport.d.ts → transport/http-transport.d.ts} +72 -14
- package/dist/src/transport/http-transport.d.ts.map +1 -0
- package/dist/src/{http-transport.js → transport/http-transport.js} +1166 -493
- package/dist/src/transport/http-transport.js.map +1 -0
- package/dist/src/{interceptors.d.ts → transport/interceptors.d.ts} +6 -2
- package/dist/src/transport/interceptors.d.ts.map +1 -0
- package/dist/src/{interceptors.js → transport/interceptors.js} +72 -41
- package/dist/src/transport/interceptors.js.map +1 -0
- package/dist/src/types/http-transport.d.ts +25 -0
- package/dist/src/types/http-transport.d.ts.map +1 -1
- package/dist/src/types/profile.d.ts +13 -1
- package/dist/src/types/profile.d.ts.map +1 -1
- package/dist/src/validation/argument-normalizer.d.ts +6 -0
- package/dist/src/validation/argument-normalizer.d.ts.map +1 -0
- package/dist/src/validation/argument-normalizer.js +70 -0
- package/dist/src/validation/argument-normalizer.js.map +1 -0
- package/dist/src/validation/jsonrpc-validator.d.ts.map +1 -0
- package/dist/src/validation/jsonrpc-validator.js.map +1 -0
- package/dist/src/{schema-validator.d.ts → validation/schema-validator.d.ts} +2 -2
- package/dist/src/validation/schema-validator.d.ts.map +1 -0
- package/dist/src/validation/schema-validator.js.map +1 -0
- package/dist/src/validation/validation-utils.d.ts.map +1 -0
- package/dist/src/validation/validation-utils.js.map +1 -0
- package/package.json +9 -3
- package/profile-schema.json +63 -3
- package/profiles/gitlab/developer-profile-oauth.json +1520 -0
- package/profiles/gitlab/developer-profile-oauth.test.json +3432 -0
- package/profiles/gitlab/openapi.yaml +6891 -0
- package/profiles/n8n/openapi.yaml +2441 -0
- package/profiles/n8n/profile-optimized.json +965 -0
- package/profiles/n8n/profile-optimized.test.json +1078 -0
- package/profiles/n8n/profile.json +1033 -0
- package/profiles/n8n/profile.test.json +983 -0
- package/profiles/n8n-nodes/openapi.yaml +24 -0
- package/profiles/n8n-nodes/profile-nodes.json +44 -0
- package/profiles/n8n-nodes/profile-nodes.test.json +91 -0
- package/profiles/semgrep/openapi.yaml +4706 -0
- package/profiles/semgrep/profile.json +692 -0
- package/profiles/semgrep/profile.test.json +471 -0
- package/profiles/youtrack/openapi.json +16976 -0
- package/profiles/youtrack/profile.json +608 -0
- package/profiles/youtrack/profile.test.json +1926 -0
- package/dist/src/composite-executor.d.ts.map +0 -1
- package/dist/src/composite-executor.js.map +0 -1
- package/dist/src/constants.d.ts.map +0 -1
- package/dist/src/constants.js.map +0 -1
- package/dist/src/dag-executor.d.ts.map +0 -1
- package/dist/src/dag-executor.js.map +0 -1
- package/dist/src/errors.d.ts.map +0 -1
- package/dist/src/errors.js.map +0 -1
- package/dist/src/http-client-factory.d.ts.map +0 -1
- package/dist/src/http-client-factory.js.map +0 -1
- package/dist/src/http-transport.d.ts.map +0 -1
- package/dist/src/http-transport.js.map +0 -1
- package/dist/src/interceptors.d.ts.map +0 -1
- package/dist/src/interceptors.js.map +0 -1
- package/dist/src/jsonrpc-validator.d.ts.map +0 -1
- package/dist/src/jsonrpc-validator.js.map +0 -1
- package/dist/src/logger.d.ts.map +0 -1
- package/dist/src/logger.js.map +0 -1
- package/dist/src/mcp-server.d.ts.map +0 -1
- package/dist/src/mcp-server.js.map +0 -1
- package/dist/src/metrics.d.ts.map +0 -1
- package/dist/src/metrics.js.map +0 -1
- package/dist/src/naming-warnings.d.ts.map +0 -1
- package/dist/src/naming-warnings.js.map +0 -1
- package/dist/src/naming.d.ts.map +0 -1
- package/dist/src/naming.js.map +0 -1
- package/dist/src/oauth-provider.d.ts.map +0 -1
- package/dist/src/oauth-provider.js.map +0 -1
- package/dist/src/openapi-parser.d.ts.map +0 -1
- package/dist/src/openapi-parser.js.map +0 -1
- package/dist/src/profile-loader.d.ts.map +0 -1
- package/dist/src/profile-loader.js.map +0 -1
- package/dist/src/proxy-executor.d.ts.map +0 -1
- package/dist/src/proxy-executor.js.map +0 -1
- package/dist/src/schema-validator.d.ts.map +0 -1
- package/dist/src/schema-validator.js.map +0 -1
- package/dist/src/testing/fixtures.d.ts +0 -684
- package/dist/src/testing/fixtures.d.ts.map +0 -1
- package/dist/src/testing/fixtures.js +0 -528
- package/dist/src/testing/fixtures.js.map +0 -1
- package/dist/src/testing/mock-gitlab-server.d.ts +0 -43
- package/dist/src/testing/mock-gitlab-server.d.ts.map +0 -1
- package/dist/src/testing/mock-gitlab-server.js +0 -1026
- package/dist/src/testing/mock-gitlab-server.js.map +0 -1
- package/dist/src/testing/mock-semgrep-server.d.ts +0 -32
- package/dist/src/testing/mock-semgrep-server.d.ts.map +0 -1
- package/dist/src/testing/mock-semgrep-server.js +0 -213
- package/dist/src/testing/mock-semgrep-server.js.map +0 -1
- package/dist/src/testing/mock-youtrack-server.d.ts +0 -11
- package/dist/src/testing/mock-youtrack-server.d.ts.map +0 -1
- package/dist/src/testing/mock-youtrack-server.js +0 -152
- package/dist/src/testing/mock-youtrack-server.js.map +0 -1
- package/dist/src/tool-generator.d.ts.map +0 -1
- package/dist/src/tool-generator.js.map +0 -1
- package/dist/src/validation-utils.d.ts.map +0 -1
- package/dist/src/validation-utils.js.map +0 -1
- /package/dist/src/{naming-warnings.d.ts → core/naming-warnings.d.ts} +0 -0
- /package/dist/src/{naming-warnings.js → core/naming-warnings.js} +0 -0
- /package/dist/src/{naming.d.ts → core/naming.d.ts} +0 -0
- /package/dist/src/{naming.js → core/naming.js} +0 -0
- /package/dist/src/{dag-executor.js → tooling/dag-executor.js} +0 -0
- /package/dist/src/{jsonrpc-validator.d.ts → validation/jsonrpc-validator.d.ts} +0 -0
- /package/dist/src/{jsonrpc-validator.js → validation/jsonrpc-validator.js} +0 -0
- /package/dist/src/{schema-validator.js → validation/schema-validator.js} +0 -0
- /package/dist/src/{validation-utils.d.ts → validation/validation-utils.d.ts} +0 -0
- /package/dist/src/{validation-utils.js → validation/validation-utils.js} +0 -0
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tool Filter Service - orchestrates all filtering components
|
|
3
|
+
*/
|
|
4
|
+
import { GlobalToolFilter } from '../filter/global-tool-filter.js';
|
|
5
|
+
import { SessionToolFilter } from '../filter/session-tool-filter.js';
|
|
6
|
+
/**
|
|
7
|
+
* Service that orchestrates tool filtering from environment and headers
|
|
8
|
+
*/
|
|
9
|
+
export class ToolFilterService {
|
|
10
|
+
constructor(envParser, headerParser, logger, detector) {
|
|
11
|
+
this.envParser = envParser;
|
|
12
|
+
this.headerParser = headerParser;
|
|
13
|
+
this.logger = logger;
|
|
14
|
+
this.detector = detector;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Apply global filtering based on environment variables
|
|
18
|
+
*
|
|
19
|
+
* @param tools - Tools to filter
|
|
20
|
+
* @param env - Environment variables (process.env)
|
|
21
|
+
* @returns Filtered tools (or original if no config)
|
|
22
|
+
*/
|
|
23
|
+
applyGlobalFilter(tools, env) {
|
|
24
|
+
const config = this.envParser.parse(env);
|
|
25
|
+
if (!config) {
|
|
26
|
+
return tools;
|
|
27
|
+
}
|
|
28
|
+
const filter = new GlobalToolFilter(config, this.logger, this.detector);
|
|
29
|
+
const result = filter.apply(tools);
|
|
30
|
+
this.logger.info('Global tool filter applied', {
|
|
31
|
+
original: result.summary.originalCount,
|
|
32
|
+
allowed: result.summary.allowedCount,
|
|
33
|
+
removed: result.summary.removedCount
|
|
34
|
+
});
|
|
35
|
+
return result.allowed;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Apply session filtering based on X-Mcp4-Tools header
|
|
39
|
+
*
|
|
40
|
+
* @param tools - Tools to filter (typically after global filtering)
|
|
41
|
+
* @param headerValue - X-Mcp4-Tools header value
|
|
42
|
+
* @returns Session filter result with allowed tool names
|
|
43
|
+
*/
|
|
44
|
+
applySessionFilter(tools, headerValue) {
|
|
45
|
+
const request = this.headerParser.parse(headerValue);
|
|
46
|
+
const filter = new SessionToolFilter(request, this.detector);
|
|
47
|
+
const result = filter.apply(tools);
|
|
48
|
+
if (request.hasRules) {
|
|
49
|
+
this.logger.info('Session tool filter applied', {
|
|
50
|
+
header: request.normalizedHeader,
|
|
51
|
+
available: tools.length,
|
|
52
|
+
allowed: result.allowedToolNames.size
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
return result;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Check if tool is allowed in session
|
|
59
|
+
*
|
|
60
|
+
* @param toolName - Tool name to check
|
|
61
|
+
* @param sessionResult - Session filter result
|
|
62
|
+
* @returns true if tool is allowed
|
|
63
|
+
*/
|
|
64
|
+
isToolAllowed(toolName, sessionResult) {
|
|
65
|
+
return sessionResult.allowedToolNames.has(toolName);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
//# sourceMappingURL=tool-filter-service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tool-filter-service.js","sourceRoot":"","sources":["../../../../src/tool-filter/integration/tool-filter-service.ts"],"names":[],"mappings":"AAAA;;GAEG;AAQH,OAAO,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AACnE,OAAO,EAAE,iBAAiB,EAAE,MAAM,kCAAkC,CAAC;AAErE;;GAEG;AACH,MAAM,OAAO,iBAAiB;IAC5B,YACU,SAA0B,EAC1B,YAAgC,EAChC,MAAc,EACd,QAA4B;QAH5B,cAAS,GAAT,SAAS,CAAiB;QAC1B,iBAAY,GAAZ,YAAY,CAAoB;QAChC,WAAM,GAAN,MAAM,CAAQ;QACd,aAAQ,GAAR,QAAQ,CAAoB;IACnC,CAAC;IAEJ;;;;;;OAMG;IACH,iBAAiB,CACf,KAAuB,EACvB,GAAsB;QAEtB,MAAM,MAAM,GAAG,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QAEzC,IAAI,CAAC,MAAM,EAAE,CAAC;YACZ,OAAO,KAAK,CAAC;QACf,CAAC;QAED,MAAM,MAAM,GAAG,IAAI,gBAAgB,CAAC,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC;QACxE,MAAM,MAAM,GAAG,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;QAEnC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,4BAA4B,EAAE;YAC7C,QAAQ,EAAE,MAAM,CAAC,OAAO,CAAC,aAAa;YACtC,OAAO,EAAE,MAAM,CAAC,OAAO,CAAC,YAAY;YACpC,OAAO,EAAE,MAAM,CAAC,OAAO,CAAC,YAAY;SACrC,CAAC,CAAC;QAEH,OAAO,MAAM,CAAC,OAAO,CAAC;IACxB,CAAC;IAED;;;;;;OAMG;IACH,kBAAkB,CAChB,KAAuB,EACvB,WAAmB;QAEnB,MAAM,OAAO,GAAG,IAAI,CAAC,YAAY,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC;QACrD,MAAM,MAAM,GAAG,IAAI,iBAAiB,CAAC,OAAO,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC;QAC7D,MAAM,MAAM,GAAG,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;QAEnC,IAAI,OAAO,CAAC,QAAQ,EAAE,CAAC;YACrB,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,6BAA6B,EAAE;gBAC9C,MAAM,EAAE,OAAO,CAAC,gBAAgB;gBAChC,SAAS,EAAE,KAAK,CAAC,MAAM;gBACvB,OAAO,EAAE,MAAM,CAAC,gBAAgB,CAAC,IAAI;aACtC,CAAC,CAAC;QACL,CAAC;QAED,OAAO,MAAM,CAAC;IAChB,CAAC;IAED;;;;;;OAMG;IACH,aAAa,CAAC,QAAgB,EAAE,aAAsC;QACpE,OAAO,aAAa,CAAC,gBAAgB,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;IACtD,CAAC;CACF"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Operation classifier - categorizes operations as list/read/modify
|
|
3
|
+
*/
|
|
4
|
+
import type { OperationInfo } from '../../types/openapi.js';
|
|
5
|
+
import type { OperationCategory } from '../types.js';
|
|
6
|
+
/**
|
|
7
|
+
* Classifies operations into categories based on HTTP method and parameters
|
|
8
|
+
*/
|
|
9
|
+
export declare class OperationClassifier {
|
|
10
|
+
/**
|
|
11
|
+
* Classify an operation as list, read, or modify
|
|
12
|
+
*
|
|
13
|
+
* Rules:
|
|
14
|
+
* - GET without path params → list
|
|
15
|
+
* - GET with path params → read
|
|
16
|
+
* - All other methods → modify
|
|
17
|
+
*/
|
|
18
|
+
classify(operation: OperationInfo): OperationCategory;
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=operation-classifier.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"operation-classifier.d.ts","sourceRoot":"","sources":["../../../../src/tool-filter/operation/operation-classifier.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAC5D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAErD;;GAEG;AACH,qBAAa,mBAAmB;IAC9B;;;;;;;OAOG;IACH,QAAQ,CAAC,SAAS,EAAE,aAAa,GAAG,iBAAiB;CAWtD"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Operation classifier - categorizes operations as list/read/modify
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Classifies operations into categories based on HTTP method and parameters
|
|
6
|
+
*/
|
|
7
|
+
export class OperationClassifier {
|
|
8
|
+
/**
|
|
9
|
+
* Classify an operation as list, read, or modify
|
|
10
|
+
*
|
|
11
|
+
* Rules:
|
|
12
|
+
* - GET without path params → list
|
|
13
|
+
* - GET with path params → read
|
|
14
|
+
* - All other methods → modify
|
|
15
|
+
*/
|
|
16
|
+
classify(operation) {
|
|
17
|
+
const method = operation.method.toLowerCase();
|
|
18
|
+
if (method !== 'get') {
|
|
19
|
+
return 'modify';
|
|
20
|
+
}
|
|
21
|
+
// GET operation - check for path parameters
|
|
22
|
+
const hasPathParams = operation.parameters.some(param => param.in === 'path');
|
|
23
|
+
return hasPathParams ? 'read' : 'list';
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=operation-classifier.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"operation-classifier.js","sourceRoot":"","sources":["../../../../src/tool-filter/operation/operation-classifier.ts"],"names":[],"mappings":"AAAA;;GAEG;AAKH;;GAEG;AACH,MAAM,OAAO,mBAAmB;IAC9B;;;;;;;OAOG;IACH,QAAQ,CAAC,SAAwB;QAC/B,MAAM,MAAM,GAAG,SAAS,CAAC,MAAM,CAAC,WAAW,EAAE,CAAC;QAE9C,IAAI,MAAM,KAAK,KAAK,EAAE,CAAC;YACrB,OAAO,QAAQ,CAAC;QAClB,CAAC;QAED,4CAA4C;QAC5C,MAAM,aAAa,GAAG,SAAS,CAAC,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,EAAE,KAAK,MAAM,CAAC,CAAC;QAC9E,OAAO,aAAa,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC;IACzC,CAAC;CACF"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Operation detector - detects tool categories
|
|
3
|
+
*/
|
|
4
|
+
import type { ToolDefinition } from '../../types/profile.js';
|
|
5
|
+
import type { OperationResolver, ToolCategories } from '../types.js';
|
|
6
|
+
import type { OperationClassifier } from './operation-classifier.js';
|
|
7
|
+
/**
|
|
8
|
+
* Detects categories (list/read) for tools
|
|
9
|
+
*/
|
|
10
|
+
export declare class OperationDetector {
|
|
11
|
+
private classifier;
|
|
12
|
+
private resolver;
|
|
13
|
+
constructor(classifier: OperationClassifier, resolver: OperationResolver);
|
|
14
|
+
/**
|
|
15
|
+
* Detect whether tool is list-only and/or read-only
|
|
16
|
+
*
|
|
17
|
+
* For simple tools: checks all operations
|
|
18
|
+
* For composite tools: ALL steps must be same category (strict)
|
|
19
|
+
*/
|
|
20
|
+
detectCategories(tool: ToolDefinition): ToolCategories;
|
|
21
|
+
/**
|
|
22
|
+
* Detect composite tool categories (strict: ALL steps must be same)
|
|
23
|
+
*/
|
|
24
|
+
private detectCompositeCategories;
|
|
25
|
+
/**
|
|
26
|
+
* Detect simple tool categories
|
|
27
|
+
*/
|
|
28
|
+
private detectSimpleToolCategories;
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=operation-detector.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"operation-detector.d.ts","sourceRoot":"","sources":["../../../../src/tool-filter/operation/operation-detector.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAC7D,OAAO,KAAK,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AACrE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAErE;;GAEG;AACH,qBAAa,iBAAiB;IAE1B,OAAO,CAAC,UAAU;IAClB,OAAO,CAAC,QAAQ;gBADR,UAAU,EAAE,mBAAmB,EAC/B,QAAQ,EAAE,iBAAiB;IAGrC;;;;;OAKG;IACH,gBAAgB,CAAC,IAAI,EAAE,cAAc,GAAG,cAAc;IAYtD;;OAEG;IACH,OAAO,CAAC,yBAAyB;IAmCjC;;OAEG;IACH,OAAO,CAAC,0BAA0B;CAsCnC"}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Operation detector - detects tool categories
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Detects categories (list/read) for tools
|
|
6
|
+
*/
|
|
7
|
+
export class OperationDetector {
|
|
8
|
+
constructor(classifier, resolver) {
|
|
9
|
+
this.classifier = classifier;
|
|
10
|
+
this.resolver = resolver;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Detect whether tool is list-only and/or read-only
|
|
14
|
+
*
|
|
15
|
+
* For simple tools: checks all operations
|
|
16
|
+
* For composite tools: ALL steps must be same category (strict)
|
|
17
|
+
*/
|
|
18
|
+
detectCategories(tool) {
|
|
19
|
+
if (tool.composite && tool.steps) {
|
|
20
|
+
return this.detectCompositeCategories(tool);
|
|
21
|
+
}
|
|
22
|
+
if (tool.operations) {
|
|
23
|
+
return this.detectSimpleToolCategories(tool);
|
|
24
|
+
}
|
|
25
|
+
return { isList: false, isRead: false };
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Detect composite tool categories (strict: ALL steps must be same)
|
|
29
|
+
*/
|
|
30
|
+
detectCompositeCategories(tool) {
|
|
31
|
+
if (!tool.steps || tool.steps.length === 0) {
|
|
32
|
+
return { isList: false, isRead: false };
|
|
33
|
+
}
|
|
34
|
+
let hasAny = false;
|
|
35
|
+
let allList = true;
|
|
36
|
+
let allRead = true;
|
|
37
|
+
for (const step of tool.steps) {
|
|
38
|
+
const operation = this.resolver.getOperationForCall(step.call);
|
|
39
|
+
if (!operation) {
|
|
40
|
+
// Can't resolve - treat as unsafe (modify)
|
|
41
|
+
allList = false;
|
|
42
|
+
allRead = false;
|
|
43
|
+
continue;
|
|
44
|
+
}
|
|
45
|
+
hasAny = true;
|
|
46
|
+
const category = this.classifier.classify(operation);
|
|
47
|
+
if (category !== 'list') {
|
|
48
|
+
allList = false;
|
|
49
|
+
}
|
|
50
|
+
if (category !== 'read') {
|
|
51
|
+
allRead = false;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
return {
|
|
55
|
+
isList: hasAny && allList,
|
|
56
|
+
isRead: hasAny && allRead
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Detect simple tool categories
|
|
61
|
+
*/
|
|
62
|
+
detectSimpleToolCategories(tool) {
|
|
63
|
+
if (!tool.operations) {
|
|
64
|
+
return { isList: false, isRead: false };
|
|
65
|
+
}
|
|
66
|
+
let isList = false;
|
|
67
|
+
let isRead = false;
|
|
68
|
+
for (const [action, operationId] of Object.entries(tool.operations)) {
|
|
69
|
+
if (typeof operationId !== 'string') {
|
|
70
|
+
continue;
|
|
71
|
+
}
|
|
72
|
+
// Try to resolve operation
|
|
73
|
+
const operation = this.resolver.getOperationById(operationId);
|
|
74
|
+
if (operation) {
|
|
75
|
+
const category = this.classifier.classify(operation);
|
|
76
|
+
if (category === 'list') {
|
|
77
|
+
isList = true;
|
|
78
|
+
}
|
|
79
|
+
if (category === 'read') {
|
|
80
|
+
isRead = true;
|
|
81
|
+
}
|
|
82
|
+
continue;
|
|
83
|
+
}
|
|
84
|
+
// Fallback: detect from action name
|
|
85
|
+
const actionLower = action.toLowerCase();
|
|
86
|
+
if (actionLower === 'list' || actionLower === 'search') {
|
|
87
|
+
isList = true;
|
|
88
|
+
}
|
|
89
|
+
if (actionLower === 'get' || actionLower === 'read') {
|
|
90
|
+
isRead = true;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
return { isList, isRead };
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
//# sourceMappingURL=operation-detector.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"operation-detector.js","sourceRoot":"","sources":["../../../../src/tool-filter/operation/operation-detector.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Operation resolver - resolves operations from OpenAPI spec
|
|
3
|
+
*/
|
|
4
|
+
import type { OpenAPIParser } from '../../openapi/openapi-parser.js';
|
|
5
|
+
import type { OperationInfo } from '../../types/openapi.js';
|
|
6
|
+
import type { OperationResolver } from '../types.js';
|
|
7
|
+
/**
|
|
8
|
+
* Resolves operations from OpenAPI specification
|
|
9
|
+
*/
|
|
10
|
+
export declare class OpenAPIOperationResolver implements OperationResolver {
|
|
11
|
+
private parser;
|
|
12
|
+
constructor(parser: OpenAPIParser);
|
|
13
|
+
/**
|
|
14
|
+
* Get operation by operation ID
|
|
15
|
+
*/
|
|
16
|
+
getOperationById(operationId: string): OperationInfo | undefined;
|
|
17
|
+
/**
|
|
18
|
+
* Get operation from call string (e.g., "GET /users/{id}")
|
|
19
|
+
*/
|
|
20
|
+
getOperationForCall(call: string): OperationInfo | undefined;
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=operation-resolver.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"operation-resolver.d.ts","sourceRoot":"","sources":["../../../../src/tool-filter/operation/operation-resolver.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AACrE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAC5D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAErD;;GAEG;AACH,qBAAa,wBAAyB,YAAW,iBAAiB;IACpD,OAAO,CAAC,MAAM;gBAAN,MAAM,EAAE,aAAa;IAEzC;;OAEG;IACH,gBAAgB,CAAC,WAAW,EAAE,MAAM,GAAG,aAAa,GAAG,SAAS;IAIhE;;OAEG;IACH,mBAAmB,CAAC,IAAI,EAAE,MAAM,GAAG,aAAa,GAAG,SAAS;CAa7D"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Operation resolver - resolves operations from OpenAPI spec
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Resolves operations from OpenAPI specification
|
|
6
|
+
*/
|
|
7
|
+
export class OpenAPIOperationResolver {
|
|
8
|
+
constructor(parser) {
|
|
9
|
+
this.parser = parser;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Get operation by operation ID
|
|
13
|
+
*/
|
|
14
|
+
getOperationById(operationId) {
|
|
15
|
+
return this.parser.getOperation(operationId);
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Get operation from call string (e.g., "GET /users/{id}")
|
|
19
|
+
*/
|
|
20
|
+
getOperationForCall(call) {
|
|
21
|
+
const [method, path] = call.split(' ', 2);
|
|
22
|
+
if (!method || !path) {
|
|
23
|
+
return undefined;
|
|
24
|
+
}
|
|
25
|
+
const pathInfo = this.parser.getPath(path);
|
|
26
|
+
if (!pathInfo) {
|
|
27
|
+
return undefined;
|
|
28
|
+
}
|
|
29
|
+
return pathInfo.operations[method.toLowerCase()];
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=operation-resolver.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"operation-resolver.js","sourceRoot":"","sources":["../../../../src/tool-filter/operation/operation-resolver.ts"],"names":[],"mappings":"AAAA;;GAEG;AAMH;;GAEG;AACH,MAAM,OAAO,wBAAwB;IACnC,YAAoB,MAAqB;QAArB,WAAM,GAAN,MAAM,CAAe;IAAG,CAAC;IAE7C;;OAEG;IACH,gBAAgB,CAAC,WAAmB;QAClC,OAAO,IAAI,CAAC,MAAM,CAAC,YAAY,CAAC,WAAW,CAAC,CAAC;IAC/C,CAAC;IAED;;OAEG;IACH,mBAAmB,CAAC,IAAY;QAC9B,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC;QAC1C,IAAI,CAAC,MAAM,IAAI,CAAC,IAAI,EAAE,CAAC;YACrB,OAAO,SAAS,CAAC;QACnB,CAAC;QAED,MAAM,QAAQ,GAAG,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QAC3C,IAAI,CAAC,QAAQ,EAAE,CAAC;YACd,OAAO,SAAS,CAAC;QACnB,CAAC;QAED,OAAO,QAAQ,CAAC,UAAU,CAAC,MAAM,CAAC,WAAW,EAAE,CAAC,CAAC;IACnD,CAAC;CACF"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Regex compiler with auto-anchoring support
|
|
3
|
+
*/
|
|
4
|
+
import type { CompiledRegex } from '../types.js';
|
|
5
|
+
import type { RegexValidator } from './regex-validator.js';
|
|
6
|
+
/**
|
|
7
|
+
* Compiles regex patterns with validation and auto-anchoring
|
|
8
|
+
*/
|
|
9
|
+
export declare class RegexCompiler {
|
|
10
|
+
private validator;
|
|
11
|
+
constructor(validator: RegexValidator);
|
|
12
|
+
/**
|
|
13
|
+
* Compile a regex pattern with validation and auto-anchoring
|
|
14
|
+
* @throws InvalidRegexError if pattern is invalid or unsafe
|
|
15
|
+
*/
|
|
16
|
+
compile(pattern: string, context: string): CompiledRegex;
|
|
17
|
+
/**
|
|
18
|
+
* Auto-anchor pattern with ^ and $ if not already present
|
|
19
|
+
*/
|
|
20
|
+
private autoAnchor;
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=regex-compiler.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"regex-compiler.d.ts","sourceRoot":"","sources":["../../../../src/tool-filter/regex/regex-compiler.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAkB3D;;GAEG;AACH,qBAAa,aAAa;IACZ,OAAO,CAAC,SAAS;gBAAT,SAAS,EAAE,cAAc;IAE7C;;;OAGG;IACH,OAAO,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,aAAa;IAoBxD;;OAEG;IACH,OAAO,CAAC,UAAU;CAKnB"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Regex compiler with auto-anchoring support
|
|
3
|
+
*/
|
|
4
|
+
import { InvalidRegexError } from '../errors.js';
|
|
5
|
+
/**
|
|
6
|
+
* Compiled regex implementation
|
|
7
|
+
*/
|
|
8
|
+
class CompiledRegexImpl {
|
|
9
|
+
constructor(regex, original, anchored) {
|
|
10
|
+
this.regex = regex;
|
|
11
|
+
this.original = original;
|
|
12
|
+
this.anchored = anchored;
|
|
13
|
+
}
|
|
14
|
+
test(value) {
|
|
15
|
+
return this.regex.test(value);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Compiles regex patterns with validation and auto-anchoring
|
|
20
|
+
*/
|
|
21
|
+
export class RegexCompiler {
|
|
22
|
+
constructor(validator) {
|
|
23
|
+
this.validator = validator;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Compile a regex pattern with validation and auto-anchoring
|
|
27
|
+
* @throws InvalidRegexError if pattern is invalid or unsafe
|
|
28
|
+
*/
|
|
29
|
+
compile(pattern, context) {
|
|
30
|
+
const trimmed = pattern.trim();
|
|
31
|
+
const anchored = this.autoAnchor(trimmed);
|
|
32
|
+
// Validate for safety
|
|
33
|
+
const validation = this.validator.validate(anchored);
|
|
34
|
+
if (!validation.valid) {
|
|
35
|
+
throw new InvalidRegexError(context, pattern, validation.error);
|
|
36
|
+
}
|
|
37
|
+
// Try to compile
|
|
38
|
+
try {
|
|
39
|
+
const regex = new RegExp(anchored);
|
|
40
|
+
return new CompiledRegexImpl(regex, pattern, anchored);
|
|
41
|
+
}
|
|
42
|
+
catch (error) {
|
|
43
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
44
|
+
throw new InvalidRegexError(context, pattern, message);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Auto-anchor pattern with ^ and $ if not already present
|
|
49
|
+
*/
|
|
50
|
+
autoAnchor(pattern) {
|
|
51
|
+
const withStart = pattern.startsWith('^') ? pattern : `^${pattern}`;
|
|
52
|
+
const withEnd = withStart.endsWith('$') ? withStart : `${withStart}$`;
|
|
53
|
+
return withEnd;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
//# sourceMappingURL=regex-compiler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"regex-compiler.js","sourceRoot":"","sources":["../../../../src/tool-filter/regex/regex-compiler.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAEjD;;GAEG;AACH,MAAM,iBAAiB;IACrB,YACkB,KAAa,EACb,QAAgB,EAChB,QAAgB;QAFhB,UAAK,GAAL,KAAK,CAAQ;QACb,aAAQ,GAAR,QAAQ,CAAQ;QAChB,aAAQ,GAAR,QAAQ,CAAQ;IAC/B,CAAC;IAEJ,IAAI,CAAC,KAAa;QAChB,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAChC,CAAC;CACF;AAED;;GAEG;AACH,MAAM,OAAO,aAAa;IACxB,YAAoB,SAAyB;QAAzB,cAAS,GAAT,SAAS,CAAgB;IAAG,CAAC;IAEjD;;;OAGG;IACH,OAAO,CAAC,OAAe,EAAE,OAAe;QACtC,MAAM,OAAO,GAAG,OAAO,CAAC,IAAI,EAAE,CAAC;QAC/B,MAAM,QAAQ,GAAG,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;QAE1C,sBAAsB;QACtB,MAAM,UAAU,GAAG,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;QACrD,IAAI,CAAC,UAAU,CAAC,KAAK,EAAE,CAAC;YACtB,MAAM,IAAI,iBAAiB,CAAC,OAAO,EAAE,OAAO,EAAE,UAAU,CAAC,KAAM,CAAC,CAAC;QACnE,CAAC;QAED,iBAAiB;QACjB,IAAI,CAAC;YACH,MAAM,KAAK,GAAG,IAAI,MAAM,CAAC,QAAQ,CAAC,CAAC;YACnC,OAAO,IAAI,iBAAiB,CAAC,KAAK,EAAE,OAAO,EAAE,QAAQ,CAAC,CAAC;QACzD,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,MAAM,OAAO,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;YACvE,MAAM,IAAI,iBAAiB,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;QACzD,CAAC;IACH,CAAC;IAED;;OAEG;IACK,UAAU,CAAC,OAAe;QAChC,MAAM,SAAS,GAAG,OAAO,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,OAAO,EAAE,CAAC;QACpE,MAAM,OAAO,GAAG,SAAS,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,GAAG,SAAS,GAAG,CAAC;QACtE,OAAO,OAAO,CAAC;IACjB,CAAC;CACF"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Regex pattern validator with ReDoS protection
|
|
3
|
+
*/
|
|
4
|
+
import type { ValidationResult } from '../types.js';
|
|
5
|
+
/**
|
|
6
|
+
* Validates regex patterns for ReDoS vulnerabilities
|
|
7
|
+
*/
|
|
8
|
+
export declare class RegexValidator {
|
|
9
|
+
private readonly maxLength;
|
|
10
|
+
constructor(maxLength?: number);
|
|
11
|
+
/**
|
|
12
|
+
* Validate regex pattern for safety
|
|
13
|
+
*/
|
|
14
|
+
validate(pattern: string): ValidationResult;
|
|
15
|
+
/**
|
|
16
|
+
* Detect nested quantifiers like (a+)+ which cause exponential backtracking
|
|
17
|
+
*/
|
|
18
|
+
private hasNestedQuantifiers;
|
|
19
|
+
/**
|
|
20
|
+
* Detect alternation groups with quantifiers which can cause backtracking
|
|
21
|
+
*/
|
|
22
|
+
private hasAmbiguousAlternation;
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=regex-validator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"regex-validator.d.ts","sourceRoot":"","sources":["../../../../src/tool-filter/regex/regex-validator.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAIpD;;GAEG;AACH,qBAAa,cAAc;IACzB,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAS;gBAEvB,SAAS,GAAE,MAA2B;IAIlD;;OAEG;IACH,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,gBAAgB;IA4B3C;;OAEG;IACH,OAAO,CAAC,oBAAoB;IAO5B;;OAEG;IACH,OAAO,CAAC,uBAAuB;CAMhC"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Regex pattern validator with ReDoS protection
|
|
3
|
+
*/
|
|
4
|
+
const DEFAULT_MAX_LENGTH = 100;
|
|
5
|
+
/**
|
|
6
|
+
* Validates regex patterns for ReDoS vulnerabilities
|
|
7
|
+
*/
|
|
8
|
+
export class RegexValidator {
|
|
9
|
+
constructor(maxLength = DEFAULT_MAX_LENGTH) {
|
|
10
|
+
this.maxLength = maxLength;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Validate regex pattern for safety
|
|
14
|
+
*/
|
|
15
|
+
validate(pattern) {
|
|
16
|
+
// Check length
|
|
17
|
+
if (pattern.length > this.maxLength) {
|
|
18
|
+
return {
|
|
19
|
+
valid: false,
|
|
20
|
+
error: `Pattern exceeds ${this.maxLength} characters`
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
// Check for nested quantifiers (ReDoS risk)
|
|
24
|
+
if (this.hasNestedQuantifiers(pattern)) {
|
|
25
|
+
return {
|
|
26
|
+
valid: false,
|
|
27
|
+
error: 'Pattern contains nested quantifiers'
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
// Check for ambiguous alternation (ReDoS risk)
|
|
31
|
+
if (this.hasAmbiguousAlternation(pattern)) {
|
|
32
|
+
return {
|
|
33
|
+
valid: false,
|
|
34
|
+
error: 'Pattern contains alternation with quantifier'
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
return { valid: true };
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Detect nested quantifiers like (a+)+ which cause exponential backtracking
|
|
41
|
+
*/
|
|
42
|
+
hasNestedQuantifiers(pattern) {
|
|
43
|
+
// Match: group with quantifier inside, followed by quantifier outside
|
|
44
|
+
// Example: (a+)+ or (x*)* or (y{2,3})+
|
|
45
|
+
const nestedPattern = /\((?:[^\\]|\\.)*?[+*{](?:[^\\]|\\.)*?\)[+*{]/;
|
|
46
|
+
return nestedPattern.test(pattern);
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Detect alternation groups with quantifiers which can cause backtracking
|
|
50
|
+
*/
|
|
51
|
+
hasAmbiguousAlternation(pattern) {
|
|
52
|
+
// Match: group with alternation (|), followed by quantifier
|
|
53
|
+
// Example: (a|aa)+ or (foo|foobar)*
|
|
54
|
+
const alternationPattern = /\((?:[^\\]|\\.)*?\|(?:[^\\]|\\.)*?\)[+*{]/;
|
|
55
|
+
return alternationPattern.test(pattern);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
//# sourceMappingURL=regex-validator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"regex-validator.js","sourceRoot":"","sources":["../../../../src/tool-filter/regex/regex-validator.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH,MAAM,kBAAkB,GAAG,GAAG,CAAC;AAE/B;;GAEG;AACH,MAAM,OAAO,cAAc;IAGzB,YAAY,YAAoB,kBAAkB;QAChD,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;IAC7B,CAAC;IAED;;OAEG;IACH,QAAQ,CAAC,OAAe;QACtB,eAAe;QACf,IAAI,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,SAAS,EAAE,CAAC;YACpC,OAAO;gBACL,KAAK,EAAE,KAAK;gBACZ,KAAK,EAAE,mBAAmB,IAAI,CAAC,SAAS,aAAa;aACtD,CAAC;QACJ,CAAC;QAED,4CAA4C;QAC5C,IAAI,IAAI,CAAC,oBAAoB,CAAC,OAAO,CAAC,EAAE,CAAC;YACvC,OAAO;gBACL,KAAK,EAAE,KAAK;gBACZ,KAAK,EAAE,qCAAqC;aAC7C,CAAC;QACJ,CAAC;QAED,+CAA+C;QAC/C,IAAI,IAAI,CAAC,uBAAuB,CAAC,OAAO,CAAC,EAAE,CAAC;YAC1C,OAAO;gBACL,KAAK,EAAE,KAAK;gBACZ,KAAK,EAAE,8CAA8C;aACtD,CAAC;QACJ,CAAC;QAED,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;IACzB,CAAC;IAED;;OAEG;IACK,oBAAoB,CAAC,OAAe;QAC1C,sEAAsE;QACtE,uCAAuC;QACvC,MAAM,aAAa,GAAG,8CAA8C,CAAC;QACrE,OAAO,aAAa,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IACrC,CAAC;IAED;;OAEG;IACK,uBAAuB,CAAC,OAAe;QAC7C,4DAA4D;QAC5D,oCAAoC;QACpC,MAAM,kBAAkB,GAAG,2CAA2C,CAAC;QACvE,OAAO,kBAAkB,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAC1C,CAAC;CACF"}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared types for tool-filter module
|
|
3
|
+
*/
|
|
4
|
+
import type { ToolDefinition } from '../types/profile.js';
|
|
5
|
+
import type { OperationInfo } from '../types/openapi.js';
|
|
6
|
+
/**
|
|
7
|
+
* Result of regex pattern validation
|
|
8
|
+
*/
|
|
9
|
+
export interface ValidationResult {
|
|
10
|
+
valid: boolean;
|
|
11
|
+
error?: string;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Compiled regex with metadata
|
|
15
|
+
*/
|
|
16
|
+
export interface CompiledRegex {
|
|
17
|
+
readonly regex: RegExp;
|
|
18
|
+
readonly original: string;
|
|
19
|
+
readonly anchored: string;
|
|
20
|
+
test(value: string): boolean;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Tool filter configuration from environment variables
|
|
24
|
+
*/
|
|
25
|
+
export interface ToolFilterConfig {
|
|
26
|
+
allowList: Set<string>;
|
|
27
|
+
denyList: Set<string>;
|
|
28
|
+
allowRegex: CompiledRegex[];
|
|
29
|
+
denyRegex: CompiledRegex[];
|
|
30
|
+
allowCategories: Set<ToolFilterCategory>;
|
|
31
|
+
hasAllowRules: boolean;
|
|
32
|
+
sources: {
|
|
33
|
+
allowList: string[];
|
|
34
|
+
allowRegex: string[];
|
|
35
|
+
denyList: string[];
|
|
36
|
+
denyRegex: string[];
|
|
37
|
+
allowCategories: string[];
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Result of applying tool filter
|
|
42
|
+
*/
|
|
43
|
+
export interface ToolFilterResult {
|
|
44
|
+
allowed: ToolDefinition[];
|
|
45
|
+
removed: ToolDefinition[];
|
|
46
|
+
reasons: Map<string, string[]>;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Session tool filter request (parsed from header)
|
|
50
|
+
*/
|
|
51
|
+
export interface SessionToolFilterRequest {
|
|
52
|
+
exactNames: Set<string>;
|
|
53
|
+
regexPatterns: CompiledRegex[];
|
|
54
|
+
allowCategories: Set<ToolFilterCategory>;
|
|
55
|
+
normalizedHeader: string;
|
|
56
|
+
rawEntries: string[];
|
|
57
|
+
hasRules: boolean;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Session tool filter result
|
|
61
|
+
*/
|
|
62
|
+
export interface SessionToolFilter {
|
|
63
|
+
allowedToolNames: Set<string>;
|
|
64
|
+
reasons: Map<string, string[]>;
|
|
65
|
+
patterns: {
|
|
66
|
+
allow: CompiledRegex[];
|
|
67
|
+
};
|
|
68
|
+
normalizedHeader: string;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Operation resolver interface (strong contract)
|
|
72
|
+
*/
|
|
73
|
+
export interface OperationResolver {
|
|
74
|
+
getOperationById(operationId: string): OperationInfo | undefined;
|
|
75
|
+
getOperationForCall(call: string): OperationInfo | undefined;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Operation category
|
|
79
|
+
*/
|
|
80
|
+
export type OperationCategory = 'list' | 'read' | 'modify';
|
|
81
|
+
/**
|
|
82
|
+
* Allowed tool filter category (excludes 'modify')
|
|
83
|
+
*/
|
|
84
|
+
export type ToolFilterCategory = 'list' | 'read';
|
|
85
|
+
/**
|
|
86
|
+
* Tool categories detection result
|
|
87
|
+
*/
|
|
88
|
+
export interface ToolCategories {
|
|
89
|
+
isList: boolean;
|
|
90
|
+
isRead: boolean;
|
|
91
|
+
}
|
|
92
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/tool-filter/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEzD;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,KAAK,EAAE,OAAO,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,IAAI,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC;CAC9B;AAED;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,SAAS,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IACvB,QAAQ,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IACtB,UAAU,EAAE,aAAa,EAAE,CAAC;IAC5B,SAAS,EAAE,aAAa,EAAE,CAAC;IAC3B,eAAe,EAAE,GAAG,CAAC,kBAAkB,CAAC,CAAC;IACzC,aAAa,EAAE,OAAO,CAAC;IACvB,OAAO,EAAE;QACP,SAAS,EAAE,MAAM,EAAE,CAAC;QACpB,UAAU,EAAE,MAAM,EAAE,CAAC;QACrB,QAAQ,EAAE,MAAM,EAAE,CAAC;QACnB,SAAS,EAAE,MAAM,EAAE,CAAC;QACpB,eAAe,EAAE,MAAM,EAAE,CAAC;KAC3B,CAAC;CACH;AAED;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,OAAO,EAAE,cAAc,EAAE,CAAC;IAC1B,OAAO,EAAE,cAAc,EAAE,CAAC;IAC1B,OAAO,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;CAChC;AAED;;GAEG;AACH,MAAM,WAAW,wBAAwB;IACvC,UAAU,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IACxB,aAAa,EAAE,aAAa,EAAE,CAAC;IAC/B,eAAe,EAAE,GAAG,CAAC,kBAAkB,CAAC,CAAC;IACzC,gBAAgB,EAAE,MAAM,CAAC;IACzB,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,QAAQ,EAAE,OAAO,CAAC;CACnB;AAED;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,gBAAgB,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IAC9B,OAAO,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;IAC/B,QAAQ,EAAE;QAAE,KAAK,EAAE,aAAa,EAAE,CAAA;KAAE,CAAC;IACrC,gBAAgB,EAAE,MAAM,CAAC;CAC1B;AAED;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,gBAAgB,CAAC,WAAW,EAAE,MAAM,GAAG,aAAa,GAAG,SAAS,CAAC;IACjE,mBAAmB,CAAC,IAAI,EAAE,MAAM,GAAG,aAAa,GAAG,SAAS,CAAC;CAC9D;AAED;;GAEG;AACH,MAAM,MAAM,iBAAiB,GAAG,MAAM,GAAG,MAAM,GAAG,QAAQ,CAAC;AAE3D;;GAEG;AACH,MAAM,MAAM,kBAAkB,GAAG,MAAM,GAAG,MAAM,CAAC;AAEjD;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,MAAM,EAAE,OAAO,CAAC;IAChB,MAAM,EAAE,OAAO,CAAC;CACjB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/tool-filter/types.ts"],"names":[],"mappings":"AAAA;;GAEG"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Utility functions for tool filtering
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Normalize tool name using Unicode NFC normalization
|
|
6
|
+
*
|
|
7
|
+
* Why: Ensures consistent matching across different Unicode representations
|
|
8
|
+
* Example: "café" (composed) vs "café" (decomposed) match correctly
|
|
9
|
+
*/
|
|
10
|
+
export declare function normalizeToolName(name: string): string;
|
|
11
|
+
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/tool-filter/utils.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAEtD"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Utility functions for tool filtering
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Normalize tool name using Unicode NFC normalization
|
|
6
|
+
*
|
|
7
|
+
* Why: Ensures consistent matching across different Unicode representations
|
|
8
|
+
* Example: "café" (composed) vs "café" (decomposed) match correctly
|
|
9
|
+
*/
|
|
10
|
+
export function normalizeToolName(name) {
|
|
11
|
+
return name.normalize('NFC');
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/tool-filter/utils.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;;;;GAKG;AACH,MAAM,UAAU,iBAAiB,CAAC,IAAY;IAC5C,OAAO,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;AAC/B,CAAC"}
|