@kya-os/mcp-i-core 1.2.3-canary.7 → 1.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/.claude/settings.local.json +9 -0
- package/.turbo/turbo-build.log +4 -0
- package/.turbo/turbo-test.log +2979 -0
- package/COMPLIANCE_IMPROVEMENT_REPORT.md +483 -0
- package/Composer 3.md +615 -0
- package/GPT-5.md +1169 -0
- package/OPUS-plan.md +352 -0
- package/PHASE_3_AND_4.1_SUMMARY.md +585 -0
- package/PHASE_3_SUMMARY.md +317 -0
- package/PHASE_4.1.3_SUMMARY.md +428 -0
- package/PHASE_4.1_COMPLETE.md +525 -0
- package/PHASE_4_USER_DID_IDENTITY_LINKING_PLAN.md +1240 -0
- package/SCHEMA_COMPLIANCE_REPORT.md +275 -0
- package/TEST_PLAN.md +571 -0
- package/coverage/coverage-final.json +57 -0
- package/dist/__tests__/utils/mock-providers.d.ts +1 -2
- package/dist/__tests__/utils/mock-providers.d.ts.map +1 -1
- package/dist/__tests__/utils/mock-providers.js.map +1 -1
- package/dist/cache/oauth-config-cache.d.ts +69 -0
- package/dist/cache/oauth-config-cache.d.ts.map +1 -0
- package/dist/cache/oauth-config-cache.js +76 -0
- package/dist/cache/oauth-config-cache.js.map +1 -0
- package/dist/identity/idp-token-resolver.d.ts +53 -0
- package/dist/identity/idp-token-resolver.d.ts.map +1 -0
- package/dist/identity/idp-token-resolver.js +108 -0
- package/dist/identity/idp-token-resolver.js.map +1 -0
- package/dist/identity/idp-token-storage.interface.d.ts +42 -0
- package/dist/identity/idp-token-storage.interface.d.ts.map +1 -0
- package/dist/identity/idp-token-storage.interface.js +12 -0
- package/dist/identity/idp-token-storage.interface.js.map +1 -0
- package/dist/identity/user-did-manager.d.ts +39 -1
- package/dist/identity/user-did-manager.d.ts.map +1 -1
- package/dist/identity/user-did-manager.js +69 -3
- package/dist/identity/user-did-manager.js.map +1 -1
- package/dist/index.d.ts +22 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +39 -1
- package/dist/index.js.map +1 -1
- package/dist/runtime/audit-logger.d.ts +37 -0
- package/dist/runtime/audit-logger.d.ts.map +1 -0
- package/dist/runtime/audit-logger.js +9 -0
- package/dist/runtime/audit-logger.js.map +1 -0
- package/dist/runtime/base.d.ts +58 -2
- package/dist/runtime/base.d.ts.map +1 -1
- package/dist/runtime/base.js +266 -11
- package/dist/runtime/base.js.map +1 -1
- package/dist/services/access-control.service.d.ts.map +1 -1
- package/dist/services/access-control.service.js +200 -35
- package/dist/services/access-control.service.js.map +1 -1
- package/dist/services/authorization/authorization-registry.d.ts +29 -0
- package/dist/services/authorization/authorization-registry.d.ts.map +1 -0
- package/dist/services/authorization/authorization-registry.js +57 -0
- package/dist/services/authorization/authorization-registry.js.map +1 -0
- package/dist/services/authorization/types.d.ts +53 -0
- package/dist/services/authorization/types.d.ts.map +1 -0
- package/dist/services/authorization/types.js +10 -0
- package/dist/services/authorization/types.js.map +1 -0
- package/dist/services/batch-delegation.service.d.ts +53 -0
- package/dist/services/batch-delegation.service.d.ts.map +1 -0
- package/dist/services/batch-delegation.service.js +95 -0
- package/dist/services/batch-delegation.service.js.map +1 -0
- package/dist/services/oauth-config.service.d.ts +53 -0
- package/dist/services/oauth-config.service.d.ts.map +1 -0
- package/dist/services/oauth-config.service.js +119 -0
- package/dist/services/oauth-config.service.js.map +1 -0
- package/dist/services/oauth-provider-registry.d.ts +88 -0
- package/dist/services/oauth-provider-registry.d.ts.map +1 -0
- package/dist/services/oauth-provider-registry.js +128 -0
- package/dist/services/oauth-provider-registry.js.map +1 -0
- package/dist/services/oauth-service.d.ts +77 -0
- package/dist/services/oauth-service.d.ts.map +1 -0
- package/dist/services/oauth-service.js +348 -0
- package/dist/services/oauth-service.js.map +1 -0
- package/dist/services/oauth-token-retrieval.service.d.ts +49 -0
- package/dist/services/oauth-token-retrieval.service.d.ts.map +1 -0
- package/dist/services/oauth-token-retrieval.service.js +150 -0
- package/dist/services/oauth-token-retrieval.service.js.map +1 -0
- package/dist/services/provider-resolver.d.ts +48 -0
- package/dist/services/provider-resolver.d.ts.map +1 -0
- package/dist/services/provider-resolver.js +121 -0
- package/dist/services/provider-resolver.js.map +1 -0
- package/dist/services/provider-validator.d.ts +55 -0
- package/dist/services/provider-validator.d.ts.map +1 -0
- package/dist/services/provider-validator.js +135 -0
- package/dist/services/provider-validator.js.map +1 -0
- package/dist/services/tool-context-builder.d.ts +57 -0
- package/dist/services/tool-context-builder.d.ts.map +1 -0
- package/dist/services/tool-context-builder.js +125 -0
- package/dist/services/tool-context-builder.js.map +1 -0
- package/dist/services/tool-protection.service.d.ts +87 -10
- package/dist/services/tool-protection.service.d.ts.map +1 -1
- package/dist/services/tool-protection.service.js +282 -112
- package/dist/services/tool-protection.service.js.map +1 -1
- package/dist/types/oauth-required-error.d.ts +40 -0
- package/dist/types/oauth-required-error.d.ts.map +1 -0
- package/dist/types/oauth-required-error.js +40 -0
- package/dist/types/oauth-required-error.js.map +1 -0
- package/dist/utils/did-helpers.d.ts +33 -0
- package/dist/utils/did-helpers.d.ts.map +1 -1
- package/dist/utils/did-helpers.js +40 -0
- package/dist/utils/did-helpers.js.map +1 -1
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +1 -0
- package/dist/utils/index.js.map +1 -1
- package/docs/API_REFERENCE.md +1362 -0
- package/docs/COMPLIANCE_MATRIX.md +691 -0
- package/docs/STATUSLIST2021_GUIDE.md +696 -0
- package/docs/W3C_VC_DELEGATION_GUIDE.md +710 -0
- package/package.json +24 -50
- package/scripts/audit-compliance.ts +724 -0
- package/src/__tests__/cache/tool-protection-cache.test.ts +640 -0
- package/src/__tests__/config/provider-runtime-config.test.ts +309 -0
- package/src/__tests__/delegation-e2e.test.ts +690 -0
- package/src/__tests__/identity/user-did-manager.test.ts +213 -0
- package/src/__tests__/index.test.ts +56 -0
- package/src/__tests__/integration/full-flow.test.ts +776 -0
- package/src/__tests__/integration.test.ts +281 -0
- package/src/__tests__/providers/base.test.ts +173 -0
- package/src/__tests__/providers/memory.test.ts +319 -0
- package/src/__tests__/regression/phase2-regression.test.ts +429 -0
- package/src/__tests__/runtime/audit-logger.test.ts +154 -0
- package/src/__tests__/runtime/base-extensions.test.ts +593 -0
- package/src/__tests__/runtime/base.test.ts +869 -0
- package/src/__tests__/runtime/delegation-flow.test.ts +164 -0
- package/src/__tests__/runtime/proof-client-did.test.ts +375 -0
- package/src/__tests__/runtime/route-interception.test.ts +686 -0
- package/src/__tests__/runtime/tool-protection-enforcement.test.ts +908 -0
- package/src/__tests__/services/agentshield-integration.test.ts +784 -0
- package/src/__tests__/services/provider-resolver-edge-cases.test.ts +591 -0
- package/src/__tests__/services/tool-protection-oauth-provider.test.ts +480 -0
- package/src/__tests__/services/tool-protection.service.test.ts +1366 -0
- package/src/__tests__/utils/mock-providers.ts +340 -0
- package/src/cache/oauth-config-cache.d.ts +69 -0
- package/src/cache/oauth-config-cache.d.ts.map +1 -0
- package/src/cache/oauth-config-cache.js.map +1 -0
- package/src/cache/oauth-config-cache.ts +123 -0
- package/src/cache/tool-protection-cache.ts +171 -0
- package/src/compliance/EXAMPLE.md +412 -0
- package/src/compliance/__tests__/schema-verifier.test.ts +797 -0
- package/src/compliance/index.ts +8 -0
- package/src/compliance/schema-registry.ts +460 -0
- package/src/compliance/schema-verifier.ts +708 -0
- package/src/config/__tests__/remote-config.spec.ts +268 -0
- package/src/config/remote-config.ts +174 -0
- package/src/config.ts +309 -0
- package/src/delegation/__tests__/audience-validator.test.ts +112 -0
- package/src/delegation/__tests__/bitstring.test.ts +346 -0
- package/src/delegation/__tests__/cascading-revocation.test.ts +628 -0
- package/src/delegation/__tests__/delegation-graph.test.ts +584 -0
- package/src/delegation/__tests__/utils.test.ts +152 -0
- package/src/delegation/__tests__/vc-issuer.test.ts +442 -0
- package/src/delegation/__tests__/vc-verifier.test.ts +922 -0
- package/src/delegation/audience-validator.ts +52 -0
- package/src/delegation/bitstring.ts +278 -0
- package/src/delegation/cascading-revocation.ts +370 -0
- package/src/delegation/delegation-graph.ts +299 -0
- package/src/delegation/index.ts +14 -0
- package/src/delegation/statuslist-manager.ts +353 -0
- package/src/delegation/storage/__tests__/memory-graph-storage.test.ts +366 -0
- package/src/delegation/storage/__tests__/memory-statuslist-storage.test.ts +228 -0
- package/src/delegation/storage/index.ts +9 -0
- package/src/delegation/storage/memory-graph-storage.ts +178 -0
- package/src/delegation/storage/memory-statuslist-storage.ts +77 -0
- package/src/delegation/utils.ts +42 -0
- package/src/delegation/vc-issuer.ts +232 -0
- package/src/delegation/vc-verifier.ts +568 -0
- package/src/identity/idp-token-resolver.ts +147 -0
- package/src/identity/idp-token-storage.interface.ts +59 -0
- package/src/identity/user-did-manager.ts +370 -0
- package/src/index.ts +260 -0
- package/src/providers/base.d.ts +91 -0
- package/src/providers/base.d.ts.map +1 -0
- package/src/providers/base.js.map +1 -0
- package/src/providers/base.ts +96 -0
- package/src/providers/memory.ts +142 -0
- package/src/runtime/audit-logger.ts +39 -0
- package/src/runtime/base.ts +1329 -0
- package/src/services/__tests__/access-control.integration.test.ts +443 -0
- package/src/services/__tests__/access-control.proof-response-validation.test.ts +578 -0
- package/src/services/__tests__/access-control.service.test.ts +970 -0
- package/src/services/__tests__/batch-delegation.service.test.ts +351 -0
- package/src/services/__tests__/crypto.service.test.ts +531 -0
- package/src/services/__tests__/oauth-provider-registry.test.ts +142 -0
- package/src/services/__tests__/proof-verifier.integration.test.ts +485 -0
- package/src/services/__tests__/proof-verifier.test.ts +489 -0
- package/src/services/__tests__/provider-resolution.integration.test.ts +202 -0
- package/src/services/__tests__/provider-resolver.test.ts +213 -0
- package/src/services/__tests__/storage.service.test.ts +358 -0
- package/src/services/access-control.service.ts +990 -0
- package/src/services/authorization/authorization-registry.ts +66 -0
- package/src/services/authorization/types.ts +71 -0
- package/src/services/batch-delegation.service.ts +137 -0
- package/src/services/crypto.service.ts +302 -0
- package/src/services/errors.ts +76 -0
- package/src/services/index.ts +9 -0
- package/src/services/oauth-config.service.d.ts +53 -0
- package/src/services/oauth-config.service.d.ts.map +1 -0
- package/src/services/oauth-config.service.js.map +1 -0
- package/src/services/oauth-config.service.ts +169 -0
- package/src/services/oauth-provider-registry.d.ts +57 -0
- package/src/services/oauth-provider-registry.d.ts.map +1 -0
- package/src/services/oauth-provider-registry.js.map +1 -0
- package/src/services/oauth-provider-registry.ts +141 -0
- package/src/services/oauth-service.ts +510 -0
- package/src/services/oauth-token-retrieval.service.ts +245 -0
- package/src/services/proof-verifier.ts +478 -0
- package/src/services/provider-resolver.d.ts +48 -0
- package/src/services/provider-resolver.d.ts.map +1 -0
- package/src/services/provider-resolver.js.map +1 -0
- package/src/services/provider-resolver.ts +146 -0
- package/src/services/provider-validator.ts +170 -0
- package/src/services/storage.service.ts +566 -0
- package/src/services/tool-context-builder.ts +172 -0
- package/src/services/tool-protection.service.ts +958 -0
- package/src/types/oauth-required-error.ts +63 -0
- package/src/types/tool-protection.ts +155 -0
- package/src/utils/__tests__/did-helpers.test.ts +101 -0
- package/src/utils/base64.ts +148 -0
- package/src/utils/cors.ts +83 -0
- package/src/utils/did-helpers.ts +150 -0
- package/src/utils/index.ts +8 -0
- package/src/utils/storage-keys.ts +278 -0
- package/tsconfig.json +21 -0
- package/vitest.config.ts +56 -0
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Provider Resolver
|
|
4
|
+
*
|
|
5
|
+
* Resolves OAuth provider for tools using priority-based resolution strategy.
|
|
6
|
+
* Supports Phase 2+ tool-specific providers with backward compatibility for Phase 1.
|
|
7
|
+
*
|
|
8
|
+
* @package @kya-os/mcp-i-core
|
|
9
|
+
*/
|
|
10
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
11
|
+
exports.ProviderResolver = void 0;
|
|
12
|
+
/**
|
|
13
|
+
* Resolves OAuth provider for tools with priority-based fallback strategy
|
|
14
|
+
*
|
|
15
|
+
* Priority order:
|
|
16
|
+
* 1. Tool-specific oauthProvider field (Phase 2+ preferred)
|
|
17
|
+
* 2. Scope prefix inference (fallback)
|
|
18
|
+
* 3. Project-configured provider from AgentShield dashboard
|
|
19
|
+
* 4. Error if no provider can be resolved
|
|
20
|
+
*/
|
|
21
|
+
class ProviderResolver {
|
|
22
|
+
registry;
|
|
23
|
+
configService;
|
|
24
|
+
constructor(registry, configService) {
|
|
25
|
+
this.registry = registry;
|
|
26
|
+
this.configService = configService;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Resolve OAuth provider for a tool
|
|
30
|
+
*
|
|
31
|
+
* @param toolProtection - Tool protection configuration
|
|
32
|
+
* @param projectId - Project ID for fetching provider config
|
|
33
|
+
* @returns Provider name (never null - throws if cannot resolve)
|
|
34
|
+
* @throws Error if provider cannot be resolved
|
|
35
|
+
*/
|
|
36
|
+
async resolveProvider(toolProtection, projectId) {
|
|
37
|
+
// Priority 1: Tool-specific provider (Phase 2+ preferred)
|
|
38
|
+
if (toolProtection.oauthProvider) {
|
|
39
|
+
// Ensure registry is loaded before checking
|
|
40
|
+
if (this.registry.getProviderNames().length === 0) {
|
|
41
|
+
await this.registry.loadFromAgentShield(projectId);
|
|
42
|
+
}
|
|
43
|
+
if (!this.registry.hasProvider(toolProtection.oauthProvider)) {
|
|
44
|
+
throw new Error(`Provider "${toolProtection.oauthProvider}" not configured for project "${projectId}". ` +
|
|
45
|
+
`Add provider in project settings.`);
|
|
46
|
+
}
|
|
47
|
+
return toolProtection.oauthProvider;
|
|
48
|
+
}
|
|
49
|
+
// Priority 2: Scope prefix inference (fallback)
|
|
50
|
+
const inferredProvider = this.inferProviderFromScopes(toolProtection.requiredScopes || []);
|
|
51
|
+
if (inferredProvider) {
|
|
52
|
+
// Ensure registry is loaded before checking
|
|
53
|
+
if (this.registry.getProviderNames().length === 0) {
|
|
54
|
+
await this.registry.loadFromAgentShield(projectId);
|
|
55
|
+
}
|
|
56
|
+
if (this.registry.hasProvider(inferredProvider)) {
|
|
57
|
+
console.log(`[ProviderResolver] Inferred provider "${inferredProvider}" from scopes`);
|
|
58
|
+
return inferredProvider;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
// Priority 3: Use explicitly configured provider from AgentShield dashboard
|
|
62
|
+
// This is the provider the user has actually configured, not just any available provider
|
|
63
|
+
await this.registry.loadFromAgentShield(projectId);
|
|
64
|
+
const configuredProvider = this.registry.getConfiguredProvider();
|
|
65
|
+
if (configuredProvider && this.registry.hasProvider(configuredProvider)) {
|
|
66
|
+
console.warn(`[ProviderResolver] Tool does not specify oauthProvider. ` +
|
|
67
|
+
`Using project-configured provider "${configuredProvider}" as fallback. ` +
|
|
68
|
+
`Consider explicitly setting oauthProvider in tool protection config.`);
|
|
69
|
+
return configuredProvider;
|
|
70
|
+
}
|
|
71
|
+
// Priority 4: Error if no provider is configured
|
|
72
|
+
// NOTE: We intentionally do NOT fall back to "first available provider" anymore
|
|
73
|
+
// because AgentShield returns ALL providers (even unconfigured ones).
|
|
74
|
+
// Only use providers explicitly configured by the user.
|
|
75
|
+
throw new Error(`Tool requires OAuth but no provider is configured for project "${projectId}". ` +
|
|
76
|
+
`Configure an OAuth provider in AgentShield dashboard.`);
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Infer provider from scope prefixes
|
|
80
|
+
*
|
|
81
|
+
* Used as Priority 2 fallback when oauthProvider is not specified.
|
|
82
|
+
* Examples:
|
|
83
|
+
* - github:repo:read → github
|
|
84
|
+
* - gmail:read → google
|
|
85
|
+
* - microsoft:calendar:read → microsoft
|
|
86
|
+
*
|
|
87
|
+
* @param scopes - Required scopes for the tool
|
|
88
|
+
* @returns Provider name if uniquely inferred, null otherwise
|
|
89
|
+
*/
|
|
90
|
+
inferProviderFromScopes(scopes) {
|
|
91
|
+
if (!scopes || scopes.length === 0) {
|
|
92
|
+
return null;
|
|
93
|
+
}
|
|
94
|
+
// Extract first part of scope (before first colon)
|
|
95
|
+
const scopePrefixes = scopes.map((scope) => {
|
|
96
|
+
const parts = scope.split(":");
|
|
97
|
+
return parts[0].toLowerCase();
|
|
98
|
+
});
|
|
99
|
+
// Provider mapping
|
|
100
|
+
const providerMap = {
|
|
101
|
+
github: "github",
|
|
102
|
+
google: "google",
|
|
103
|
+
gmail: "google", // gmail:read → google
|
|
104
|
+
calendar: "google", // calendar:read → google (if ambiguous, use project default)
|
|
105
|
+
microsoft: "microsoft",
|
|
106
|
+
outlook: "microsoft",
|
|
107
|
+
slack: "slack",
|
|
108
|
+
auth0: "auth0",
|
|
109
|
+
okta: "okta",
|
|
110
|
+
};
|
|
111
|
+
// Find unique provider
|
|
112
|
+
const providers = new Set(scopePrefixes.map((prefix) => providerMap[prefix]).filter(Boolean));
|
|
113
|
+
if (providers.size === 1) {
|
|
114
|
+
return Array.from(providers)[0];
|
|
115
|
+
}
|
|
116
|
+
// Ambiguous or no prefix → return null (use project-level provider)
|
|
117
|
+
return null;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
exports.ProviderResolver = ProviderResolver;
|
|
121
|
+
//# sourceMappingURL=provider-resolver.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"provider-resolver.js","sourceRoot":"","sources":["../../src/services/provider-resolver.ts"],"names":[],"mappings":";AAAA;;;;;;;GAOG;;;AAMH;;;;;;;;GAQG;AACH,MAAa,gBAAgB;IAEjB;IACA;IAFV,YACU,QAA+B,EAC/B,aAAiC;QADjC,aAAQ,GAAR,QAAQ,CAAuB;QAC/B,kBAAa,GAAb,aAAa,CAAoB;IACxC,CAAC;IAEJ;;;;;;;OAOG;IACH,KAAK,CAAC,eAAe,CACnB,cAA8B,EAC9B,SAAiB;QAEjB,0DAA0D;QAC1D,IAAI,cAAc,CAAC,aAAa,EAAE,CAAC;YACjC,4CAA4C;YAC5C,IAAI,IAAI,CAAC,QAAQ,CAAC,gBAAgB,EAAE,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;gBAClD,M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,4CA0HC"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Provider Validator
|
|
3
|
+
*
|
|
4
|
+
* Validates OAuth provider configurations for custom IDP support.
|
|
5
|
+
* Ensures provider configurations are valid before registration.
|
|
6
|
+
*
|
|
7
|
+
* @package @kya-os/mcp-i-core
|
|
8
|
+
*/
|
|
9
|
+
import type { OAuthProvider } from "@kya-os/contracts/config";
|
|
10
|
+
/**
|
|
11
|
+
* Validation error for provider configuration issues
|
|
12
|
+
*/
|
|
13
|
+
export declare class ProviderValidationError extends Error {
|
|
14
|
+
readonly field?: string | undefined;
|
|
15
|
+
constructor(message: string, field?: string | undefined);
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Service for validating OAuth provider configurations
|
|
19
|
+
*/
|
|
20
|
+
export declare class ProviderValidator {
|
|
21
|
+
/**
|
|
22
|
+
* Validate provider configuration
|
|
23
|
+
*
|
|
24
|
+
* @param provider - Provider configuration to validate
|
|
25
|
+
* @param name - Provider name (for error messages)
|
|
26
|
+
* @throws ProviderValidationError if validation fails
|
|
27
|
+
*/
|
|
28
|
+
validate(provider: OAuthProvider, name: string): void;
|
|
29
|
+
/**
|
|
30
|
+
* Validate URL format
|
|
31
|
+
*
|
|
32
|
+
* @param url - URL to validate
|
|
33
|
+
* @param providerName - Provider name (for error messages)
|
|
34
|
+
* @param fieldName - Field name (for error messages)
|
|
35
|
+
* @throws ProviderValidationError if URL is invalid
|
|
36
|
+
*/
|
|
37
|
+
private validateUrl;
|
|
38
|
+
/**
|
|
39
|
+
* Validate custom parameters don't override reserved OAuth parameters
|
|
40
|
+
*
|
|
41
|
+
* @param customParams - Custom parameters to validate
|
|
42
|
+
* @param providerName - Provider name (for error messages)
|
|
43
|
+
* @throws ProviderValidationError if reserved parameter is overridden
|
|
44
|
+
*/
|
|
45
|
+
private validateCustomParams;
|
|
46
|
+
/**
|
|
47
|
+
* Test provider endpoint reachability (optional)
|
|
48
|
+
*
|
|
49
|
+
* @param provider - Provider configuration
|
|
50
|
+
* @param fetchProvider - Fetch implementation
|
|
51
|
+
* @returns True if endpoint is reachable, false otherwise
|
|
52
|
+
*/
|
|
53
|
+
testProvider(provider: OAuthProvider, fetchProvider: typeof fetch): Promise<boolean>;
|
|
54
|
+
}
|
|
55
|
+
//# sourceMappingURL=provider-validator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"provider-validator.d.ts","sourceRoot":"","sources":["../../src/services/provider-validator.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAe9D;;GAEG;AACH,qBAAa,uBAAwB,SAAQ,KAAK;aACH,KAAK,CAAC,EAAE,MAAM;gBAA/C,OAAO,EAAE,MAAM,EAAkB,KAAK,CAAC,EAAE,MAAM,YAAA;CAI5D;AAED;;GAEG;AACH,qBAAa,iBAAiB;IAC5B;;;;;;OAMG;IACH,QAAQ,CAAC,QAAQ,EAAE,aAAa,EAAE,IAAI,EAAE,MAAM,GAAG,IAAI;IA6CrD;;;;;;;OAOG;IACH,OAAO,CAAC,WAAW;IAoBnB;;;;;;OAMG;IACH,OAAO,CAAC,oBAAoB;IAqB5B;;;;;;OAMG;IACG,YAAY,CAChB,QAAQ,EAAE,aAAa,EACvB,aAAa,EAAE,OAAO,KAAK,GAC1B,OAAO,CAAC,OAAO,CAAC;CAYpB"}
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Provider Validator
|
|
4
|
+
*
|
|
5
|
+
* Validates OAuth provider configurations for custom IDP support.
|
|
6
|
+
* Ensures provider configurations are valid before registration.
|
|
7
|
+
*
|
|
8
|
+
* @package @kya-os/mcp-i-core
|
|
9
|
+
*/
|
|
10
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
11
|
+
exports.ProviderValidator = exports.ProviderValidationError = void 0;
|
|
12
|
+
/**
|
|
13
|
+
* Reserved OAuth parameters that cannot be overridden by custom parameters
|
|
14
|
+
*/
|
|
15
|
+
const RESERVED_PARAMETERS = [
|
|
16
|
+
"response_type",
|
|
17
|
+
"client_id",
|
|
18
|
+
"redirect_uri",
|
|
19
|
+
"scope",
|
|
20
|
+
"state",
|
|
21
|
+
"code_challenge",
|
|
22
|
+
"code_challenge_method",
|
|
23
|
+
];
|
|
24
|
+
/**
|
|
25
|
+
* Validation error for provider configuration issues
|
|
26
|
+
*/
|
|
27
|
+
class ProviderValidationError extends Error {
|
|
28
|
+
field;
|
|
29
|
+
constructor(message, field) {
|
|
30
|
+
super(message);
|
|
31
|
+
this.field = field;
|
|
32
|
+
this.name = "ProviderValidationError";
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
exports.ProviderValidationError = ProviderValidationError;
|
|
36
|
+
/**
|
|
37
|
+
* Service for validating OAuth provider configurations
|
|
38
|
+
*/
|
|
39
|
+
class ProviderValidator {
|
|
40
|
+
/**
|
|
41
|
+
* Validate provider configuration
|
|
42
|
+
*
|
|
43
|
+
* @param provider - Provider configuration to validate
|
|
44
|
+
* @param name - Provider name (for error messages)
|
|
45
|
+
* @throws ProviderValidationError if validation fails
|
|
46
|
+
*/
|
|
47
|
+
validate(provider, name) {
|
|
48
|
+
// Validate required fields
|
|
49
|
+
if (!provider.clientId || provider.clientId.trim().length === 0) {
|
|
50
|
+
throw new ProviderValidationError(`Provider "${name}" must have a clientId`, "clientId");
|
|
51
|
+
}
|
|
52
|
+
if (!provider.authorizationUrl || provider.authorizationUrl.trim().length === 0) {
|
|
53
|
+
throw new ProviderValidationError(`Provider "${name}" must have an authorizationUrl`, "authorizationUrl");
|
|
54
|
+
}
|
|
55
|
+
if (!provider.tokenUrl || provider.tokenUrl.trim().length === 0) {
|
|
56
|
+
throw new ProviderValidationError(`Provider "${name}" must have a tokenUrl`, "tokenUrl");
|
|
57
|
+
}
|
|
58
|
+
// Validate URL formats
|
|
59
|
+
this.validateUrl(provider.authorizationUrl, name, "authorizationUrl");
|
|
60
|
+
this.validateUrl(provider.tokenUrl, name, "tokenUrl");
|
|
61
|
+
if (provider.userInfoUrl) {
|
|
62
|
+
this.validateUrl(provider.userInfoUrl, name, "userInfoUrl");
|
|
63
|
+
}
|
|
64
|
+
// Validate proxy mode requirements
|
|
65
|
+
if (provider.proxyMode && !provider.requiresClientSecret) {
|
|
66
|
+
throw new ProviderValidationError(`Provider "${name}" with proxyMode=true must have requiresClientSecret=true`, "proxyMode");
|
|
67
|
+
}
|
|
68
|
+
// Validate custom parameters don't conflict with reserved parameters
|
|
69
|
+
if (provider.customParams) {
|
|
70
|
+
this.validateCustomParams(provider.customParams, name);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Validate URL format
|
|
75
|
+
*
|
|
76
|
+
* @param url - URL to validate
|
|
77
|
+
* @param providerName - Provider name (for error messages)
|
|
78
|
+
* @param fieldName - Field name (for error messages)
|
|
79
|
+
* @throws ProviderValidationError if URL is invalid
|
|
80
|
+
*/
|
|
81
|
+
validateUrl(url, providerName, fieldName) {
|
|
82
|
+
try {
|
|
83
|
+
const parsedUrl = new URL(url);
|
|
84
|
+
if (parsedUrl.protocol !== "http:" && parsedUrl.protocol !== "https:") {
|
|
85
|
+
throw new ProviderValidationError(`Provider "${providerName}" ${fieldName} must use HTTP or HTTPS protocol`, fieldName);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
catch (error) {
|
|
89
|
+
if (error instanceof ProviderValidationError) {
|
|
90
|
+
throw error;
|
|
91
|
+
}
|
|
92
|
+
throw new ProviderValidationError(`Provider "${providerName}" ${fieldName} is not a valid URL: ${error instanceof Error ? error.message : String(error)}`, fieldName);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Validate custom parameters don't override reserved OAuth parameters
|
|
97
|
+
*
|
|
98
|
+
* @param customParams - Custom parameters to validate
|
|
99
|
+
* @param providerName - Provider name (for error messages)
|
|
100
|
+
* @throws ProviderValidationError if reserved parameter is overridden
|
|
101
|
+
*/
|
|
102
|
+
validateCustomParams(customParams, providerName) {
|
|
103
|
+
for (const [key, value] of Object.entries(customParams)) {
|
|
104
|
+
const normalizedKey = key.toLowerCase();
|
|
105
|
+
if (RESERVED_PARAMETERS.includes(normalizedKey)) {
|
|
106
|
+
throw new ProviderValidationError(`Provider "${providerName}" custom parameter "${key}" conflicts with reserved OAuth parameter. Reserved parameters: ${RESERVED_PARAMETERS.join(", ")}`, `customParams.${key}`);
|
|
107
|
+
}
|
|
108
|
+
if (!value || value.trim().length === 0) {
|
|
109
|
+
throw new ProviderValidationError(`Provider "${providerName}" custom parameter "${key}" has empty value`, `customParams.${key}`);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* Test provider endpoint reachability (optional)
|
|
115
|
+
*
|
|
116
|
+
* @param provider - Provider configuration
|
|
117
|
+
* @param fetchProvider - Fetch implementation
|
|
118
|
+
* @returns True if endpoint is reachable, false otherwise
|
|
119
|
+
*/
|
|
120
|
+
async testProvider(provider, fetchProvider) {
|
|
121
|
+
try {
|
|
122
|
+
// Test authorization URL (HEAD request to avoid triggering OAuth flow)
|
|
123
|
+
const authResponse = await fetchProvider(provider.authorizationUrl, {
|
|
124
|
+
method: "HEAD",
|
|
125
|
+
signal: AbortSignal.timeout(5000), // 5 second timeout
|
|
126
|
+
});
|
|
127
|
+
return authResponse.ok || authResponse.status === 405; // 405 Method Not Allowed is OK
|
|
128
|
+
}
|
|
129
|
+
catch (error) {
|
|
130
|
+
return false;
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
exports.ProviderValidator = ProviderValidator;
|
|
135
|
+
//# sourceMappingURL=provider-validator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"provider-validator.js","sourceRoot":"","sources":["../../src/services/provider-validator.ts"],"names":[],"mappings":";AA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
|
+
* Builds ToolExecutionContext for tool handlers by resolving IDP tokens
|
|
5
|
+
* based on tool protection configuration and user identity.
|
|
6
|
+
*
|
|
7
|
+
* @package @kya-os/mcp-i-core
|
|
8
|
+
*/
|
|
9
|
+
import type { ToolExecutionContext } from "@kya-os/contracts/config";
|
|
10
|
+
import type { IdpTokenResolver } from "../identity/idp-token-resolver.js";
|
|
11
|
+
import type { ToolProtection } from "../types/tool-protection.js";
|
|
12
|
+
import type { OAuthConfigService } from "./oauth-config.service.js";
|
|
13
|
+
import type { ProviderResolver } from "./provider-resolver.js";
|
|
14
|
+
export interface ToolContextBuilderConfig {
|
|
15
|
+
/** IDP token resolver for resolving tokens from User DID */
|
|
16
|
+
tokenResolver: IdpTokenResolver;
|
|
17
|
+
/** OAuth config service for fetching provider configurations */
|
|
18
|
+
configService: OAuthConfigService;
|
|
19
|
+
/** Provider resolver for resolving OAuth providers for tools */
|
|
20
|
+
providerResolver: ProviderResolver;
|
|
21
|
+
/** Project ID for fetching OAuth config */
|
|
22
|
+
projectId: string;
|
|
23
|
+
/** Optional logger callback for diagnostics */
|
|
24
|
+
logger?: (message: string, data?: unknown) => void;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Builder for tool execution context
|
|
28
|
+
*
|
|
29
|
+
* Resolves IDP tokens and builds context for tool handlers.
|
|
30
|
+
* Phase 1: Uses configured provider as temporary fallback.
|
|
31
|
+
* Phase 2+: Requires explicit oauthProvider on tool protection.
|
|
32
|
+
*/
|
|
33
|
+
export declare class ToolContextBuilder {
|
|
34
|
+
private config;
|
|
35
|
+
constructor(config: ToolContextBuilderConfig);
|
|
36
|
+
/**
|
|
37
|
+
* Build tool execution context
|
|
38
|
+
*
|
|
39
|
+
* @param toolName - Name of the tool being executed
|
|
40
|
+
* @param userDid - User DID (optional, required for OAuth)
|
|
41
|
+
* @param sessionId - Session ID (optional)
|
|
42
|
+
* @param delegationToken - Delegation token (optional)
|
|
43
|
+
* @param toolProtection - Tool protection configuration (optional)
|
|
44
|
+
* @returns Tool execution context or undefined if not needed
|
|
45
|
+
*/
|
|
46
|
+
buildContext(toolName: string, userDid: string | undefined, sessionId: string | undefined, delegationToken: string | undefined, toolProtection: ToolProtection | null): Promise<ToolExecutionContext | undefined>;
|
|
47
|
+
/**
|
|
48
|
+
* Resolve OAuth provider for a tool
|
|
49
|
+
*
|
|
50
|
+
* Phase 2: Uses ProviderResolver with priority-based resolution
|
|
51
|
+
*
|
|
52
|
+
* @param toolProtection - Tool protection configuration
|
|
53
|
+
* @returns Provider name or throws error if not found
|
|
54
|
+
*/
|
|
55
|
+
private resolveProvider;
|
|
56
|
+
}
|
|
57
|
+
//# sourceMappingURL=tool-context-builder.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tool-context-builder.d.ts","sourceRoot":"","sources":["../../src/services/tool-context-builder.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AACrE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AAC1E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAClE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AACpE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAG/D,MAAM,WAAW,wBAAwB;IACvC,4DAA4D;IAC5D,aAAa,EAAE,gBAAgB,CAAC;IAEhC,gEAAgE;IAChE,aAAa,EAAE,kBAAkB,CAAC;IAElC,gEAAgE;IAChE,gBAAgB,EAAE,gBAAgB,CAAC;IAEnC,2CAA2C;IAC3C,SAAS,EAAE,MAAM,CAAC;IAElB,+CAA+C;IAC/C,MAAM,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,OAAO,KAAK,IAAI,CAAC;CACpD;AAED;;;;;;GAMG;AACH,qBAAa,kBAAkB;IAC7B,OAAO,CAAC,MAAM,CAEZ;gBAEU,MAAM,EAAE,wBAAwB;IAU5C;;;;;;;;;OASG;IACG,YAAY,CAChB,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE,MAAM,GAAG,SAAS,EAC3B,SAAS,EAAE,MAAM,GAAG,SAAS,EAC7B,eAAe,EAAE,MAAM,GAAG,SAAS,EACnC,cAAc,EAAE,cAAc,GAAG,IAAI,GACpC,OAAO,CAAC,oBAAoB,GAAG,SAAS,CAAC;IAqE5C;;;;;;;OAOG;YACW,eAAe;CAsB9B"}
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Tool Context Builder
|
|
4
|
+
*
|
|
5
|
+
* Builds ToolExecutionContext for tool handlers by resolving IDP tokens
|
|
6
|
+
* based on tool protection configuration and user identity.
|
|
7
|
+
*
|
|
8
|
+
* @package @kya-os/mcp-i-core
|
|
9
|
+
*/
|
|
10
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
11
|
+
exports.ToolContextBuilder = void 0;
|
|
12
|
+
const oauth_required_error_js_1 = require("../types/oauth-required-error.js");
|
|
13
|
+
/**
|
|
14
|
+
* Builder for tool execution context
|
|
15
|
+
*
|
|
16
|
+
* Resolves IDP tokens and builds context for tool handlers.
|
|
17
|
+
* Phase 1: Uses configured provider as temporary fallback.
|
|
18
|
+
* Phase 2+: Requires explicit oauthProvider on tool protection.
|
|
19
|
+
*/
|
|
20
|
+
class ToolContextBuilder {
|
|
21
|
+
config;
|
|
22
|
+
constructor(config) {
|
|
23
|
+
this.config = {
|
|
24
|
+
tokenResolver: config.tokenResolver,
|
|
25
|
+
configService: config.configService,
|
|
26
|
+
providerResolver: config.providerResolver,
|
|
27
|
+
projectId: config.projectId,
|
|
28
|
+
logger: config.logger || (() => { }),
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Build tool execution context
|
|
33
|
+
*
|
|
34
|
+
* @param toolName - Name of the tool being executed
|
|
35
|
+
* @param userDid - User DID (optional, required for OAuth)
|
|
36
|
+
* @param sessionId - Session ID (optional)
|
|
37
|
+
* @param delegationToken - Delegation token (optional)
|
|
38
|
+
* @param toolProtection - Tool protection configuration (optional)
|
|
39
|
+
* @returns Tool execution context or undefined if not needed
|
|
40
|
+
*/
|
|
41
|
+
async buildContext(toolName, userDid, sessionId, delegationToken, toolProtection) {
|
|
42
|
+
// Only build context if tool requires OAuth
|
|
43
|
+
if (!toolProtection?.requiredScopes?.length || !userDid) {
|
|
44
|
+
return undefined;
|
|
45
|
+
}
|
|
46
|
+
// Phase 2: Resolve provider using ProviderResolver
|
|
47
|
+
// ProviderResolver handles priority-based resolution with fallbacks
|
|
48
|
+
let provider;
|
|
49
|
+
try {
|
|
50
|
+
provider = await this.resolveProvider(toolProtection);
|
|
51
|
+
}
|
|
52
|
+
catch (error) {
|
|
53
|
+
// Provider resolution failed - cannot build context
|
|
54
|
+
this.config.logger("[ToolContextBuilder] Provider not resolved", {
|
|
55
|
+
toolName,
|
|
56
|
+
userDid: userDid.substring(0, 20) + "...",
|
|
57
|
+
error: error instanceof Error ? error.message : String(error),
|
|
58
|
+
});
|
|
59
|
+
return undefined;
|
|
60
|
+
}
|
|
61
|
+
// Resolve IDP token
|
|
62
|
+
const idpToken = await this.config.tokenResolver.resolveTokenFromDid(userDid, provider, toolProtection.requiredScopes);
|
|
63
|
+
if (!idpToken) {
|
|
64
|
+
// Token not available - throw OAuthRequiredError to trigger OAuth flow
|
|
65
|
+
this.config.logger("[ToolContextBuilder] Token not available, throwing OAuthRequiredError", {
|
|
66
|
+
toolName,
|
|
67
|
+
userDid: userDid.substring(0, 20) + "...",
|
|
68
|
+
provider,
|
|
69
|
+
scopes: toolProtection.requiredScopes,
|
|
70
|
+
});
|
|
71
|
+
// Throw error with provider and scopes info
|
|
72
|
+
// OAuth URL will be built by the Cloudflare layer (agent.ts)
|
|
73
|
+
throw new oauth_required_error_js_1.OAuthRequiredError({
|
|
74
|
+
toolName,
|
|
75
|
+
requiredScopes: toolProtection.requiredScopes,
|
|
76
|
+
provider,
|
|
77
|
+
oauthUrl: "", // Will be populated by Cloudflare layer
|
|
78
|
+
userDid,
|
|
79
|
+
sessionId,
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
// Build context with token
|
|
83
|
+
const context = {
|
|
84
|
+
idpToken,
|
|
85
|
+
provider,
|
|
86
|
+
scopes: toolProtection.requiredScopes,
|
|
87
|
+
userDid,
|
|
88
|
+
sessionId,
|
|
89
|
+
delegationToken,
|
|
90
|
+
};
|
|
91
|
+
this.config.logger("[ToolContextBuilder] Context built successfully", {
|
|
92
|
+
toolName,
|
|
93
|
+
userDid: userDid.substring(0, 20) + "...",
|
|
94
|
+
provider,
|
|
95
|
+
hasToken: !!idpToken,
|
|
96
|
+
});
|
|
97
|
+
return context;
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Resolve OAuth provider for a tool
|
|
101
|
+
*
|
|
102
|
+
* Phase 2: Uses ProviderResolver with priority-based resolution
|
|
103
|
+
*
|
|
104
|
+
* @param toolProtection - Tool protection configuration
|
|
105
|
+
* @returns Provider name or throws error if not found
|
|
106
|
+
*/
|
|
107
|
+
async resolveProvider(toolProtection) {
|
|
108
|
+
try {
|
|
109
|
+
const provider = await this.config.providerResolver.resolveProvider(toolProtection, this.config.projectId);
|
|
110
|
+
this.config.logger("[ToolContextBuilder] Provider resolved", {
|
|
111
|
+
provider,
|
|
112
|
+
});
|
|
113
|
+
return provider;
|
|
114
|
+
}
|
|
115
|
+
catch (error) {
|
|
116
|
+
this.config.logger("[ToolContextBuilder] Provider resolution failed", {
|
|
117
|
+
error: error instanceof Error ? error.message : String(error),
|
|
118
|
+
projectId: this.config.projectId,
|
|
119
|
+
});
|
|
120
|
+
throw error; // Re-throw to let caller handle
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
exports.ToolContextBuilder = ToolContextBuilder;
|
|
125
|
+
//# sourceMappingURL=tool-context-builder.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tool-context-builder.js","sourceRoot":"","sources":["../../src/services/tool-context-builder.ts"],"names":[],"mappings":";AAAA;;;;;;;GAOG;;;AAOH,8EAAsE;AAmBtE;;;;;;GAMG;AACH,MAAa,kBAAkB;IACrB,MAAM,CAEZ;IAEF,YAAY,MAAgC;QAC1C,IAAI,CAAC,MAAM,GAAG;YACZ,aAAa,EAAE,MAAM,CAAC,aAAa;YACnC,aAAa,EAAE,MAAM,CAAC,aAAa;YACnC,gBAAgB,EAAE,MAAM,CAAC,gBAAgB;YACzC,SAAS,EAAE,MAAM,CAAC,SAAS;YAC3B,MAAM,EAAE,MAAM,CAAC,MAAM,IAAI,CAAC,GAAG,EAAE,GAAE,CAAC,CAAC;SACpC,CAAC;IACJ,CAAC;IAED;;;;;;;;;OASG;IACH,KAAK,CAAC,YAAY,CAChB,QAAgB,EAChB,OAA2B,EAC3B,SAA6B,EAC7B,eAAmC,EACnC,cAAqC;QAErC,4CAA4C;QAC5C,IAAI,CAAC,cAAc,EAAE,cAAc,EAAE,MAAM,IAAI,CAAC,OAAO,EAAE,CAAC;YACxD,OAAO,SAAS,CAAC;QACnB,CAAC;QAED,mDAAmD;QACnD,oEAAoE;QACpE,IAAI,QAAgB,CAAC;QACrB,IAAI,CAAC;YACH,QAAQ,GAAG,MAAM,IAAI,CAAC,eAAe,CAAC,cAAc,CAAC,CAAC;QACxD,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,oDAAoD;YACpD,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,4CAA4C,EAAE;gBAC/D,QAAQ;gBACR,OAAO,EAAE,OAAO,CAAC,SAAS,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,KAAK;gBACzC,KAAK,EAAE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC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AC,MAAM,CAAC,gBAAgB,CAAC,eAAe,CACjE,cAAc,EACd,IAAI,CAAC,MAAM,CAAC,SAAS,CACtB,CAAC;YAEF,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,wCAAwC,EAAE;gBAC3D,QAAQ;aACT,CAAC,CAAC;YAEH,OAAO,QAAQ,CAAC;QAClB,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,iDAAiD,EAAE;gBACpE,KAAK,EAAE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC;gBAC7D,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,SAAS;aACjC,CAAC,CAAC;YACH,MAAM,KAAK,CAAC,CAAC,gCAAgC;QAC/C,CAAC;IACH,CAAC;CACF;AAlID,gDAkIC"}
|
|
@@ -1,12 +1,80 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* ToolProtectionService - Fetches and caches tool protection configurations
|
|
3
3
|
*
|
|
4
|
-
* This service
|
|
4
|
+
* This service manages tool protection configuration from AgentShield API with
|
|
5
|
+
* efficient caching and automatic synchronization support.
|
|
6
|
+
*
|
|
7
|
+
* CORE FUNCTIONALITY:
|
|
8
|
+
* -------------------
|
|
5
9
|
* 1. Fetches tool protection config from AgentShield API
|
|
6
|
-
* 2. Caches responses
|
|
10
|
+
* 2. Caches responses with configurable TTL (default 5 minutes)
|
|
7
11
|
* 3. Falls back to local config if API unavailable
|
|
8
|
-
* 4. Provides delegation checking
|
|
12
|
+
* 4. Provides delegation requirement checking before tool execution
|
|
13
|
+
*
|
|
14
|
+
* SYNCHRONIZATION WITH AGENTSHIELD:
|
|
15
|
+
* ----------------------------------
|
|
16
|
+
* When you update tool protection settings in the AgentShield dashboard:
|
|
17
|
+
*
|
|
18
|
+
* 1. Dashboard sends PATCH /api/internal/bouncer/tools/{projectId}/{toolName}
|
|
19
|
+
* 2. AgentShield updates the database immediately (PostgreSQL JSONB column)
|
|
20
|
+
* 3. Dashboard sends POST /admin/clear-cache to this service (automatic)
|
|
21
|
+
* 4. This service clears the cached config from KV storage
|
|
22
|
+
* 5. Next tool call fetches fresh config from AgentShield API
|
|
23
|
+
* 6. New config is cached for the configured TTL period
|
|
24
|
+
*
|
|
25
|
+
* CACHE INVALIDATION:
|
|
26
|
+
* -------------------
|
|
27
|
+
* Cache is invalidated via POST /admin/clear-cache endpoint:
|
|
28
|
+
* - Triggered automatically by AgentShield dashboard when tool protection changes
|
|
29
|
+
* - Can be triggered manually for testing/debugging
|
|
30
|
+
* - Requires API key authentication for security
|
|
31
|
+
*
|
|
32
|
+
* If cache is NOT cleared:
|
|
33
|
+
* - Stale config is served until TTL expires (default 5 minutes)
|
|
34
|
+
* - Configure shorter TTL via TOOL_PROTECTION_CACHE_TTL env var for faster updates
|
|
35
|
+
* - Set to 0 for no cache (not recommended for production)
|
|
36
|
+
*
|
|
37
|
+
* TOOL DISCOVERY PREREQUISITE:
|
|
38
|
+
* ----------------------------
|
|
39
|
+
* IMPORTANT: Tools must be discovered before they can be protected!
|
|
40
|
+
*
|
|
41
|
+
* Discovery happens when:
|
|
42
|
+
* - Agent makes first tool call with proof submission
|
|
43
|
+
* - AgentShield extracts tool info from cryptographic proof
|
|
44
|
+
* - Tool is added to bouncerConfigs.discoveredTools in database
|
|
9
45
|
*
|
|
46
|
+
* If tool not discovered:
|
|
47
|
+
* - Tool won't appear in dashboard
|
|
48
|
+
* - Protection settings can't be configured
|
|
49
|
+
* - GET /tool-protections returns empty object
|
|
50
|
+
*
|
|
51
|
+
* DEBUGGING:
|
|
52
|
+
* ----------
|
|
53
|
+
* Enable debug logging with:
|
|
54
|
+
* toolProtection: { debug: true }
|
|
55
|
+
*
|
|
56
|
+
* Debug logs show:
|
|
57
|
+
* - Cache hits vs API fetches
|
|
58
|
+
* - Full API responses
|
|
59
|
+
* - Tool protection status for each tool
|
|
60
|
+
* - Cache TTL and expiration times
|
|
61
|
+
* - Source of config data (cache, api, or fallback)
|
|
62
|
+
*
|
|
63
|
+
* TROUBLESHOOTING:
|
|
64
|
+
* ----------------
|
|
65
|
+
* Problem: Dashboard shows protection but tool still executes
|
|
66
|
+
* Cause: Stale cache not invalidated
|
|
67
|
+
* Solution: POST /admin/clear-cache or wait for TTL expiration
|
|
68
|
+
*
|
|
69
|
+
* Problem: Empty toolProtections returned from API
|
|
70
|
+
* Cause: Tool not discovered yet (no proof submissions)
|
|
71
|
+
* Solution: Make at least one tool call to trigger discovery
|
|
72
|
+
*
|
|
73
|
+
* Problem: Updates take 5+ minutes to apply
|
|
74
|
+
* Cause: Long cache TTL and cache clear failed
|
|
75
|
+
* Solution: Configure MCP server URL in AgentShield for auto cache clear
|
|
76
|
+
*
|
|
77
|
+
* @see https://github.com/modelcontextprotocol-identity/agent-shield/docs/bouncer/tool-protection-sync.md
|
|
10
78
|
* @package @kya-os/mcp-i-core
|
|
11
79
|
*/
|
|
12
80
|
import type { ToolProtection, ToolProtectionConfig, ToolProtectionServiceConfig } from "../types/tool-protection.js";
|
|
@@ -58,7 +126,6 @@ export declare class ToolProtectionService {
|
|
|
58
126
|
* Uses projectId endpoint if available (preferred, project-scoped), otherwise falls back to agent_did query param
|
|
59
127
|
*
|
|
60
128
|
* @param agentDid DID of the agent to fetch config for
|
|
61
|
-
* @param bypassCache If true, adds Cache-Control header to bypass AgentShield's cache
|
|
62
129
|
*/
|
|
63
130
|
private fetchFromApi;
|
|
64
131
|
/**
|
|
@@ -71,14 +138,24 @@ export declare class ToolProtectionService {
|
|
|
71
138
|
*/
|
|
72
139
|
clearCache(agentDid: string): Promise<void>;
|
|
73
140
|
/**
|
|
74
|
-
*
|
|
141
|
+
* Clear cache and immediately fetch fresh config from API
|
|
142
|
+
*
|
|
143
|
+
* This method is designed for Cloudflare Workers where KV has edge caching.
|
|
144
|
+
* After clearing the KV entry, it fetches fresh data from the API and writes
|
|
145
|
+
* it back to KV. This ensures:
|
|
146
|
+
* 1. The global KV entry is deleted
|
|
147
|
+
* 2. Fresh data is fetched from API
|
|
148
|
+
* 3. New data is written to KV (updating edge cache)
|
|
75
149
|
*
|
|
76
|
-
*
|
|
77
|
-
* with Cache-Control headers to bypass AgentShield's 5-minute cache.
|
|
150
|
+
* The next request from the same edge location will get the fresh data.
|
|
78
151
|
*
|
|
79
|
-
* @param agentDid DID of the agent
|
|
80
|
-
* @returns
|
|
152
|
+
* @param agentDid DID of the agent (used for cache key)
|
|
153
|
+
* @returns The fresh tool protection config from API
|
|
81
154
|
*/
|
|
82
|
-
|
|
155
|
+
clearAndRefresh(agentDid: string): Promise<{
|
|
156
|
+
config: ToolProtectionConfig;
|
|
157
|
+
cacheKey: string;
|
|
158
|
+
source: 'api' | 'fallback';
|
|
159
|
+
}>;
|
|
83
160
|
}
|
|
84
161
|
//# sourceMappingURL=tool-protection.service.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tool-protection.service.d.ts","sourceRoot":"","sources":["../../src/services/tool-protection.service.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"tool-protection.service.d.ts","sourceRoot":"","sources":["../../src/services/tool-protection.service.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8EG;AAEH,OAAO,KAAK,EACV,cAAc,EACd,oBAAoB,EACpB,2BAA2B,EAE5B,MAAM,6BAA6B,CAAC;AACrC,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,mCAAmC,CAAC;AA8D7E;;GAEG;AACH,qBAAa,qBAAqB;IAChC,OAAO,CAAC,MAAM,CAA8B;IAC5C,OAAO,CAAC,KAAK,CAAsB;gBAEvB,MAAM,EAAE,2BAA2B,EAAE,KAAK,EAAE,mBAAmB;IAK3E;;;OAGG;IACH,YAAY,IAAI,MAAM,GAAG,SAAS;IAIlC;;;;;;;;OAQG;YACW,aAAa;IA4C3B;;;;;;;;;;OAUG;IACG,uBAAuB,CAC3B,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC,oBAAoB,CAAC;IAuYhC;;;;;;OAMG;IACG,mBAAmB,CACvB,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC,cAAc,GAAG,IAAI,CAAC;IA8BjC;;;;;OAKG;YACW,YAAY;IAsG1B;;;;;;;OAOG;IACG,UAAU,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAiBjD;;;;;;;;;;;;;;OAcG;IACG,eAAe,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC;QAC/C,MAAM,EAAE,oBAAoB,CAAC;QAC7B,QAAQ,EAAE,MAAM,CAAC;QACjB,MAAM,EAAE,KAAK,GAAG,UAAU,CAAC;KAC5B,CAAC;CA4IH"}
|