@kya-os/checkpoint-shared 1.8.0 → 1.9.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/CHANGELOG.md +37 -0
- package/dist/agent-catalog.d.mts +12 -0
- package/dist/agent-catalog.d.mts.map +1 -0
- package/dist/agent-catalog.d.ts +12 -0
- package/dist/agent-catalog.d.ts.map +1 -0
- package/dist/agent-catalog.js +105 -0
- package/dist/agent-catalog.mjs +105 -0
- package/dist/agent-catalog.mjs.map +1 -0
- package/dist/beacon-types/index.d.mts +18 -0
- package/dist/beacon-types/index.d.mts.map +1 -1
- package/dist/beacon-types/index.d.ts +18 -0
- package/dist/beacon-types/index.d.ts.map +1 -1
- package/dist/beacon-types/index.js +116 -12
- package/dist/beacon-types/index.mjs +105 -13
- package/dist/beacon-types/index.mjs.map +1 -1
- package/dist/browser-posture-5fPrsxx7.d.mts.map +1 -1
- package/dist/browser-posture-CCR1kh5e.d.ts.map +1 -1
- package/dist/browser-posture-cookie.js +1 -1
- package/dist/browser-posture-cookie.mjs +1 -1
- package/dist/browser-posture-cookie.mjs.map +1 -1
- package/dist/browser-posture-proof-verifier-DvsOmFrM.js +202 -0
- package/dist/browser-posture-proof-verifier-I0HP2Ics.mjs +180 -0
- package/dist/browser-posture-proof-verifier-I0HP2Ics.mjs.map +1 -0
- package/dist/browser-posture-proof-verifier.d.mts +25 -0
- package/dist/browser-posture-proof-verifier.d.mts.map +1 -0
- package/dist/browser-posture-proof-verifier.d.ts +25 -0
- package/dist/browser-posture-proof-verifier.d.ts.map +1 -0
- package/dist/browser-posture-proof-verifier.js +7 -0
- package/dist/browser-posture-proof-verifier.mjs +3 -0
- package/dist/browser-posture-proof.d.mts +3 -18
- package/dist/browser-posture-proof.d.mts.map +1 -1
- package/dist/browser-posture-proof.d.ts +3 -18
- package/dist/browser-posture-proof.d.ts.map +1 -1
- package/dist/browser-posture-proof.js +6 -131
- package/dist/browser-posture-proof.mjs +1 -126
- package/dist/browser-posture-proof.mjs.map +1 -1
- package/dist/browser-posture.js +1 -1
- package/dist/browser-posture.mjs +1 -1
- package/dist/browser-posture.mjs.map +1 -1
- package/dist/browser.d.mts +0 -282
- package/dist/browser.d.mts.map +1 -1
- package/dist/browser.d.ts +0 -282
- package/dist/browser.d.ts.map +1 -1
- package/dist/browser.js +1 -1
- package/dist/browser.mjs +1 -1
- package/dist/browser.mjs.map +1 -1
- package/dist/canonical-signer/index.mjs.map +1 -1
- package/dist/consent-handoff.d.mts +0 -3
- package/dist/consent-handoff.d.mts.map +1 -1
- package/dist/consent-handoff.d.ts +0 -3
- package/dist/consent-handoff.d.ts.map +1 -1
- package/dist/consent-handoff.mjs.map +1 -1
- package/dist/default-sign-in-host.d.mts +10 -0
- package/dist/default-sign-in-host.d.mts.map +1 -0
- package/dist/default-sign-in-host.d.ts +10 -0
- package/dist/default-sign-in-host.d.ts.map +1 -0
- package/dist/default-sign-in-host.js +72 -0
- package/dist/default-sign-in-host.mjs +66 -0
- package/dist/default-sign-in-host.mjs.map +1 -0
- package/dist/errors/index.d.mts +1 -0
- package/dist/errors/index.d.mts.map +1 -1
- package/dist/errors/index.d.ts +1 -0
- package/dist/errors/index.d.ts.map +1 -1
- package/dist/errors/index.js +5 -2
- package/dist/errors/index.mjs +5 -2
- package/dist/errors/index.mjs.map +1 -1
- package/dist/{fetcher-CivUCbhL.d.ts → fetcher-C8qvwdnA.d.ts} +2 -2
- package/dist/{fetcher-CivUCbhL.d.ts.map → fetcher-C8qvwdnA.d.ts.map} +1 -1
- package/dist/{fetcher-cXQsbm6s.d.mts → fetcher-D2vjr7jB.d.mts} +2 -2
- package/dist/{fetcher-cXQsbm6s.d.mts.map → fetcher-D2vjr7jB.d.mts.map} +1 -1
- package/dist/gateway-client-ip.d.mts +0 -2
- package/dist/gateway-client-ip.d.mts.map +1 -1
- package/dist/gateway-client-ip.d.ts +0 -2
- package/dist/gateway-client-ip.d.ts.map +1 -1
- package/dist/gateway-client-ip.mjs.map +1 -1
- package/dist/host-adapter/index.d.mts +1 -1
- package/dist/host-adapter/index.d.ts +1 -1
- package/dist/host-adapter/index.js +1 -1
- package/dist/host-adapter/index.mjs +1 -1
- package/dist/{host-adapter-DHyISsIf.mjs → host-adapter-BKdQHwbi.mjs} +2 -2
- package/dist/{host-adapter-DHyISsIf.mjs.map → host-adapter-BKdQHwbi.mjs.map} +1 -1
- package/dist/{host-adapter-0F8EpbD6.js → host-adapter-bWftXA9T.js} +1 -1
- package/dist/{index-CXbOY7gB.d.ts → index-DnFsmr_o.d.ts} +3 -3
- package/dist/{index-CXbOY7gB.d.ts.map → index-DnFsmr_o.d.ts.map} +1 -1
- package/dist/{index-B3cHxr3O.d.mts → index-rvw5Bz-r.d.mts} +3 -3
- package/dist/{index-B3cHxr3O.d.mts.map → index-rvw5Bz-r.d.mts.map} +1 -1
- package/dist/index.d.mts +94 -449
- package/dist/index.d.mts.map +1 -1
- package/dist/index.d.ts +94 -449
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +25 -455
- package/dist/index.mjs +17 -422
- package/dist/index.mjs.map +1 -1
- package/dist/{kya-http-error-codes-UYb1zpGM.js → kya-http-error-codes-B4rUmUEI.js} +2 -0
- package/dist/{kya-http-error-codes-7ewV5RuK.d.ts → kya-http-error-codes-C14E4gi3.d.mts} +2 -1
- package/dist/kya-http-error-codes-C14E4gi3.d.mts.map +1 -0
- package/dist/{kya-http-error-codes-7ewV5RuK.d.mts → kya-http-error-codes-C14E4gi3.d.ts} +2 -1
- package/dist/kya-http-error-codes-C14E4gi3.d.ts.map +1 -0
- package/dist/{kya-http-error-codes-C2JiWPsi.mjs → kya-http-error-codes-DSBrxNry.mjs} +3 -1
- package/dist/kya-http-error-codes-DSBrxNry.mjs.map +1 -0
- package/dist/kya-http.d.mts +1 -1
- package/dist/kya-http.d.ts +1 -1
- package/dist/kya-http.js +1 -1
- package/dist/kya-http.mjs +1 -1
- package/dist/mcpi/dashboard-config/index.d.mts.map +1 -1
- package/dist/mcpi/dashboard-config/index.d.ts.map +1 -1
- package/dist/mcpi/dashboard-config/index.mjs.map +1 -1
- package/dist/{patterns-B2r7M9wR.js → patterns-CiMpbdAF.js} +1 -1
- package/dist/{patterns-B7dQoeE3.mjs → patterns-D4OAsNQY.mjs} +2 -2
- package/dist/{patterns-B7dQoeE3.mjs.map → patterns-D4OAsNQY.mjs.map} +1 -1
- package/dist/patterns.js +1 -1
- package/dist/patterns.mjs +1 -1
- package/dist/policy/fetcher.d.mts +1 -1
- package/dist/policy/fetcher.d.ts +1 -1
- package/dist/policy/schemas.d.mts +1 -1
- package/dist/policy/schemas.d.ts +1 -1
- package/dist/{schemas-C_3C72SR.d.ts → schemas-CGKHzcMV.d.ts} +21 -21
- package/dist/{schemas-C_3C72SR.d.ts.map → schemas-CGKHzcMV.d.ts.map} +1 -1
- package/dist/{schemas-02CI7jgm.d.mts → schemas-m-GqyfyO.d.mts} +21 -21
- package/dist/{schemas-02CI7jgm.d.mts.map → schemas-m-GqyfyO.d.mts.map} +1 -1
- package/dist/tool-protection/index.d.mts +12 -0
- package/dist/tool-protection/index.d.mts.map +1 -1
- package/dist/tool-protection/index.d.ts +12 -0
- package/dist/tool-protection/index.d.ts.map +1 -1
- package/dist/tool-protection/index.js +46 -0
- package/dist/tool-protection/index.mjs +44 -1
- package/dist/tool-protection/index.mjs.map +1 -1
- package/fixtures/kya-http/error-codes.json +2 -1
- package/package.json +19 -3
- package/dist/kya-http-error-codes-7ewV5RuK.d.mts.map +0 -1
- package/dist/kya-http-error-codes-7ewV5RuK.d.ts.map +0 -1
- package/dist/kya-http-error-codes-C2JiWPsi.mjs.map +0 -1
|
@@ -250,23 +250,23 @@ declare const AllowListEntrySchema: ZodObject<{
|
|
|
250
250
|
addedBy: ZodOptional<ZodString>;
|
|
251
251
|
}, $strip>;
|
|
252
252
|
declare const ConditionOperatorSchema: ZodEnum<{
|
|
253
|
+
in: "in";
|
|
254
|
+
matches: "matches";
|
|
255
|
+
endsWith: "endsWith";
|
|
256
|
+
startsWith: "startsWith";
|
|
253
257
|
equals: "equals";
|
|
254
258
|
notEquals: "notEquals";
|
|
255
259
|
contains: "contains";
|
|
256
260
|
notContains: "notContains";
|
|
257
|
-
startsWith: "startsWith";
|
|
258
|
-
endsWith: "endsWith";
|
|
259
261
|
greaterThan: "greaterThan";
|
|
260
262
|
lessThan: "lessThan";
|
|
261
263
|
greaterThanOrEquals: "greaterThanOrEquals";
|
|
262
264
|
lessThanOrEquals: "lessThanOrEquals";
|
|
263
|
-
matches: "matches";
|
|
264
|
-
in: "in";
|
|
265
265
|
notIn: "notIn";
|
|
266
266
|
}>;
|
|
267
267
|
declare const ConditionFieldSchema: ZodEnum<{
|
|
268
|
-
path: "path";
|
|
269
268
|
origin: "origin";
|
|
269
|
+
path: "path";
|
|
270
270
|
confidence: "confidence";
|
|
271
271
|
clientDid: "clientDid";
|
|
272
272
|
agentDid: "agentDid";
|
|
@@ -284,8 +284,8 @@ declare const ConditionFieldSchema: ZodEnum<{
|
|
|
284
284
|
declare const ConditionValueSchema: ZodUnion<readonly [ZodString, ZodNumber, ZodBoolean, ZodArray<ZodString>]>;
|
|
285
285
|
declare const PolicyConditionSchema: ZodObject<{
|
|
286
286
|
field: ZodEnum<{
|
|
287
|
-
path: "path";
|
|
288
287
|
origin: "origin";
|
|
288
|
+
path: "path";
|
|
289
289
|
confidence: "confidence";
|
|
290
290
|
clientDid: "clientDid";
|
|
291
291
|
agentDid: "agentDid";
|
|
@@ -301,18 +301,18 @@ declare const PolicyConditionSchema: ZodObject<{
|
|
|
301
301
|
hasValidDelegation: "hasValidDelegation";
|
|
302
302
|
}>;
|
|
303
303
|
operator: ZodEnum<{
|
|
304
|
+
in: "in";
|
|
305
|
+
matches: "matches";
|
|
306
|
+
endsWith: "endsWith";
|
|
307
|
+
startsWith: "startsWith";
|
|
304
308
|
equals: "equals";
|
|
305
309
|
notEquals: "notEquals";
|
|
306
310
|
contains: "contains";
|
|
307
311
|
notContains: "notContains";
|
|
308
|
-
startsWith: "startsWith";
|
|
309
|
-
endsWith: "endsWith";
|
|
310
312
|
greaterThan: "greaterThan";
|
|
311
313
|
lessThan: "lessThan";
|
|
312
314
|
greaterThanOrEquals: "greaterThanOrEquals";
|
|
313
315
|
lessThanOrEquals: "lessThanOrEquals";
|
|
314
|
-
matches: "matches";
|
|
315
|
-
in: "in";
|
|
316
316
|
notIn: "notIn";
|
|
317
317
|
}>;
|
|
318
318
|
value: ZodUnion<readonly [ZodString, ZodNumber, ZodBoolean, ZodArray<ZodString>]>;
|
|
@@ -330,8 +330,8 @@ declare const PolicyRuleSchema: ZodObject<{
|
|
|
330
330
|
priority: ZodDefault<ZodNumber>;
|
|
331
331
|
conditions: ZodArray<ZodObject<{
|
|
332
332
|
field: ZodEnum<{
|
|
333
|
-
path: "path";
|
|
334
333
|
origin: "origin";
|
|
334
|
+
path: "path";
|
|
335
335
|
confidence: "confidence";
|
|
336
336
|
clientDid: "clientDid";
|
|
337
337
|
agentDid: "agentDid";
|
|
@@ -347,18 +347,18 @@ declare const PolicyRuleSchema: ZodObject<{
|
|
|
347
347
|
hasValidDelegation: "hasValidDelegation";
|
|
348
348
|
}>;
|
|
349
349
|
operator: ZodEnum<{
|
|
350
|
+
in: "in";
|
|
351
|
+
matches: "matches";
|
|
352
|
+
endsWith: "endsWith";
|
|
353
|
+
startsWith: "startsWith";
|
|
350
354
|
equals: "equals";
|
|
351
355
|
notEquals: "notEquals";
|
|
352
356
|
contains: "contains";
|
|
353
357
|
notContains: "notContains";
|
|
354
|
-
startsWith: "startsWith";
|
|
355
|
-
endsWith: "endsWith";
|
|
356
358
|
greaterThan: "greaterThan";
|
|
357
359
|
lessThan: "lessThan";
|
|
358
360
|
greaterThanOrEquals: "greaterThanOrEquals";
|
|
359
361
|
lessThanOrEquals: "lessThanOrEquals";
|
|
360
|
-
matches: "matches";
|
|
361
|
-
in: "in";
|
|
362
362
|
notIn: "notIn";
|
|
363
363
|
}>;
|
|
364
364
|
value: ZodUnion<readonly [ZodString, ZodNumber, ZodBoolean, ZodArray<ZodString>]>;
|
|
@@ -451,8 +451,8 @@ declare const PolicyConfigSchema: ZodObject<{
|
|
|
451
451
|
priority: ZodDefault<ZodNumber>;
|
|
452
452
|
conditions: ZodArray<ZodObject<{
|
|
453
453
|
field: ZodEnum<{
|
|
454
|
-
path: "path";
|
|
455
454
|
origin: "origin";
|
|
455
|
+
path: "path";
|
|
456
456
|
confidence: "confidence";
|
|
457
457
|
clientDid: "clientDid";
|
|
458
458
|
agentDid: "agentDid";
|
|
@@ -468,18 +468,18 @@ declare const PolicyConfigSchema: ZodObject<{
|
|
|
468
468
|
hasValidDelegation: "hasValidDelegation";
|
|
469
469
|
}>;
|
|
470
470
|
operator: ZodEnum<{
|
|
471
|
+
in: "in";
|
|
472
|
+
matches: "matches";
|
|
473
|
+
endsWith: "endsWith";
|
|
474
|
+
startsWith: "startsWith";
|
|
471
475
|
equals: "equals";
|
|
472
476
|
notEquals: "notEquals";
|
|
473
477
|
contains: "contains";
|
|
474
478
|
notContains: "notContains";
|
|
475
|
-
startsWith: "startsWith";
|
|
476
|
-
endsWith: "endsWith";
|
|
477
479
|
greaterThan: "greaterThan";
|
|
478
480
|
lessThan: "lessThan";
|
|
479
481
|
greaterThanOrEquals: "greaterThanOrEquals";
|
|
480
482
|
lessThanOrEquals: "lessThanOrEquals";
|
|
481
|
-
matches: "matches";
|
|
482
|
-
in: "in";
|
|
483
483
|
notIn: "notIn";
|
|
484
484
|
}>;
|
|
485
485
|
value: ZodUnion<readonly [ZodString, ZodNumber, ZodBoolean, ZodArray<ZodString>]>;
|
|
@@ -532,4 +532,4 @@ type PolicyConfig = output<typeof PolicyConfigSchema>;
|
|
|
532
532
|
declare function safeParsePolicyConfig(data: unknown): PolicyConfig | null;
|
|
533
533
|
//#endregion
|
|
534
534
|
export { PolicyMetadataSchema as A, ThresholdConfigSchema as B, InstructPayload as C, PolicyConfig as D, PolicyConditionSchema as E, RuleMetadata as F, RuleMetadataSchema as I, SuggestedAction as L, PolicyRuleSchema as M, RedirectTarget as N, PolicyConfigSchema as O, RedirectTargetSchema as P, SuggestedActionSchema as R, EnforcementModeSchema as S, PolicyCondition as T, safeParsePolicyConfig as V, DenyListEntry as _, BlockReason as a, EnforcementActionSchema as b, ChallengeParamsSchema as c, ConditionOperator as d, ConditionOperatorSchema as f, DecisionSchema as g, Decision as h, AssuranceTierSchema as i, PolicyRule as j, PolicyMetadata as k, ConditionField as l, ConditionValueSchema as m, AllowListEntrySchema as n, BlockReasonSchema as o, ConditionValue as p, AssuranceTier as r, ChallengeParams as s, AllowListEntry as t, ConditionFieldSchema as u, DenyListEntrySchema as v, InstructPayloadSchema as w, EnforcementMode as x, EnforcementAction as y, ThresholdConfig as z };
|
|
535
|
-
//# sourceMappingURL=schemas-
|
|
535
|
+
//# sourceMappingURL=schemas-CGKHzcMV.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schemas-
|
|
1
|
+
{"version":3,"file":"schemas-CGKHzcMV.d.ts","names":[],"sources":["../src/policy/schemas.ts"],"mappings":";;cAiCa,yBAAuB;;;;;;;;;cAgBvB,uBAAqB;;;;KAEtB,kBAAkB,cAAe;cAoBhC,mBAAiB,uBAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6C5B;KAEU,cAAc,cAAe;cAS5B,qBAAmB;;;;;;;KASpB,gBAAgB,cAAe;cAQ9B,uBAAqB;;;;;;;;;;;;;;GAsBhC;KAEU,kBAAkB,cAAe;cAIhC,sBAAoB;;;;;GAM/B;KAEU,iBAAiB,cAAe;cAE/B,uBAAqB,uBAAA;;;;;;;;;;;;;;GAShC;KAEU,kBAAkB,cAAe;cAEhC,uBAAqB;;;;;;;;;;;;;;;;;;;GAMhC;KAEU,kBAAkB,cAAe;cAUhC,gBAAc,uBAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GASzB;KAEU,WAAW,cAAe;cAMzB,uBAAqB;;;;;;;;;;;;;;;;;;;;;;;GAiBhC;cAMW,qBAAmB;;;;;;;;;;GAmB9B;cAEW,sBAAoB;;;;;;;;GAe/B;cAMW,yBAAuB;;;;;;;;;;;;;;;cAgBvB,sBAAoB;;;;;;;;;;;;;;;;;cAsBpB,sBAAoB,mBAAA,WAAA,WAAA,YAAA,SAAA;cAOpB,uBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAShC;cAMW,oBAAkB;;;;GAI7B;cAEW,kBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqB3B;cAMW,sBAAoB;;;;GAI/B;cAEW,oBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsF7B;KAMU,oBAAoB,cAAe;KACnC,kBAAkB,cAAe;KACjC,gBAAgB,cAAe;KAC/B,iBAAiB,cAAe;KAChC,oBAAoB,cAAe;KACnC,iBAAiB,cAAe;KAChC,iBAAiB,cAAe;KAChC,kBAAkB,cAAe;KACjC,eAAe,cAAe;KAC9B,aAAa,cAAe;KAC5B,iBAAiB,cAAe;KAChC,eAAe,cAAe;iBAW1B,sBAAsB,gBAAgB"}
|
|
@@ -250,23 +250,23 @@ declare const AllowListEntrySchema: ZodObject<{
|
|
|
250
250
|
addedBy: ZodOptional<ZodString>;
|
|
251
251
|
}, $strip>;
|
|
252
252
|
declare const ConditionOperatorSchema: ZodEnum<{
|
|
253
|
+
in: "in";
|
|
254
|
+
matches: "matches";
|
|
255
|
+
endsWith: "endsWith";
|
|
256
|
+
startsWith: "startsWith";
|
|
253
257
|
equals: "equals";
|
|
254
258
|
notEquals: "notEquals";
|
|
255
259
|
contains: "contains";
|
|
256
260
|
notContains: "notContains";
|
|
257
|
-
startsWith: "startsWith";
|
|
258
|
-
endsWith: "endsWith";
|
|
259
261
|
greaterThan: "greaterThan";
|
|
260
262
|
lessThan: "lessThan";
|
|
261
263
|
greaterThanOrEquals: "greaterThanOrEquals";
|
|
262
264
|
lessThanOrEquals: "lessThanOrEquals";
|
|
263
|
-
matches: "matches";
|
|
264
|
-
in: "in";
|
|
265
265
|
notIn: "notIn";
|
|
266
266
|
}>;
|
|
267
267
|
declare const ConditionFieldSchema: ZodEnum<{
|
|
268
|
-
path: "path";
|
|
269
268
|
origin: "origin";
|
|
269
|
+
path: "path";
|
|
270
270
|
confidence: "confidence";
|
|
271
271
|
clientDid: "clientDid";
|
|
272
272
|
agentDid: "agentDid";
|
|
@@ -284,8 +284,8 @@ declare const ConditionFieldSchema: ZodEnum<{
|
|
|
284
284
|
declare const ConditionValueSchema: ZodUnion<readonly [ZodString, ZodNumber, ZodBoolean, ZodArray<ZodString>]>;
|
|
285
285
|
declare const PolicyConditionSchema: ZodObject<{
|
|
286
286
|
field: ZodEnum<{
|
|
287
|
-
path: "path";
|
|
288
287
|
origin: "origin";
|
|
288
|
+
path: "path";
|
|
289
289
|
confidence: "confidence";
|
|
290
290
|
clientDid: "clientDid";
|
|
291
291
|
agentDid: "agentDid";
|
|
@@ -301,18 +301,18 @@ declare const PolicyConditionSchema: ZodObject<{
|
|
|
301
301
|
hasValidDelegation: "hasValidDelegation";
|
|
302
302
|
}>;
|
|
303
303
|
operator: ZodEnum<{
|
|
304
|
+
in: "in";
|
|
305
|
+
matches: "matches";
|
|
306
|
+
endsWith: "endsWith";
|
|
307
|
+
startsWith: "startsWith";
|
|
304
308
|
equals: "equals";
|
|
305
309
|
notEquals: "notEquals";
|
|
306
310
|
contains: "contains";
|
|
307
311
|
notContains: "notContains";
|
|
308
|
-
startsWith: "startsWith";
|
|
309
|
-
endsWith: "endsWith";
|
|
310
312
|
greaterThan: "greaterThan";
|
|
311
313
|
lessThan: "lessThan";
|
|
312
314
|
greaterThanOrEquals: "greaterThanOrEquals";
|
|
313
315
|
lessThanOrEquals: "lessThanOrEquals";
|
|
314
|
-
matches: "matches";
|
|
315
|
-
in: "in";
|
|
316
316
|
notIn: "notIn";
|
|
317
317
|
}>;
|
|
318
318
|
value: ZodUnion<readonly [ZodString, ZodNumber, ZodBoolean, ZodArray<ZodString>]>;
|
|
@@ -330,8 +330,8 @@ declare const PolicyRuleSchema: ZodObject<{
|
|
|
330
330
|
priority: ZodDefault<ZodNumber>;
|
|
331
331
|
conditions: ZodArray<ZodObject<{
|
|
332
332
|
field: ZodEnum<{
|
|
333
|
-
path: "path";
|
|
334
333
|
origin: "origin";
|
|
334
|
+
path: "path";
|
|
335
335
|
confidence: "confidence";
|
|
336
336
|
clientDid: "clientDid";
|
|
337
337
|
agentDid: "agentDid";
|
|
@@ -347,18 +347,18 @@ declare const PolicyRuleSchema: ZodObject<{
|
|
|
347
347
|
hasValidDelegation: "hasValidDelegation";
|
|
348
348
|
}>;
|
|
349
349
|
operator: ZodEnum<{
|
|
350
|
+
in: "in";
|
|
351
|
+
matches: "matches";
|
|
352
|
+
endsWith: "endsWith";
|
|
353
|
+
startsWith: "startsWith";
|
|
350
354
|
equals: "equals";
|
|
351
355
|
notEquals: "notEquals";
|
|
352
356
|
contains: "contains";
|
|
353
357
|
notContains: "notContains";
|
|
354
|
-
startsWith: "startsWith";
|
|
355
|
-
endsWith: "endsWith";
|
|
356
358
|
greaterThan: "greaterThan";
|
|
357
359
|
lessThan: "lessThan";
|
|
358
360
|
greaterThanOrEquals: "greaterThanOrEquals";
|
|
359
361
|
lessThanOrEquals: "lessThanOrEquals";
|
|
360
|
-
matches: "matches";
|
|
361
|
-
in: "in";
|
|
362
362
|
notIn: "notIn";
|
|
363
363
|
}>;
|
|
364
364
|
value: ZodUnion<readonly [ZodString, ZodNumber, ZodBoolean, ZodArray<ZodString>]>;
|
|
@@ -451,8 +451,8 @@ declare const PolicyConfigSchema: ZodObject<{
|
|
|
451
451
|
priority: ZodDefault<ZodNumber>;
|
|
452
452
|
conditions: ZodArray<ZodObject<{
|
|
453
453
|
field: ZodEnum<{
|
|
454
|
-
path: "path";
|
|
455
454
|
origin: "origin";
|
|
455
|
+
path: "path";
|
|
456
456
|
confidence: "confidence";
|
|
457
457
|
clientDid: "clientDid";
|
|
458
458
|
agentDid: "agentDid";
|
|
@@ -468,18 +468,18 @@ declare const PolicyConfigSchema: ZodObject<{
|
|
|
468
468
|
hasValidDelegation: "hasValidDelegation";
|
|
469
469
|
}>;
|
|
470
470
|
operator: ZodEnum<{
|
|
471
|
+
in: "in";
|
|
472
|
+
matches: "matches";
|
|
473
|
+
endsWith: "endsWith";
|
|
474
|
+
startsWith: "startsWith";
|
|
471
475
|
equals: "equals";
|
|
472
476
|
notEquals: "notEquals";
|
|
473
477
|
contains: "contains";
|
|
474
478
|
notContains: "notContains";
|
|
475
|
-
startsWith: "startsWith";
|
|
476
|
-
endsWith: "endsWith";
|
|
477
479
|
greaterThan: "greaterThan";
|
|
478
480
|
lessThan: "lessThan";
|
|
479
481
|
greaterThanOrEquals: "greaterThanOrEquals";
|
|
480
482
|
lessThanOrEquals: "lessThanOrEquals";
|
|
481
|
-
matches: "matches";
|
|
482
|
-
in: "in";
|
|
483
483
|
notIn: "notIn";
|
|
484
484
|
}>;
|
|
485
485
|
value: ZodUnion<readonly [ZodString, ZodNumber, ZodBoolean, ZodArray<ZodString>]>;
|
|
@@ -532,4 +532,4 @@ type PolicyConfig = output<typeof PolicyConfigSchema>;
|
|
|
532
532
|
declare function safeParsePolicyConfig(data: unknown): PolicyConfig | null;
|
|
533
533
|
//#endregion
|
|
534
534
|
export { PolicyMetadataSchema as A, ThresholdConfigSchema as B, InstructPayload as C, PolicyConfig as D, PolicyConditionSchema as E, RuleMetadata as F, RuleMetadataSchema as I, SuggestedAction as L, PolicyRuleSchema as M, RedirectTarget as N, PolicyConfigSchema as O, RedirectTargetSchema as P, SuggestedActionSchema as R, EnforcementModeSchema as S, PolicyCondition as T, safeParsePolicyConfig as V, DenyListEntry as _, BlockReason as a, EnforcementActionSchema as b, ChallengeParamsSchema as c, ConditionOperator as d, ConditionOperatorSchema as f, DecisionSchema as g, Decision as h, AssuranceTierSchema as i, PolicyRule as j, PolicyMetadata as k, ConditionField as l, ConditionValueSchema as m, AllowListEntrySchema as n, BlockReasonSchema as o, ConditionValue as p, AssuranceTier as r, ChallengeParams as s, AllowListEntry as t, ConditionFieldSchema as u, DenyListEntrySchema as v, InstructPayloadSchema as w, EnforcementMode as x, EnforcementAction as y, ThresholdConfig as z };
|
|
535
|
-
//# sourceMappingURL=schemas-
|
|
535
|
+
//# sourceMappingURL=schemas-m-GqyfyO.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schemas-
|
|
1
|
+
{"version":3,"file":"schemas-m-GqyfyO.d.mts","names":[],"sources":["../src/policy/schemas.ts"],"mappings":";;cAiCa,yBAAuB;;;;;;;;;cAgBvB,uBAAqB;;;;KAEtB,kBAAkB,cAAe;cAoBhC,mBAAiB,uBAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6C5B;KAEU,cAAc,cAAe;cAS5B,qBAAmB;;;;;;;KASpB,gBAAgB,cAAe;cAQ9B,uBAAqB;;;;;;;;;;;;;;GAsBhC;KAEU,kBAAkB,cAAe;cAIhC,sBAAoB;;;;;GAM/B;KAEU,iBAAiB,cAAe;cAE/B,uBAAqB,uBAAA;;;;;;;;;;;;;;GAShC;KAEU,kBAAkB,cAAe;cAEhC,uBAAqB;;;;;;;;;;;;;;;;;;;GAMhC;KAEU,kBAAkB,cAAe;cAUhC,gBAAc,uBAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GASzB;KAEU,WAAW,cAAe;cAMzB,uBAAqB;;;;;;;;;;;;;;;;;;;;;;;GAiBhC;cAMW,qBAAmB;;;;;;;;;;GAmB9B;cAEW,sBAAoB;;;;;;;;GAe/B;cAMW,yBAAuB;;;;;;;;;;;;;;;cAgBvB,sBAAoB;;;;;;;;;;;;;;;;;cAsBpB,sBAAoB,mBAAA,WAAA,WAAA,YAAA,SAAA;cAOpB,uBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAShC;cAMW,oBAAkB;;;;GAI7B;cAEW,kBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqB3B;cAMW,sBAAoB;;;;GAI/B;cAEW,oBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsF7B;KAMU,oBAAoB,cAAe;KACnC,kBAAkB,cAAe;KACjC,gBAAgB,cAAe;KAC/B,iBAAiB,cAAe;KAChC,oBAAoB,cAAe;KACnC,iBAAiB,cAAe;KAChC,iBAAiB,cAAe;KAChC,kBAAkB,cAAe;KACjC,eAAe,cAAe;KAC9B,aAAa,cAAe;KAC5B,iBAAiB,cAAe;KAChC,eAAe,cAAe;iBAW1B,sBAAsB,gBAAgB"}
|
|
@@ -1,4 +1,15 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
+
//#region src/tool-protection/default-required-scopes.d.ts
|
|
3
|
+
interface ToolScopeSources {
|
|
4
|
+
requiredScopes?: unknown;
|
|
5
|
+
scopes?: unknown;
|
|
6
|
+
securitySchemes?: unknown;
|
|
7
|
+
capability?: unknown;
|
|
8
|
+
}
|
|
9
|
+
export declare const MAX_DEFAULT_SCOPE_LENGTH = 200;
|
|
10
|
+
export declare function executeScopeFor(toolName: string): string;
|
|
11
|
+
export declare function defaultRequiredScopes(toolName: string, entry: ToolScopeSources | null | undefined): string[];
|
|
12
|
+
//#endregion
|
|
2
13
|
//#region src/tool-protection/index.d.ts
|
|
3
14
|
export type AuthorizationRequirement = {
|
|
4
15
|
type: 'oauth';
|
|
@@ -418,4 +429,5 @@ export declare function normalizeAuthorizationType(auth: AuthorizationRequiremen
|
|
|
418
429
|
logger?: (message: string) => void;
|
|
419
430
|
}): AuthorizationRequirement;
|
|
420
431
|
//#endregion
|
|
432
|
+
export type { ToolScopeSources };
|
|
421
433
|
//# sourceMappingURL=index.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","names":[],"sources":["../../src/tool-protection/index.ts"],"mappings":";;
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../../src/tool-protection/default-required-scopes.ts","../../src/tool-protection/index.ts"],"mappings":";;UAaiB;EAEf;EAEA;EAEA;EAEA;;qBAIW;wBAiCG,gBAAgB;wBAkBhB,sBACd,kBACA,OAAO;;;YC/BG;EAKN;EACA;EACA;;EAIA;EACA;EACA;;EAGA;EACA;;EAGA;EACA;EACA;;EAGA;EACA;EACA;;EAIA;EACA;EACA;;EAOA;EACA;EACA;;EAIA;EACA;EACA;;EAIA;EACA;EACA;;EAIA;EACA;EACA,eAAe;;EAGf;;qBAIO;;;;;;;;;;;;YAkBD,4BAA4B,kCAAkC;iBAQzD;EAIf;EAMA;EAMA;EASA;EAMA,gBAAgB;;YASN,oBAAoB,eAAe;YAMnC,wBAAwB,QAAQ;YAOhC;EACV;EACA;EACA;EACA;EACA,gBAAgB;;iBASD;EAIf,iBAAiB;EAKjB;IAIE;IAKA;IAKA;;;iBAUa;EAIf;EAKA;EAKA;EAKA;EAKA;;iBAae;EAEf;EAGA;EAGA;EAGA;EAGA;;qBAGW,6BAA2B,EAAA;;;;;;;;;;GAMtC,EAAA,KAAA;qBAQW,0BAA0B;WACrB,MAAM;WACN;WACA;EAEJ,YAAA;IACV,MAAM;IACN;IACA;IACA;;EAeF,UAAU;;YAeA,uBAAuB,KAAK;EACtC;;YAOU,sBAAsB,iBAAiB;qBAMtC,gCAA8B,EAAA,uBAAA,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6DzC,EAAA,KAAA;qBAEW,sBAAoB,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAM/B,EAAA,KAAA;qBAEW,yBAAuB,EAAA,UAAA,EAAA,WAAA,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAA6C,EAAA,KAAA;qBAEpE,8BAA4B,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GASvC,EAAA,KAAA;qBAEW,mCAAiC,EAAA;;;;;;GAM5C,EAAA,KAAA;wBAMc,iBAAiB,eAAe,OAAO;wBAIvC,oBAAoB,eAAe,OAAO;wBAI1C,yBAAyB,eAAe,OAAO;wBAI/C,8BAA8B,eAAe,OAAO;wBAOpD,2BAA2B,eAAe,OAAO;wBAQjD,sBACd,YAAY,iBACX,cAAc;EAAmB;IAAiB;;;wBAOrC,yBACd,YAAY,iBACX,cAAc;EAAmB;IAAiB;;;wBASrC,qCACd,YAAY,iBACX,cAAc;EACf;IAAiB;;;wBAWH,uBACd,YAAY,iBACX,cAAc;EAAmB;IAAiB;;;wBAQrC,uBAAuB,eAAe;wBAItC,0BAA0B,eAAe;wBAIzC,+BAA+B,eAAe;wBAI9C,oCAAoC,eAAe;wBAWnD,uBAAuB,kBAAkB,aAAa;wBAQtD,sBAAsB,kBAAkB,aAAa;wBAQrD,iBACd,kBACA,aAAa,oBACZ;wBAOa,8BACd,kBACA,0BACA,sBACC;wBAsBa,wBACd,KAAK,iBAAiB,wBACrB;qBA0CU;;;;;;;;YAeD,8BACF,qCAAqC;wBAa/B,6BACd,2BACA,0BACA,2BACA,sBACC;wBAmBa,0BAA0B,MAAM;wBAoChC,wBAAwB,MAAM;wBA4D9B,2BACd,MAAM,0BACN;EAAW;EAAgB,UAAU;IACpC"}
|
|
@@ -1,4 +1,15 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
+
//#region src/tool-protection/default-required-scopes.d.ts
|
|
3
|
+
interface ToolScopeSources {
|
|
4
|
+
requiredScopes?: unknown;
|
|
5
|
+
scopes?: unknown;
|
|
6
|
+
securitySchemes?: unknown;
|
|
7
|
+
capability?: unknown;
|
|
8
|
+
}
|
|
9
|
+
export declare const MAX_DEFAULT_SCOPE_LENGTH = 200;
|
|
10
|
+
export declare function executeScopeFor(toolName: string): string;
|
|
11
|
+
export declare function defaultRequiredScopes(toolName: string, entry: ToolScopeSources | null | undefined): string[];
|
|
12
|
+
//#endregion
|
|
2
13
|
//#region src/tool-protection/index.d.ts
|
|
3
14
|
export type AuthorizationRequirement = {
|
|
4
15
|
type: 'oauth';
|
|
@@ -418,4 +429,5 @@ export declare function normalizeAuthorizationType(auth: AuthorizationRequiremen
|
|
|
418
429
|
logger?: (message: string) => void;
|
|
419
430
|
}): AuthorizationRequirement;
|
|
420
431
|
//#endregion
|
|
432
|
+
export type { ToolScopeSources };
|
|
421
433
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","names":[],"sources":["../../src/tool-protection/index.ts"],"mappings":";;
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../../src/tool-protection/default-required-scopes.ts","../../src/tool-protection/index.ts"],"mappings":";;UAaiB;EAEf;EAEA;EAEA;EAEA;;qBAIW;wBAiCG,gBAAgB;wBAkBhB,sBACd,kBACA,OAAO;;;YC/BG;EAKN;EACA;EACA;;EAIA;EACA;EACA;;EAGA;EACA;;EAGA;EACA;EACA;;EAGA;EACA;EACA;;EAIA;EACA;EACA;;EAOA;EACA;EACA;;EAIA;EACA;EACA;;EAIA;EACA;EACA;;EAIA;EACA;EACA,eAAe;;EAGf;;qBAIO;;;;;;;;;;;;YAkBD,4BAA4B,kCAAkC;iBAQzD;EAIf;EAMA;EAMA;EASA;EAMA,gBAAgB;;YASN,oBAAoB,eAAe;YAMnC,wBAAwB,QAAQ;YAOhC;EACV;EACA;EACA;EACA;EACA,gBAAgB;;iBASD;EAIf,iBAAiB;EAKjB;IAIE;IAKA;IAKA;;;iBAUa;EAIf;EAKA;EAKA;EAKA;EAKA;;iBAae;EAEf;EAGA;EAGA;EAGA;EAGA;;qBAGW,6BAA2B,EAAA;;;;;;;;;;GAMtC,EAAA,KAAA;qBAQW,0BAA0B;WACrB,MAAM;WACN;WACA;EAEJ,YAAA;IACV,MAAM;IACN;IACA;IACA;;EAeF,UAAU;;YAeA,uBAAuB,KAAK;EACtC;;YAOU,sBAAsB,iBAAiB;qBAMtC,gCAA8B,EAAA,uBAAA,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6DzC,EAAA,KAAA;qBAEW,sBAAoB,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAM/B,EAAA,KAAA;qBAEW,yBAAuB,EAAA,UAAA,EAAA,WAAA,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAA6C,EAAA,KAAA;qBAEpE,8BAA4B,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GASvC,EAAA,KAAA;qBAEW,mCAAiC,EAAA;;;;;;GAM5C,EAAA,KAAA;wBAMc,iBAAiB,eAAe,OAAO;wBAIvC,oBAAoB,eAAe,OAAO;wBAI1C,yBAAyB,eAAe,OAAO;wBAI/C,8BAA8B,eAAe,OAAO;wBAOpD,2BAA2B,eAAe,OAAO;wBAQjD,sBACd,YAAY,iBACX,cAAc;EAAmB;IAAiB;;;wBAOrC,yBACd,YAAY,iBACX,cAAc;EAAmB;IAAiB;;;wBASrC,qCACd,YAAY,iBACX,cAAc;EACf;IAAiB;;;wBAWH,uBACd,YAAY,iBACX,cAAc;EAAmB;IAAiB;;;wBAQrC,uBAAuB,eAAe;wBAItC,0BAA0B,eAAe;wBAIzC,+BAA+B,eAAe;wBAI9C,oCAAoC,eAAe;wBAWnD,uBAAuB,kBAAkB,aAAa;wBAQtD,sBAAsB,kBAAkB,aAAa;wBAQrD,iBACd,kBACA,aAAa,oBACZ;wBAOa,8BACd,kBACA,0BACA,sBACC;wBAsBa,wBACd,KAAK,iBAAiB,wBACrB;qBA0CU;;;;;;;;YAeD,8BACF,qCAAqC;wBAa/B,6BACd,2BACA,0BACA,2BACA,sBACC;wBAmBa,0BAA0B,MAAM;wBAoChC,wBAAwB,MAAM;wBA4D9B,2BACd,MAAM,0BACN;EAAW;EAAgB,UAAU;IACpC"}
|
|
@@ -1,6 +1,49 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
2
|
let zod = require("zod");
|
|
3
3
|
|
|
4
|
+
//#region src/tool-protection/default-required-scopes.ts
|
|
5
|
+
/** The longest scope a consent request carries. */
|
|
6
|
+
const MAX_DEFAULT_SCOPE_LENGTH = 200;
|
|
7
|
+
const EXECUTE_SUFFIX = ":execute";
|
|
8
|
+
/** Outside the RFC 6749 scope-token alphabet: printable ASCII except space, `"` and `\`. */
|
|
9
|
+
const NON_SCOPE_TOKEN_CHARS = /[^\x21\x23-\x5B\x5D-\x7E]/gu;
|
|
10
|
+
function scopeList(value) {
|
|
11
|
+
return Array.isArray(value) && value.length > 0 && value.every((item) => typeof item === "string") ? value : void 0;
|
|
12
|
+
}
|
|
13
|
+
function declaredOauthScopes(schemes) {
|
|
14
|
+
if (!Array.isArray(schemes)) return [];
|
|
15
|
+
const scopes = schemes.flatMap((scheme) => typeof scheme === "object" && scheme !== null && scheme.type === "oauth2" && Array.isArray(scheme.scopes) ? scheme.scopes.filter((scope) => typeof scope === "string" && scope.length > 0) : []);
|
|
16
|
+
return [...new Set(scopes)];
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* `<name>:execute`, with the name reduced to the scope-token alphabet (the edge
|
|
20
|
+
* drops other characters) and the whole scope at most
|
|
21
|
+
* {@link MAX_DEFAULT_SCOPE_LENGTH} characters.
|
|
22
|
+
*/
|
|
23
|
+
function executeScopeFor(toolName) {
|
|
24
|
+
return `${toolName.replace(NON_SCOPE_TOKEN_CHARS, "_").slice(0, 192)}${EXECUTE_SUFFIX}`;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* The scopes to store for `toolName`: the first non-empty of
|
|
28
|
+
*
|
|
29
|
+
* 1. the entry's own `requiredScopes`, as stored;
|
|
30
|
+
* 2. its legacy `scopes`, so a grant for the scope the runtime reported keeps matching;
|
|
31
|
+
* 3. the oauth2 scopes its `securitySchemes` declare;
|
|
32
|
+
* 4. its `capability`;
|
|
33
|
+
* 5. {@link executeScopeFor}`(toolName)`.
|
|
34
|
+
*
|
|
35
|
+
* Never empty. An absent entry gets the last.
|
|
36
|
+
*/
|
|
37
|
+
function defaultRequiredScopes(toolName, entry) {
|
|
38
|
+
const own = scopeList(entry?.requiredScopes) ?? scopeList(entry?.scopes);
|
|
39
|
+
if (own) return [...own];
|
|
40
|
+
const declared = declaredOauthScopes(entry?.securitySchemes);
|
|
41
|
+
if (declared.length > 0) return declared;
|
|
42
|
+
if (typeof entry?.capability === "string" && entry.capability.length > 0) return [entry.capability];
|
|
43
|
+
return [executeScopeFor(toolName)];
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
//#endregion
|
|
4
47
|
//#region src/tool-protection/index.ts
|
|
5
48
|
/**
|
|
6
49
|
* KYA-OS Tool Protection Specification
|
|
@@ -424,11 +467,14 @@ exports.AuthRequiredErrorDataSchema = AuthRequiredErrorDataSchema;
|
|
|
424
467
|
exports.AuthorizationRequirementSchema = AuthorizationRequirementSchema;
|
|
425
468
|
exports.CONSENT_PROVIDER_TYPES = CONSENT_PROVIDER_TYPES;
|
|
426
469
|
exports.DelegationRequiredErrorDataSchema = DelegationRequiredErrorDataSchema;
|
|
470
|
+
exports.MAX_DEFAULT_SCOPE_LENGTH = MAX_DEFAULT_SCOPE_LENGTH;
|
|
427
471
|
exports.ToolProtectionMapSchema = ToolProtectionMapSchema;
|
|
428
472
|
exports.ToolProtectionResponseSchema = ToolProtectionResponseSchema;
|
|
429
473
|
exports.ToolProtectionSchema = ToolProtectionSchema;
|
|
430
474
|
exports.createDelegationRequiredError = createDelegationRequiredError;
|
|
475
|
+
exports.defaultRequiredScopes = defaultRequiredScopes;
|
|
431
476
|
exports.determineConsentProviderType = determineConsentProviderType;
|
|
477
|
+
exports.executeScopeFor = executeScopeFor;
|
|
432
478
|
exports.getAuthorizationTypeKey = getAuthorizationTypeKey;
|
|
433
479
|
exports.getAuthorizationTypeLabel = getAuthorizationTypeLabel;
|
|
434
480
|
exports.getToolRequiredScopes = getToolRequiredScopes;
|
|
@@ -1,5 +1,48 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
|
|
3
|
+
//#region src/tool-protection/default-required-scopes.ts
|
|
4
|
+
/** The longest scope a consent request carries. */
|
|
5
|
+
const MAX_DEFAULT_SCOPE_LENGTH = 200;
|
|
6
|
+
const EXECUTE_SUFFIX = ":execute";
|
|
7
|
+
/** Outside the RFC 6749 scope-token alphabet: printable ASCII except space, `"` and `\`. */
|
|
8
|
+
const NON_SCOPE_TOKEN_CHARS = /[^\x21\x23-\x5B\x5D-\x7E]/gu;
|
|
9
|
+
function scopeList(value) {
|
|
10
|
+
return Array.isArray(value) && value.length > 0 && value.every((item) => typeof item === "string") ? value : void 0;
|
|
11
|
+
}
|
|
12
|
+
function declaredOauthScopes(schemes) {
|
|
13
|
+
if (!Array.isArray(schemes)) return [];
|
|
14
|
+
const scopes = schemes.flatMap((scheme) => typeof scheme === "object" && scheme !== null && scheme.type === "oauth2" && Array.isArray(scheme.scopes) ? scheme.scopes.filter((scope) => typeof scope === "string" && scope.length > 0) : []);
|
|
15
|
+
return [...new Set(scopes)];
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* `<name>:execute`, with the name reduced to the scope-token alphabet (the edge
|
|
19
|
+
* drops other characters) and the whole scope at most
|
|
20
|
+
* {@link MAX_DEFAULT_SCOPE_LENGTH} characters.
|
|
21
|
+
*/
|
|
22
|
+
function executeScopeFor(toolName) {
|
|
23
|
+
return `${toolName.replace(NON_SCOPE_TOKEN_CHARS, "_").slice(0, 192)}${EXECUTE_SUFFIX}`;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* The scopes to store for `toolName`: the first non-empty of
|
|
27
|
+
*
|
|
28
|
+
* 1. the entry's own `requiredScopes`, as stored;
|
|
29
|
+
* 2. its legacy `scopes`, so a grant for the scope the runtime reported keeps matching;
|
|
30
|
+
* 3. the oauth2 scopes its `securitySchemes` declare;
|
|
31
|
+
* 4. its `capability`;
|
|
32
|
+
* 5. {@link executeScopeFor}`(toolName)`.
|
|
33
|
+
*
|
|
34
|
+
* Never empty. An absent entry gets the last.
|
|
35
|
+
*/
|
|
36
|
+
function defaultRequiredScopes(toolName, entry) {
|
|
37
|
+
const own = scopeList(entry?.requiredScopes) ?? scopeList(entry?.scopes);
|
|
38
|
+
if (own) return [...own];
|
|
39
|
+
const declared = declaredOauthScopes(entry?.securitySchemes);
|
|
40
|
+
if (declared.length > 0) return declared;
|
|
41
|
+
if (typeof entry?.capability === "string" && entry.capability.length > 0) return [entry.capability];
|
|
42
|
+
return [executeScopeFor(toolName)];
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
//#endregion
|
|
3
46
|
//#region src/tool-protection/index.ts
|
|
4
47
|
/**
|
|
5
48
|
* KYA-OS Tool Protection Specification
|
|
@@ -417,5 +460,5 @@ function normalizeAuthorizationType(auth, options = {}) {
|
|
|
417
460
|
}
|
|
418
461
|
|
|
419
462
|
//#endregion
|
|
420
|
-
export { AUTHORIZATION_TYPES, AuthRequiredError, AuthRequiredErrorDataSchema, AuthorizationRequirementSchema, CONSENT_PROVIDER_TYPES, DelegationRequiredErrorDataSchema, ToolProtectionMapSchema, ToolProtectionResponseSchema, ToolProtectionSchema, createDelegationRequiredError, determineConsentProviderType, getAuthorizationTypeKey, getAuthorizationTypeLabel, getToolRequiredScopes, getToolRiskLevel, hasApiKeyAuthorization, hasOAuthAuthorization, hasPasswordAuthorization, hasVerifiableCredentialAuthorization, isAuthorizationRequirement, isDelegationRequiredErrorData, isToolProtection, isToolProtectionMap, isToolProtectionResponse, normalizeAuthorizationType, normalizeToolProtection, toolRequiresDelegation, validateDelegationRequiredErrorData, validateToolProtection, validateToolProtectionMap, validateToolProtectionResponse };
|
|
463
|
+
export { AUTHORIZATION_TYPES, AuthRequiredError, AuthRequiredErrorDataSchema, AuthorizationRequirementSchema, CONSENT_PROVIDER_TYPES, DelegationRequiredErrorDataSchema, MAX_DEFAULT_SCOPE_LENGTH, ToolProtectionMapSchema, ToolProtectionResponseSchema, ToolProtectionSchema, createDelegationRequiredError, defaultRequiredScopes, determineConsentProviderType, executeScopeFor, getAuthorizationTypeKey, getAuthorizationTypeLabel, getToolRequiredScopes, getToolRiskLevel, hasApiKeyAuthorization, hasOAuthAuthorization, hasPasswordAuthorization, hasVerifiableCredentialAuthorization, isAuthorizationRequirement, isDelegationRequiredErrorData, isToolProtection, isToolProtectionMap, isToolProtectionResponse, normalizeAuthorizationType, normalizeToolProtection, toolRequiresDelegation, validateDelegationRequiredErrorData, validateToolProtection, validateToolProtectionMap, validateToolProtectionResponse };
|
|
421
464
|
//# sourceMappingURL=index.mjs.map
|