@frontmcp/auth 1.8.0 → 1.8.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/authorities/authorities.context.d.ts +16 -1
- package/authorities/authorities.context.d.ts.map +1 -1
- package/authorities/authorities.evaluator.d.ts +1 -1
- package/authorities/authorities.evaluator.d.ts.map +1 -1
- package/authorities/authorities.types.d.ts +2 -2
- package/authorities/authorities.types.d.ts.map +1 -1
- package/authorities/index.d.ts +1 -1
- package/authorities/index.d.ts.map +1 -1
- package/cimd/cimd.service.d.ts.map +1 -1
- package/cimd/cimd.validator.d.ts.map +1 -1
- package/context/frontmcp-auth-context.impl.d.ts.map +1 -1
- package/esm/index.mjs +74 -129
- package/esm/package.json +5 -5
- package/index.js +223 -278
- package/jwks/jwks.service.d.ts.map +1 -1
- package/package.json +5 -5
- package/session/authorization-vault.d.ts +1 -1
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
* Builds an AuthoritiesEvaluationContext from AuthInfo and claimsMapping.
|
|
5
5
|
* Handles JWT shape differences across IdPs (Auth0, Keycloak, Okta, etc.).
|
|
6
6
|
*/
|
|
7
|
-
import type { AuthoritiesEvaluationContext, RelationshipResolver } from './authorities.types';
|
|
8
7
|
import type { AuthoritiesClaimsMapping } from './authorities.profiles';
|
|
8
|
+
import type { AuthoritiesEvaluationContext, RelationshipResolver } from './authorities.types';
|
|
9
9
|
/**
|
|
10
10
|
* Resolve a dot-path value from a nested object.
|
|
11
11
|
* First tries a direct key lookup (for keys containing dots, e.g., Auth0 namespaced claims),
|
|
@@ -39,6 +39,21 @@ export interface AuthInfoLike {
|
|
|
39
39
|
extra?: Record<string, unknown>;
|
|
40
40
|
[key: string]: unknown;
|
|
41
41
|
}
|
|
42
|
+
/**
|
|
43
|
+
* The caller's claims, wherever the entry point put them: top-level `user`, or
|
|
44
|
+
* `extra.user` (MCP 2026-07-28 and the HTTP flow's context).
|
|
45
|
+
*/
|
|
46
|
+
export declare function resolveAuthUser(authInfo: Partial<AuthInfoLike> | undefined): NonNullable<AuthInfoLike['user']>;
|
|
47
|
+
/**
|
|
48
|
+
* Whether a subject names no signed-in caller: missing, not a string, empty, or an anonymous placeholder (`anon:…`).
|
|
49
|
+
*/
|
|
50
|
+
export declare function isAnonymousSubject(sub: unknown): boolean;
|
|
51
|
+
/**
|
|
52
|
+
* The signed-in subject of a caller, or undefined for an anonymous one. A caller whose own
|
|
53
|
+
* subject is anonymous stays anonymous, whatever `claimsMapping.userId` resolves to; a mapped
|
|
54
|
+
* user id that is not a usable string falls back to the caller's own subject.
|
|
55
|
+
*/
|
|
56
|
+
export declare function signedInSubject(rawSub: unknown, mappedSub?: unknown): string | undefined;
|
|
42
57
|
/**
|
|
43
58
|
* Options for building an evaluation context.
|
|
44
59
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"authorities.context.d.ts","sourceRoot":"","sources":["../../src/authorities/authorities.context.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"authorities.context.d.ts","sourceRoot":"","sources":["../../src/authorities/authorities.context.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,wBAAwB,CAAC;AACvE,OAAO,KAAK,EAAE,4BAA4B,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAE9F;;;;;;;;;GASG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAelF;AA0BD;;GAEG;AACH,MAAM,MAAM,gBAAgB,GAAG,CAAC,QAAQ,EAAE,OAAO,CAAC,YAAY,CAAC,KAAK;IAClE,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,MAAM,EAAE,MAAM,CAAC,MAAM,EAA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GAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAM,GAChC,4BAA4B;CAoEhC"}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Pure functions for evaluating RBAC, ABAC, and ReBAC policies.
|
|
5
5
|
*/
|
|
6
|
-
import type {
|
|
6
|
+
import type { AbacPolicy, AuthoritiesEvaluationContext, AuthoritiesResult, RbacPermissionsPolicy, RbacRolesPolicy, RebacPolicy, ResourceIdRef } from './authorities.types';
|
|
7
7
|
/**
|
|
8
8
|
* Evaluate RBAC roles policy against user roles.
|
|
9
9
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"authorities.evaluator.d.ts","sourceRoot":"","sources":["../../src/authorities/authorities.evaluator.ts"],"names":[],"mappings":"AAAA;;;;GAIG;
|
|
1
|
+
{"version":3,"file":"authorities.evaluator.d.ts","sourceRoot":"","sources":["../../src/authorities/authorities.evaluator.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,KAAK,EAEV,UAAU,EACV,4BAA4B,EAC5B,iBAAiB,EACjB,qBAAqB,EACrB,eAAe,EACf,WAAW,EACX,aAAa,EACd,MAAM,qBAAqB,CAAC;AAM7B;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,eAAe,EAAE,GAAG,EAAE,4BAA4B,GAAG,iBAAiB,CA4B/G;AAED;;GAEG;AACH,wBAAgB,uBAAuB,CACrC,MAAM,EAAE,qBAAqB,EAC7B,GAAG,EAAE,4BAA4B,GAChC,iBAAiB,CA4BnB;AA8FD;;GAEG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,UAAU,EAAE,GAAG,EAAE,4BAA4B,GAAG,iBAAiB,CAqCrG;AAMD;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,aAAa,EAAE,GAAG,EAAE,4BAA4B,GAAG,MAAM,GAAG,SAAS,CAc3G;AAgDD;;;GAGG;AACH,wBAAsB,aAAa,CACjC,MAAM,EAAE,WAAW,GAAG,WAAW,EAAE,EACnC,GAAG,EAAE,4BAA4B,GAChC,OAAO,CAAC,iBAAiB,CAAC,CAS5B"}
|
|
@@ -249,8 +249,8 @@ export interface RelationshipResolver {
|
|
|
249
249
|
export interface AuthoritiesEvaluationContext {
|
|
250
250
|
/** Resolved user information */
|
|
251
251
|
user: {
|
|
252
|
-
/** User subject identifier */
|
|
253
|
-
sub
|
|
252
|
+
/** User subject identifier; undefined for anonymous callers */
|
|
253
|
+
sub?: string;
|
|
254
254
|
/** User roles (extracted via claimsMapping) */
|
|
255
255
|
roles: string[];
|
|
256
256
|
/** User permissions (extracted via claimsMapping) */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"authorities.types.d.ts","sourceRoot":"","sources":["../../src/authorities/authorities.types.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAMH;;;;;;;GAOG;AACH,MAAM,WAAW,eAAe;IAC9B,wCAAwC;IACxC,GAAG,CAAC,EAAE,MAAM,EAAE,CAAC;IACf,iDAAiD;IACjD,GAAG,CAAC,EAAE,MAAM,EAAE,CAAC;CAChB;AAED;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC,8CAA8C;IAC9C,GAAG,CAAC,EAAE,MAAM,EAAE,CAAC;IACf,uDAAuD;IACvD,GAAG,CAAC,EAAE,MAAM,EAAE,CAAC;CAChB;AAMD;;GAEG;AACH,MAAM,MAAM,YAAY,GACpB,IAAI,GACJ,KAAK,GACL,IAAI,GACJ,OAAO,GACP,IAAI,GACJ,KAAK,GACL,IAAI,GACJ,KAAK,GACL,UAAU,GACV,YAAY,GACZ,UAAU,GACV,QAAQ,GACR,SAAS,CAAC;AAEd;;;GAGG;AACH,MAAM,MAAM,eAAe,GAAG;IAAE,SAAS,EAAE,MAAM,CAAA;CAAE,GAAG;IAAE,UAAU,EAAE,MAAM,CAAA;CAAE,CAAC;AAE7E;;;;;;;;;GASG;AACH,MAAM,WAAW,aAAa;IAC5B;;;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D;;;;GAIG;AACH,MAAM,WAAW,oBAAoB;IACnC;;;;;;;;OAQG;IACH,KAAK,CACH,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,MAAM,EAChB,UAAU,EAAE,MAAM,EAClB,OAAO,EAAE,MAAM,EACf,GAAG,EAAE,4BAA4B,GAChC,OAAO,CAAC,OAAO,CAAC,CAAC;CACrB;AAMD;;;GAGG;AACH,MAAM,WAAW,4BAA4B;IAC3C,gCAAgC;IAChC,IAAI,EAAE;QACJ
|
|
1
|
+
{"version":3,"file":"authorities.types.d.ts","sourceRoot":"","sources":["../../src/authorities/authorities.types.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAMH;;;;;;;GAOG;AACH,MAAM,WAAW,eAAe;IAC9B,wCAAwC;IACxC,GAAG,CAAC,EAAE,MAAM,EAAE,CAAC;IACf,iDAAiD;IACjD,GAAG,CAAC,EAAE,MAAM,EAAE,CAAC;CAChB;AAED;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC,8CAA8C;IAC9C,GAAG,CAAC,EAAE,MAAM,EAAE,CAAC;IACf,uDAAuD;IACvD,GAAG,CAAC,EAAE,MAAM,EAAE,CAAC;CAChB;AAMD;;GAEG;AACH,MAAM,MAAM,YAAY,GACpB,IAAI,GACJ,KAAK,GACL,IAAI,GACJ,OAAO,GACP,IAAI,GACJ,KAAK,GACL,IAAI,GACJ,KAAK,GACL,UAAU,GACV,YAAY,GACZ,UAAU,GACV,QAAQ,GACR,SAAS,CAAC;AAEd;;;GAGG;AACH,MAAM,MAAM,eAAe,GAAG;IAAE,SAAS,EAAE,MAAM,CAAA;CAAE,GAAG;IAAE,UAAU,EAAE,MAAM,CAAA;CAAE,CAAC;AAE7E;;;;;;;;;GASG;AACH,MAAM,WAAW,aAAa;IAC5B;;;OAGG;IACH,IAAI,EAAE,MAAM,CAAC;IACb,0BAA0B;IAC1B,EAAE,EAAE,YAAY,CAAC;IACjB;;;OAGG;IACH,KAAK,EAAE,OAAO,CAAC;C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AAU,EAAE,MAAM,EAClB,OAAO,EAAE,MAAM,EACf,GAAG,EAAE,4BAA4B,GAChC,OAAO,CAAC,OAAO,CAAC,CAAC;CACrB;AAMD;;;GAGG;AACH,MAAM,WAAW,4BAA4B;IAC3C,gCAAgC;IAChC,IAAI,EAAE;QACJ,+DAA+D;QAC/D,GAAG,CAAC,EAAE,MAAM,CAAC;QACb,+CAA+C;QAC/C,KAAK,EAAE,MAAM,EAAE,CAAC;QAChB,qDAAqD;QACrD,WAAW,EAAE,MAAM,EAAE,CAAC;QACtB,qBAAqB;QACrB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;KACjC,CAAC;IACF,kCAAkC;IAClC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC/B,oCAAoC;IACpC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC7B,6CAA6C;IAC7C,aAAa,EAAE,oBAAoB,CAAC;CACrC;AAMD;;;;;;;;;;;;;;;GAeG;AACH,MAAM,WAAW,oBAAoB;IACnC,uEAAuE;IACvE,IAAI,EAAE,MAAM,CAAC;IACb,8CAA8C;IAC9C,QAAQ,CAAC,MAAM,EAAE,OAAO,EAAE,GAAG,EAAE,4BAA4B,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAAC;CAC1F"}
|
package/authorities/index.d.ts
CHANGED
|
@@ -10,7 +10,7 @@ export type { AuthoritiesClaimsMapping, AuthoritiesConfig, AuthoritiesScopeMappi
|
|
|
10
10
|
export { resolveRequiredScopes } from './authorities.scope-mapping';
|
|
11
11
|
export { rbacRolesPolicySchema, rbacPermissionsPolicySchema, abacOperatorSchema, abacConditionSchema, abacPolicySchema, resourceIdRefSchema, rebacPolicySchema, authoritiesPolicySchema, authoritiesMetadataSchema, authoritiesClaimsMappingSchema, authoritiesConfigSchema, } from './authorities.schema';
|
|
12
12
|
export { AuthoritiesEngine } from './authorities.engine';
|
|
13
|
-
export { AuthoritiesContextBuilder } from './authorities.context';
|
|
13
|
+
export { AuthoritiesContextBuilder, isAnonymousSubject } from './authorities.context';
|
|
14
14
|
export type { ClaimsResolverFn } from './authorities.context';
|
|
15
15
|
export { AuthoritiesEvaluatorRegistry, AuthoritiesProfileRegistry } from './authorities.registry';
|
|
16
16
|
export { AuthorityDeniedError } from './authorities.errors';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/authorities/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,gCAAgC,CAAC;AAGxC,YAAY,EACV,eAAe,EACf,qBAAqB,EACrB,YAAY,EACZ,aAAa,EACb,UAAU,EACV,eAAe,EACf,aAAa,EACb,WAAW,EACX,yBAAyB,EACzB,oBAAoB,EACpB,mBAAmB,EACnB,iBAAiB,EACjB,iBAAiB,EACjB,oBAAoB,EACpB,4BAA4B,EAC5B,oBAAoB,EACpB,gBAAgB,GACjB,MAAM,qBAAqB,CAAC;AAG7B,YAAY,EAAE,wBAAwB,EAAE,iBAAiB,EAAE,uBAAuB,EAAE,MAAM,wBAAwB,CAAC;AAGnH,OAAO,EAAE,qBAAqB,EAAE,MAAM,6BAA6B,CAAC;AAGpE,OAAO,EACL,qBAAqB,EACrB,2BAA2B,EAC3B,kBAAkB,EAClB,mBAAmB,EACnB,gBAAgB,EAChB,mBAAmB,EACnB,iBAAiB,EACjB,uBAAuB,EACvB,yBAAyB,EACzB,8BAA8B,EAC9B,uBAAuB,GACxB,MAAM,sBAAsB,CAAC;AAG9B,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAGzD,OAAO,EAAE,yBAAyB,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/authorities/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,gCAAgC,CAAC;AAGxC,YAAY,EACV,eAAe,EACf,qBAAqB,EACrB,YAAY,EACZ,aAAa,EACb,UAAU,EACV,eAAe,EACf,aAAa,EACb,WAAW,EACX,yBAAyB,EACzB,oBAAoB,EACpB,mBAAmB,EACnB,iBAAiB,EACjB,iBAAiB,EACjB,oBAAoB,EACpB,4BAA4B,EAC5B,oBAAoB,EACpB,gBAAgB,GACjB,MAAM,qBAAqB,CAAC;AAG7B,YAAY,EAAE,wBAAwB,EAAE,iBAAiB,EAAE,uBAAuB,EAAE,MAAM,wBAAwB,CAAC;AAGnH,OAAO,EAAE,qBAAqB,EAAE,MAAM,6BAA6B,CAAC;AAGpE,OAAO,EACL,qBAAqB,EACrB,2BAA2B,EAC3B,kBAAkB,EAClB,mBAAmB,EACnB,gBAAgB,EAChB,mBAAmB,EACnB,iBAAiB,EACjB,uBAAuB,EACvB,yBAAyB,EACzB,8BAA8B,EAC9B,uBAAuB,GACxB,MAAM,sBAAsB,CAAC;AAG9B,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAGzD,OAAO,EAAE,yBAAyB,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AACtF,YAAY,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAG9D,OAAO,EAAE,4BAA4B,EAAE,0BAA0B,EAAE,MAAM,wBAAwB,CAAC;AAGlG,OAAO,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cimd.service.d.ts","sourceRoot":"","sources":["../../src/cimd/cimd.service.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"cimd.service.d.ts","sourceRoot":"","sources":["../../src/cimd/cimd.service.ts"],"names":[],"mappings":"AAkBA,OAAO,EAAc,KAAK,UAAU,EAAE,MAAM,eAAe,CAAC;AAC5D,OAAO,EAQL,KAAK,eAAe,EAEpB,KAAK,oBAAoB,EAEzB,KAAK,sBAAsB,EAC5B,MAAM,cAAc,CAAC;AAGtB;;;;GAIG;AACH,qBAAa,WAAW;IACtB,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAa;IACpC,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAkB;IAC9C,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAqB;IACpD,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAoB;IAClD,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAmB;IACzC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAa;IAEpC;;OAEG;IACH,IAAI,OAAO,IAAI,OAAO,CAErB;IAED;;;;;OAKG;gBACS,MAAM,CAAC,EAAE,UAAU,EAAE,MAAM,CAAC,EAAE,OAAO,CAAC,eAAe,CAAC;IA4BlE;;;;;OAKG;IACH,cAAc,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO;IAIzC;;;;;;;;OAQG;IACG,qBAAqB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,oBAAoB,CAAC;IAoD5E;;;;;;OAMG;IACH,mBAAmB,CAAC,WAAW,EAAE,MAAM,EAAE,QAAQ,EAAE,sBAAsB,GAAG,IAAI;IAUhF;;;;OAIG;IACG,UAAU,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAUlD;;OAEG;IACG,aAAa,IAAI,OAAO,CAAC;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC;IAMhD;;;;OAIG;YACW,qBAAqB;IAoKnC;;OAEG;YACW,qBAAqB;IAyCnC;;;;;OAKG;IACH,OAAO,CAAC,gBAAgB;CAiBzB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cimd.validator.d.ts","sourceRoot":"","sources":["../../src/cimd/cimd.validator.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"cimd.validator.d.ts","sourceRoot":"","sources":["../../src/cimd/cimd.validator.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAEvD;;;;;;;;;;GAUG;AACH,wBAAgB,cAAc,CAAC,QAAQ,EAAE,MAAM,EAAE,aAAa,UAAQ,GAAG,OAAO,CA4B/E;AAUD;;;;;;;;GAQG;AACH,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,MAAM,EAAE,cAAc,CAAC,EAAE,OAAO,CAAC,kBAAkB,CAAC,GAAG,GAAG,CA6DvG;AAED;;GAEG;AACH,UAAU,eAAe;IACvB,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;CAChB;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,MAAM,GAAG,eAAe,CAqBrE;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAsB,uBAAuB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,eAAe,CAAC,CAgDxF;AAED;;;;;;;GAOG;AACH,wBAAsB,iBAAiB,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAKzF;AAyGD;;;;;;;;GAQG;AACH,wBAAgB,4BAA4B,CAAC,YAAY,EAAE,MAAM,EAAE,GAAG,OAAO,CAgB5E"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"frontmcp-auth-context.impl.d.ts","sourceRoot":"","sources":["../../src/context/frontmcp-auth-context.impl.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;
|
|
1
|
+
{"version":3,"file":"frontmcp-auth-context.impl.d.ts","sourceRoot":"","sources":["../../src/context/frontmcp-auth-context.impl.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,qCAAqC,CAAC;AACpF,OAAO,KAAK,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAErF;;;;GAIG;AACH,MAAM,WAAW,qBAAqB;IACpC,+BAA+B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AqB,EAAE,aAAa,CAAC,EAAE,wBAAwB;IA4DnF,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO;IAI9B,WAAW,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,GAAG,OAAO;IAI9C,UAAU,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,GAAG,OAAO;IAI7C,aAAa,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO;IAI1C,iBAAiB,CAAC,WAAW,EAAE,SAAS,MAAM,EAAE,GAAG,OAAO;IAI1D,gBAAgB,CAAC,WAAW,EAAE,SAAS,MAAM,EAAE,GAAG,OAAO;IAIzD,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO;IAIhC,YAAY,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,GAAG,OAAO;IAIhD,WAAW,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,GAAG,OAAO;IAM/C;;;OAGG;IACH,OAAO,CAAC,cAAc;CASvB"}
|
package/esm/index.mjs
CHANGED
|
@@ -225,10 +225,14 @@ import {
|
|
|
225
225
|
bytesToHex,
|
|
226
226
|
createKeyPersistence,
|
|
227
227
|
isProduction,
|
|
228
|
+
isRedirectResponse,
|
|
228
229
|
randomBytes,
|
|
229
230
|
rsaVerify
|
|
230
231
|
} from "@frontmcp/utils";
|
|
231
232
|
|
|
233
|
+
// libs/auth/src/cimd/cimd.validator.ts
|
|
234
|
+
import { classifyIpAddress } from "@frontmcp/utils";
|
|
235
|
+
|
|
232
236
|
// libs/auth/src/cimd/cimd.errors.ts
|
|
233
237
|
var CimdError = class extends Error {
|
|
234
238
|
/**
|
|
@@ -492,122 +496,38 @@ function isIpAddress(hostname) {
|
|
|
492
496
|
}
|
|
493
497
|
return false;
|
|
494
498
|
}
|
|
499
|
+
var BLOCKED_RANGE_REASONS = /* @__PURE__ */ new Map([
|
|
500
|
+
["0.0.0.0/8", "Current network addresses (0.x.x.x) are not allowed"],
|
|
501
|
+
["10.0.0.0/8", "Private IP addresses (10.x.x.x) are not allowed"],
|
|
502
|
+
["100.64.0.0/10", "Carrier-grade NAT addresses (100.64-127.x.x) are not allowed"],
|
|
503
|
+
["127.0.0.0/8", "Loopback addresses (127.x.x.x) are not allowed"],
|
|
504
|
+
["169.254.0.0/16", "Link-local addresses (169.254.x.x) are not allowed"],
|
|
505
|
+
["172.16.0.0/12", "Private IP addresses (172.16-31.x.x) are not allowed"],
|
|
506
|
+
["192.0.0.0/24", "IETF protocol-assignment addresses (192.0.0.0/24) are not allowed"],
|
|
507
|
+
["192.168.0.0/16", "Private IP addresses (192.168.x.x) are not allowed"],
|
|
508
|
+
["224.0.0.0/4", "Multicast addresses are not allowed"],
|
|
509
|
+
["255.255.255.255/32", "Broadcast address is not allowed"],
|
|
510
|
+
["::/128", "IPv6 unspecified address (::) is not allowed"],
|
|
511
|
+
["::1/128", "IPv6 loopback address (::1) is not allowed"],
|
|
512
|
+
["fc00::/7", "IPv6 unique local addresses (fc00::/7) are not allowed"],
|
|
513
|
+
["fe80::/10", "IPv6 link-local addresses (fe80::/10) are not allowed"]
|
|
514
|
+
]);
|
|
495
515
|
function checkIpAddress(ip) {
|
|
496
|
-
const
|
|
497
|
-
if (
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
}
|
|
502
|
-
|
|
503
|
-
const parts = ip.split(".").map(Number);
|
|
504
|
-
if (parts.length !== 4 || parts.some((p) => isNaN(p) || p < 0 || p > 255)) {
|
|
505
|
-
return { allowed: false, reason: "Invalid IPv4 address" };
|
|
506
|
-
}
|
|
507
|
-
const [a, b, c, d] = parts;
|
|
508
|
-
if (a === 127) {
|
|
509
|
-
return { allowed: false, reason: "Loopback addresses (127.x.x.x) are not allowed" };
|
|
510
|
-
}
|
|
511
|
-
if (a === 10) {
|
|
512
|
-
return { allowed: false, reason: "Private IP addresses (10.x.x.x) are not allowed" };
|
|
513
|
-
}
|
|
514
|
-
if (a === 172 && b >= 16 && b <= 31) {
|
|
515
|
-
return { allowed: false, reason: "Private IP addresses (172.16-31.x.x) are not allowed" };
|
|
516
|
-
}
|
|
517
|
-
if (a === 192 && b === 168) {
|
|
518
|
-
return { allowed: false, reason: "Private IP addresses (192.168.x.x) are not allowed" };
|
|
519
|
-
}
|
|
520
|
-
if (a === 169 && b === 254) {
|
|
521
|
-
return { allowed: false, reason: "Link-local addresses (169.254.x.x) are not allowed" };
|
|
522
|
-
}
|
|
523
|
-
if (a === 100 && b >= 64 && b <= 127) {
|
|
524
|
-
return { allowed: false, reason: "Carrier-grade NAT addresses (100.64-127.x.x) are not allowed" };
|
|
525
|
-
}
|
|
526
|
-
if (a === 192 && b === 0 && c === 0) {
|
|
527
|
-
return { allowed: false, reason: "IETF protocol-assignment addresses (192.0.0.0/24) are not allowed" };
|
|
528
|
-
}
|
|
529
|
-
if (a === 0) {
|
|
530
|
-
return { allowed: false, reason: "Current network addresses (0.x.x.x) are not allowed" };
|
|
531
|
-
}
|
|
532
|
-
if (a === 255 && b === 255 && c === 255 && d === 255) {
|
|
533
|
-
return { allowed: false, reason: "Broadcast address is not allowed" };
|
|
534
|
-
}
|
|
535
|
-
if (a >= 224 && a <= 239) {
|
|
536
|
-
return { allowed: false, reason: "Multicast addresses are not allowed" };
|
|
537
|
-
}
|
|
538
|
-
return { allowed: true, reason: "" };
|
|
539
|
-
}
|
|
540
|
-
function expandIpv6(ip) {
|
|
541
|
-
let text = ip.toLowerCase();
|
|
542
|
-
if (text.includes("%")) {
|
|
543
|
-
text = text.slice(0, text.indexOf("%"));
|
|
544
|
-
}
|
|
545
|
-
const dottedQuad = text.match(/^(.*:)(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})$/);
|
|
546
|
-
if (dottedQuad) {
|
|
547
|
-
const octets = dottedQuad[2].split(".").map(Number);
|
|
548
|
-
if (octets.some((octet) => !Number.isInteger(octet) || octet < 0 || octet > 255)) return null;
|
|
549
|
-
const high = (octets[0] << 8 | octets[1]).toString(16);
|
|
550
|
-
const low = (octets[2] << 8 | octets[3]).toString(16);
|
|
551
|
-
text = `${dottedQuad[1]}${high}:${low}`;
|
|
552
|
-
}
|
|
553
|
-
const halves = text.split("::");
|
|
554
|
-
if (halves.length > 2) return null;
|
|
555
|
-
const parseGroups = (part) => {
|
|
556
|
-
if (part === "") return [];
|
|
557
|
-
const groups = [];
|
|
558
|
-
for (const group of part.split(":")) {
|
|
559
|
-
if (!/^[0-9a-f]{1,4}$/.test(group)) return null;
|
|
560
|
-
groups.push(parseInt(group, 16));
|
|
561
|
-
}
|
|
562
|
-
return groups;
|
|
563
|
-
};
|
|
564
|
-
const head = parseGroups(halves[0]);
|
|
565
|
-
if (head === null) return null;
|
|
566
|
-
if (halves.length === 1) {
|
|
567
|
-
return head.length === 8 ? head : null;
|
|
568
|
-
}
|
|
569
|
-
const tail = parseGroups(halves[1]);
|
|
570
|
-
if (tail === null) return null;
|
|
571
|
-
if (head.length + tail.length > 7) return null;
|
|
572
|
-
return [...head, ...new Array(8 - head.length - tail.length).fill(0), ...tail];
|
|
573
|
-
}
|
|
574
|
-
function checkIpv6(ip) {
|
|
575
|
-
const groups = expandIpv6(ip);
|
|
576
|
-
if (!groups) {
|
|
577
|
-
return { allowed: false, reason: `Malformed IPv6 address: ${ip}` };
|
|
578
|
-
}
|
|
579
|
-
const isZeroPrefix = groups.slice(0, 7).every((group) => group === 0);
|
|
580
|
-
if (isZeroPrefix && groups[7] === 1) {
|
|
581
|
-
return { allowed: false, reason: "IPv6 loopback address (::1) is not allowed" };
|
|
582
|
-
}
|
|
583
|
-
if (isZeroPrefix && groups[7] === 0) {
|
|
584
|
-
return { allowed: false, reason: "IPv6 unspecified address (::) is not allowed" };
|
|
585
|
-
}
|
|
586
|
-
if ((groups[0] & 65472) === 65152) {
|
|
587
|
-
return { allowed: false, reason: "IPv6 link-local addresses (fe80::/10) are not allowed" };
|
|
588
|
-
}
|
|
589
|
-
if ((groups[0] & 65024) === 64512) {
|
|
590
|
-
return { allowed: false, reason: "IPv6 unique local addresses (fc00::/7) are not allowed" };
|
|
516
|
+
const classification = classifyIpAddress(ip);
|
|
517
|
+
if (!classification) {
|
|
518
|
+
const bareIp = ip.replace(/^\[|\]$/g, "");
|
|
519
|
+
return {
|
|
520
|
+
allowed: false,
|
|
521
|
+
reason: bareIp.includes(":") ? `Malformed IPv6 address: ${bareIp}` : "Invalid IPv4 address"
|
|
522
|
+
};
|
|
591
523
|
}
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
return checkIpv4(embedded);
|
|
524
|
+
if (classification.range === "public") {
|
|
525
|
+
return { allowed: true, reason: "" };
|
|
595
526
|
}
|
|
596
|
-
return {
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
const toDotted = () => {
|
|
600
|
-
const high = groups[6];
|
|
601
|
-
const low = groups[7];
|
|
602
|
-
return `${high >> 8}.${high & 255}.${low >> 8}.${low & 255}`;
|
|
527
|
+
return {
|
|
528
|
+
allowed: false,
|
|
529
|
+
reason: BLOCKED_RANGE_REASONS.get(classification.cidr) ?? `Addresses in the ${classification.range} range (${classification.cidr}) are not allowed`
|
|
603
530
|
};
|
|
604
|
-
const firstFive = groups.slice(0, 5).every((group) => group === 0);
|
|
605
|
-
if (firstFive && groups[5] === 65535) return toDotted();
|
|
606
|
-
if (firstFive && groups[5] === 0) return toDotted();
|
|
607
|
-
if (groups[0] === 100 && groups[1] === 65435 && groups.slice(2, 6).every((group) => group === 0)) {
|
|
608
|
-
return toDotted();
|
|
609
|
-
}
|
|
610
|
-
return null;
|
|
611
531
|
}
|
|
612
532
|
function isDomainInList(hostname, domainList) {
|
|
613
533
|
const lowerHostname = hostname.toLowerCase();
|
|
@@ -1016,11 +936,10 @@ var JwksService = class {
|
|
|
1016
936
|
// Follow redirects manually so each hop is re-validated (scheme + SSRF).
|
|
1017
937
|
redirect: "manual"
|
|
1018
938
|
});
|
|
1019
|
-
if (res
|
|
939
|
+
if (isRedirectResponse(res)) {
|
|
1020
940
|
const location = res.headers.get("location");
|
|
1021
|
-
if (!location
|
|
1022
|
-
|
|
1023
|
-
}
|
|
941
|
+
if (!location) throw new Error("redirect without a readable Location header");
|
|
942
|
+
if (hop >= MAX_JWKS_FETCH_HOPS) throw new Error("too many redirects");
|
|
1024
943
|
currentUrl = new URL(location, currentUrl).toString();
|
|
1025
944
|
continue;
|
|
1026
945
|
}
|
|
@@ -7488,6 +7407,7 @@ init_cimd_cache();
|
|
|
7488
7407
|
|
|
7489
7408
|
// libs/auth/src/cimd/cimd.service.ts
|
|
7490
7409
|
init_cimd_cache();
|
|
7410
|
+
import { isRedirectResponse as isRedirectResponse2 } from "@frontmcp/utils";
|
|
7491
7411
|
var CimdService = class {
|
|
7492
7412
|
config;
|
|
7493
7413
|
cacheConfig;
|
|
@@ -7661,7 +7581,7 @@ var CimdService = class {
|
|
|
7661
7581
|
httpStatus: 304
|
|
7662
7582
|
});
|
|
7663
7583
|
}
|
|
7664
|
-
if (response
|
|
7584
|
+
if (isRedirectResponse2(response)) {
|
|
7665
7585
|
const location = response.headers.get("location");
|
|
7666
7586
|
if (!location) {
|
|
7667
7587
|
throw new CimdFetchError(clientId, "Redirect response missing Location header", {
|
|
@@ -10049,6 +9969,18 @@ var noopRelationshipResolver = {
|
|
|
10049
9969
|
return false;
|
|
10050
9970
|
}
|
|
10051
9971
|
};
|
|
9972
|
+
function resolveAuthUser(authInfo) {
|
|
9973
|
+
const extraUser = authInfo?.extra?.["user"];
|
|
9974
|
+
if (authInfo?.user) return authInfo.user;
|
|
9975
|
+
return typeof extraUser === "object" && extraUser !== null ? extraUser : {};
|
|
9976
|
+
}
|
|
9977
|
+
function isAnonymousSubject(sub) {
|
|
9978
|
+
return typeof sub !== "string" || sub === "" || sub.startsWith("anon:");
|
|
9979
|
+
}
|
|
9980
|
+
function signedInSubject(rawSub, mappedSub) {
|
|
9981
|
+
if (rawSub !== void 0 && isAnonymousSubject(rawSub)) return void 0;
|
|
9982
|
+
return [mappedSub, rawSub].find((candidate) => !isAnonymousSubject(candidate));
|
|
9983
|
+
}
|
|
10052
9984
|
var AuthoritiesContextBuilder = class {
|
|
10053
9985
|
claimsMapping;
|
|
10054
9986
|
claimsResolver;
|
|
@@ -10066,7 +9998,7 @@ var AuthoritiesContextBuilder = class {
|
|
|
10066
9998
|
const resolved = this.claimsResolver(authInfo);
|
|
10067
9999
|
return {
|
|
10068
10000
|
user: {
|
|
10069
|
-
sub: authInfo
|
|
10001
|
+
sub: signedInSubject(resolveAuthUser(authInfo).sub),
|
|
10070
10002
|
roles: resolved.roles,
|
|
10071
10003
|
permissions: resolved.permissions,
|
|
10072
10004
|
claims: resolved.claims
|
|
@@ -10076,7 +10008,7 @@ var AuthoritiesContextBuilder = class {
|
|
|
10076
10008
|
relationships: this.relationshipResolver
|
|
10077
10009
|
};
|
|
10078
10010
|
}
|
|
10079
|
-
const user = authInfo
|
|
10011
|
+
const user = resolveAuthUser(authInfo);
|
|
10080
10012
|
const authorization = authInfo?.extra?.["authorization"];
|
|
10081
10013
|
const authorizationClaims = authorization?.["claims"] ?? {};
|
|
10082
10014
|
const rawClaims = {
|
|
@@ -10097,10 +10029,10 @@ var AuthoritiesContextBuilder = class {
|
|
|
10097
10029
|
} else {
|
|
10098
10030
|
permissions = toStringArray(user["permissions"] ?? []);
|
|
10099
10031
|
}
|
|
10100
|
-
const
|
|
10032
|
+
const mappedSub = this.claimsMapping?.userId ? resolveDotPath(rawClaims, this.claimsMapping.userId) : void 0;
|
|
10101
10033
|
return {
|
|
10102
10034
|
user: {
|
|
10103
|
-
sub,
|
|
10035
|
+
sub: signedInSubject(user.sub, mappedSub),
|
|
10104
10036
|
roles,
|
|
10105
10037
|
permissions,
|
|
10106
10038
|
claims: rawClaims
|
|
@@ -10132,15 +10064,17 @@ var FrontMcpAuthContextImpl = class {
|
|
|
10132
10064
|
roles;
|
|
10133
10065
|
permissions;
|
|
10134
10066
|
constructor(source, claimsMapping) {
|
|
10135
|
-
const rawUser = source
|
|
10136
|
-
const
|
|
10067
|
+
const rawUser = resolveAuthUser(source);
|
|
10068
|
+
const mappedSub = claimsMapping?.userId ? resolveDotPath(this.buildRawClaims(source), claimsMapping.userId) : void 0;
|
|
10069
|
+
const signedInSub = signedInSubject(rawUser.sub, mappedSub);
|
|
10070
|
+
const sub = signedInSub ?? (typeof rawUser.sub === "string" ? rawUser.sub : "");
|
|
10137
10071
|
this.user = Object.freeze({
|
|
10138
10072
|
sub,
|
|
10139
10073
|
name: rawUser.name,
|
|
10140
10074
|
email: rawUser.email,
|
|
10141
10075
|
picture: rawUser.picture
|
|
10142
10076
|
});
|
|
10143
|
-
this.isAnonymous =
|
|
10077
|
+
this.isAnonymous = signedInSub === void 0;
|
|
10144
10078
|
const extraAuth = source.extra?.["authorization"];
|
|
10145
10079
|
this.mode = String(
|
|
10146
10080
|
source.extra?.["authMode"] ?? extraAuth?.["mode"] ?? (source.extra?.["isPublic"] === true || rawUser["anonymous"] === true ? "public" : "authenticated")
|
|
@@ -10198,7 +10132,7 @@ var FrontMcpAuthContextImpl = class {
|
|
|
10198
10132
|
* Mirrors the logic in AuthoritiesContextBuilder.build().
|
|
10199
10133
|
*/
|
|
10200
10134
|
buildRawClaims(source) {
|
|
10201
|
-
const rawUser = source
|
|
10135
|
+
const rawUser = resolveAuthUser(source);
|
|
10202
10136
|
const extraAuth = source.extra?.["authorization"];
|
|
10203
10137
|
const authorizationClaims = extraAuth?.["claims"] ?? {};
|
|
10204
10138
|
return {
|
|
@@ -10417,8 +10351,9 @@ function resolveValue(value, ctx) {
|
|
|
10417
10351
|
}
|
|
10418
10352
|
function applyOperator(actual, op, expected) {
|
|
10419
10353
|
switch (op) {
|
|
10354
|
+
// A missing expected value (e.g. an absent fromInput) never matches, even an absent actual value
|
|
10420
10355
|
case "eq":
|
|
10421
|
-
return actual === expected;
|
|
10356
|
+
return expected !== void 0 && actual === expected;
|
|
10422
10357
|
case "neq":
|
|
10423
10358
|
return actual !== expected;
|
|
10424
10359
|
case "in":
|
|
@@ -10467,7 +10402,7 @@ function evaluateAbac(policy, ctx) {
|
|
|
10467
10402
|
for (const [path, expectedRaw] of Object.entries(policy.match)) {
|
|
10468
10403
|
const actual = resolveDotPath(envelope, path);
|
|
10469
10404
|
const expected = resolveValue(expectedRaw, ctx);
|
|
10470
|
-
if (actual !== expected) {
|
|
10405
|
+
if (expected === void 0 || actual !== expected) {
|
|
10471
10406
|
return {
|
|
10472
10407
|
granted: false,
|
|
10473
10408
|
deniedBy: `attributes.match: '${path}' expected '${String(expected)}' but got '${String(actual)}'`,
|
|
@@ -10507,6 +10442,15 @@ function resolveResourceId(ref, ctx) {
|
|
|
10507
10442
|
return void 0;
|
|
10508
10443
|
}
|
|
10509
10444
|
async function evaluateSingleRebac(policy, ctx) {
|
|
10445
|
+
const userSub = ctx.user.sub;
|
|
10446
|
+
if (userSub === void 0 || isAnonymousSubject(userSub)) {
|
|
10447
|
+
return {
|
|
10448
|
+
granted: false,
|
|
10449
|
+
deniedBy: `relationships: an anonymous caller cannot be '${policy.type}' of ${policy.resource}`,
|
|
10450
|
+
denial: { kind: "relationships", path: "user.sub", expected: "a signed-in caller", actual: void 0 },
|
|
10451
|
+
evaluatedPolicies: ["relationships"]
|
|
10452
|
+
};
|
|
10453
|
+
}
|
|
10510
10454
|
const resourceId = resolveResourceId(policy.resourceId, ctx);
|
|
10511
10455
|
if (resourceId === void 0) {
|
|
10512
10456
|
return {
|
|
@@ -10521,11 +10465,11 @@ async function evaluateSingleRebac(policy, ctx) {
|
|
|
10521
10465
|
evaluatedPolicies: ["relationships"]
|
|
10522
10466
|
};
|
|
10523
10467
|
}
|
|
10524
|
-
const hasRelationship = await ctx.relationships.check(policy.type, policy.resource, resourceId,
|
|
10468
|
+
const hasRelationship = await ctx.relationships.check(policy.type, policy.resource, resourceId, userSub, ctx);
|
|
10525
10469
|
if (!hasRelationship) {
|
|
10526
10470
|
return {
|
|
10527
10471
|
granted: false,
|
|
10528
|
-
deniedBy: `relationships: user '${
|
|
10472
|
+
deniedBy: `relationships: user '${userSub}' is not '${policy.type}' of ${policy.resource}:${resourceId}`,
|
|
10529
10473
|
denial: {
|
|
10530
10474
|
kind: "relationships",
|
|
10531
10475
|
path: "relationships",
|
|
@@ -11198,6 +11142,7 @@ export {
|
|
|
11198
11142
|
headerApplier,
|
|
11199
11143
|
hkdfSha2564 as hkdfSha256,
|
|
11200
11144
|
incrementalAuthConfigSchema,
|
|
11145
|
+
isAnonymousSubject,
|
|
11201
11146
|
isCimdClientId,
|
|
11202
11147
|
isFrontMcpCredentials,
|
|
11203
11148
|
isJwt,
|
package/esm/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@frontmcp/auth",
|
|
3
|
-
"version": "1.8.
|
|
3
|
+
"version": "1.8.1",
|
|
4
4
|
"description": "FrontMCP Auth - Authentication, session management, and credential vault",
|
|
5
5
|
"author": "AgentFront <info@agentfront.dev>",
|
|
6
6
|
"homepage": "https://docs.agentfront.dev",
|
|
@@ -47,8 +47,8 @@
|
|
|
47
47
|
"node": ">=24.0.0"
|
|
48
48
|
},
|
|
49
49
|
"peerDependencies": {
|
|
50
|
-
"@frontmcp/lazy-zod": "1.8.
|
|
51
|
-
"@frontmcp/storage-sqlite": "1.8.
|
|
50
|
+
"@frontmcp/lazy-zod": "1.8.1",
|
|
51
|
+
"@frontmcp/storage-sqlite": "1.8.1",
|
|
52
52
|
"@vercel/kv": "^3.0.0",
|
|
53
53
|
"ioredis": "^5.0.0"
|
|
54
54
|
},
|
|
@@ -64,8 +64,8 @@
|
|
|
64
64
|
}
|
|
65
65
|
},
|
|
66
66
|
"dependencies": {
|
|
67
|
-
"@frontmcp/di": "1.8.
|
|
68
|
-
"@frontmcp/utils": "1.8.
|
|
67
|
+
"@frontmcp/di": "1.8.1",
|
|
68
|
+
"@frontmcp/utils": "1.8.1",
|
|
69
69
|
"jose": "^6.0.0"
|
|
70
70
|
},
|
|
71
71
|
"devDependencies": {
|