@frontmcp/auth 1.7.2 → 1.8.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/cimd/cimd.validator.d.ts.map +1 -1
- package/detection/auth-provider-detection.d.ts +2 -0
- package/detection/auth-provider-detection.d.ts.map +1 -1
- package/errors/auth-internal.errors.d.ts +12 -0
- package/errors/auth-internal.errors.d.ts.map +1 -1
- package/errors/index.d.ts +1 -1
- package/errors/index.d.ts.map +1 -1
- package/esm/index.mjs +291 -177
- package/esm/package.json +5 -5
- package/index.d.ts +1 -1
- package/index.d.ts.map +1 -1
- package/index.js +295 -177
- package/options/index.d.ts +4 -2
- package/options/index.d.ts.map +1 -1
- package/options/interfaces.d.ts +20 -2
- package/options/interfaces.d.ts.map +1 -1
- package/options/schema.d.ts +13 -1
- package/options/schema.d.ts.map +1 -1
- package/options/static.schema.d.ts +27 -0
- package/options/static.schema.d.ts.map +1 -0
- package/options/typecheck.d.ts.map +1 -1
- package/options/utils.d.ts +7 -2
- package/options/utils.d.ts.map +1 -1
- package/package.json +5 -5
package/esm/index.mjs
CHANGED
|
@@ -537,26 +537,78 @@ function checkIpv4(ip) {
|
|
|
537
537
|
}
|
|
538
538
|
return { allowed: true, reason: "" };
|
|
539
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
|
+
}
|
|
540
574
|
function checkIpv6(ip) {
|
|
541
|
-
const
|
|
542
|
-
if (
|
|
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) {
|
|
543
581
|
return { allowed: false, reason: "IPv6 loopback address (::1) is not allowed" };
|
|
544
582
|
}
|
|
545
|
-
if (
|
|
583
|
+
if (isZeroPrefix && groups[7] === 0) {
|
|
546
584
|
return { allowed: false, reason: "IPv6 unspecified address (::) is not allowed" };
|
|
547
585
|
}
|
|
548
|
-
if (
|
|
586
|
+
if ((groups[0] & 65472) === 65152) {
|
|
549
587
|
return { allowed: false, reason: "IPv6 link-local addresses (fe80::/10) are not allowed" };
|
|
550
588
|
}
|
|
551
|
-
if (
|
|
589
|
+
if ((groups[0] & 65024) === 64512) {
|
|
552
590
|
return { allowed: false, reason: "IPv6 unique local addresses (fc00::/7) are not allowed" };
|
|
553
591
|
}
|
|
554
|
-
const
|
|
555
|
-
if (
|
|
556
|
-
return checkIpv4(
|
|
592
|
+
const embedded = extractEmbeddedIpv4(groups);
|
|
593
|
+
if (embedded) {
|
|
594
|
+
return checkIpv4(embedded);
|
|
557
595
|
}
|
|
558
596
|
return { allowed: true, reason: "" };
|
|
559
597
|
}
|
|
598
|
+
function extractEmbeddedIpv4(groups) {
|
|
599
|
+
const toDotted = () => {
|
|
600
|
+
const high = groups[6];
|
|
601
|
+
const low = groups[7];
|
|
602
|
+
return `${high >> 8}.${high & 255}.${low >> 8}.${low & 255}`;
|
|
603
|
+
};
|
|
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
|
+
}
|
|
560
612
|
function isDomainInList(hostname, domainList) {
|
|
561
613
|
const lowerHostname = hostname.toLowerCase();
|
|
562
614
|
for (const domain of domainList) {
|
|
@@ -3544,6 +3596,22 @@ var SessionSecretRequiredError = class extends AuthInternalError {
|
|
|
3544
3596
|
super(`Session secret is required for ${component}`, "SESSION_SECRET_REQUIRED");
|
|
3545
3597
|
}
|
|
3546
3598
|
};
|
|
3599
|
+
var JwtSecretRequiredError = class extends AuthInternalError {
|
|
3600
|
+
constructor(mode) {
|
|
3601
|
+
super(
|
|
3602
|
+
`JWT_SECRET is required in production for auth.mode "${mode}". Without it the server signs tokens with a random per-process secret, so every restart invalidates outstanding tokens and any second instance or isolate rejects tokens the first one minted.`,
|
|
3603
|
+
"JWT_SECRET_REQUIRED"
|
|
3604
|
+
);
|
|
3605
|
+
}
|
|
3606
|
+
};
|
|
3607
|
+
var JwtSecretWeakError = class extends AuthInternalError {
|
|
3608
|
+
constructor(byteLength) {
|
|
3609
|
+
super(
|
|
3610
|
+
`JWT_SECRET is ${byteLength} bytes; HS256 requires at least 32 (RFC 7518 \xA73.2). A shorter secret is guessable, and whoever guesses it can forge tokens for this server. Generate one with \`openssl rand -hex 32\`.`,
|
|
3611
|
+
"JWT_SECRET_INVALID"
|
|
3612
|
+
);
|
|
3613
|
+
}
|
|
3614
|
+
};
|
|
3547
3615
|
var CredentialProviderAlreadyRegisteredError = class extends AuthInternalError {
|
|
3548
3616
|
constructor(name) {
|
|
3549
3617
|
super(`Credential provider "${name}" is already registered`, "CREDENTIAL_PROVIDER_ALREADY_REGISTERED");
|
|
@@ -8210,10 +8278,48 @@ var publicAuthOptionsSchema = z11.object({
|
|
|
8210
8278
|
signKey: jwkSchema.or(z11.instanceof(Uint8Array)).optional()
|
|
8211
8279
|
});
|
|
8212
8280
|
|
|
8213
|
-
// libs/auth/src/options/
|
|
8281
|
+
// libs/auth/src/options/static.schema.ts
|
|
8214
8282
|
import { z as z12 } from "@frontmcp/lazy-zod";
|
|
8215
|
-
var
|
|
8216
|
-
mode: z12.literal("
|
|
8283
|
+
var staticAuthOptionsSchema = z12.object({
|
|
8284
|
+
mode: z12.literal("static"),
|
|
8285
|
+
/**
|
|
8286
|
+
* Accepted credentials. Compared against the presented one in constant time,
|
|
8287
|
+
* over SHA-256 digests so neither the value nor its length leaks by timing.
|
|
8288
|
+
*
|
|
8289
|
+
* Read these from the environment — never commit them.
|
|
8290
|
+
*/
|
|
8291
|
+
tokens: z12.array(z12.string().min(1)).min(1),
|
|
8292
|
+
/**
|
|
8293
|
+
* Request header carrying the credential.
|
|
8294
|
+
* @default 'authorization'
|
|
8295
|
+
*/
|
|
8296
|
+
header: z12.string().min(1).default("authorization"),
|
|
8297
|
+
/**
|
|
8298
|
+
* Scheme prefix to strip before comparing, matched case-insensitively. Set to
|
|
8299
|
+
* an empty string for headers that carry a bare token (e.g. `x-api-key`).
|
|
8300
|
+
* @default 'Bearer'
|
|
8301
|
+
*/
|
|
8302
|
+
scheme: z12.string().default("Bearer"),
|
|
8303
|
+
/**
|
|
8304
|
+
* Scopes granted to a request that presents a valid token.
|
|
8305
|
+
* @default ['static']
|
|
8306
|
+
*/
|
|
8307
|
+
scopes: z12.array(z12.string()).default(["static"]),
|
|
8308
|
+
/**
|
|
8309
|
+
* Realm reported in the `WWW-Authenticate` challenge on failure.
|
|
8310
|
+
* @default 'mcp'
|
|
8311
|
+
*/
|
|
8312
|
+
realm: z12.string().default("mcp"),
|
|
8313
|
+
/**
|
|
8314
|
+
* Tool/prompt access configuration, same shape the other modes accept.
|
|
8315
|
+
*/
|
|
8316
|
+
publicAccess: publicAccessConfigSchema.optional()
|
|
8317
|
+
});
|
|
8318
|
+
|
|
8319
|
+
// libs/auth/src/options/transparent.schema.ts
|
|
8320
|
+
import { z as z13 } from "@frontmcp/lazy-zod";
|
|
8321
|
+
var transparentAuthOptionsSchema = z13.object({
|
|
8322
|
+
mode: z13.literal("transparent"),
|
|
8217
8323
|
/**
|
|
8218
8324
|
* Flattened remote provider fields (provider, clientId, clientSecret, scopes, providerConfig)
|
|
8219
8325
|
*/
|
|
@@ -8222,28 +8328,28 @@ var transparentAuthOptionsSchema = z12.object({
|
|
|
8222
8328
|
* Expected token audience
|
|
8223
8329
|
* If not set, defaults to the resource URL
|
|
8224
8330
|
*/
|
|
8225
|
-
expectedAudience:
|
|
8331
|
+
expectedAudience: z13.union([z13.string(), z13.array(z13.string())]).optional(),
|
|
8226
8332
|
/**
|
|
8227
8333
|
* Require an `aud` claim (reject audience-less tokens). Defaults to `false`
|
|
8228
8334
|
* for IdP compatibility; set `true` to reject tokens with no audience.
|
|
8229
8335
|
*/
|
|
8230
|
-
requireAudience:
|
|
8336
|
+
requireAudience: z13.boolean().optional(),
|
|
8231
8337
|
/**
|
|
8232
8338
|
* Required scopes for access
|
|
8233
8339
|
* Empty array means any valid token is accepted
|
|
8234
8340
|
* @default []
|
|
8235
8341
|
*/
|
|
8236
|
-
requiredScopes:
|
|
8342
|
+
requiredScopes: z13.array(z13.string()).default([]),
|
|
8237
8343
|
/**
|
|
8238
8344
|
* Allow anonymous fallback when no token is provided
|
|
8239
8345
|
* @default false
|
|
8240
8346
|
*/
|
|
8241
|
-
allowAnonymous:
|
|
8347
|
+
allowAnonymous: z13.boolean().default(false),
|
|
8242
8348
|
/**
|
|
8243
8349
|
* Scopes granted to anonymous sessions (when allowAnonymous=true)
|
|
8244
8350
|
* @default ['anonymous']
|
|
8245
8351
|
*/
|
|
8246
|
-
anonymousScopes:
|
|
8352
|
+
anonymousScopes: z13.array(z13.string()).default(["anonymous"]),
|
|
8247
8353
|
/**
|
|
8248
8354
|
* Public access config for anonymous users (when allowAnonymous=true)
|
|
8249
8355
|
*/
|
|
@@ -8251,13 +8357,13 @@ var transparentAuthOptionsSchema = z12.object({
|
|
|
8251
8357
|
});
|
|
8252
8358
|
|
|
8253
8359
|
// libs/auth/src/options/orchestrated.schema.ts
|
|
8254
|
-
import { z as
|
|
8255
|
-
var authSlotSchema =
|
|
8256
|
-
var authUiMapSchema =
|
|
8257
|
-
var authExtraHandlerSchema =
|
|
8360
|
+
import { z as z14 } from "@frontmcp/lazy-zod";
|
|
8361
|
+
var authSlotSchema = z14.enum(["login", "consent", "incremental", "federated", "error"]);
|
|
8362
|
+
var authUiMapSchema = z14.partialRecord(authSlotSchema, z14.string().min(1));
|
|
8363
|
+
var authExtraHandlerSchema = z14.custom((v) => typeof v === "function", {
|
|
8258
8364
|
message: "auth.extras entries must be handler functions (input, ctx) => AuthExtraResult."
|
|
8259
8365
|
});
|
|
8260
|
-
var authExtrasMapSchema =
|
|
8366
|
+
var authExtrasMapSchema = z14.record(z14.string().min(1), authExtraHandlerSchema);
|
|
8261
8367
|
var sharedAuthFields = {
|
|
8262
8368
|
local: localSigningConfigSchema.optional(),
|
|
8263
8369
|
tokenStorage: tokenStorageConfigSchema.default("memory"),
|
|
@@ -8265,13 +8371,13 @@ var sharedAuthFields = {
|
|
|
8265
8371
|
// Optional (no default) so an unset value resolves to the in-memory encrypted
|
|
8266
8372
|
// default at runtime; existing configs are unaffected.
|
|
8267
8373
|
secureStore: secureStoreConfigSchema.optional(),
|
|
8268
|
-
allowDefaultPublic:
|
|
8269
|
-
anonymousScopes:
|
|
8374
|
+
allowDefaultPublic: z14.boolean().default(false),
|
|
8375
|
+
anonymousScopes: z14.array(z14.string()).default(["anonymous"]),
|
|
8270
8376
|
publicAccess: publicAccessConfigSchema.optional(),
|
|
8271
8377
|
consent: consentConfigSchema.optional(),
|
|
8272
8378
|
federatedAuth: federatedAuthConfigSchema.optional(),
|
|
8273
8379
|
refresh: tokenRefreshConfigSchema.optional(),
|
|
8274
|
-
expectedAudience:
|
|
8380
|
+
expectedAudience: z14.union([z14.string(), z14.array(z14.string())]).optional(),
|
|
8275
8381
|
incrementalAuth: incrementalAuthConfigSchema.optional(),
|
|
8276
8382
|
/**
|
|
8277
8383
|
* Require the OAuth client to be KNOWN (registered via DCR / pre-registered,
|
|
@@ -8287,46 +8393,46 @@ var sharedAuthFields = {
|
|
|
8287
8393
|
* matching for every client. Clients on a configured
|
|
8288
8394
|
* `dcr.allowedRedirectUris` allowlist still pass.
|
|
8289
8395
|
*/
|
|
8290
|
-
requireRegisteredClients:
|
|
8396
|
+
requireRegisteredClients: z14.boolean().default(false),
|
|
8291
8397
|
cimd: cimdConfigSchema.optional(),
|
|
8292
8398
|
// #469 — custom auth UI as a slot→file map + extras name→handler map (per-app
|
|
8293
8399
|
// under splitByApp). Both optional; omitting them serves the built-in pages.
|
|
8294
8400
|
ui: authUiMapSchema.optional(),
|
|
8295
8401
|
extras: authExtrasMapSchema.optional()
|
|
8296
8402
|
};
|
|
8297
|
-
var loginFieldSchema =
|
|
8298
|
-
type:
|
|
8299
|
-
label:
|
|
8300
|
-
required:
|
|
8301
|
-
placeholder:
|
|
8302
|
-
options:
|
|
8403
|
+
var loginFieldSchema = z14.object({
|
|
8404
|
+
type: z14.enum(["text", "password", "email", "select", "hidden"]),
|
|
8405
|
+
label: z14.string().optional(),
|
|
8406
|
+
required: z14.boolean().optional(),
|
|
8407
|
+
placeholder: z14.string().optional(),
|
|
8408
|
+
options: z14.array(z14.object({ value: z14.string(), label: z14.string() })).optional()
|
|
8303
8409
|
});
|
|
8304
|
-
var loginConfigSchema =
|
|
8305
|
-
title:
|
|
8306
|
-
subtitle:
|
|
8307
|
-
logoUri:
|
|
8308
|
-
fields:
|
|
8410
|
+
var loginConfigSchema = z14.object({
|
|
8411
|
+
title: z14.string().optional(),
|
|
8412
|
+
subtitle: z14.string().optional(),
|
|
8413
|
+
logoUri: z14.string().optional(),
|
|
8414
|
+
fields: z14.record(z14.string(), loginFieldSchema).optional(),
|
|
8309
8415
|
// Full HTML override — a function, validated structurally like other callbacks
|
|
8310
8416
|
// in the codebase (see http/cors handlers using z.custom<…>).
|
|
8311
|
-
render:
|
|
8417
|
+
render: z14.custom((v) => typeof v === "function", {
|
|
8312
8418
|
message: "login.render must be a function"
|
|
8313
8419
|
}).optional(),
|
|
8314
|
-
subject:
|
|
8315
|
-
fromField:
|
|
8316
|
-
strategy:
|
|
8420
|
+
subject: z14.object({
|
|
8421
|
+
fromField: z14.string().optional(),
|
|
8422
|
+
strategy: z14.enum(["per-session", "per-account"]).optional()
|
|
8317
8423
|
}).optional()
|
|
8318
8424
|
});
|
|
8319
|
-
var authenticateFnSchema =
|
|
8425
|
+
var authenticateFnSchema = z14.custom((v) => typeof v === "function", {
|
|
8320
8426
|
message: "authenticate must be a function"
|
|
8321
8427
|
});
|
|
8322
|
-
var localAuthSchema =
|
|
8323
|
-
mode:
|
|
8428
|
+
var localAuthSchema = z14.object({
|
|
8429
|
+
mode: z14.literal("local"),
|
|
8324
8430
|
...sharedAuthFields,
|
|
8325
8431
|
// #468 — opt-out of the email requirement at /oauth/callback for
|
|
8326
8432
|
// single-operator local setups. Defaults preserve the historical behavior
|
|
8327
8433
|
// (email required) so existing configs are unaffected.
|
|
8328
|
-
requireEmail:
|
|
8329
|
-
anonymousSubject:
|
|
8434
|
+
requireEmail: z14.boolean().default(true),
|
|
8435
|
+
anonymousSubject: z14.string().min(1).default("local-operator"),
|
|
8330
8436
|
// Checkpoint 3a — declarative login customization + custom verification.
|
|
8331
8437
|
// Both optional; omitting them preserves the default login path exactly.
|
|
8332
8438
|
login: loginConfigSchema.optional(),
|
|
@@ -8334,7 +8440,7 @@ var localAuthSchema = z13.object({
|
|
|
8334
8440
|
// Multi-OAuth-provider orchestration — declare upstream providers (GitHub,
|
|
8335
8441
|
// Slack, Jira, …) to federate at /oauth/authorize. Optional; omitting it
|
|
8336
8442
|
// preserves the default single-operator local login exactly.
|
|
8337
|
-
providers:
|
|
8443
|
+
providers: z14.array(upstreamProviderSchema).optional(),
|
|
8338
8444
|
// Local-AS Dynamic Client Registration control surface (#462) — gate
|
|
8339
8445
|
// `POST /oauth/register`, allowlist redirect_uris/client_ids, require an
|
|
8340
8446
|
// initial access token, and seed pre-registered trusted clients. Optional;
|
|
@@ -8342,8 +8448,8 @@ var localAuthSchema = z13.object({
|
|
|
8342
8448
|
// no allowlist; no initial access token).
|
|
8343
8449
|
dcr: localDcrConfigSchema.optional()
|
|
8344
8450
|
});
|
|
8345
|
-
var remoteAuthSchema =
|
|
8346
|
-
mode:
|
|
8451
|
+
var remoteAuthSchema = z14.object({
|
|
8452
|
+
mode: z14.literal("remote"),
|
|
8347
8453
|
...flatRemoteProviderFields,
|
|
8348
8454
|
...sharedAuthFields
|
|
8349
8455
|
});
|
|
@@ -8351,21 +8457,22 @@ var orchestratedLocalSchema = localAuthSchema;
|
|
|
8351
8457
|
var orchestratedRemoteSchema = remoteAuthSchema;
|
|
8352
8458
|
|
|
8353
8459
|
// libs/auth/src/options/schema.ts
|
|
8354
|
-
import { z as
|
|
8355
|
-
var authOptionsSchema =
|
|
8460
|
+
import { z as z15 } from "@frontmcp/lazy-zod";
|
|
8461
|
+
var authOptionsSchema = z15.union([
|
|
8356
8462
|
publicAuthOptionsSchema,
|
|
8463
|
+
staticAuthOptionsSchema,
|
|
8357
8464
|
transparentAuthOptionsSchema,
|
|
8358
8465
|
localAuthSchema,
|
|
8359
8466
|
remoteAuthSchema
|
|
8360
8467
|
]);
|
|
8361
8468
|
|
|
8362
8469
|
// libs/auth/src/options/app-auth.schema.ts
|
|
8363
|
-
import { z as
|
|
8470
|
+
import { z as z16 } from "@frontmcp/lazy-zod";
|
|
8364
8471
|
var standaloneOptionSchema = {
|
|
8365
|
-
standalone:
|
|
8366
|
-
excludeFromParent:
|
|
8472
|
+
standalone: z16.boolean().optional(),
|
|
8473
|
+
excludeFromParent: z16.boolean().optional()
|
|
8367
8474
|
};
|
|
8368
|
-
var appAuthOptionsSchema =
|
|
8475
|
+
var appAuthOptionsSchema = z16.union([
|
|
8369
8476
|
publicAuthOptionsSchema.extend(standaloneOptionSchema),
|
|
8370
8477
|
transparentAuthOptionsSchema.extend(standaloneOptionSchema),
|
|
8371
8478
|
localAuthSchema.extend(standaloneOptionSchema),
|
|
@@ -8379,6 +8486,9 @@ function parseAuthOptions(input) {
|
|
|
8379
8486
|
function isPublicMode(options) {
|
|
8380
8487
|
return options.mode === "public";
|
|
8381
8488
|
}
|
|
8489
|
+
function isStaticMode(options) {
|
|
8490
|
+
return options.mode === "static";
|
|
8491
|
+
}
|
|
8382
8492
|
function isTransparentMode(options) {
|
|
8383
8493
|
return options.mode === "transparent";
|
|
8384
8494
|
}
|
|
@@ -8405,108 +8515,108 @@ function allowsPublicAccess(options) {
|
|
|
8405
8515
|
}
|
|
8406
8516
|
|
|
8407
8517
|
// libs/auth/src/consent/consent.types.ts
|
|
8408
|
-
import { z as
|
|
8409
|
-
var consentToolItemSchema =
|
|
8518
|
+
import { z as z17 } from "@frontmcp/lazy-zod";
|
|
8519
|
+
var consentToolItemSchema = z17.object({
|
|
8410
8520
|
/** Tool ID (e.g., 'slack:send_message') */
|
|
8411
|
-
id:
|
|
8521
|
+
id: z17.string().min(1),
|
|
8412
8522
|
/** Tool name for display */
|
|
8413
|
-
name:
|
|
8523
|
+
name: z17.string().min(1),
|
|
8414
8524
|
/** Tool description */
|
|
8415
|
-
description:
|
|
8525
|
+
description: z17.string().optional(),
|
|
8416
8526
|
/** App ID this tool belongs to */
|
|
8417
|
-
appId:
|
|
8527
|
+
appId: z17.string().min(1),
|
|
8418
8528
|
/** App name for display */
|
|
8419
|
-
appName:
|
|
8529
|
+
appName: z17.string().min(1),
|
|
8420
8530
|
/** Whether the tool is selected by default */
|
|
8421
|
-
defaultSelected:
|
|
8531
|
+
defaultSelected: z17.boolean().default(true),
|
|
8422
8532
|
/** Whether this tool requires specific scopes */
|
|
8423
|
-
requiredScopes:
|
|
8533
|
+
requiredScopes: z17.array(z17.string()).optional(),
|
|
8424
8534
|
/** Category for grouping (e.g., 'read', 'write', 'admin') */
|
|
8425
|
-
category:
|
|
8535
|
+
category: z17.string().optional()
|
|
8426
8536
|
});
|
|
8427
|
-
var consentSelectionSchema =
|
|
8537
|
+
var consentSelectionSchema = z17.object({
|
|
8428
8538
|
/** Selected tool IDs */
|
|
8429
|
-
selectedTools:
|
|
8539
|
+
selectedTools: z17.array(z17.string()),
|
|
8430
8540
|
/** Whether all tools were selected */
|
|
8431
|
-
allSelected:
|
|
8541
|
+
allSelected: z17.boolean(),
|
|
8432
8542
|
/** Timestamp when consent was given */
|
|
8433
|
-
consentedAt:
|
|
8543
|
+
consentedAt: z17.string().datetime(),
|
|
8434
8544
|
/** Consent version for tracking changes */
|
|
8435
|
-
consentVersion:
|
|
8545
|
+
consentVersion: z17.string().default("1.0")
|
|
8436
8546
|
});
|
|
8437
|
-
var consentStateSchema =
|
|
8547
|
+
var consentStateSchema = z17.object({
|
|
8438
8548
|
/** Whether consent flow is enabled */
|
|
8439
|
-
enabled:
|
|
8549
|
+
enabled: z17.boolean(),
|
|
8440
8550
|
/** Available tools for consent */
|
|
8441
|
-
availableTools:
|
|
8551
|
+
availableTools: z17.array(consentToolItemSchema),
|
|
8442
8552
|
/** Pre-selected tools (from previous consent or defaults) */
|
|
8443
|
-
preselectedTools:
|
|
8553
|
+
preselectedTools: z17.array(z17.string()).optional(),
|
|
8444
8554
|
/** Whether to show all tools or group by app */
|
|
8445
|
-
groupByApp:
|
|
8555
|
+
groupByApp: z17.boolean().default(true),
|
|
8446
8556
|
/** Custom consent message */
|
|
8447
|
-
customMessage:
|
|
8557
|
+
customMessage: z17.string().optional()
|
|
8448
8558
|
});
|
|
8449
|
-
var federatedProviderItemSchema =
|
|
8559
|
+
var federatedProviderItemSchema = z17.object({
|
|
8450
8560
|
/** Provider ID (derived or explicit) */
|
|
8451
|
-
id:
|
|
8561
|
+
id: z17.string().min(1),
|
|
8452
8562
|
/** Provider display name */
|
|
8453
|
-
name:
|
|
8563
|
+
name: z17.string().min(1),
|
|
8454
8564
|
/** Provider description */
|
|
8455
|
-
description:
|
|
8565
|
+
description: z17.string().optional(),
|
|
8456
8566
|
/** Provider icon URL or emoji */
|
|
8457
|
-
icon:
|
|
8567
|
+
icon: z17.string().optional(),
|
|
8458
8568
|
/** Provider type */
|
|
8459
|
-
type:
|
|
8569
|
+
type: z17.enum(["local", "remote", "transparent"]),
|
|
8460
8570
|
/** OAuth provider URL (for remote providers) */
|
|
8461
|
-
providerUrl:
|
|
8571
|
+
providerUrl: z17.string().url().optional(),
|
|
8462
8572
|
/** Apps using this provider */
|
|
8463
|
-
appIds:
|
|
8573
|
+
appIds: z17.array(z17.string()),
|
|
8464
8574
|
/** App names using this provider */
|
|
8465
|
-
appNames:
|
|
8575
|
+
appNames: z17.array(z17.string()),
|
|
8466
8576
|
/** Scopes required by this provider */
|
|
8467
|
-
scopes:
|
|
8577
|
+
scopes: z17.array(z17.string()),
|
|
8468
8578
|
/** Whether this is the primary/parent provider */
|
|
8469
|
-
isPrimary:
|
|
8579
|
+
isPrimary: z17.boolean(),
|
|
8470
8580
|
/** Whether this provider is optional (can be skipped) */
|
|
8471
|
-
isOptional:
|
|
8581
|
+
isOptional: z17.boolean().default(false)
|
|
8472
8582
|
});
|
|
8473
|
-
var federatedLoginStateSchema =
|
|
8583
|
+
var federatedLoginStateSchema = z17.object({
|
|
8474
8584
|
/** All available providers */
|
|
8475
|
-
providers:
|
|
8585
|
+
providers: z17.array(federatedProviderItemSchema),
|
|
8476
8586
|
/** Primary provider ID (if any) */
|
|
8477
|
-
primaryProviderId:
|
|
8587
|
+
primaryProviderId: z17.string().optional(),
|
|
8478
8588
|
/** Whether user can skip optional providers */
|
|
8479
|
-
allowSkip:
|
|
8589
|
+
allowSkip: z17.boolean().default(true),
|
|
8480
8590
|
/** Pre-selected provider IDs (from previous session) */
|
|
8481
|
-
preselectedProviders:
|
|
8591
|
+
preselectedProviders: z17.array(z17.string()).optional()
|
|
8482
8592
|
});
|
|
8483
|
-
var federatedSelectionSchema =
|
|
8593
|
+
var federatedSelectionSchema = z17.object({
|
|
8484
8594
|
/** Selected provider IDs */
|
|
8485
|
-
selectedProviders:
|
|
8595
|
+
selectedProviders: z17.array(z17.string()),
|
|
8486
8596
|
/** Skipped provider IDs */
|
|
8487
|
-
skippedProviders:
|
|
8597
|
+
skippedProviders: z17.array(z17.string()),
|
|
8488
8598
|
/** Provider-specific metadata */
|
|
8489
|
-
providerMetadata:
|
|
8599
|
+
providerMetadata: z17.record(z17.string(), z17.unknown()).optional()
|
|
8490
8600
|
});
|
|
8491
8601
|
|
|
8492
8602
|
// libs/auth/src/detection/auth-provider-detection.ts
|
|
8493
|
-
import { z as
|
|
8494
|
-
var detectedAuthProviderSchema =
|
|
8495
|
-
id:
|
|
8496
|
-
providerUrl:
|
|
8497
|
-
mode:
|
|
8498
|
-
appIds:
|
|
8499
|
-
scopes:
|
|
8500
|
-
isParentProvider:
|
|
8603
|
+
import { z as z18 } from "@frontmcp/lazy-zod";
|
|
8604
|
+
var detectedAuthProviderSchema = z18.object({
|
|
8605
|
+
id: z18.string(),
|
|
8606
|
+
providerUrl: z18.string().optional(),
|
|
8607
|
+
mode: z18.enum(["public", "static", "transparent", "local", "remote"]),
|
|
8608
|
+
appIds: z18.array(z18.string()),
|
|
8609
|
+
scopes: z18.array(z18.string()),
|
|
8610
|
+
isParentProvider: z18.boolean()
|
|
8501
8611
|
});
|
|
8502
|
-
var authProviderDetectionResultSchema =
|
|
8503
|
-
providers:
|
|
8504
|
-
requiresOrchestration:
|
|
8505
|
-
parentProviderId:
|
|
8506
|
-
childProviderIds:
|
|
8507
|
-
uniqueProviderCount:
|
|
8508
|
-
validationErrors:
|
|
8509
|
-
warnings:
|
|
8612
|
+
var authProviderDetectionResultSchema = z18.object({
|
|
8613
|
+
providers: z18.map(z18.string(), detectedAuthProviderSchema),
|
|
8614
|
+
requiresOrchestration: z18.boolean(),
|
|
8615
|
+
parentProviderId: z18.string().optional(),
|
|
8616
|
+
childProviderIds: z18.array(z18.string()),
|
|
8617
|
+
uniqueProviderCount: z18.number(),
|
|
8618
|
+
validationErrors: z18.array(z18.string()),
|
|
8619
|
+
warnings: z18.array(z18.string())
|
|
8510
8620
|
});
|
|
8511
8621
|
function deriveProviderId(options) {
|
|
8512
8622
|
if (isPublicMode(options)) {
|
|
@@ -8895,43 +9005,43 @@ var AudienceValidator = class _AudienceValidator {
|
|
|
8895
9005
|
};
|
|
8896
9006
|
|
|
8897
9007
|
// libs/auth/src/vault/auth-providers.types.ts
|
|
8898
|
-
import { z as
|
|
8899
|
-
var credentialScopeSchema =
|
|
8900
|
-
var loadingStrategySchema =
|
|
8901
|
-
var getCredentialOptionsSchema =
|
|
8902
|
-
forceRefresh:
|
|
8903
|
-
scopes:
|
|
8904
|
-
timeout:
|
|
9008
|
+
import { z as z19 } from "@frontmcp/lazy-zod";
|
|
9009
|
+
var credentialScopeSchema = z19.enum(["global", "user", "session"]);
|
|
9010
|
+
var loadingStrategySchema = z19.enum(["eager", "lazy"]);
|
|
9011
|
+
var getCredentialOptionsSchema = z19.object({
|
|
9012
|
+
forceRefresh: z19.boolean().optional(),
|
|
9013
|
+
scopes: z19.array(z19.string()).optional(),
|
|
9014
|
+
timeout: z19.number().positive().optional()
|
|
8905
9015
|
}).strict();
|
|
8906
|
-
var credentialProviderConfigSchema =
|
|
8907
|
-
name:
|
|
8908
|
-
description:
|
|
9016
|
+
var credentialProviderConfigSchema = z19.object({
|
|
9017
|
+
name: z19.string().min(1),
|
|
9018
|
+
description: z19.string().optional(),
|
|
8909
9019
|
scope: credentialScopeSchema,
|
|
8910
9020
|
loading: loadingStrategySchema,
|
|
8911
|
-
cacheTtl:
|
|
9021
|
+
cacheTtl: z19.number().nonnegative().optional(),
|
|
8912
9022
|
// Functions validated at runtime, not via Zod (Zod 4 compatibility)
|
|
8913
|
-
factory:
|
|
8914
|
-
refresh:
|
|
8915
|
-
toHeaders:
|
|
8916
|
-
metadata:
|
|
8917
|
-
required:
|
|
9023
|
+
factory: z19.any(),
|
|
9024
|
+
refresh: z19.any().optional(),
|
|
9025
|
+
toHeaders: z19.any().optional(),
|
|
9026
|
+
metadata: z19.record(z19.string(), z19.unknown()).optional(),
|
|
9027
|
+
required: z19.boolean().optional()
|
|
8918
9028
|
}).strict();
|
|
8919
|
-
var authProviderMappingSchema =
|
|
8920
|
-
|
|
8921
|
-
|
|
8922
|
-
name:
|
|
8923
|
-
required:
|
|
8924
|
-
scopes:
|
|
8925
|
-
alias:
|
|
9029
|
+
var authProviderMappingSchema = z19.union([
|
|
9030
|
+
z19.string(),
|
|
9031
|
+
z19.object({
|
|
9032
|
+
name: z19.string().min(1),
|
|
9033
|
+
required: z19.boolean().optional().default(true),
|
|
9034
|
+
scopes: z19.array(z19.string()).optional(),
|
|
9035
|
+
alias: z19.string().optional()
|
|
8926
9036
|
}).strict()
|
|
8927
9037
|
]);
|
|
8928
|
-
var authProvidersVaultOptionsSchema =
|
|
8929
|
-
enabled:
|
|
8930
|
-
useSharedStorage:
|
|
8931
|
-
namespace:
|
|
8932
|
-
defaultCacheTtl:
|
|
8933
|
-
maxCredentialsPerSession:
|
|
8934
|
-
providers:
|
|
9038
|
+
var authProvidersVaultOptionsSchema = z19.object({
|
|
9039
|
+
enabled: z19.boolean().optional(),
|
|
9040
|
+
useSharedStorage: z19.boolean().optional().default(true),
|
|
9041
|
+
namespace: z19.string().optional().default("authproviders:"),
|
|
9042
|
+
defaultCacheTtl: z19.number().nonnegative().optional().default(36e5),
|
|
9043
|
+
maxCredentialsPerSession: z19.number().positive().optional().default(100),
|
|
9044
|
+
providers: z19.array(credentialProviderConfigSchema).optional()
|
|
8935
9045
|
}).strict();
|
|
8936
9046
|
|
|
8937
9047
|
// libs/auth/src/vault/credential-helpers.ts
|
|
@@ -10153,20 +10263,20 @@ function resolveRequiredScopes(denial, mapping, authorities) {
|
|
|
10153
10263
|
}
|
|
10154
10264
|
|
|
10155
10265
|
// libs/auth/src/authorities/authorities.schema.ts
|
|
10156
|
-
import { z as
|
|
10157
|
-
var rbacRolesPolicySchema =
|
|
10158
|
-
all:
|
|
10159
|
-
any:
|
|
10266
|
+
import { z as z20 } from "@frontmcp/lazy-zod";
|
|
10267
|
+
var rbacRolesPolicySchema = z20.object({
|
|
10268
|
+
all: z20.array(z20.string().min(1)).optional(),
|
|
10269
|
+
any: z20.array(z20.string().min(1)).optional()
|
|
10160
10270
|
}).refine((data) => data.all !== void 0 || data.any !== void 0, {
|
|
10161
10271
|
message: 'Roles policy must have at least "all" or "any"'
|
|
10162
10272
|
});
|
|
10163
|
-
var rbacPermissionsPolicySchema =
|
|
10164
|
-
all:
|
|
10165
|
-
any:
|
|
10273
|
+
var rbacPermissionsPolicySchema = z20.object({
|
|
10274
|
+
all: z20.array(z20.string().min(1)).optional(),
|
|
10275
|
+
any: z20.array(z20.string().min(1)).optional()
|
|
10166
10276
|
}).refine((data) => data.all !== void 0 || data.any !== void 0, {
|
|
10167
10277
|
message: 'Permissions policy must have at least "all" or "any"'
|
|
10168
10278
|
});
|
|
10169
|
-
var abacOperatorSchema =
|
|
10279
|
+
var abacOperatorSchema = z20.enum([
|
|
10170
10280
|
"eq",
|
|
10171
10281
|
"neq",
|
|
10172
10282
|
"in",
|
|
@@ -10181,55 +10291,55 @@ var abacOperatorSchema = z19.enum([
|
|
|
10181
10291
|
"exists",
|
|
10182
10292
|
"matches"
|
|
10183
10293
|
]);
|
|
10184
|
-
var abacConditionSchema =
|
|
10185
|
-
path:
|
|
10294
|
+
var abacConditionSchema = z20.object({
|
|
10295
|
+
path: z20.string().min(1),
|
|
10186
10296
|
op: abacOperatorSchema,
|
|
10187
|
-
value:
|
|
10297
|
+
value: z20.unknown()
|
|
10188
10298
|
});
|
|
10189
|
-
var abacPolicySchema =
|
|
10190
|
-
match:
|
|
10191
|
-
conditions:
|
|
10299
|
+
var abacPolicySchema = z20.object({
|
|
10300
|
+
match: z20.record(z20.string(), z20.unknown()).optional(),
|
|
10301
|
+
conditions: z20.array(abacConditionSchema).optional()
|
|
10192
10302
|
}).refine((data) => data.match !== void 0 || data.conditions !== void 0, {
|
|
10193
10303
|
message: 'Attributes policy must have at least "match" or "conditions"'
|
|
10194
10304
|
});
|
|
10195
|
-
var resourceIdRefSchema =
|
|
10196
|
-
|
|
10197
|
-
|
|
10198
|
-
|
|
10305
|
+
var resourceIdRefSchema = z20.union([
|
|
10306
|
+
z20.string().min(1),
|
|
10307
|
+
z20.object({ fromInput: z20.string().min(1) }).strict(),
|
|
10308
|
+
z20.object({ fromClaims: z20.string().min(1) }).strict()
|
|
10199
10309
|
]);
|
|
10200
|
-
var rebacPolicySchema =
|
|
10201
|
-
type:
|
|
10202
|
-
resource:
|
|
10310
|
+
var rebacPolicySchema = z20.object({
|
|
10311
|
+
type: z20.string().min(1),
|
|
10312
|
+
resource: z20.string().min(1),
|
|
10203
10313
|
resourceId: resourceIdRefSchema
|
|
10204
10314
|
});
|
|
10205
10315
|
var basePolicyShape = {
|
|
10206
10316
|
roles: rbacRolesPolicySchema.optional(),
|
|
10207
10317
|
permissions: rbacPermissionsPolicySchema.optional(),
|
|
10208
10318
|
attributes: abacPolicySchema.optional(),
|
|
10209
|
-
relationships:
|
|
10210
|
-
custom:
|
|
10211
|
-
guards:
|
|
10212
|
-
operator:
|
|
10319
|
+
relationships: z20.union([rebacPolicySchema, z20.array(rebacPolicySchema)]).optional(),
|
|
10320
|
+
custom: z20.record(z20.string(), z20.unknown()).optional(),
|
|
10321
|
+
guards: z20.array(z20.instanceof(Function)).optional(),
|
|
10322
|
+
operator: z20.enum(["AND", "OR"]).optional()
|
|
10213
10323
|
};
|
|
10214
|
-
var authoritiesPolicySchema =
|
|
10215
|
-
() =>
|
|
10324
|
+
var authoritiesPolicySchema = z20.lazy(
|
|
10325
|
+
() => z20.object({
|
|
10216
10326
|
...basePolicyShape,
|
|
10217
10327
|
not: authoritiesPolicySchema.optional(),
|
|
10218
|
-
anyOf:
|
|
10219
|
-
allOf:
|
|
10328
|
+
anyOf: z20.array(authoritiesPolicySchema).optional(),
|
|
10329
|
+
allOf: z20.array(authoritiesPolicySchema).optional()
|
|
10220
10330
|
})
|
|
10221
10331
|
);
|
|
10222
|
-
var authoritiesMetadataSchema =
|
|
10223
|
-
|
|
10224
|
-
|
|
10332
|
+
var authoritiesMetadataSchema = z20.union([
|
|
10333
|
+
z20.string().min(1),
|
|
10334
|
+
z20.array(z20.string().min(1)).min(1),
|
|
10225
10335
|
authoritiesPolicySchema
|
|
10226
10336
|
]);
|
|
10227
|
-
var authoritiesClaimsMappingSchema =
|
|
10337
|
+
var authoritiesClaimsMappingSchema = z20.record(z20.string(), z20.string().optional()).refine((data) => Object.values(data).some((v) => v !== void 0), {
|
|
10228
10338
|
message: "Claims mapping must have at least one mapping"
|
|
10229
10339
|
});
|
|
10230
|
-
var authoritiesConfigSchema =
|
|
10340
|
+
var authoritiesConfigSchema = z20.object({
|
|
10231
10341
|
claimsMapping: authoritiesClaimsMappingSchema.optional(),
|
|
10232
|
-
profiles:
|
|
10342
|
+
profiles: z20.record(z20.string().min(1), authoritiesPolicySchema).optional()
|
|
10233
10343
|
});
|
|
10234
10344
|
|
|
10235
10345
|
// libs/auth/src/authorities/authorities.evaluator.ts
|
|
@@ -10932,6 +11042,8 @@ export {
|
|
|
10932
11042
|
InMemoryStoreRequiredError,
|
|
10933
11043
|
InvalidClientIdUrlError,
|
|
10934
11044
|
JwksService,
|
|
11045
|
+
JwtSecretRequiredError,
|
|
11046
|
+
JwtSecretWeakError,
|
|
10935
11047
|
LazyCredentialLoader,
|
|
10936
11048
|
NoProviderIdError,
|
|
10937
11049
|
NullOrchestratedAuthAccessor,
|
|
@@ -11102,6 +11214,7 @@ export {
|
|
|
11102
11214
|
isSoonExpiring,
|
|
11103
11215
|
isSoonExpiringProvider,
|
|
11104
11216
|
isSqliteTokenStorage,
|
|
11217
|
+
isStaticMode,
|
|
11105
11218
|
isTransparentMode,
|
|
11106
11219
|
jsonWebKeySetSchema,
|
|
11107
11220
|
jwkParametersSchema,
|
|
@@ -11161,6 +11274,7 @@ export {
|
|
|
11161
11274
|
startNextProvider,
|
|
11162
11275
|
statefulHttpTransportStateSchema,
|
|
11163
11276
|
statelessHttpTransportStateSchema,
|
|
11277
|
+
staticAuthOptionsSchema,
|
|
11164
11278
|
storedSessionSchema,
|
|
11165
11279
|
streamableHttpTransportStateSchema,
|
|
11166
11280
|
toEpochSeconds,
|