mcp4openapi 0.2.8 → 0.3.1
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/argument-normalizer.d.ts +5 -0
- package/dist/src/argument-normalizer.d.ts.map +1 -0
- package/dist/src/argument-normalizer.js +61 -0
- package/dist/src/argument-normalizer.js.map +1 -0
- package/dist/src/auth/oauth-provider.d.ts +131 -0
- package/dist/src/auth/oauth-provider.d.ts.map +1 -0
- package/dist/src/auth/oauth-provider.js +839 -0
- package/dist/src/auth/oauth-provider.js.map +1 -0
- package/dist/src/cli-config.d.ts +9 -0
- package/dist/src/cli-config.d.ts.map +1 -0
- package/dist/src/cli-config.js +111 -0
- package/dist/src/cli-config.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 +125 -0
- package/dist/src/core/cli-config.js.map +1 -0
- package/dist/src/core/constants.d.ts +86 -0
- package/dist/src/core/constants.d.ts.map +1 -0
- package/dist/src/core/constants.js +86 -0
- package/dist/src/core/constants.js.map +1 -0
- package/dist/src/core/errors.d.ts +59 -0
- package/dist/src/core/errors.d.ts.map +1 -0
- package/dist/src/core/errors.js +119 -0
- 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 +276 -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/core/logger.d.ts +59 -0
- package/dist/src/core/logger.d.ts.map +1 -0
- package/dist/src/core/logger.js +197 -0
- package/dist/src/core/logger.js.map +1 -0
- package/dist/src/core/metrics.d.ts +97 -0
- package/dist/src/core/metrics.d.ts.map +1 -0
- package/dist/src/core/metrics.js +273 -0
- package/dist/src/core/metrics.js.map +1 -0
- package/dist/src/core/naming-warnings.d.ts +23 -0
- package/dist/src/core/naming-warnings.d.ts.map +1 -0
- package/dist/src/core/naming-warnings.js +83 -0
- package/dist/src/core/naming-warnings.js.map +1 -0
- package/dist/src/core/naming.d.ts +58 -0
- package/dist/src/core/naming.d.ts.map +1 -0
- package/dist/src/core/naming.js +510 -0
- package/dist/src/core/naming.js.map +1 -0
- package/dist/src/errors.d.ts +6 -0
- package/dist/src/errors.d.ts.map +1 -1
- package/dist/src/errors.js +15 -6
- package/dist/src/errors.js.map +1 -1
- package/dist/src/filtering.d.ts +19 -0
- package/dist/src/filtering.d.ts.map +1 -0
- package/dist/src/filtering.js +292 -0
- package/dist/src/filtering.js.map +1 -0
- package/dist/src/generated-schemas.d.ts +290 -79
- package/dist/src/generated-schemas.d.ts.map +1 -1
- package/dist/src/generated-schemas.js +17 -2
- package/dist/src/generated-schemas.js.map +1 -1
- package/dist/src/http-transport-config.d.ts +6 -0
- package/dist/src/http-transport-config.d.ts.map +1 -0
- package/dist/src/http-transport-config.js +47 -0
- package/dist/src/http-transport-config.js.map +1 -0
- package/dist/src/http-transport.d.ts +63 -13
- package/dist/src/http-transport.d.ts.map +1 -1
- package/dist/src/http-transport.js +1045 -482
- package/dist/src/http-transport.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/interceptors.d.ts +1 -0
- package/dist/src/interceptors.d.ts.map +1 -1
- package/dist/src/interceptors.js +73 -63
- package/dist/src/interceptors.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/logger.d.ts +5 -0
- package/dist/src/logger.d.ts.map +1 -1
- package/dist/src/logger.js +9 -1
- package/dist/src/logger.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/mcp-server.d.ts +205 -0
- package/dist/src/mcp/mcp-server.d.ts.map +1 -0
- package/dist/src/mcp/mcp-server.js +1473 -0
- package/dist/src/mcp/mcp-server.js.map +1 -0
- package/dist/src/mcp-server-manager.d.ts +20 -0
- package/dist/src/mcp-server-manager.d.ts.map +1 -0
- package/dist/src/mcp-server-manager.js +38 -0
- package/dist/src/mcp-server-manager.js.map +1 -0
- package/dist/src/mcp-server.d.ts +28 -0
- package/dist/src/mcp-server.d.ts.map +1 -1
- package/dist/src/mcp-server.js +406 -109
- package/dist/src/mcp-server.js.map +1 -1
- package/dist/src/metrics.d.ts +11 -0
- package/dist/src/metrics.d.ts.map +1 -1
- package/dist/src/metrics.js +61 -0
- package/dist/src/metrics.js.map +1 -1
- package/dist/src/oauth-provider.d.ts +5 -0
- package/dist/src/oauth-provider.d.ts.map +1 -1
- package/dist/src/oauth-provider.js +29 -1
- package/dist/src/oauth-provider.js.map +1 -1
- package/dist/src/openapi/openapi-parser.d.ts +70 -0
- package/dist/src/openapi/openapi-parser.d.ts.map +1 -0
- package/dist/src/openapi/openapi-parser.js +458 -0
- package/dist/src/openapi/openapi-parser.js.map +1 -0
- package/dist/src/profile/profile-loader.d.ts +78 -0
- package/dist/src/profile/profile-loader.d.ts.map +1 -0
- package/dist/src/profile/profile-loader.js +490 -0
- package/dist/src/profile/profile-loader.js.map +1 -0
- package/dist/src/profile/profile-registry.d.ts +19 -0
- package/dist/src/profile/profile-registry.d.ts.map +1 -0
- package/dist/src/profile/profile-registry.js +43 -0
- package/dist/src/profile/profile-registry.js.map +1 -0
- package/dist/src/profile/profile-resolver.d.ts +41 -0
- package/dist/src/profile/profile-resolver.d.ts.map +1 -0
- package/dist/src/profile/profile-resolver.js +324 -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/profile-loader.d.ts +1 -0
- package/dist/src/profile-loader.d.ts.map +1 -1
- package/dist/src/profile-loader.js +14 -3
- package/dist/src/profile-loader.js.map +1 -1
- package/dist/src/profile-registry.d.ts +18 -0
- package/dist/src/profile-registry.d.ts.map +1 -0
- package/dist/src/profile-registry.js +26 -0
- package/dist/src/profile-registry.js.map +1 -0
- package/dist/src/profile-resolver.d.ts +19 -0
- package/dist/src/profile-resolver.d.ts.map +1 -0
- package/dist/src/profile-resolver.js +167 -0
- package/dist/src/profile-resolver.js.map +1 -0
- package/dist/src/proxy-executor.d.ts.map +1 -1
- package/dist/src/proxy-executor.js +7 -0
- package/dist/src/proxy-executor.js.map +1 -1
- package/dist/src/startup-profile.d.ts +17 -0
- package/dist/src/startup-profile.d.ts.map +1 -0
- package/dist/src/startup-profile.js +30 -0
- package/dist/src/startup-profile.js.map +1 -0
- package/dist/src/startup-validation.d.ts +11 -0
- package/dist/src/startup-validation.d.ts.map +1 -0
- package/dist/src/startup-validation.js +21 -0
- package/dist/src/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/tool-filter.d.ts +65 -0
- package/dist/src/tool-filter.d.ts.map +1 -0
- package/dist/src/tool-filter.js +471 -0
- package/dist/src/tool-filter.js.map +1 -0
- package/dist/src/tool-generator.d.ts +1 -0
- package/dist/src/tool-generator.d.ts.map +1 -1
- package/dist/src/tool-generator.js +15 -6
- package/dist/src/tool-generator.js.map +1 -1
- package/dist/src/tooling/composite-executor.d.ts +77 -0
- package/dist/src/tooling/composite-executor.d.ts.map +1 -0
- package/dist/src/tooling/composite-executor.js +198 -0
- package/dist/src/tooling/composite-executor.js.map +1 -0
- package/dist/src/tooling/dag-executor.d.ts +49 -0
- package/dist/src/tooling/dag-executor.d.ts.map +1 -0
- package/dist/src/tooling/dag-executor.js +138 -0
- package/dist/src/tooling/dag-executor.js.map +1 -0
- package/dist/src/tooling/proxy-executor.d.ts +86 -0
- package/dist/src/tooling/proxy-executor.d.ts.map +1 -0
- package/dist/src/tooling/proxy-executor.js +501 -0
- package/dist/src/tooling/proxy-executor.js.map +1 -0
- package/dist/src/tooling/tool-generator.d.ts +67 -0
- package/dist/src/tooling/tool-generator.d.ts.map +1 -0
- package/dist/src/tooling/tool-generator.js +222 -0
- package/dist/src/tooling/tool-generator.js.map +1 -0
- package/dist/src/transport/http-client-factory.d.ts +65 -0
- package/dist/src/transport/http-client-factory.d.ts.map +1 -0
- package/dist/src/transport/http-client-factory.js +143 -0
- 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 +63 -0
- package/dist/src/transport/http-transport-config.js.map +1 -0
- package/dist/src/transport/http-transport.d.ts +329 -0
- package/dist/src/transport/http-transport.d.ts.map +1 -0
- package/dist/src/transport/http-transport.js +2584 -0
- package/dist/src/transport/http-transport.js.map +1 -0
- package/dist/src/transport/interceptors.d.ts +119 -0
- package/dist/src/transport/interceptors.d.ts.map +1 -0
- package/dist/src/transport/interceptors.js +413 -0
- package/dist/src/transport/interceptors.js.map +1 -0
- package/dist/src/transport/profile-index.d.ts +84 -0
- package/dist/src/transport/profile-index.d.ts.map +1 -0
- package/dist/src/transport/profile-index.js +405 -0
- package/dist/src/transport/profile-index.js.map +1 -0
- package/dist/src/types/http-transport.d.ts +26 -0
- package/dist/src/types/http-transport.d.ts.map +1 -1
- package/dist/src/types/openapi.d.ts +3 -0
- package/dist/src/types/openapi.d.ts.map +1 -1
- package/dist/src/types/profile.d.ts +16 -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 +27 -0
- package/dist/src/validation/jsonrpc-validator.d.ts.map +1 -0
- package/dist/src/validation/jsonrpc-validator.js +58 -0
- package/dist/src/validation/jsonrpc-validator.js.map +1 -0
- package/dist/src/validation/schema-validator.d.ts +30 -0
- package/dist/src/validation/schema-validator.d.ts.map +1 -0
- package/dist/src/validation/schema-validator.js +128 -0
- package/dist/src/validation/schema-validator.js.map +1 -0
- package/dist/src/validation/validation-utils.d.ts +49 -0
- package/dist/src/validation/validation-utils.d.ts.map +1 -0
- package/dist/src/validation/validation-utils.js +139 -0
- package/dist/src/validation/validation-utils.js.map +1 -0
- package/html/profile-index.html +386 -0
- package/package.json +10 -3
- package/profile-schema.json +77 -3
- package/profiles/gitlab/developer-profile-oauth.json +1520 -0
- package/profiles/gitlab/developer-profile-oauth.test.json +3432 -0
- package/profiles/gitlab/developer-profile.json +1508 -0
- package/profiles/gitlab/developer-profile.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/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
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
export function normalizeArguments(toolDef, args) {
|
|
2
|
+
const normalized = { ...args };
|
|
3
|
+
for (const [paramName, paramDef] of Object.entries(toolDef.parameters)) {
|
|
4
|
+
const value = normalized[paramName];
|
|
5
|
+
if (value === undefined) {
|
|
6
|
+
continue;
|
|
7
|
+
}
|
|
8
|
+
const mappedEntries = normalizeObjectEntries(paramDef, value);
|
|
9
|
+
if (mappedEntries !== undefined) {
|
|
10
|
+
normalized[paramName] = mappedEntries;
|
|
11
|
+
continue;
|
|
12
|
+
}
|
|
13
|
+
const mappedArrayItems = normalizeArrayItems(paramDef, value);
|
|
14
|
+
if (mappedArrayItems !== undefined) {
|
|
15
|
+
normalized[paramName] = mappedArrayItems;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
return normalized;
|
|
19
|
+
}
|
|
20
|
+
export function applyParameterDefaults(toolDef, args) {
|
|
21
|
+
const normalized = { ...args };
|
|
22
|
+
for (const [paramName, paramDef] of Object.entries(toolDef.parameters)) {
|
|
23
|
+
if (normalized[paramName] === undefined && paramDef.default !== undefined) {
|
|
24
|
+
normalized[paramName] = paramDef.default;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
return normalized;
|
|
28
|
+
}
|
|
29
|
+
function normalizeObjectEntries(paramDef, value) {
|
|
30
|
+
if (!paramDef.object_entries_to_array) {
|
|
31
|
+
return undefined;
|
|
32
|
+
}
|
|
33
|
+
if (typeof value !== 'object' || value === null || Array.isArray(value)) {
|
|
34
|
+
return undefined;
|
|
35
|
+
}
|
|
36
|
+
const { key_field, value_field, wrap_value_field } = paramDef.object_entries_to_array;
|
|
37
|
+
const entries = Object.entries(value);
|
|
38
|
+
return entries.map(([key, entryValue]) => ({
|
|
39
|
+
[key_field]: key,
|
|
40
|
+
[value_field]: wrapObjectValue(entryValue, wrap_value_field),
|
|
41
|
+
}));
|
|
42
|
+
}
|
|
43
|
+
function wrapObjectValue(value, wrapValueField) {
|
|
44
|
+
if (!wrapValueField) {
|
|
45
|
+
return value;
|
|
46
|
+
}
|
|
47
|
+
if (typeof value === 'object' && value !== null) {
|
|
48
|
+
return value;
|
|
49
|
+
}
|
|
50
|
+
return { [wrapValueField]: value };
|
|
51
|
+
}
|
|
52
|
+
function normalizeArrayItems(paramDef, value) {
|
|
53
|
+
if (!paramDef.array_item_to_object) {
|
|
54
|
+
return undefined;
|
|
55
|
+
}
|
|
56
|
+
if (!Array.isArray(value)) {
|
|
57
|
+
return undefined;
|
|
58
|
+
}
|
|
59
|
+
const { key_field } = paramDef.array_item_to_object;
|
|
60
|
+
return value.map(item => {
|
|
61
|
+
if (typeof item === 'object' && item !== null && !Array.isArray(item)) {
|
|
62
|
+
return item;
|
|
63
|
+
}
|
|
64
|
+
if (['string', 'number', 'boolean'].includes(typeof item)) {
|
|
65
|
+
return { [key_field]: item };
|
|
66
|
+
}
|
|
67
|
+
return item;
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
//# sourceMappingURL=argument-normalizer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"argument-normalizer.js","sourceRoot":"","sources":["../../../src/validation/argument-normalizer.ts"],"names":[],"mappings":"AAIA,MAAM,UAAU,kBAAkB,CAChC,OAAuB,EACvB,IAA6B;IAE7B,MAAM,UAAU,GAAwB,EAAE,GAAG,IAAI,EAAE,CAAA;IAEnD,KAAK,MAA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AAI,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC;YACtE,OAAO,IAAI,CAAA;QACb,CAAC;QAED,IAAI,CAAC,QAAQ,EAAE,QAAQ,EAAE,SAAS,CAAC,CAAC,QAAQ,CAAC,OAAO,IAAI,CAAC,EAAE,CAAC;YAC1D,OAAO,EAAE,CAAC,SAAS,CAAC,EAAE,IAAI,EAAE,CAAA;QAC9B,CAAC;QAED,OAAO,IAAI,CAAA;IACb,CAAC,CAAC,CAAA;AACJ,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* JSON-RPC message validation utilities
|
|
3
|
+
*
|
|
4
|
+
* Why: Eliminates code duplication between http-transport.ts and mcp-server.ts
|
|
5
|
+
* These functions validate JSON-RPC 2.0 message types used in MCP protocol.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Check if message is an initialize request
|
|
9
|
+
*/
|
|
10
|
+
export declare function isInitializeRequest(message: unknown): boolean;
|
|
11
|
+
/**
|
|
12
|
+
* Check if message is a tool call request
|
|
13
|
+
*/
|
|
14
|
+
export declare function isToolCallRequest(message: unknown): boolean;
|
|
15
|
+
/**
|
|
16
|
+
* Check if message is a tools/list request
|
|
17
|
+
*/
|
|
18
|
+
export declare function isToolsListRequest(message: unknown): boolean;
|
|
19
|
+
/**
|
|
20
|
+
* Check if message is a valid JSON-RPC request object
|
|
21
|
+
*/
|
|
22
|
+
export declare function isJsonRpcRequest(message: unknown): boolean;
|
|
23
|
+
/**
|
|
24
|
+
* Check if message is a valid JSON-RPC response object
|
|
25
|
+
*/
|
|
26
|
+
export declare function isJsonRpcResponse(message: unknown): boolean;
|
|
27
|
+
//# sourceMappingURL=jsonrpc-validator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jsonrpc-validator.d.ts","sourceRoot":"","sources":["../../../src/validation/jsonrpc-validator.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAI7D;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAI3D;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAI5D;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAS1D;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAS3D"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* JSON-RPC message validation utilities
|
|
3
|
+
*
|
|
4
|
+
* Why: Eliminates code duplication between http-transport.ts and mcp-server.ts
|
|
5
|
+
* These functions validate JSON-RPC 2.0 message types used in MCP protocol.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Check if message is an initialize request
|
|
9
|
+
*/
|
|
10
|
+
export function isInitializeRequest(message) {
|
|
11
|
+
if (typeof message !== 'object' || message === null)
|
|
12
|
+
return false;
|
|
13
|
+
const req = message;
|
|
14
|
+
return req.method === 'initialize';
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Check if message is a tool call request
|
|
18
|
+
*/
|
|
19
|
+
export function isToolCallRequest(message) {
|
|
20
|
+
if (typeof message !== 'object' || message === null)
|
|
21
|
+
return false;
|
|
22
|
+
const req = message;
|
|
23
|
+
return req.method === 'tools/call';
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Check if message is a tools/list request
|
|
27
|
+
*/
|
|
28
|
+
export function isToolsListRequest(message) {
|
|
29
|
+
if (typeof message !== 'object' || message === null)
|
|
30
|
+
return false;
|
|
31
|
+
const req = message;
|
|
32
|
+
return req.method === 'tools/list';
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Check if message is a valid JSON-RPC request object
|
|
36
|
+
*/
|
|
37
|
+
export function isJsonRpcRequest(message) {
|
|
38
|
+
if (typeof message !== 'object' || message === null)
|
|
39
|
+
return false;
|
|
40
|
+
const req = message;
|
|
41
|
+
return (typeof req.jsonrpc === 'string' &&
|
|
42
|
+
req.jsonrpc === '2.0' &&
|
|
43
|
+
typeof req.method === 'string' &&
|
|
44
|
+
'id' in req);
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Check if message is a valid JSON-RPC response object
|
|
48
|
+
*/
|
|
49
|
+
export function isJsonRpcResponse(message) {
|
|
50
|
+
if (typeof message !== 'object' || message === null)
|
|
51
|
+
return false;
|
|
52
|
+
const resp = message;
|
|
53
|
+
return (typeof resp.jsonrpc === 'string' &&
|
|
54
|
+
resp.jsonrpc === '2.0' &&
|
|
55
|
+
'id' in resp &&
|
|
56
|
+
('result' in resp || 'error' in resp));
|
|
57
|
+
}
|
|
58
|
+
//# sourceMappingURL=jsonrpc-validator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jsonrpc-validator.js","sourceRoot":"","sources":["../../../src/validation/jsonrpc-validator.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;GAEG;AACH,MAAM,UAAU,mBAAmB,CAAC,OAAgB;IAClD,IAAI,OAAO,OAAO,KAAK,QAAQ,IAAI,OAAO,KAAK,IAAI;QAAE,OAAO,KAAK,CAAC;IAClE,MAAM,GAAG,GAAG,OAAkC,CAAC;IAC/C,OAAO,GAAG,CAAC,MAAM,KAAK,YAAY,CAAC;AACrC,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,iBAAiB,CAAC,OAAgB;IAChD,IAAI,OAAO,OAAO,KAAK,QAAQ,IAAI,OAAO,KAAK,IAAI;QAAE,OAAO,KAAK,CAAC;IAClE,MAAM,GAAG,GAAG,OAAkC,CAAC;IAC/C,OAAO,GAAG,CAAC,MAAM,KAAK,YAAY,CAAC;AACrC,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,kBAAkB,CAAC,OAAgB;IACjD,IAAI,OAAO,OAAO,KAAK,QAAQ,IAAI,OAAO,KAAK,IAAI;QAAE,OAAO,KAAK,CAAC;IAClE,MAAM,GAAG,GAAG,OAAkC,CAAC;IAC/C,OAAO,GAAG,CAAC,MAAM,KAAK,YAAY,CAAC;AACrC,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,gBAAgB,CAAC,OAAgB;IAC/C,IAAI,OAAO,OAAO,KAAK,QAAQ,IAAI,OAAO,KAAK,IAAI;QAAE,OAAO,KAAK,CAAC;IAClE,MAAM,GAAG,GAAG,OAAkC,CAAC;IAC/C,OAAO,CACL,OAAO,GAAG,CAAC,OAAO,KAAK,QAAQ;QAC/B,GAAG,CAAC,OAAO,KAAK,KAAK;QACrB,OAAO,GAAG,CAAC,MAAM,KAAK,QAAQ;QAC9B,IAAI,IAAI,GAAG,CACZ,CAAC;AACJ,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,iBAAiB,CAAC,OAAgB;IAChD,IAAI,OAAO,OAAO,KAAK,QAAQ,IAAI,OAAO,KAAK,IAAI;QAAE,OAAO,KAAK,CAAC;IAClE,MAAM,IAAI,GAAG,OAAkC,CAAC;IAChD,OAAO,CACL,OAAO,IAAI,CAAC,OAAO,KAAK,QAAQ;QAChC,IAAI,CAAC,OAAO,KAAK,KAAK;QACtB,IAAI,IAAI,IAAI;QACZ,CAAC,QAAQ,IAAI,IAAI,IAAI,OAAO,IAAI,IAAI,CAAC,CACtC,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Request body schema validator
|
|
3
|
+
*
|
|
4
|
+
* Why: Catch invalid requests before sending to API. Better error messages for users.
|
|
5
|
+
* Validates against OpenAPI schema definitions.
|
|
6
|
+
*/
|
|
7
|
+
import type { SchemaInfo, OperationInfo } from '../types/openapi.js';
|
|
8
|
+
export interface ValidationResult {
|
|
9
|
+
valid: boolean;
|
|
10
|
+
errors?: ValidationError[];
|
|
11
|
+
}
|
|
12
|
+
export interface ValidationError {
|
|
13
|
+
path: string;
|
|
14
|
+
message: string;
|
|
15
|
+
schema: SchemaInfo;
|
|
16
|
+
value: unknown;
|
|
17
|
+
}
|
|
18
|
+
export declare class SchemaValidator {
|
|
19
|
+
/**
|
|
20
|
+
* Validate request body against OpenAPI schema
|
|
21
|
+
*
|
|
22
|
+
* Why: Prevents sending malformed requests. OpenAPI schema is the source of truth.
|
|
23
|
+
*/
|
|
24
|
+
validateRequestBody(operation: OperationInfo, body: unknown): ValidationResult;
|
|
25
|
+
/**
|
|
26
|
+
* Recursively validate data against schema
|
|
27
|
+
*/
|
|
28
|
+
private validateAgainstSchema;
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=schema-validator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema-validator.d.ts","sourceRoot":"","sources":["../../../src/validation/schema-validator.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAGrE,MAAM,WAAW,gBAAgB;IAC/B,KAAK,EAAE,OAAO,CAAC;IACf,MAAM,CAAC,EAAE,eAAe,EAAE,CAAC;CAC5B;AAED,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,UAAU,CAAC;IACnB,KAAK,EAAE,OAAO,CAAC;CAChB;AAED,qBAAa,eAAe;IAC1B;;;;OAIG;IACH,mBAAmB,CACjB,SAAS,EAAE,aAAa,EACxB,IAAI,EAAE,OAAO,GACZ,gBAAgB;IAgBnB;;OAEG;IACH,OAAO,CAAC,qBAAqB;CA2H9B"}
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Request body schema validator
|
|
3
|
+
*
|
|
4
|
+
* Why: Catch invalid requests before sending to API. Better error messages for users.
|
|
5
|
+
* Validates against OpenAPI schema definitions.
|
|
6
|
+
*/
|
|
7
|
+
import { isEmail, isUri } from './validation-utils.js';
|
|
8
|
+
export class SchemaValidator {
|
|
9
|
+
/**
|
|
10
|
+
* Validate request body against OpenAPI schema
|
|
11
|
+
*
|
|
12
|
+
* Why: Prevents sending malformed requests. OpenAPI schema is the source of truth.
|
|
13
|
+
*/
|
|
14
|
+
validateRequestBody(operation, body) {
|
|
15
|
+
if (!operation.requestBody?.content['application/json']?.schema) {
|
|
16
|
+
return { valid: true };
|
|
17
|
+
}
|
|
18
|
+
const schema = operation.requestBody.content['application/json'].schema;
|
|
19
|
+
const errors = [];
|
|
20
|
+
this.validateAgainstSchema(body, schema, '', errors);
|
|
21
|
+
return {
|
|
22
|
+
valid: errors.length === 0,
|
|
23
|
+
errors: errors.length > 0 ? errors : undefined,
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Recursively validate data against schema
|
|
28
|
+
*/
|
|
29
|
+
validateAgainstSchema(data, schema, path, errors) {
|
|
30
|
+
// Null/undefined handling
|
|
31
|
+
if (data === null || data === undefined) {
|
|
32
|
+
if (schema.type && schema.type !== 'null') {
|
|
33
|
+
errors.push({
|
|
34
|
+
path: path || '(root)',
|
|
35
|
+
message: `Expected ${schema.type}, got ${data}`,
|
|
36
|
+
schema,
|
|
37
|
+
value: data,
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
// Type validation
|
|
43
|
+
if (schema.type) {
|
|
44
|
+
const actualType = Array.isArray(data) ? 'array' : typeof data;
|
|
45
|
+
// OpenAPI 'integer' is a subtype of 'number' with format constraint
|
|
46
|
+
const expectedType = schema.type === 'integer' ? 'number' : schema.type;
|
|
47
|
+
if (actualType !== expectedType) {
|
|
48
|
+
errors.push({
|
|
49
|
+
path: path || '(root)',
|
|
50
|
+
message: `Expected ${schema.type}, got ${actualType}`,
|
|
51
|
+
schema,
|
|
52
|
+
value: data,
|
|
53
|
+
});
|
|
54
|
+
return; // Stop validation if type is wrong
|
|
55
|
+
}
|
|
56
|
+
// Additional integer validation: check it's actually an integer
|
|
57
|
+
if (schema.type === 'integer' && typeof data === 'number') {
|
|
58
|
+
if (!Number.isInteger(data)) {
|
|
59
|
+
errors.push({
|
|
60
|
+
path: path || '(root)',
|
|
61
|
+
message: `Expected integer, got number`,
|
|
62
|
+
schema,
|
|
63
|
+
value: data,
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
// Enum validation
|
|
69
|
+
// Note: Using 'as any' here is safe - we're checking if value exists in enum array
|
|
70
|
+
// TypeScript doesn't know the enum values at compile time
|
|
71
|
+
if (schema.enum && !schema.enum.includes(data)) {
|
|
72
|
+
errors.push({
|
|
73
|
+
path: path || '(root)',
|
|
74
|
+
message: `Value must be one of: ${schema.enum.join(', ')}`,
|
|
75
|
+
schema,
|
|
76
|
+
value: data,
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
// Object properties validation
|
|
80
|
+
if (schema.type === 'object' && schema.properties) {
|
|
81
|
+
const obj = data;
|
|
82
|
+
// Check required properties
|
|
83
|
+
for (const required of schema.required || []) {
|
|
84
|
+
if (obj[required] === undefined) {
|
|
85
|
+
errors.push({
|
|
86
|
+
path: path ? `${path}.${required}` : required,
|
|
87
|
+
message: 'Required property is missing',
|
|
88
|
+
schema,
|
|
89
|
+
value: undefined,
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
// Validate each property
|
|
94
|
+
for (const [key, value] of Object.entries(obj)) {
|
|
95
|
+
if (schema.properties[key]) {
|
|
96
|
+
this.validateAgainstSchema(value, schema.properties[key], path ? `${path}.${key}` : key, errors);
|
|
97
|
+
}
|
|
98
|
+
// Note: Not validating additionalProperties (too strict for most APIs)
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
// Array items validation
|
|
102
|
+
if (schema.type === 'array' && schema.items && Array.isArray(data)) {
|
|
103
|
+
data.forEach((item, index) => {
|
|
104
|
+
this.validateAgainstSchema(item, schema.items, `${path}[${index}]`, errors);
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
// String format validation (basic)
|
|
108
|
+
if (schema.type === 'string' && schema.format && typeof data === 'string') {
|
|
109
|
+
if (schema.format === 'email' && !isEmail(data)) {
|
|
110
|
+
errors.push({
|
|
111
|
+
path: path || '(root)',
|
|
112
|
+
message: 'Invalid email format',
|
|
113
|
+
schema,
|
|
114
|
+
value: data,
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
if (schema.format === 'uri' && !isUri(data)) {
|
|
118
|
+
errors.push({
|
|
119
|
+
path: path || '(root)',
|
|
120
|
+
message: 'Invalid URI format',
|
|
121
|
+
schema,
|
|
122
|
+
value: data,
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
//# sourceMappingURL=schema-validator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema-validator.js","sourceRoot":"","sources":["../../../src/validation/schema-validator.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAcvD,MAAM,OAAO,eAAe;IAC1B;;;;OAIG;IACH,mBAAmB,CACjB,SAAwB,EACxB,IAAa;QAEb,IAAI,CAAC,SAAS,CAAC,WAAW,EAAE,OAAO,CAAC,kBAAkB,CAAC,EAAE,MAAM,EAAE,CAAC;YAChE,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;QACzB,CAAC;QAED,MAAM,MAAM,GAAG,SAAS,CAAC,WAAW,CAAC,OAAO,CAAC,kBAAkB,CAAC,CAAC,MAAM,CAAC;QACxE,MAAM,MAAM,GAAsB,EAAE,CAAC;QAErC,IAAI,CAAC,qBAAqB,CAAC,IAAI,EAAE,MAA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AK,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC;gBAC5C,MAAM,CAAC,IAAI,CAAC;oBACV,IAAI,EAAE,IAAI,IAAI,QAAQ;oBACtB,OAAO,EAAE,oBAAoB;oBAC7B,MAAM;oBACN,KAAK,EAAE,IAAI;iBACZ,CAAC,CAAC;YACL,CAAC;QACH,CAAC;IACH,CAAC;CAEF"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Validation utilities for common data types
|
|
3
|
+
*
|
|
4
|
+
* Why: Provides reusable validation functions for email, URI, and other formats
|
|
5
|
+
* Centralizes validation logic and ensures consistency across the application
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Validates that a property name is safe to use as dynamic object key.
|
|
9
|
+
* Prevents prototype pollution attacks.
|
|
10
|
+
*/
|
|
11
|
+
export declare function isSafePropertyName(name: string): boolean;
|
|
12
|
+
/**
|
|
13
|
+
* Escape special regex characters in a string.
|
|
14
|
+
* Prevents ReDoS attacks when using dynamic strings in RegExp.
|
|
15
|
+
*/
|
|
16
|
+
export declare function escapeRegExp(str: string): string;
|
|
17
|
+
/**
|
|
18
|
+
* Redact specific header from headers object (case-insensitive)
|
|
19
|
+
*/
|
|
20
|
+
export declare function redactHeader(headers: unknown, headerName: string): Record<string, unknown>;
|
|
21
|
+
/**
|
|
22
|
+
* Redact query parameter from URL string
|
|
23
|
+
*/
|
|
24
|
+
export declare function redactQueryParam(url: string | undefined, paramName: string): string;
|
|
25
|
+
/**
|
|
26
|
+
* Redact parameter from params object
|
|
27
|
+
*/
|
|
28
|
+
export declare function redactParam(params: unknown, paramName: string): Record<string, unknown>;
|
|
29
|
+
/**
|
|
30
|
+
* Validates if a string is a valid email address
|
|
31
|
+
*/
|
|
32
|
+
export declare function isEmail(value: string): boolean;
|
|
33
|
+
/**
|
|
34
|
+
* Validates if a string is a valid URI
|
|
35
|
+
*/
|
|
36
|
+
export declare function isUri(value: string): boolean;
|
|
37
|
+
/**
|
|
38
|
+
* Escape HTML special characters to prevent XSS attacks
|
|
39
|
+
*
|
|
40
|
+
* Why: User-provided strings in error messages must be sanitized
|
|
41
|
+
* before being returned in JSON responses that might be rendered as HTML.
|
|
42
|
+
*
|
|
43
|
+
* Uses escape-html library for reliable HTML entity escaping.
|
|
44
|
+
*
|
|
45
|
+
* @param str - String to escape (can be undefined or null)
|
|
46
|
+
* @returns Escaped string safe for HTML rendering, empty string if input is falsy
|
|
47
|
+
*/
|
|
48
|
+
export declare function escapeHtmlSafe(str: string | undefined | null): string;
|
|
49
|
+
//# sourceMappingURL=validation-utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validation-utils.d.ts","sourceRoot":"","sources":["../../../src/validation/validation-utils.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAqBH;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAExD;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAEhD;AAED;;GAEG;AACH,wBAAgB,YAAY,CAC1B,OAAO,EAAE,OAAO,EAChB,UAAU,EAAE,MAAM,GACjB,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAYzB;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAC9B,GAAG,EAAE,MAAM,GAAG,SAAS,EACvB,SAAS,EAAE,MAAM,GAChB,MAAM,CAiCR;AAED;;GAEG;AACH,wBAAgB,WAAW,CACzB,MAAM,EAAE,OAAO,EACf,SAAS,EAAE,MAAM,GAChB,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CASzB;AAED;;GAEG;AACH,wBAAgB,OAAO,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAG9C;AAED;;GAEG;AACH,wBAAgB,KAAK,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAO5C;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,GAAG,MAAM,CAGrE"}
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Validation utilities for common data types
|
|
3
|
+
*
|
|
4
|
+
* Why: Provides reusable validation functions for email, URI, and other formats
|
|
5
|
+
* Centralizes validation logic and ensures consistency across the application
|
|
6
|
+
*/
|
|
7
|
+
import escapeHtml from 'escape-html';
|
|
8
|
+
/** Property names that must never be used as dynamic object keys */
|
|
9
|
+
const FORBIDDEN_PROPERTY_NAMES = new Set([
|
|
10
|
+
'__proto__',
|
|
11
|
+
'constructor',
|
|
12
|
+
'prototype',
|
|
13
|
+
'__defineGetter__',
|
|
14
|
+
'__defineSetter__',
|
|
15
|
+
'__lookupGetter__',
|
|
16
|
+
'__lookupSetter__',
|
|
17
|
+
'hasOwnProperty',
|
|
18
|
+
'isPrototypeOf',
|
|
19
|
+
'propertyIsEnumerable',
|
|
20
|
+
'toLocaleString',
|
|
21
|
+
'toString',
|
|
22
|
+
'valueOf',
|
|
23
|
+
]);
|
|
24
|
+
/**
|
|
25
|
+
* Validates that a property name is safe to use as dynamic object key.
|
|
26
|
+
* Prevents prototype pollution attacks.
|
|
27
|
+
*/
|
|
28
|
+
export function isSafePropertyName(name) {
|
|
29
|
+
return !FORBIDDEN_PROPERTY_NAMES.has(name);
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Escape special regex characters in a string.
|
|
33
|
+
* Prevents ReDoS attacks when using dynamic strings in RegExp.
|
|
34
|
+
*/
|
|
35
|
+
export function escapeRegExp(str) {
|
|
36
|
+
return str.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Redact specific header from headers object (case-insensitive)
|
|
40
|
+
*/
|
|
41
|
+
export function redactHeader(headers, headerName) {
|
|
42
|
+
if (!headers || typeof headers !== 'object')
|
|
43
|
+
return {};
|
|
44
|
+
const redacted = { ...headers };
|
|
45
|
+
for (const key of Object.keys(redacted)) {
|
|
46
|
+
if (key.toLowerCase() === headerName.toLowerCase()) {
|
|
47
|
+
redacted[key] = '[REDACTED]';
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
return redacted;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Redact query parameter from URL string
|
|
54
|
+
*/
|
|
55
|
+
export function redactQueryParam(url, paramName) {
|
|
56
|
+
if (!url)
|
|
57
|
+
return '';
|
|
58
|
+
// Enforce safe paramName (alphanumeric, underscore, dash) length <= 64
|
|
59
|
+
if (!/^[A-Za-z0-9_-]{1,64}$/.test(paramName)) {
|
|
60
|
+
return url; // Unsafe param name; return original unmodified
|
|
61
|
+
}
|
|
62
|
+
try {
|
|
63
|
+
const urlObj = new URL(url);
|
|
64
|
+
if (urlObj.searchParams.has(paramName)) {
|
|
65
|
+
urlObj.searchParams.set(paramName, '[REDACTED]');
|
|
66
|
+
}
|
|
67
|
+
return urlObj.toString();
|
|
68
|
+
}
|
|
69
|
+
catch {
|
|
70
|
+
// Fallback: manual parsing without dynamic RegExp to avoid ReDoS concerns
|
|
71
|
+
// Split on '?' then process query string key-value pairs
|
|
72
|
+
const qIndex = url.indexOf('?');
|
|
73
|
+
if (qIndex === -1)
|
|
74
|
+
return url;
|
|
75
|
+
const base = url.substring(0, qIndex);
|
|
76
|
+
const query = url.substring(qIndex + 1);
|
|
77
|
+
const parts = query.split('&');
|
|
78
|
+
const redactedParts = parts.map(part => {
|
|
79
|
+
const eqIndex = part.indexOf('=');
|
|
80
|
+
if (eqIndex === -1)
|
|
81
|
+
return part; // skip malformed segment
|
|
82
|
+
const key = part.substring(0, eqIndex);
|
|
83
|
+
if (key === paramName) {
|
|
84
|
+
// Encode [REDACTED] for consistency with URLSearchParams behavior
|
|
85
|
+
return key + '=%5BREDACTED%5D';
|
|
86
|
+
}
|
|
87
|
+
return part;
|
|
88
|
+
});
|
|
89
|
+
return base + '?' + redactedParts.join('&');
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Redact parameter from params object
|
|
94
|
+
*/
|
|
95
|
+
export function redactParam(params, paramName) {
|
|
96
|
+
if (!params || typeof params !== 'object')
|
|
97
|
+
return {};
|
|
98
|
+
const redacted = { ...params };
|
|
99
|
+
if (paramName in redacted) {
|
|
100
|
+
redacted[paramName] = '[REDACTED]';
|
|
101
|
+
}
|
|
102
|
+
return redacted;
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Validates if a string is a valid email address
|
|
106
|
+
*/
|
|
107
|
+
export function isEmail(value) {
|
|
108
|
+
// codeql[js/polynomial-redos] Simple validation; not intended to fully validate RFC emails.
|
|
109
|
+
return /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(value);
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Validates if a string is a valid URI
|
|
113
|
+
*/
|
|
114
|
+
export function isUri(value) {
|
|
115
|
+
try {
|
|
116
|
+
new URL(value);
|
|
117
|
+
return true;
|
|
118
|
+
}
|
|
119
|
+
catch {
|
|
120
|
+
return false;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* Escape HTML special characters to prevent XSS attacks
|
|
125
|
+
*
|
|
126
|
+
* Why: User-provided strings in error messages must be sanitized
|
|
127
|
+
* before being returned in JSON responses that might be rendered as HTML.
|
|
128
|
+
*
|
|
129
|
+
* Uses escape-html library for reliable HTML entity escaping.
|
|
130
|
+
*
|
|
131
|
+
* @param str - String to escape (can be undefined or null)
|
|
132
|
+
* @returns Escaped string safe for HTML rendering, empty string if input is falsy
|
|
133
|
+
*/
|
|
134
|
+
export function escapeHtmlSafe(str) {
|
|
135
|
+
if (!str)
|
|
136
|
+
return '';
|
|
137
|
+
return escapeHtml(String(str));
|
|
138
|
+
}
|
|
139
|
+
//# sourceMappingURL=validation-utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"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