@bymax-one/nest-auth 1.5.2 → 1.5.4
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 +187 -1
- package/README.md +232 -1116
- package/dist/client/index.cjs +18 -1
- package/dist/client/index.d.cts +2 -1
- package/dist/client/index.d.ts +2 -1
- package/dist/client/index.mjs +18 -1
- package/dist/nextjs/index.cjs +30 -9
- package/dist/nextjs/index.d.cts +58 -6
- package/dist/nextjs/index.d.ts +58 -6
- package/dist/nextjs/index.mjs +30 -9
- package/dist/react/index.cjs +16 -12
- package/dist/react/index.d.cts +3 -0
- package/dist/react/index.d.ts +3 -0
- package/dist/react/index.mjs +16 -12
- package/dist/server/index.cjs +593 -228
- package/dist/server/index.d.cts +1305 -1146
- package/dist/server/index.d.ts +1305 -1146
- package/dist/server/index.mjs +582 -229
- package/dist/shared/index.cjs +8 -2
- package/dist/shared/index.d.cts +5 -0
- package/dist/shared/index.d.ts +5 -0
- package/dist/shared/index.mjs +8 -2
- package/package.json +2 -2
package/dist/server/index.cjs
CHANGED
|
@@ -194,12 +194,13 @@ function shannonEntropy(value) {
|
|
|
194
194
|
}, 0);
|
|
195
195
|
}
|
|
196
196
|
__name(shannonEntropy, "shannonEntropy");
|
|
197
|
+
var AUTH_SECRET_MIN_LENGTH = 32;
|
|
197
198
|
function validateSecretStrength(secret, name) {
|
|
198
199
|
if (!secret) {
|
|
199
200
|
throw new Error(`[BymaxAuthModule] ${name} is required and must not be empty. Generate a secure secret with: node -e "console.log(require('node:crypto').randomBytes(32).toString('base64'))"`);
|
|
200
201
|
}
|
|
201
|
-
if (secret.length <
|
|
202
|
-
throw new Error(`[BymaxAuthModule] ${name} must be at least
|
|
202
|
+
if (secret.length < AUTH_SECRET_MIN_LENGTH) {
|
|
203
|
+
throw new Error(`[BymaxAuthModule] ${name} must be at least ${AUTH_SECRET_MIN_LENGTH} characters long. Generate a secure secret with: node -e "console.log(require('node:crypto').randomBytes(32).toString('base64'))"`);
|
|
203
204
|
}
|
|
204
205
|
const entropy = shannonEntropy(secret);
|
|
205
206
|
if (entropy < 3.5) {
|
|
@@ -367,6 +368,112 @@ __name(durationToSeconds, "durationToSeconds");
|
|
|
367
368
|
// src/server/constants/workspace-roles.ts
|
|
368
369
|
var ANY_WORKSPACE_MEMBER = /* @__PURE__ */ Symbol("ANY_WORKSPACE_MEMBER");
|
|
369
370
|
|
|
371
|
+
// src/server/utils/workspace-cursor.ts
|
|
372
|
+
var WORKSPACE_CURSOR_MAX_LENGTH = 4096;
|
|
373
|
+
var WORKSPACE_CURSOR_PART_MAX_LENGTH = 128;
|
|
374
|
+
var WORKSPACE_OWNER_ROLE_MAX_LENGTH = 32;
|
|
375
|
+
var INSTANT_LENGTH = 24;
|
|
376
|
+
var UNPAIRED_SURROGATE = /[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?<![\uD800-\uDBFF])[\uDC00-\uDFFF]/;
|
|
377
|
+
function hasControlCharacter(text) {
|
|
378
|
+
for (const character of text) {
|
|
379
|
+
if (character <= "" || character >= "\x7F" && character <= "\x9F") return true;
|
|
380
|
+
}
|
|
381
|
+
return false;
|
|
382
|
+
}
|
|
383
|
+
__name(hasControlCharacter, "hasControlCharacter");
|
|
384
|
+
function isWorkspaceOwnerRole(role) {
|
|
385
|
+
const length = Array.from(role).length;
|
|
386
|
+
return length >= 1 && length <= WORKSPACE_OWNER_ROLE_MAX_LENGTH && !hasControlCharacter(role) && !UNPAIRED_SURROGATE.test(role);
|
|
387
|
+
}
|
|
388
|
+
__name(isWorkspaceOwnerRole, "isWorkspaceOwnerRole");
|
|
389
|
+
function workspaceQueryKey(...parts) {
|
|
390
|
+
return JSON.stringify(parts);
|
|
391
|
+
}
|
|
392
|
+
__name(workspaceQueryKey, "workspaceQueryKey");
|
|
393
|
+
function workspacePositionOf(at, id) {
|
|
394
|
+
return at.toISOString() + id;
|
|
395
|
+
}
|
|
396
|
+
__name(workspacePositionOf, "workspacePositionOf");
|
|
397
|
+
function readWorkspacePosition(position) {
|
|
398
|
+
const instant = position.slice(0, INSTANT_LENGTH);
|
|
399
|
+
const at = new Date(instant);
|
|
400
|
+
if (Number.isNaN(at.getTime()) || at.toISOString() !== instant) return void 0;
|
|
401
|
+
return {
|
|
402
|
+
at,
|
|
403
|
+
id: position.slice(INSTANT_LENGTH)
|
|
404
|
+
};
|
|
405
|
+
}
|
|
406
|
+
__name(readWorkspacePosition, "readWorkspacePosition");
|
|
407
|
+
function describeOverflow(query, position) {
|
|
408
|
+
const part = keyParts(query).find(({ length }) => length > WORKSPACE_CURSOR_PART_MAX_LENGTH);
|
|
409
|
+
if (part !== void 0) {
|
|
410
|
+
return `query key part ${part.index} is ${part.length} code points, over ${WORKSPACE_CURSOR_PART_MAX_LENGTH}`;
|
|
411
|
+
}
|
|
412
|
+
return `the query key is ${query.length} characters and the position ${position.length}`;
|
|
413
|
+
}
|
|
414
|
+
__name(describeOverflow, "describeOverflow");
|
|
415
|
+
function whyUnreadable(position) {
|
|
416
|
+
if (readWorkspacePosition(position) === void 0) {
|
|
417
|
+
return "it is not a canonical instant followed by an id";
|
|
418
|
+
}
|
|
419
|
+
const id = position.slice(INSTANT_LENGTH);
|
|
420
|
+
if (id === "") return "its id is empty";
|
|
421
|
+
const length = Array.from(id).length;
|
|
422
|
+
if (length > WORKSPACE_CURSOR_PART_MAX_LENGTH) {
|
|
423
|
+
return `position id is ${length} code points, over ${WORKSPACE_CURSOR_PART_MAX_LENGTH}`;
|
|
424
|
+
}
|
|
425
|
+
if (hasControlCharacter(id) || UNPAIRED_SURROGATE.test(id)) {
|
|
426
|
+
return "its id holds a control character or an unpaired surrogate";
|
|
427
|
+
}
|
|
428
|
+
return void 0;
|
|
429
|
+
}
|
|
430
|
+
__name(whyUnreadable, "whyUnreadable");
|
|
431
|
+
function keyParts(query) {
|
|
432
|
+
try {
|
|
433
|
+
const parsed = JSON.parse(query);
|
|
434
|
+
if (!Array.isArray(parsed)) return [];
|
|
435
|
+
return parsed.map((part, index) => ({
|
|
436
|
+
index: index + 1,
|
|
437
|
+
length: typeof part === "string" ? Array.from(part).length : 0
|
|
438
|
+
}));
|
|
439
|
+
} catch {
|
|
440
|
+
return [];
|
|
441
|
+
}
|
|
442
|
+
}
|
|
443
|
+
__name(keyParts, "keyParts");
|
|
444
|
+
function encodeWorkspaceCursor(query, position) {
|
|
445
|
+
const reason = whyUnreadable(position);
|
|
446
|
+
if (reason !== void 0) {
|
|
447
|
+
throw new RangeError(`workspace cursor position is refused because ${reason}: the decoder reads it as the first page, so the cursor could never be followed`);
|
|
448
|
+
}
|
|
449
|
+
const cursor = Buffer.from(JSON.stringify([
|
|
450
|
+
query,
|
|
451
|
+
position
|
|
452
|
+
])).toString("base64url");
|
|
453
|
+
if (cursor.length > WORKSPACE_CURSOR_MAX_LENGTH) {
|
|
454
|
+
throw new RangeError(`workspace cursor is ${cursor.length} characters, over the ${WORKSPACE_CURSOR_MAX_LENGTH} maximum: ${describeOverflow(query, position)}`);
|
|
455
|
+
}
|
|
456
|
+
return cursor;
|
|
457
|
+
}
|
|
458
|
+
__name(encodeWorkspaceCursor, "encodeWorkspaceCursor");
|
|
459
|
+
function decodeWorkspaceCursor(cursor, query) {
|
|
460
|
+
if (typeof cursor !== "string" || cursor.length > WORKSPACE_CURSOR_MAX_LENGTH) return void 0;
|
|
461
|
+
try {
|
|
462
|
+
const parsed = JSON.parse(Buffer.from(cursor, "base64url").toString("utf8"));
|
|
463
|
+
if (!Array.isArray(parsed) || parsed.length !== 2) return void 0;
|
|
464
|
+
const [issuedFor, position] = parsed;
|
|
465
|
+
if (issuedFor !== query || typeof position !== "string") return void 0;
|
|
466
|
+
if (whyUnreadable(position) !== void 0) return void 0;
|
|
467
|
+
return Buffer.from(JSON.stringify([
|
|
468
|
+
query,
|
|
469
|
+
position
|
|
470
|
+
])).toString("base64url") === cursor ? position : void 0;
|
|
471
|
+
} catch {
|
|
472
|
+
return void 0;
|
|
473
|
+
}
|
|
474
|
+
}
|
|
475
|
+
__name(decodeWorkspaceCursor, "decodeWorkspaceCursor");
|
|
476
|
+
|
|
370
477
|
// src/server/config/workspace-options.ts
|
|
371
478
|
var WORKSPACE_INVITATION_MAX_TTL_SECONDS = 2592e3;
|
|
372
479
|
var WORKSPACE_MEMBERSHIP_CACHE_MAX_TTL_SECONDS = 3600;
|
|
@@ -392,6 +499,9 @@ function validateWorkspaceRoles(roles) {
|
|
|
392
499
|
if (typeof ownerRole !== "string" || !names.has(ownerRole)) {
|
|
393
500
|
throw new Error(`[BymaxAuthModule] workspaces.roles.ownerRole must be a role of the hierarchy.`);
|
|
394
501
|
}
|
|
502
|
+
if (!isWorkspaceOwnerRole(ownerRole)) {
|
|
503
|
+
throw new Error(`[BymaxAuthModule] workspaces.roles.ownerRole '${ownerRole}' must be 1 to ${WORKSPACE_OWNER_ROLE_MAX_LENGTH} code points of well-formed text with no control character (the role is part of a paging cursor).`);
|
|
504
|
+
}
|
|
395
505
|
for (const [role, included] of Object.entries(hierarchy)) {
|
|
396
506
|
if (role !== ownerRole && included.includes(ownerRole)) {
|
|
397
507
|
throw new Error(`[BymaxAuthModule] workspaces.roles.hierarchy: '${role}' must not include the owner role '${ownerRole}'. A role that includes the owner holds every owner permission.`);
|
|
@@ -892,7 +1002,7 @@ function validatePreviousSecrets(jwt) {
|
|
|
892
1002
|
if (typeof secret !== "string") {
|
|
893
1003
|
throw new Error(`[BymaxAuthModule] jwt.previousSecrets[${index}] must be a string. Every entry still verifies tokens, so each is held to the same rules as jwt.secret.`);
|
|
894
1004
|
}
|
|
895
|
-
validateSecretStrength(secret,
|
|
1005
|
+
validateSecretStrength(secret, `jwt.previousSecrets[${index}]`);
|
|
896
1006
|
if (seen.has(secret)) {
|
|
897
1007
|
throw new Error(`[BymaxAuthModule] jwt.previousSecrets[${index}] repeats jwt.secret or an earlier entry. A retired secret equal to the current one means the rotation did not happen, and a configuration that reads as rotated while nothing changed is worse than one that never claimed to.`);
|
|
898
1008
|
}
|
|
@@ -2166,7 +2276,17 @@ var AUTH_ERROR_CODES = {
|
|
|
2166
2276
|
* answers with. Without the filter the framework's own 500 shape stands, which is the
|
|
2167
2277
|
* behaviour this library had before it existed.
|
|
2168
2278
|
*/
|
|
2169
|
-
INTERNAL: "auth.internal"
|
|
2279
|
+
INTERNAL: "auth.internal",
|
|
2280
|
+
/**
|
|
2281
|
+
* A store this request depends on, Redis, did not answer in time or could not be reached, so
|
|
2282
|
+
* the request was refused and nothing was admitted. Retrying later may succeed; nothing here
|
|
2283
|
+
* knows when, so the answer carries no `Retry-After`.
|
|
2284
|
+
*
|
|
2285
|
+
* Raised by the library's Redis wrapper, not only by {@link AuthExceptionFilter}: it is a typed
|
|
2286
|
+
* exception, so any host filter that renders an `HttpException` answers it as a 503. The ioredis
|
|
2287
|
+
* error rides on the exception as `cause` and is never serialized.
|
|
2288
|
+
*/
|
|
2289
|
+
SERVICE_UNAVAILABLE: "auth.service_unavailable"
|
|
2170
2290
|
};
|
|
2171
2291
|
var AUTH_ERROR_STATUS = {
|
|
2172
2292
|
"auth.invalid_credentials": 401,
|
|
@@ -2218,7 +2338,8 @@ var AUTH_ERROR_STATUS = {
|
|
|
2218
2338
|
"auth.registration_closed": 403,
|
|
2219
2339
|
"auth.workspace_limit_reached": 403,
|
|
2220
2340
|
"auth.workspace_pending_deletion": 409,
|
|
2221
|
-
"auth.internal": 500
|
|
2341
|
+
"auth.internal": 500,
|
|
2342
|
+
"auth.service_unavailable": 503
|
|
2222
2343
|
};
|
|
2223
2344
|
var AUTH_ERROR_MESSAGES = {
|
|
2224
2345
|
"auth.invalid_credentials": "Invalid email or password",
|
|
@@ -2270,7 +2391,8 @@ var AUTH_ERROR_MESSAGES = {
|
|
|
2270
2391
|
"auth.registration_closed": "Registration is closed",
|
|
2271
2392
|
"auth.workspace_limit_reached": "Workspace limit reached. Workspaces pending deletion count toward the limit.",
|
|
2272
2393
|
"auth.workspace_pending_deletion": "Workspace is scheduled for deletion",
|
|
2273
|
-
"auth.internal": "Internal server error"
|
|
2394
|
+
"auth.internal": "Internal server error",
|
|
2395
|
+
"auth.service_unavailable": "Service temporarily unavailable"
|
|
2274
2396
|
};
|
|
2275
2397
|
var MESSAGE_BY_CODE = new Map(Object.entries(AUTH_ERROR_MESSAGES));
|
|
2276
2398
|
var STATUS_BY_CODE = new Map(Object.entries(AUTH_ERROR_STATUS));
|
|
@@ -2284,8 +2406,10 @@ var AuthException = class extends common.HttpException {
|
|
|
2284
2406
|
* @param details - Optional structured payload attached to the error body under
|
|
2285
2407
|
* `error.details`. An array where the failure is a list — `auth.validation` renders its
|
|
2286
2408
|
* per-field failures that way, matching what rust-auth serializes for the same code.
|
|
2409
|
+
* @param options - `cause`: the error this one reports, kept on the exception for a host's
|
|
2410
|
+
* logger and never serialized into the body.
|
|
2287
2411
|
*/
|
|
2288
|
-
constructor(code, details) {
|
|
2412
|
+
constructor(code, details, options) {
|
|
2289
2413
|
super(
|
|
2290
2414
|
{
|
|
2291
2415
|
error: {
|
|
@@ -2298,11 +2422,88 @@ var AuthException = class extends common.HttpException {
|
|
|
2298
2422
|
// A code with no entry is a programming error on the throwing side, not something the
|
|
2299
2423
|
// caller did — 500 says so, and says it with a number rather than the `undefined` an
|
|
2300
2424
|
// unguarded lookup used to hand to Express.
|
|
2301
|
-
STATUS_BY_CODE.get(code) ?? common.HttpStatus.INTERNAL_SERVER_ERROR
|
|
2425
|
+
STATUS_BY_CODE.get(code) ?? common.HttpStatus.INTERNAL_SERVER_ERROR,
|
|
2426
|
+
options?.cause === void 0 ? void 0 : {
|
|
2427
|
+
cause: options.cause
|
|
2428
|
+
}
|
|
2302
2429
|
);
|
|
2303
2430
|
}
|
|
2304
2431
|
};
|
|
2305
2432
|
|
|
2433
|
+
// src/server/redis/redis-outage.ts
|
|
2434
|
+
var MESSAGE_KINDS = /* @__PURE__ */ new Map([
|
|
2435
|
+
[
|
|
2436
|
+
"Command timed out",
|
|
2437
|
+
"timeout"
|
|
2438
|
+
],
|
|
2439
|
+
[
|
|
2440
|
+
"Connection is closed.",
|
|
2441
|
+
"closed"
|
|
2442
|
+
],
|
|
2443
|
+
[
|
|
2444
|
+
"Stream isn't writeable and enableOfflineQueue options is false",
|
|
2445
|
+
"closed"
|
|
2446
|
+
]
|
|
2447
|
+
]);
|
|
2448
|
+
var NETWORK_CODES = /* @__PURE__ */ new Set([
|
|
2449
|
+
"ECONNREFUSED",
|
|
2450
|
+
"ECONNRESET",
|
|
2451
|
+
"ETIMEDOUT",
|
|
2452
|
+
"EPIPE",
|
|
2453
|
+
"ENOTFOUND",
|
|
2454
|
+
"EAI_AGAIN",
|
|
2455
|
+
"EHOSTUNREACH",
|
|
2456
|
+
"ENETUNREACH"
|
|
2457
|
+
]);
|
|
2458
|
+
var UNAVAILABLE_REPLIES = /* @__PURE__ */ new Set([
|
|
2459
|
+
"READONLY",
|
|
2460
|
+
"LOADING",
|
|
2461
|
+
"MASTERDOWN",
|
|
2462
|
+
"CLUSTERDOWN",
|
|
2463
|
+
"TRYAGAIN"
|
|
2464
|
+
]);
|
|
2465
|
+
function redisOutageKindOf(error) {
|
|
2466
|
+
if (!(error instanceof Error)) return void 0;
|
|
2467
|
+
if (error.name === "MaxRetriesPerRequestError") return "unreachable";
|
|
2468
|
+
if (error.name === "ReplyError") {
|
|
2469
|
+
return UNAVAILABLE_REPLIES.has(error.message.split(" ", 1)[0]) ? "unavailable" : void 0;
|
|
2470
|
+
}
|
|
2471
|
+
const { code } = error;
|
|
2472
|
+
if (typeof code === "string" && NETWORK_CODES.has(code)) return "unreachable";
|
|
2473
|
+
return MESSAGE_KINDS.get(error.message);
|
|
2474
|
+
}
|
|
2475
|
+
__name(redisOutageKindOf, "redisOutageKindOf");
|
|
2476
|
+
function rethrowAsOutage(error) {
|
|
2477
|
+
if (redisOutageKindOf(error) === void 0) throw error;
|
|
2478
|
+
throw new AuthException(AUTH_ERROR_CODES.SERVICE_UNAVAILABLE, void 0, {
|
|
2479
|
+
cause: error
|
|
2480
|
+
});
|
|
2481
|
+
}
|
|
2482
|
+
__name(rethrowAsOutage, "rethrowAsOutage");
|
|
2483
|
+
function isServiceUnavailable(error) {
|
|
2484
|
+
if (!(error instanceof AuthException)) return false;
|
|
2485
|
+
const body = error.getResponse();
|
|
2486
|
+
return body.error?.code === AUTH_ERROR_CODES.SERVICE_UNAVAILABLE;
|
|
2487
|
+
}
|
|
2488
|
+
__name(isServiceUnavailable, "isServiceUnavailable");
|
|
2489
|
+
function isThenable(value) {
|
|
2490
|
+
return typeof value === "object" && value !== null && typeof value.then === "function";
|
|
2491
|
+
}
|
|
2492
|
+
__name(isThenable, "isThenable");
|
|
2493
|
+
function mappingOutages(redis) {
|
|
2494
|
+
return new Proxy(redis, {
|
|
2495
|
+
get(target, property) {
|
|
2496
|
+
const value = Reflect.get(target, property, target);
|
|
2497
|
+
if (typeof value !== "function") return value;
|
|
2498
|
+
return (...args) => {
|
|
2499
|
+
const result = Reflect.apply(value, target, args);
|
|
2500
|
+
return isThenable(result) ? result.then(void 0, rethrowAsOutage) : result;
|
|
2501
|
+
};
|
|
2502
|
+
}
|
|
2503
|
+
});
|
|
2504
|
+
}
|
|
2505
|
+
__name(mappingOutages, "mappingOutages");
|
|
2506
|
+
|
|
2306
2507
|
// src/server/constants/user-subject.ts
|
|
2307
2508
|
function userSubject(plane, userId, tenantId) {
|
|
2308
2509
|
if (plane === "platform") return `platform:${userId}`;
|
|
@@ -2350,7 +2551,6 @@ function _ts_param(paramIndex, decorator) {
|
|
|
2350
2551
|
};
|
|
2351
2552
|
}
|
|
2352
2553
|
__name(_ts_param, "_ts_param");
|
|
2353
|
-
var EPOCH_TTL_SECONDS = TOKEN_EPOCH_RETENTION_SECONDS;
|
|
2354
2554
|
var WS_TICKET_ENTROPY_BYTES = 32;
|
|
2355
2555
|
var GRACE_TAG = "GRACE:";
|
|
2356
2556
|
var REUSED_TAG = "REUSED:";
|
|
@@ -2518,7 +2718,7 @@ var AuthRedisService = class {
|
|
|
2518
2718
|
*/
|
|
2519
2719
|
#hmacKey;
|
|
2520
2720
|
constructor(redis, options) {
|
|
2521
|
-
this.#redis = redis;
|
|
2721
|
+
this.#redis = mappingOutages(redis);
|
|
2522
2722
|
this.namespace = options.redisNamespace;
|
|
2523
2723
|
this.#hmacKey = options.hmacKey;
|
|
2524
2724
|
}
|
|
@@ -3224,7 +3424,7 @@ var AuthRedisService = class {
|
|
|
3224
3424
|
return v`, [
|
|
3225
3425
|
key
|
|
3226
3426
|
], [
|
|
3227
|
-
String(
|
|
3427
|
+
String(TOKEN_EPOCH_RETENTION_SECONDS)
|
|
3228
3428
|
]);
|
|
3229
3429
|
return typeof result === "number" ? result : 0;
|
|
3230
3430
|
}
|
|
@@ -7196,7 +7396,7 @@ async function settlePendingLogout(redis, key, fromSession, owner, ttlSeconds, l
|
|
|
7196
7396
|
return fromSession || removed;
|
|
7197
7397
|
} catch (err) {
|
|
7198
7398
|
logger.warn(`logout: the retry marker could not be cleared \u2014 ${describeChannelStatus(err)}`);
|
|
7199
|
-
if (!fromSession) throw new AuthException(AUTH_ERROR_CODES.INTERNAL);
|
|
7399
|
+
if (!fromSession) throw isServiceUnavailable(err) ? err : new AuthException(AUTH_ERROR_CODES.INTERNAL);
|
|
7200
7400
|
return confirmNoStaleMarker(redis, key, owner, ttlSeconds, logger);
|
|
7201
7401
|
}
|
|
7202
7402
|
}
|
|
@@ -7204,8 +7404,9 @@ __name(settlePendingLogout, "settlePendingLogout");
|
|
|
7204
7404
|
async function confirmNoStaleMarker(redis, key, owner, ttlSeconds, logger) {
|
|
7205
7405
|
try {
|
|
7206
7406
|
if (await redis.get(key) === null) return true;
|
|
7207
|
-
} catch {
|
|
7407
|
+
} catch (err) {
|
|
7208
7408
|
await rememberPendingLogout(redis, key, owner, ttlSeconds, logger);
|
|
7409
|
+
if (isServiceUnavailable(err)) throw err;
|
|
7209
7410
|
}
|
|
7210
7411
|
throw new AuthException(AUTH_ERROR_CODES.INTERNAL);
|
|
7211
7412
|
}
|
|
@@ -8945,6 +9146,14 @@ _ts_decorate24([
|
|
|
8945
9146
|
classValidator.Length(64, 64),
|
|
8946
9147
|
_ts_metadata23("design:type", String)
|
|
8947
9148
|
], ConfirmEmailChangeDto.prototype, "token", void 0);
|
|
9149
|
+
|
|
9150
|
+
// src/server/constants/reproof-counter.ts
|
|
9151
|
+
function reproofCounterId(flow, userId, tenantId, hmacKey) {
|
|
9152
|
+
return hmacSha256(`reauth:${flow}:${userSubject("dashboard", userId, tenantId)}`, hmacKey);
|
|
9153
|
+
}
|
|
9154
|
+
__name(reproofCounterId, "reproofCounterId");
|
|
9155
|
+
|
|
9156
|
+
// src/server/services/email-change.service.ts
|
|
8948
9157
|
function _ts_decorate25(decorators, target, key, desc) {
|
|
8949
9158
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
8950
9159
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
@@ -9041,7 +9250,7 @@ exports.EmailChangeService = class _EmailChangeService {
|
|
|
9041
9250
|
if (!user?.passwordHash) {
|
|
9042
9251
|
throw new AuthException(AUTH_ERROR_CODES.INVALID_CREDENTIALS);
|
|
9043
9252
|
}
|
|
9044
|
-
const bfIdentifier =
|
|
9253
|
+
const bfIdentifier = reproofCounterId("email-change", userId, tenantId, this.options.hmacKey);
|
|
9045
9254
|
if (await this.bruteForce.isLockedOut(bfIdentifier)) {
|
|
9046
9255
|
this.logger.warn(`requestChange: account locked userId=${logSafe(userId)}`);
|
|
9047
9256
|
throw new AuthException(AUTH_ERROR_CODES.ACCOUNT_LOCKED);
|
|
@@ -10490,52 +10699,26 @@ var MfaFlowLockoutService = class {
|
|
|
10490
10699
|
this.bruteForce = bruteForce;
|
|
10491
10700
|
}
|
|
10492
10701
|
/**
|
|
10493
|
-
* The
|
|
10494
|
-
*
|
|
10495
|
-
*
|
|
10496
|
-
*
|
|
10497
|
-
*
|
|
10498
|
-
* old pod counts a failure under `{flow}:{plane}:{userId}` while a new pod counts it under
|
|
10499
|
-
* `{flow}:{userSubject}`, and either alone leaves a hole: a lockout an old pod filled would not
|
|
10500
|
-
* stop a new pod, and a success on one would not clear the other. So every read consults both
|
|
10501
|
-
* and every write touches both, and the two move as one; the plane-only arm can be dropped once
|
|
10502
|
-
* no pod writes it. On the platform plane the two ids are identical, so the plane-only arm is
|
|
10503
|
-
* skipped: operating it would be the same key a second time, double-counting a failure and
|
|
10504
|
-
* locking a platform admin out at half the threshold. `{flow}` (`challenge` / `disable` /
|
|
10505
|
-
* `reauth`) keeps the three counters isolated from each other.
|
|
10702
|
+
* The brute-force identifier for one MFA flow: the flow and the account's length-prefixed subject,
|
|
10703
|
+
* which carries the tenant on the dashboard plane. Two tenants' user `1` therefore count under
|
|
10704
|
+
* different identifiers, so one tenant's failures can neither lock the other's account out nor be
|
|
10705
|
+
* cleared by it. `{flow}` (`challenge` / `disable` / `reauth`) keeps the three counters isolated
|
|
10706
|
+
* from each other.
|
|
10506
10707
|
*/
|
|
10507
|
-
|
|
10508
|
-
return {
|
|
10509
|
-
legacy: hmacSha256(`${flow}:${context}:${userId}`, this.options.hmacKey),
|
|
10510
|
-
scoped: hmacSha256(`${flow}:${userSubject(context, userId, tenantId)}`, this.options.hmacKey)
|
|
10511
|
-
};
|
|
10708
|
+
counterId(flow, context, userId, tenantId) {
|
|
10709
|
+
return hmacSha256(`${flow}:${userSubject(context, userId, tenantId)}`, this.options.hmacKey);
|
|
10512
10710
|
}
|
|
10513
|
-
/**
|
|
10514
|
-
* Locked out when EITHER the legacy or the tenant-scoped counter has reached the threshold, so
|
|
10515
|
-
* neither a lockout an old pod recorded nor one a new pod recorded can be bypassed mid-migration.
|
|
10516
|
-
*/
|
|
10711
|
+
/** Whether the account's counter for this flow has reached the lockout threshold. */
|
|
10517
10712
|
async isLockedOut(flow, context, userId, tenantId) {
|
|
10518
|
-
|
|
10519
|
-
if (await this.bruteForce.isLockedOut(scoped)) return true;
|
|
10520
|
-
return legacy !== scoped ? this.bruteForce.isLockedOut(legacy) : false;
|
|
10713
|
+
return this.bruteForce.isLockedOut(this.counterId(flow, context, userId, tenantId));
|
|
10521
10714
|
}
|
|
10522
|
-
/**
|
|
10523
|
-
* Records the failure under both counters so the budget an attacker spends is seen by old and
|
|
10524
|
-
* new code alike — but under the scoped id ONCE when the two coincide (platform plane).
|
|
10525
|
-
*/
|
|
10715
|
+
/** Records a failed attempt against the account's counter for this flow. */
|
|
10526
10716
|
async recordFailure(flow, context, userId, tenantId) {
|
|
10527
|
-
|
|
10528
|
-
await this.bruteForce.recordFailure(scoped);
|
|
10529
|
-
if (legacy !== scoped) await this.bruteForce.recordFailure(legacy);
|
|
10717
|
+
await this.bruteForce.recordFailure(this.counterId(flow, context, userId, tenantId));
|
|
10530
10718
|
}
|
|
10531
|
-
/**
|
|
10532
|
-
* Clears both counters on success — resetting only one would leave the other to lock a
|
|
10533
|
-
* legitimately authenticated user out on the next attempt — collapsing to one when they coincide.
|
|
10534
|
-
*/
|
|
10719
|
+
/** Clears the account's counter for this flow, on a success. */
|
|
10535
10720
|
async reset(flow, context, userId, tenantId) {
|
|
10536
|
-
|
|
10537
|
-
await this.bruteForce.resetFailures(scoped);
|
|
10538
|
-
if (legacy !== scoped) await this.bruteForce.resetFailures(legacy);
|
|
10721
|
+
await this.bruteForce.resetFailures(this.counterId(flow, context, userId, tenantId));
|
|
10539
10722
|
}
|
|
10540
10723
|
};
|
|
10541
10724
|
MfaFlowLockoutService = _ts_decorate37([
|
|
@@ -10792,19 +10975,9 @@ var MfaRecordService = class {
|
|
|
10792
10975
|
* @throws {@link AuthException} `MFA_STATE_CONFLICT` when another transition holds the lock.
|
|
10793
10976
|
*/
|
|
10794
10977
|
async transition(context, userId, tenantId, mutate) {
|
|
10795
|
-
const
|
|
10796
|
-
const legacyLockKey = `mfalock:${hmacSha256(`${context}:${userId}`, this.options.hmacKey)}`;
|
|
10797
|
-
const acquireLegacy = legacyLockKey !== scopedLockKey;
|
|
10978
|
+
const lockKey = `mfalock:${hmacSha256(userSubject(context, userId, tenantId), this.options.hmacKey)}`;
|
|
10798
10979
|
const lockToken = crypto.randomBytes(16).toString("hex");
|
|
10799
|
-
if (!await this.redis.setIfAbsent(
|
|
10800
|
-
throw new AuthException(AUTH_ERROR_CODES.MFA_STATE_CONFLICT);
|
|
10801
|
-
}
|
|
10802
|
-
if (acquireLegacy && !await this.redis.setIfAbsent(legacyLockKey, lockToken, MFA_TRANSITION_LOCK_TTL_SECONDS)) {
|
|
10803
|
-
await this.redis.eval(RELEASE_LOCK_LUA, [
|
|
10804
|
-
scopedLockKey
|
|
10805
|
-
], [
|
|
10806
|
-
lockToken
|
|
10807
|
-
]);
|
|
10980
|
+
if (!await this.redis.setIfAbsent(lockKey, lockToken, MFA_TRANSITION_LOCK_TTL_SECONDS)) {
|
|
10808
10981
|
throw new AuthException(AUTH_ERROR_CODES.MFA_STATE_CONFLICT);
|
|
10809
10982
|
}
|
|
10810
10983
|
try {
|
|
@@ -10829,17 +11002,10 @@ var MfaRecordService = class {
|
|
|
10829
11002
|
return true;
|
|
10830
11003
|
} finally {
|
|
10831
11004
|
await this.redis.eval(RELEASE_LOCK_LUA, [
|
|
10832
|
-
|
|
11005
|
+
lockKey
|
|
10833
11006
|
], [
|
|
10834
11007
|
lockToken
|
|
10835
11008
|
]);
|
|
10836
|
-
if (acquireLegacy) {
|
|
10837
|
-
await this.redis.eval(RELEASE_LOCK_LUA, [
|
|
10838
|
-
legacyLockKey
|
|
10839
|
-
], [
|
|
10840
|
-
lockToken
|
|
10841
|
-
]);
|
|
10842
|
-
}
|
|
10843
11009
|
}
|
|
10844
11010
|
}
|
|
10845
11011
|
/**
|
|
@@ -10881,21 +11047,13 @@ var MfaRecordService = class {
|
|
|
10881
11047
|
* both the subject and the code value prevents code disclosure in Redis and cross-user,
|
|
10882
11048
|
* cross-tenant and cross-plane replay alike.
|
|
10883
11049
|
*
|
|
10884
|
-
* A second marker under the plane-only preimage `{context}:{userId}:{code}` is written and
|
|
10885
|
-
* required alongside it; see the call site for why both must be fresh while pods of two
|
|
10886
|
-
* versions are live.
|
|
10887
|
-
*
|
|
10888
11050
|
* @returns `true` if the code is valid and has not been replayed, `false` otherwise.
|
|
10889
11051
|
*/
|
|
10890
11052
|
async verifyTotpWithAntiReplay(context, userId, secretBase32, code, window, tenantId) {
|
|
10891
11053
|
if (!verifyTotp(secretBase32, code, window)) return false;
|
|
10892
11054
|
const ttl = totpAntiReplayTtlSeconds(window);
|
|
10893
|
-
const
|
|
10894
|
-
|
|
10895
|
-
const scopedIsNew = await this.redis.setnx(scopedReplayKey, ttl);
|
|
10896
|
-
if (scopedReplayKey === legacyReplayKey) return scopedIsNew;
|
|
10897
|
-
const legacyIsNew = await this.redis.setnx(legacyReplayKey, ttl);
|
|
10898
|
-
return scopedIsNew && legacyIsNew;
|
|
11055
|
+
const replayKey = `tu:${hmacSha256(`${userSubject(context, userId, tenantId)}:${code}`, this.options.hmacKey)}`;
|
|
11056
|
+
return await this.redis.setnx(replayKey, ttl);
|
|
10899
11057
|
}
|
|
10900
11058
|
/**
|
|
10901
11059
|
* Fetches a user from the correct repository based on the MFA context, and refuses one whose
|
|
@@ -12929,7 +13087,7 @@ async function answerResetRequest(deps, request) {
|
|
|
12929
13087
|
} catch (err) {
|
|
12930
13088
|
logger.error(`${label}: cooldown store failed: ${describeChannelStatus(err)}`);
|
|
12931
13089
|
await holdFloor();
|
|
12932
|
-
throw new AuthException(AUTH_ERROR_CODES.INTERNAL);
|
|
13090
|
+
throw isServiceUnavailable(err) ? err : new AuthException(AUTH_ERROR_CODES.INTERNAL);
|
|
12933
13091
|
}
|
|
12934
13092
|
if (!claimed) {
|
|
12935
13093
|
await holdFloor();
|
|
@@ -13056,10 +13214,9 @@ exports.PasswordResetService = class _PasswordResetService {
|
|
|
13056
13214
|
* - The account is blocked.
|
|
13057
13215
|
* - Issuing or storing the code, or the email provider, fails for an account that exists.
|
|
13058
13216
|
*
|
|
13059
|
-
*
|
|
13060
|
-
*
|
|
13061
|
-
*
|
|
13062
|
-
* whether an email address is registered.
|
|
13217
|
+
* What a failure answers, and when the cooldown this call took is released, is decided in one
|
|
13218
|
+
* place, {@link answerResetRequest}. The response cannot be used to probe whether an email
|
|
13219
|
+
* address is registered.
|
|
13063
13220
|
*
|
|
13064
13221
|
* Timing normalization: the method always takes at least {@link ANTI_ENUM_MIN_MS}
|
|
13065
13222
|
* milliseconds to respond, regardless of whether the user was found.
|
|
@@ -13167,8 +13324,8 @@ exports.PasswordResetService = class _PasswordResetService {
|
|
|
13167
13324
|
*
|
|
13168
13325
|
* Subject to an atomic 60-second cooldown enforced via a Redis NX key to
|
|
13169
13326
|
* prevent OTP flooding. Resolves the same way whether or not the user exists —
|
|
13170
|
-
* anti-enumeration principle; a failure
|
|
13171
|
-
*
|
|
13327
|
+
* anti-enumeration principle; what a failure answers is decided in one place,
|
|
13328
|
+
* {@link answerResetRequest}.
|
|
13172
13329
|
*
|
|
13173
13330
|
* Timing normalization: always takes at least {@link ANTI_ENUM_MIN_MS} ms.
|
|
13174
13331
|
*
|
|
@@ -13320,7 +13477,7 @@ exports.PasswordResetService = class _PasswordResetService {
|
|
|
13320
13477
|
if (!user?.passwordHash) {
|
|
13321
13478
|
throw new AuthException(AUTH_ERROR_CODES.INVALID_CREDENTIALS);
|
|
13322
13479
|
}
|
|
13323
|
-
const bfIdentifier =
|
|
13480
|
+
const bfIdentifier = reproofCounterId("change-password", userId, tenantId, this.options.hmacKey);
|
|
13324
13481
|
if (await this.bruteForce.isLockedOut(bfIdentifier)) {
|
|
13325
13482
|
this.logger.warn(`changePassword: account locked userId=${logSafe(userId)}`);
|
|
13326
13483
|
throw new AuthException(AUTH_ERROR_CODES.ACCOUNT_LOCKED);
|
|
@@ -13666,8 +13823,8 @@ var PasswordResetController = class {
|
|
|
13666
13823
|
*
|
|
13667
13824
|
* Sends a reset token or OTP to the user's email if the account exists and
|
|
13668
13825
|
* is eligible. Answers `200 OK` with an empty JSON object whether or not the account exists
|
|
13669
|
-
* (anti-enumeration; the body is pinned by the wire contract).
|
|
13670
|
-
*
|
|
13826
|
+
* (anti-enumeration; the body is pinned by the wire contract). What a failure answers is
|
|
13827
|
+
* decided in one place, `answerResetRequest` (utils/answer-reset-request.ts).
|
|
13671
13828
|
*
|
|
13672
13829
|
* @param dto - Validated DTO with `email` and `tenantId`.
|
|
13673
13830
|
* @returns An empty object.
|
|
@@ -13755,8 +13912,8 @@ var PasswordResetController = class {
|
|
|
13755
13912
|
*
|
|
13756
13913
|
* Subject to a 60-second atomic cooldown per `(tenantId, email)` pair.
|
|
13757
13914
|
* Answers `200 OK` with an empty JSON object whether or not the account exists
|
|
13758
|
-
* (anti-enumeration; the body is pinned by the wire contract).
|
|
13759
|
-
*
|
|
13915
|
+
* (anti-enumeration; the body is pinned by the wire contract). What a failure answers is
|
|
13916
|
+
* decided in one place, `answerResetRequest` (utils/answer-reset-request.ts).
|
|
13760
13917
|
*
|
|
13761
13918
|
* @param dto - Validated DTO with `email` and `tenantId`.
|
|
13762
13919
|
* @returns An empty object.
|
|
@@ -15205,7 +15362,8 @@ var WorkspacePageQueryDto = class {
|
|
|
15205
15362
|
/**
|
|
15206
15363
|
* The `nextCursor` of the previous page; absent for the first page.
|
|
15207
15364
|
*
|
|
15208
|
-
*
|
|
15365
|
+
* The length bound is the one the cursor codec reads, so a cursor the library issues is always one
|
|
15366
|
+
* this accepts, and an oversized value stays away from the repository.
|
|
15209
15367
|
*/
|
|
15210
15368
|
cursor;
|
|
15211
15369
|
/**
|
|
@@ -15219,7 +15377,7 @@ _ts_decorate62([
|
|
|
15219
15377
|
classValidator.IsOptional(),
|
|
15220
15378
|
classValidator.IsString(),
|
|
15221
15379
|
classValidator.IsNotEmpty(),
|
|
15222
|
-
classValidator.MaxLength(
|
|
15380
|
+
classValidator.MaxLength(WORKSPACE_CURSOR_MAX_LENGTH),
|
|
15223
15381
|
classValidator.Matches(NO_CONTROL_CHARACTERS, {
|
|
15224
15382
|
message: "cursor must not contain control characters"
|
|
15225
15383
|
}),
|
|
@@ -15289,8 +15447,8 @@ function membershipCacheKeyBase(tenantId, workspaceId, userId, hmacKey) {
|
|
|
15289
15447
|
__name(membershipCacheKeyBase, "membershipCacheKeyBase");
|
|
15290
15448
|
|
|
15291
15449
|
// src/server/utils/resolve-request-workspace.ts
|
|
15292
|
-
var
|
|
15293
|
-
var WORKSPACE_ID_RULE = `workspaceId must be 1 to ${
|
|
15450
|
+
var WORKSPACE_ID_MAX_LENGTH = 128;
|
|
15451
|
+
var WORKSPACE_ID_RULE = `workspaceId must be 1 to ${WORKSPACE_ID_MAX_LENGTH} code points, not blank, with no control characters`;
|
|
15294
15452
|
function invalidWorkspaceId(message) {
|
|
15295
15453
|
throw new AuthException(AUTH_ERROR_CODES.VALIDATION, [
|
|
15296
15454
|
{
|
|
@@ -15301,7 +15459,7 @@ function invalidWorkspaceId(message) {
|
|
|
15301
15459
|
}
|
|
15302
15460
|
__name(invalidWorkspaceId, "invalidWorkspaceId");
|
|
15303
15461
|
function assertWorkspaceId(value) {
|
|
15304
|
-
if (typeof value !== "string" || value.trim() === "" || exceedsCodePoints(value,
|
|
15462
|
+
if (typeof value !== "string" || value.trim() === "" || exceedsCodePoints(value, WORKSPACE_ID_MAX_LENGTH) || !NO_CONTROL_CHARACTERS.test(value)) {
|
|
15305
15463
|
return invalidWorkspaceId(WORKSPACE_ID_RULE);
|
|
15306
15464
|
}
|
|
15307
15465
|
return value;
|
|
@@ -20211,6 +20369,32 @@ function isStoredOAuthState(value) {
|
|
|
20211
20369
|
}
|
|
20212
20370
|
__name(isStoredOAuthState, "isStoredOAuthState");
|
|
20213
20371
|
|
|
20372
|
+
// src/server/oauth/plugin-deadline.ts
|
|
20373
|
+
var OAUTH_PLUGIN_DEFAULT_TIMEOUT_MS = 1e4;
|
|
20374
|
+
var OAUTH_PLUGIN_MAX_TIMEOUT_MS = 12e4;
|
|
20375
|
+
function pluginDeadlineMs(plugin) {
|
|
20376
|
+
const { timeoutMs } = plugin;
|
|
20377
|
+
return typeof timeoutMs === "number" && Number.isInteger(timeoutMs) && timeoutMs >= 1 && timeoutMs <= OAUTH_PLUGIN_MAX_TIMEOUT_MS ? timeoutMs : OAUTH_PLUGIN_DEFAULT_TIMEOUT_MS;
|
|
20378
|
+
}
|
|
20379
|
+
__name(pluginDeadlineMs, "pluginDeadlineMs");
|
|
20380
|
+
async function withDeadline(work, ms) {
|
|
20381
|
+
let timer;
|
|
20382
|
+
const expiry = new Promise((_resolve, reject) => {
|
|
20383
|
+
timer = setTimeout(() => {
|
|
20384
|
+
reject(new Error(`the plugin did not answer within ${ms} ms`));
|
|
20385
|
+
}, ms);
|
|
20386
|
+
});
|
|
20387
|
+
try {
|
|
20388
|
+
return await Promise.race([
|
|
20389
|
+
work(),
|
|
20390
|
+
expiry
|
|
20391
|
+
]);
|
|
20392
|
+
} finally {
|
|
20393
|
+
clearTimeout(timer);
|
|
20394
|
+
}
|
|
20395
|
+
}
|
|
20396
|
+
__name(withDeadline, "withDeadline");
|
|
20397
|
+
|
|
20214
20398
|
// src/server/constants/oauth-state-cookie.ts
|
|
20215
20399
|
var OAUTH_STATE_COOKIE_NAME = "oauth_state";
|
|
20216
20400
|
var OAUTH_STATE_COOKIE_SAME_SITE = "lax";
|
|
@@ -20573,12 +20757,15 @@ exports.OAuthService = class _OAuthService {
|
|
|
20573
20757
|
* @param code - The authorization code.
|
|
20574
20758
|
* @param codeVerifier - The PKCE verifier stored with the state.
|
|
20575
20759
|
* @returns The normalized profile.
|
|
20576
|
-
* @throws `AuthException(OAUTH_FAILED)` when the exchange or the fetch fails
|
|
20760
|
+
* @throws `AuthException(OAUTH_FAILED)` when the exchange or the fetch fails, or the plugin's
|
|
20761
|
+
* deadline passes first.
|
|
20577
20762
|
*/
|
|
20578
20763
|
async fetchProfile(plugin, provider, code, codeVerifier) {
|
|
20579
20764
|
try {
|
|
20580
|
-
|
|
20581
|
-
|
|
20765
|
+
return await withDeadline(async () => {
|
|
20766
|
+
const tokenResponse = await plugin.exchangeCode(code, codeVerifier);
|
|
20767
|
+
return await plugin.fetchProfile(tokenResponse.access_token);
|
|
20768
|
+
}, pluginDeadlineMs(plugin));
|
|
20582
20769
|
} catch (err) {
|
|
20583
20770
|
this.logger.error(`OAuth plugin '${provider}' failed during code exchange or profile fetch: ` + describeChannelStatus(err));
|
|
20584
20771
|
throw new AuthException(AUTH_ERROR_CODES.OAUTH_FAILED);
|
|
@@ -21298,6 +21485,11 @@ var GoogleOAuthPlugin = class {
|
|
|
21298
21485
|
}
|
|
21299
21486
|
/** Stable provider identifier used as a route segment and storage key. */
|
|
21300
21487
|
name = "google";
|
|
21488
|
+
/**
|
|
21489
|
+
* The library's deadline for the two requests together: each is bounded at 10 s by its own abort
|
|
21490
|
+
* signal, so the pair is 20 s and the library never cuts in before the plugin's own bound.
|
|
21491
|
+
*/
|
|
21492
|
+
timeoutMs = 2e4;
|
|
21301
21493
|
clientId;
|
|
21302
21494
|
/** The Google client secret, withheld from serialization. */
|
|
21303
21495
|
#clientSecret;
|
|
@@ -22191,7 +22383,7 @@ var REQUEST_SCHEMAS = {
|
|
|
22191
22383
|
"cursor": {
|
|
22192
22384
|
"type": "string",
|
|
22193
22385
|
"pattern": "^[^\\u0000-\\u001F\\u007F-\\u009F]+$",
|
|
22194
|
-
"maxLength":
|
|
22386
|
+
"maxLength": 4096,
|
|
22195
22387
|
"minLength": 1
|
|
22196
22388
|
},
|
|
22197
22389
|
"limit": {
|
|
@@ -23137,6 +23329,164 @@ exports.NoOpEmailProvider = class _NoOpEmailProvider {
|
|
|
23137
23329
|
exports.NoOpEmailProvider = _ts_decorate97([
|
|
23138
23330
|
common.Injectable()
|
|
23139
23331
|
], exports.NoOpEmailProvider);
|
|
23332
|
+
function _ts_decorate98(decorators, target, key, desc) {
|
|
23333
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
23334
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
23335
|
+
r = Reflect.decorate(decorators, target, key, desc);
|
|
23336
|
+
} else {
|
|
23337
|
+
for (var i = decorators.length - 1; i >= 0; i--) {
|
|
23338
|
+
if (d = decorators[i]) {
|
|
23339
|
+
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
23340
|
+
}
|
|
23341
|
+
}
|
|
23342
|
+
}
|
|
23343
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
23344
|
+
}
|
|
23345
|
+
__name(_ts_decorate98, "_ts_decorate");
|
|
23346
|
+
function _ts_metadata94(metadataKey, metadataValue) {
|
|
23347
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
23348
|
+
return Reflect.metadata(metadataKey, metadataValue);
|
|
23349
|
+
}
|
|
23350
|
+
}
|
|
23351
|
+
__name(_ts_metadata94, "_ts_metadata");
|
|
23352
|
+
function _ts_param59(paramIndex, decorator) {
|
|
23353
|
+
return function(target, key) {
|
|
23354
|
+
decorator(target, key, paramIndex);
|
|
23355
|
+
};
|
|
23356
|
+
}
|
|
23357
|
+
__name(_ts_param59, "_ts_param");
|
|
23358
|
+
var STARTUP_PING_TIMEOUT_MS = 5e3;
|
|
23359
|
+
var STARTUP_PING_RETRY_MS = 250;
|
|
23360
|
+
var CONNECTING_STATES = [
|
|
23361
|
+
"connecting",
|
|
23362
|
+
"connect",
|
|
23363
|
+
"reconnecting"
|
|
23364
|
+
];
|
|
23365
|
+
function commandTimeoutOf(client) {
|
|
23366
|
+
const options = client.options;
|
|
23367
|
+
if (typeof options !== "object" || options === null) return void 0;
|
|
23368
|
+
const own = options.commandTimeout;
|
|
23369
|
+
const nested = options.redisOptions?.commandTimeout;
|
|
23370
|
+
const found = typeof own === "number" ? own : nested;
|
|
23371
|
+
return typeof found === "number" ? found : void 0;
|
|
23372
|
+
}
|
|
23373
|
+
__name(commandTimeoutOf, "commandTimeoutOf");
|
|
23374
|
+
function addressOf(client) {
|
|
23375
|
+
const options = client.options;
|
|
23376
|
+
if (options?.path != null || options?.sentinels != null) return void 0;
|
|
23377
|
+
const host = options?.host;
|
|
23378
|
+
const port = options?.port;
|
|
23379
|
+
if (typeof host !== "string" || typeof port !== "number") return void 0;
|
|
23380
|
+
if (!/^[A-Za-z0-9._:%-]+$/.test(host)) return void 0;
|
|
23381
|
+
return host.includes(":") ? `[${host}]:${port}` : `${host}:${port}`;
|
|
23382
|
+
}
|
|
23383
|
+
__name(addressOf, "addressOf");
|
|
23384
|
+
function pause(ms) {
|
|
23385
|
+
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
23386
|
+
}
|
|
23387
|
+
__name(pause, "pause");
|
|
23388
|
+
var RedisReadinessService = class _RedisReadinessService {
|
|
23389
|
+
static {
|
|
23390
|
+
__name(this, "RedisReadinessService");
|
|
23391
|
+
}
|
|
23392
|
+
redis;
|
|
23393
|
+
logger = new common.Logger(_RedisReadinessService.name);
|
|
23394
|
+
constructor(redis) {
|
|
23395
|
+
this.redis = redis;
|
|
23396
|
+
}
|
|
23397
|
+
/**
|
|
23398
|
+
* Waits for a client that is on its way to `ready`, and refuses one that has ended. A client in
|
|
23399
|
+
* any other state is left to the command, which is what starts a lazy connection.
|
|
23400
|
+
*
|
|
23401
|
+
* @param timeoutMs - The time left in the budget.
|
|
23402
|
+
* @throws {Error} When the client ends, or does not become ready in time.
|
|
23403
|
+
*/
|
|
23404
|
+
whenReachable(timeoutMs) {
|
|
23405
|
+
const { status } = this.redis;
|
|
23406
|
+
if (status === "end") {
|
|
23407
|
+
return Promise.reject(new Error("the client is closed"));
|
|
23408
|
+
}
|
|
23409
|
+
if (!CONNECTING_STATES.includes(status)) return Promise.resolve();
|
|
23410
|
+
return new Promise((resolve, reject) => {
|
|
23411
|
+
const settle = /* @__PURE__ */ __name((done) => {
|
|
23412
|
+
clearTimeout(timer);
|
|
23413
|
+
this.redis.off("ready", onReady);
|
|
23414
|
+
this.redis.off("end", onEnd);
|
|
23415
|
+
done();
|
|
23416
|
+
}, "settle");
|
|
23417
|
+
const onReady = /* @__PURE__ */ __name(() => {
|
|
23418
|
+
settle(resolve);
|
|
23419
|
+
}, "onReady");
|
|
23420
|
+
const onEnd = /* @__PURE__ */ __name(() => {
|
|
23421
|
+
settle(() => {
|
|
23422
|
+
reject(new Error("the client gave up connecting"));
|
|
23423
|
+
});
|
|
23424
|
+
}, "onEnd");
|
|
23425
|
+
const timer = setTimeout(() => {
|
|
23426
|
+
settle(() => {
|
|
23427
|
+
reject(new Error("the client did not become ready"));
|
|
23428
|
+
});
|
|
23429
|
+
}, timeoutMs);
|
|
23430
|
+
this.redis.once("ready", onReady);
|
|
23431
|
+
this.redis.once("end", onEnd);
|
|
23432
|
+
});
|
|
23433
|
+
}
|
|
23434
|
+
/**
|
|
23435
|
+
* One PING attempt: waits for the client if it is connecting, then sends the command.
|
|
23436
|
+
*
|
|
23437
|
+
* @param timeoutMs - The time left in the budget; the attempt gives up when it runs out.
|
|
23438
|
+
* @throws {Error} When the client is closed, the command fails or the time runs out.
|
|
23439
|
+
*/
|
|
23440
|
+
async attempt(timeoutMs) {
|
|
23441
|
+
let timer;
|
|
23442
|
+
const expiry = new Promise((_resolve, reject) => {
|
|
23443
|
+
timer = setTimeout(() => {
|
|
23444
|
+
reject(new Error("the PING did not complete in time"));
|
|
23445
|
+
}, timeoutMs);
|
|
23446
|
+
});
|
|
23447
|
+
try {
|
|
23448
|
+
await Promise.race([
|
|
23449
|
+
this.whenReachable(timeoutMs).then(() => this.redis.ping()),
|
|
23450
|
+
expiry
|
|
23451
|
+
]);
|
|
23452
|
+
} finally {
|
|
23453
|
+
clearTimeout(timer);
|
|
23454
|
+
}
|
|
23455
|
+
}
|
|
23456
|
+
/**
|
|
23457
|
+
* @throws {Error} When the client cannot PING, or Redis does not answer within the budget. The
|
|
23458
|
+
* message names the address from the client's own `host` and `port` and never repeats what
|
|
23459
|
+
* ioredis raised, which can quote a connection string.
|
|
23460
|
+
*/
|
|
23461
|
+
async onApplicationBootstrap() {
|
|
23462
|
+
if (commandTimeoutOf(this.redis) === void 0) {
|
|
23463
|
+
this.logger.warn("The Redis client has no commandTimeout, so a slow or unreachable Redis holds each request until ioredis gives up. Set commandTimeout, a small maxRetriesPerRequest and a bounded retryStrategy on the client you provide as BYMAX_AUTH_REDIS_CLIENT.");
|
|
23464
|
+
}
|
|
23465
|
+
if (typeof this.redis.ping !== "function") {
|
|
23466
|
+
throw new Error("[BymaxAuthModule] BYMAX_AUTH_REDIS_CLIENT must be an ioredis client.");
|
|
23467
|
+
}
|
|
23468
|
+
const budgetEnd = Date.now() + STARTUP_PING_TIMEOUT_MS;
|
|
23469
|
+
for (; ; ) {
|
|
23470
|
+
try {
|
|
23471
|
+
await this.attempt(Math.max(budgetEnd - Date.now(), 1));
|
|
23472
|
+
return;
|
|
23473
|
+
} catch {
|
|
23474
|
+
if (this.redis.status === "end" || budgetEnd - Date.now() <= STARTUP_PING_RETRY_MS) break;
|
|
23475
|
+
await pause(STARTUP_PING_RETRY_MS);
|
|
23476
|
+
}
|
|
23477
|
+
}
|
|
23478
|
+
const address = addressOf(this.redis);
|
|
23479
|
+
throw new Error(`[BymaxAuthModule] Redis${address === void 0 ? "" : ` at ${address}`} did not answer PING within ${STARTUP_PING_TIMEOUT_MS} ms at startup. Check the address, the credentials and the network.`);
|
|
23480
|
+
}
|
|
23481
|
+
};
|
|
23482
|
+
RedisReadinessService = _ts_decorate98([
|
|
23483
|
+
common.Injectable(),
|
|
23484
|
+
_ts_param59(0, common.Inject(BYMAX_AUTH_REDIS_CLIENT)),
|
|
23485
|
+
_ts_metadata94("design:type", Function),
|
|
23486
|
+
_ts_metadata94("design:paramtypes", [
|
|
23487
|
+
typeof Redis === "undefined" ? Object : Redis
|
|
23488
|
+
])
|
|
23489
|
+
], RedisReadinessService);
|
|
23140
23490
|
|
|
23141
23491
|
// src/server/services/api-key-clock.ts
|
|
23142
23492
|
var SystemApiKeyClock = class {
|
|
@@ -23148,7 +23498,7 @@ var SystemApiKeyClock = class {
|
|
|
23148
23498
|
return /* @__PURE__ */ new Date();
|
|
23149
23499
|
}
|
|
23150
23500
|
};
|
|
23151
|
-
function
|
|
23501
|
+
function _ts_decorate99(decorators, target, key, desc) {
|
|
23152
23502
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
23153
23503
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
23154
23504
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -23161,19 +23511,19 @@ function _ts_decorate98(decorators, target, key, desc) {
|
|
|
23161
23511
|
}
|
|
23162
23512
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
23163
23513
|
}
|
|
23164
|
-
__name(
|
|
23165
|
-
function
|
|
23514
|
+
__name(_ts_decorate99, "_ts_decorate");
|
|
23515
|
+
function _ts_metadata95(metadataKey, metadataValue) {
|
|
23166
23516
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
23167
23517
|
return Reflect.metadata(metadataKey, metadataValue);
|
|
23168
23518
|
}
|
|
23169
23519
|
}
|
|
23170
|
-
__name(
|
|
23171
|
-
function
|
|
23520
|
+
__name(_ts_metadata95, "_ts_metadata");
|
|
23521
|
+
function _ts_param60(paramIndex, decorator) {
|
|
23172
23522
|
return function(target, key) {
|
|
23173
23523
|
decorator(target, key, paramIndex);
|
|
23174
23524
|
};
|
|
23175
23525
|
}
|
|
23176
|
-
__name(
|
|
23526
|
+
__name(_ts_param60, "_ts_param");
|
|
23177
23527
|
var ApiKeyScopeAuditService = class {
|
|
23178
23528
|
static {
|
|
23179
23529
|
__name(this, "ApiKeyScopeAuditService");
|
|
@@ -23216,21 +23566,21 @@ var ApiKeyScopeAuditService = class {
|
|
|
23216
23566
|
}
|
|
23217
23567
|
}
|
|
23218
23568
|
};
|
|
23219
|
-
ApiKeyScopeAuditService =
|
|
23569
|
+
ApiKeyScopeAuditService = _ts_decorate99([
|
|
23220
23570
|
common.Injectable(),
|
|
23221
|
-
|
|
23222
|
-
|
|
23223
|
-
|
|
23224
|
-
|
|
23225
|
-
|
|
23226
|
-
|
|
23571
|
+
_ts_param60(0, common.Inject(core.DiscoveryService)),
|
|
23572
|
+
_ts_param60(1, common.Inject(core.MetadataScanner)),
|
|
23573
|
+
_ts_param60(2, common.Inject(core.Reflector)),
|
|
23574
|
+
_ts_param60(3, common.Inject(BYMAX_AUTH_OPTIONS)),
|
|
23575
|
+
_ts_metadata95("design:type", Function),
|
|
23576
|
+
_ts_metadata95("design:paramtypes", [
|
|
23227
23577
|
typeof core.DiscoveryService === "undefined" ? Object : core.DiscoveryService,
|
|
23228
23578
|
typeof core.MetadataScanner === "undefined" ? Object : core.MetadataScanner,
|
|
23229
23579
|
typeof core.Reflector === "undefined" ? Object : core.Reflector,
|
|
23230
23580
|
typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions
|
|
23231
23581
|
])
|
|
23232
23582
|
], ApiKeyScopeAuditService);
|
|
23233
|
-
function
|
|
23583
|
+
function _ts_decorate100(decorators, target, key, desc) {
|
|
23234
23584
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
23235
23585
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
23236
23586
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -23243,19 +23593,19 @@ function _ts_decorate99(decorators, target, key, desc) {
|
|
|
23243
23593
|
}
|
|
23244
23594
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
23245
23595
|
}
|
|
23246
|
-
__name(
|
|
23247
|
-
function
|
|
23596
|
+
__name(_ts_decorate100, "_ts_decorate");
|
|
23597
|
+
function _ts_metadata96(metadataKey, metadataValue) {
|
|
23248
23598
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
23249
23599
|
return Reflect.metadata(metadataKey, metadataValue);
|
|
23250
23600
|
}
|
|
23251
23601
|
}
|
|
23252
|
-
__name(
|
|
23253
|
-
function
|
|
23602
|
+
__name(_ts_metadata96, "_ts_metadata");
|
|
23603
|
+
function _ts_param61(paramIndex, decorator) {
|
|
23254
23604
|
return function(target, key) {
|
|
23255
23605
|
decorator(target, key, paramIndex);
|
|
23256
23606
|
};
|
|
23257
23607
|
}
|
|
23258
|
-
__name(
|
|
23608
|
+
__name(_ts_param61, "_ts_param");
|
|
23259
23609
|
var API_KEY_MAX_LABEL_LENGTH = 128;
|
|
23260
23610
|
var API_KEY_MAX_OVERLAP_SECONDS = 2592e3;
|
|
23261
23611
|
var CONTROL_CHARACTERS = /[\p{Cc}\p{Cf}\p{Zl}\p{Zp}]/u;
|
|
@@ -23393,13 +23743,13 @@ exports.ApiKeyService = class ApiKeyService {
|
|
|
23393
23743
|
return value;
|
|
23394
23744
|
}
|
|
23395
23745
|
};
|
|
23396
|
-
exports.ApiKeyService =
|
|
23746
|
+
exports.ApiKeyService = _ts_decorate100([
|
|
23397
23747
|
common.Injectable(),
|
|
23398
|
-
|
|
23399
|
-
|
|
23400
|
-
|
|
23401
|
-
|
|
23402
|
-
|
|
23748
|
+
_ts_param61(0, common.Inject(BYMAX_AUTH_API_KEY_REPOSITORY)),
|
|
23749
|
+
_ts_param61(1, common.Inject(BYMAX_AUTH_API_KEY_CLOCK)),
|
|
23750
|
+
_ts_param61(2, common.Inject(BYMAX_AUTH_OPTIONS)),
|
|
23751
|
+
_ts_metadata96("design:type", Function),
|
|
23752
|
+
_ts_metadata96("design:paramtypes", [
|
|
23403
23753
|
typeof IApiKeyRepository === "undefined" ? Object : IApiKeyRepository,
|
|
23404
23754
|
typeof ApiKeyClock === "undefined" ? Object : ApiKeyClock,
|
|
23405
23755
|
typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions
|
|
@@ -23481,7 +23831,7 @@ async function assertTenantBinding(options, handshake, tenantId) {
|
|
|
23481
23831
|
__name(assertTenantBinding, "assertTenantBinding");
|
|
23482
23832
|
|
|
23483
23833
|
// src/server/services/auth-token-verifier.service.ts
|
|
23484
|
-
function
|
|
23834
|
+
function _ts_decorate101(decorators, target, key, desc) {
|
|
23485
23835
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
23486
23836
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
23487
23837
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -23494,19 +23844,19 @@ function _ts_decorate100(decorators, target, key, desc) {
|
|
|
23494
23844
|
}
|
|
23495
23845
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
23496
23846
|
}
|
|
23497
|
-
__name(
|
|
23498
|
-
function
|
|
23847
|
+
__name(_ts_decorate101, "_ts_decorate");
|
|
23848
|
+
function _ts_metadata97(metadataKey, metadataValue) {
|
|
23499
23849
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
23500
23850
|
return Reflect.metadata(metadataKey, metadataValue);
|
|
23501
23851
|
}
|
|
23502
23852
|
}
|
|
23503
|
-
__name(
|
|
23504
|
-
function
|
|
23853
|
+
__name(_ts_metadata97, "_ts_metadata");
|
|
23854
|
+
function _ts_param62(paramIndex, decorator) {
|
|
23505
23855
|
return function(target, key) {
|
|
23506
23856
|
decorator(target, key, paramIndex);
|
|
23507
23857
|
};
|
|
23508
23858
|
}
|
|
23509
|
-
__name(
|
|
23859
|
+
__name(_ts_param62, "_ts_param");
|
|
23510
23860
|
exports.AuthTokenVerifierService = class _AuthTokenVerifierService {
|
|
23511
23861
|
static {
|
|
23512
23862
|
__name(this, "AuthTokenVerifierService");
|
|
@@ -23586,11 +23936,14 @@ exports.AuthTokenVerifierService = class _AuthTokenVerifierService {
|
|
|
23586
23936
|
};
|
|
23587
23937
|
}
|
|
23588
23938
|
/**
|
|
23589
|
-
* The function that admits a caller to a workspace
|
|
23590
|
-
*
|
|
23939
|
+
* The function that admits a caller to a workspace. On a plane with no workspaces that is a
|
|
23940
|
+
* `TypeError` raised at once, a programmer's error. On a deployment that has not enabled them the
|
|
23941
|
+
* function is returned and refuses with the `auth.validation` error naming `workspaceId` when it is
|
|
23942
|
+
* called, which is after the token has been verified: the id came from a client, and an anonymous
|
|
23943
|
+
* caller must get `TOKEN_INVALID`, not a description of the deployment.
|
|
23591
23944
|
*
|
|
23592
|
-
*
|
|
23593
|
-
* for a malformed id and then the guard's refusals.
|
|
23945
|
+
* Otherwise the returned function admits the caller as `WorkspaceGuard` would a route, with
|
|
23946
|
+
* `auth.validation` for a malformed id and then the guard's refusals.
|
|
23594
23947
|
*/
|
|
23595
23948
|
workspaceResolver(plane) {
|
|
23596
23949
|
if (plane !== "dashboard") {
|
|
@@ -23600,7 +23953,12 @@ exports.AuthTokenVerifierService = class _AuthTokenVerifierService {
|
|
|
23600
23953
|
const group = this.options.workspaces;
|
|
23601
23954
|
const denied = this.deniedEvents;
|
|
23602
23955
|
if (access === null || group === void 0) {
|
|
23603
|
-
|
|
23956
|
+
return () => Promise.reject(new AuthException(AUTH_ERROR_CODES.VALIDATION, [
|
|
23957
|
+
{
|
|
23958
|
+
field: "workspaceId",
|
|
23959
|
+
message: "workspaceId is not accepted: workspaces are not enabled for this deployment"
|
|
23960
|
+
}
|
|
23961
|
+
]));
|
|
23604
23962
|
}
|
|
23605
23963
|
return async (payload, check) => {
|
|
23606
23964
|
const workspaceId = assertWorkspaceId(check.workspaceId);
|
|
@@ -23708,18 +24066,18 @@ exports.AuthTokenVerifierService = class _AuthTokenVerifierService {
|
|
|
23708
24066
|
}
|
|
23709
24067
|
}
|
|
23710
24068
|
};
|
|
23711
|
-
exports.AuthTokenVerifierService =
|
|
24069
|
+
exports.AuthTokenVerifierService = _ts_decorate101([
|
|
23712
24070
|
common.Injectable(),
|
|
23713
|
-
|
|
23714
|
-
|
|
23715
|
-
|
|
23716
|
-
|
|
23717
|
-
|
|
23718
|
-
|
|
23719
|
-
|
|
23720
|
-
|
|
23721
|
-
|
|
23722
|
-
|
|
24071
|
+
_ts_param62(0, common.Inject(jwt.JwtService)),
|
|
24072
|
+
_ts_param62(1, common.Inject(BYMAX_AUTH_OPTIONS)),
|
|
24073
|
+
_ts_param62(2, common.Inject(exports.AuthRevocationService)),
|
|
24074
|
+
_ts_param62(3, common.Inject(exports.AccountStatusService)),
|
|
24075
|
+
_ts_param62(4, common.Inject(exports.WorkspaceAccessService)),
|
|
24076
|
+
_ts_param62(4, common.Optional()),
|
|
24077
|
+
_ts_param62(5, common.Inject(WorkspaceDeniedEventsService)),
|
|
24078
|
+
_ts_param62(5, common.Optional()),
|
|
24079
|
+
_ts_metadata97("design:type", Function),
|
|
24080
|
+
_ts_metadata97("design:paramtypes", [
|
|
23723
24081
|
typeof jwt.JwtService === "undefined" ? Object : jwt.JwtService,
|
|
23724
24082
|
typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions,
|
|
23725
24083
|
typeof exports.AuthRevocationService === "undefined" ? Object : exports.AuthRevocationService,
|
|
@@ -23730,7 +24088,7 @@ exports.AuthTokenVerifierService = _ts_decorate100([
|
|
|
23730
24088
|
], exports.AuthTokenVerifierService);
|
|
23731
24089
|
|
|
23732
24090
|
// src/server/bymax-auth.module.ts
|
|
23733
|
-
function
|
|
24091
|
+
function _ts_decorate102(decorators, target, key, desc) {
|
|
23734
24092
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
23735
24093
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
23736
24094
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -23743,7 +24101,7 @@ function _ts_decorate101(decorators, target, key, desc) {
|
|
|
23743
24101
|
}
|
|
23744
24102
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
23745
24103
|
}
|
|
23746
|
-
__name(
|
|
24104
|
+
__name(_ts_decorate102, "_ts_decorate");
|
|
23747
24105
|
function hasProviderToken(providers, token) {
|
|
23748
24106
|
return providers.some((p) => {
|
|
23749
24107
|
if (typeof p === "function") return false;
|
|
@@ -24015,10 +24373,10 @@ exports.BymaxAuthModule = class _BymaxAuthModule {
|
|
|
24015
24373
|
...breachCheckerProviders,
|
|
24016
24374
|
...hooksProviders,
|
|
24017
24375
|
// Core services.
|
|
24018
|
-
// AuthRedisService is registered directly (not via AuthRedisModule) so that
|
|
24019
|
-
//
|
|
24020
|
-
// are visible in the same module scope.
|
|
24376
|
+
// AuthRedisService is registered directly (not via AuthRedisModule) so that the client and
|
|
24377
|
+
// the options provided via extraProviders are visible in the same module scope.
|
|
24021
24378
|
AuthRedisService,
|
|
24379
|
+
RedisReadinessService,
|
|
24022
24380
|
exports.AuthRevocationService,
|
|
24023
24381
|
exports.AccountStatusService,
|
|
24024
24382
|
exports.AuthTokenVerifierService,
|
|
@@ -24133,9 +24491,9 @@ exports.BymaxAuthModule = class _BymaxAuthModule {
|
|
|
24133
24491
|
// exported for the same @UseGuards() reason as the entries around it: the guard is
|
|
24134
24492
|
// re-instantiated in the consumer's injector, where an unexported dep fails their boot.
|
|
24135
24493
|
exports.AccountStatusService,
|
|
24136
|
-
// AuthTokenVerifierService is
|
|
24137
|
-
//
|
|
24138
|
-
//
|
|
24494
|
+
// AuthTokenVerifierService is the one call that establishes everything a guarded route
|
|
24495
|
+
// establishes, which is what a long-lived transport needs and cannot assemble from the
|
|
24496
|
+
// exported parts alone. `WsJwtGuard` depends on it, and a host may call it directly.
|
|
24139
24497
|
exports.AuthTokenVerifierService,
|
|
24140
24498
|
// Same reason, for the two exported guards whose remaining constructor deps are not
|
|
24141
24499
|
// covered by the entries above. Exporting the guard class is necessary but not
|
|
@@ -24144,7 +24502,7 @@ exports.BymaxAuthModule = class _BymaxAuthModule {
|
|
|
24144
24502
|
// UnknownDependenciesException even though the guard itself is exported.
|
|
24145
24503
|
//
|
|
24146
24504
|
// UserStatusGuard -> AccountStatusService
|
|
24147
|
-
// WsJwtGuard -> WsTicketService
|
|
24505
|
+
// WsJwtGuard -> AuthTokenVerifierService, WsTicketService
|
|
24148
24506
|
//
|
|
24149
24507
|
// Only the DIRECT dependency needs exporting. An exported provider arrives already
|
|
24150
24508
|
// instantiated, so the consumer's injector binds that instance and never re-resolves its
|
|
@@ -24188,7 +24546,7 @@ exports.BymaxAuthModule = class _BymaxAuthModule {
|
|
|
24188
24546
|
};
|
|
24189
24547
|
}
|
|
24190
24548
|
};
|
|
24191
|
-
exports.BymaxAuthModule =
|
|
24549
|
+
exports.BymaxAuthModule = _ts_decorate102([
|
|
24192
24550
|
common.Module({})
|
|
24193
24551
|
], exports.BymaxAuthModule);
|
|
24194
24552
|
|
|
@@ -24563,7 +24921,7 @@ var DefaultAuthEmailProvider = class _DefaultAuthEmailProvider {
|
|
|
24563
24921
|
}
|
|
24564
24922
|
}
|
|
24565
24923
|
};
|
|
24566
|
-
function
|
|
24924
|
+
function _ts_decorate103(decorators, target, key, desc) {
|
|
24567
24925
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
24568
24926
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
24569
24927
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -24576,13 +24934,13 @@ function _ts_decorate102(decorators, target, key, desc) {
|
|
|
24576
24934
|
}
|
|
24577
24935
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
24578
24936
|
}
|
|
24579
|
-
__name(
|
|
24580
|
-
function
|
|
24937
|
+
__name(_ts_decorate103, "_ts_decorate");
|
|
24938
|
+
function _ts_metadata98(metadataKey, metadataValue) {
|
|
24581
24939
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
24582
24940
|
return Reflect.metadata(metadataKey, metadataValue);
|
|
24583
24941
|
}
|
|
24584
24942
|
}
|
|
24585
|
-
__name(
|
|
24943
|
+
__name(_ts_metadata98, "_ts_metadata");
|
|
24586
24944
|
var HIBP_RANGE_URL = "https://api.pwnedpasswords.com/range/";
|
|
24587
24945
|
var PREFIX_LENGTH = 5;
|
|
24588
24946
|
var DEFAULT_TIMEOUT_MS = 1500;
|
|
@@ -24639,10 +24997,10 @@ exports.HibpBreachChecker = class _HibpBreachChecker {
|
|
|
24639
24997
|
}
|
|
24640
24998
|
}
|
|
24641
24999
|
};
|
|
24642
|
-
exports.HibpBreachChecker =
|
|
25000
|
+
exports.HibpBreachChecker = _ts_decorate103([
|
|
24643
25001
|
common.Injectable(),
|
|
24644
|
-
|
|
24645
|
-
|
|
25002
|
+
_ts_metadata98("design:type", Function),
|
|
25003
|
+
_ts_metadata98("design:paramtypes", [
|
|
24646
25004
|
Number
|
|
24647
25005
|
])
|
|
24648
25006
|
], exports.HibpBreachChecker);
|
|
@@ -24655,10 +25013,10 @@ exports.AllowAllBreachChecker = class AllowAllBreachChecker {
|
|
|
24655
25013
|
return false;
|
|
24656
25014
|
}
|
|
24657
25015
|
};
|
|
24658
|
-
exports.AllowAllBreachChecker =
|
|
25016
|
+
exports.AllowAllBreachChecker = _ts_decorate103([
|
|
24659
25017
|
common.Injectable()
|
|
24660
25018
|
], exports.AllowAllBreachChecker);
|
|
24661
|
-
function
|
|
25019
|
+
function _ts_decorate104(decorators, target, key, desc) {
|
|
24662
25020
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
24663
25021
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
24664
25022
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -24671,7 +25029,7 @@ function _ts_decorate103(decorators, target, key, desc) {
|
|
|
24671
25029
|
}
|
|
24672
25030
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
24673
25031
|
}
|
|
24674
|
-
__name(
|
|
25032
|
+
__name(_ts_decorate104, "_ts_decorate");
|
|
24675
25033
|
exports.OptionalAuthGuard = class OptionalAuthGuard extends exports.JwtAuthGuard {
|
|
24676
25034
|
static {
|
|
24677
25035
|
__name(this, "OptionalAuthGuard");
|
|
@@ -24686,10 +25044,10 @@ exports.OptionalAuthGuard = class OptionalAuthGuard extends exports.JwtAuthGuard
|
|
|
24686
25044
|
return super.canActivate(context);
|
|
24687
25045
|
}
|
|
24688
25046
|
};
|
|
24689
|
-
exports.OptionalAuthGuard =
|
|
25047
|
+
exports.OptionalAuthGuard = _ts_decorate104([
|
|
24690
25048
|
common.Injectable()
|
|
24691
25049
|
], exports.OptionalAuthGuard);
|
|
24692
|
-
function
|
|
25050
|
+
function _ts_decorate105(decorators, target, key, desc) {
|
|
24693
25051
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
24694
25052
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
24695
25053
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -24702,19 +25060,19 @@ function _ts_decorate104(decorators, target, key, desc) {
|
|
|
24702
25060
|
}
|
|
24703
25061
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
24704
25062
|
}
|
|
24705
|
-
__name(
|
|
24706
|
-
function
|
|
25063
|
+
__name(_ts_decorate105, "_ts_decorate");
|
|
25064
|
+
function _ts_metadata99(metadataKey, metadataValue) {
|
|
24707
25065
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
24708
25066
|
return Reflect.metadata(metadataKey, metadataValue);
|
|
24709
25067
|
}
|
|
24710
25068
|
}
|
|
24711
|
-
__name(
|
|
24712
|
-
function
|
|
25069
|
+
__name(_ts_metadata99, "_ts_metadata");
|
|
25070
|
+
function _ts_param63(paramIndex, decorator) {
|
|
24713
25071
|
return function(target, key) {
|
|
24714
25072
|
decorator(target, key, paramIndex);
|
|
24715
25073
|
};
|
|
24716
25074
|
}
|
|
24717
|
-
__name(
|
|
25075
|
+
__name(_ts_param63, "_ts_param");
|
|
24718
25076
|
exports.SelfOrAdminGuard = class SelfOrAdminGuard {
|
|
24719
25077
|
static {
|
|
24720
25078
|
__name(this, "SelfOrAdminGuard");
|
|
@@ -24750,11 +25108,11 @@ exports.SelfOrAdminGuard = class SelfOrAdminGuard {
|
|
|
24750
25108
|
throw new AuthException(AUTH_ERROR_CODES.INSUFFICIENT_ROLE);
|
|
24751
25109
|
}
|
|
24752
25110
|
};
|
|
24753
|
-
exports.SelfOrAdminGuard =
|
|
25111
|
+
exports.SelfOrAdminGuard = _ts_decorate105([
|
|
24754
25112
|
common.Injectable(),
|
|
24755
|
-
|
|
24756
|
-
|
|
24757
|
-
|
|
25113
|
+
_ts_param63(0, common.Inject(BYMAX_AUTH_OPTIONS)),
|
|
25114
|
+
_ts_metadata99("design:type", Function),
|
|
25115
|
+
_ts_metadata99("design:paramtypes", [
|
|
24758
25116
|
typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions
|
|
24759
25117
|
])
|
|
24760
25118
|
], exports.SelfOrAdminGuard);
|
|
@@ -24776,7 +25134,7 @@ function isHexLooking(value) {
|
|
|
24776
25134
|
return value.length === 64 && /^[a-fA-F0-9]{64}$/.test(value);
|
|
24777
25135
|
}
|
|
24778
25136
|
__name(isHexLooking, "isHexLooking");
|
|
24779
|
-
function
|
|
25137
|
+
function _ts_decorate106(decorators, target, key, desc) {
|
|
24780
25138
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
24781
25139
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
24782
25140
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -24789,32 +25147,32 @@ function _ts_decorate105(decorators, target, key, desc) {
|
|
|
24789
25147
|
}
|
|
24790
25148
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
24791
25149
|
}
|
|
24792
|
-
__name(
|
|
24793
|
-
function
|
|
25150
|
+
__name(_ts_decorate106, "_ts_decorate");
|
|
25151
|
+
function _ts_metadata100(metadataKey, metadataValue) {
|
|
24794
25152
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
24795
25153
|
return Reflect.metadata(metadataKey, metadataValue);
|
|
24796
25154
|
}
|
|
24797
25155
|
}
|
|
24798
|
-
__name(
|
|
24799
|
-
function
|
|
25156
|
+
__name(_ts_metadata100, "_ts_metadata");
|
|
25157
|
+
function _ts_param64(paramIndex, decorator) {
|
|
24800
25158
|
return function(target, key) {
|
|
24801
25159
|
decorator(target, key, paramIndex);
|
|
24802
25160
|
};
|
|
24803
25161
|
}
|
|
24804
|
-
__name(
|
|
25162
|
+
__name(_ts_param64, "_ts_param");
|
|
24805
25163
|
exports.WsJwtGuard = class WsJwtGuard {
|
|
24806
25164
|
static {
|
|
24807
25165
|
__name(this, "WsJwtGuard");
|
|
24808
25166
|
}
|
|
24809
|
-
|
|
24810
|
-
revocation;
|
|
25167
|
+
verifier;
|
|
24811
25168
|
wsTickets;
|
|
24812
25169
|
options;
|
|
24813
|
-
|
|
24814
|
-
|
|
24815
|
-
this.
|
|
25170
|
+
reflector;
|
|
25171
|
+
constructor(verifier, wsTickets, options, reflector) {
|
|
25172
|
+
this.verifier = verifier;
|
|
24816
25173
|
this.wsTickets = wsTickets;
|
|
24817
25174
|
this.options = options;
|
|
25175
|
+
this.reflector = reflector;
|
|
24818
25176
|
}
|
|
24819
25177
|
/**
|
|
24820
25178
|
* Verifies that `@nestjs/websockets` is installed and throws a descriptive
|
|
@@ -24846,37 +25204,32 @@ exports.WsJwtGuard = class WsJwtGuard {
|
|
|
24846
25204
|
if (!token) {
|
|
24847
25205
|
throw new AuthException(AUTH_ERROR_CODES.TOKEN_INVALID);
|
|
24848
25206
|
}
|
|
24849
|
-
|
|
24850
|
-
|
|
24851
|
-
|
|
24852
|
-
|
|
24853
|
-
|
|
24854
|
-
|
|
24855
|
-
|
|
24856
|
-
|
|
24857
|
-
|
|
24858
|
-
|
|
24859
|
-
|
|
24860
|
-
if (await this.revocation.isAccessTokenRevoked(payload)) {
|
|
24861
|
-
throw new AuthException(AUTH_ERROR_CODES.TOKEN_INVALID);
|
|
24862
|
-
}
|
|
24863
|
-
await assertTenantBinding(this.options, bindingInput(handshake), payload.tenantId);
|
|
24864
|
-
client.data.user = payload;
|
|
25207
|
+
const skipMfa = this.reflector.getAllAndOverride(SKIP_MFA_KEY, [
|
|
25208
|
+
context.getHandler(),
|
|
25209
|
+
context.getClass()
|
|
25210
|
+
]) === true;
|
|
25211
|
+
const verified = await this.verifier.verifyAccessToken(token, {
|
|
25212
|
+
plane: "dashboard",
|
|
25213
|
+
requireMfa: !skipMfa,
|
|
25214
|
+
checkStatus: true,
|
|
25215
|
+
request: bindingInput(handshake)
|
|
25216
|
+
});
|
|
25217
|
+
client.data.user = verified.payload;
|
|
24865
25218
|
return true;
|
|
24866
25219
|
}
|
|
24867
25220
|
};
|
|
24868
|
-
exports.WsJwtGuard =
|
|
25221
|
+
exports.WsJwtGuard = _ts_decorate106([
|
|
24869
25222
|
common.Injectable(),
|
|
24870
|
-
|
|
24871
|
-
|
|
24872
|
-
|
|
24873
|
-
|
|
24874
|
-
|
|
24875
|
-
|
|
24876
|
-
typeof
|
|
24877
|
-
typeof exports.AuthRevocationService === "undefined" ? Object : exports.AuthRevocationService,
|
|
25223
|
+
_ts_param64(0, common.Inject(exports.AuthTokenVerifierService)),
|
|
25224
|
+
_ts_param64(1, common.Inject(exports.WsTicketService)),
|
|
25225
|
+
_ts_param64(2, common.Inject(BYMAX_AUTH_OPTIONS)),
|
|
25226
|
+
_ts_param64(3, common.Inject(core.Reflector)),
|
|
25227
|
+
_ts_metadata100("design:type", Function),
|
|
25228
|
+
_ts_metadata100("design:paramtypes", [
|
|
25229
|
+
typeof exports.AuthTokenVerifierService === "undefined" ? Object : exports.AuthTokenVerifierService,
|
|
24878
25230
|
typeof exports.WsTicketService === "undefined" ? Object : exports.WsTicketService,
|
|
24879
|
-
typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions
|
|
25231
|
+
typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions,
|
|
25232
|
+
typeof core.Reflector === "undefined" ? Object : core.Reflector
|
|
24880
25233
|
])
|
|
24881
25234
|
], exports.WsJwtGuard);
|
|
24882
25235
|
function assertDashboardSnapshot(snapshot) {
|
|
@@ -24912,7 +25265,7 @@ function bindingInput(handshake) {
|
|
|
24912
25265
|
};
|
|
24913
25266
|
}
|
|
24914
25267
|
__name(bindingInput, "bindingInput");
|
|
24915
|
-
function
|
|
25268
|
+
function _ts_decorate107(decorators, target, key, desc) {
|
|
24916
25269
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
24917
25270
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
24918
25271
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -24925,7 +25278,7 @@ function _ts_decorate106(decorators, target, key, desc) {
|
|
|
24925
25278
|
}
|
|
24926
25279
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
24927
25280
|
}
|
|
24928
|
-
__name(
|
|
25281
|
+
__name(_ts_decorate107, "_ts_decorate");
|
|
24929
25282
|
function isAuthEnvelope(body) {
|
|
24930
25283
|
if (typeof body !== "object" || body === null) return false;
|
|
24931
25284
|
const error = body.error;
|
|
@@ -25044,10 +25397,10 @@ exports.AuthExceptionFilter = class _AuthExceptionFilter {
|
|
|
25044
25397
|
});
|
|
25045
25398
|
}
|
|
25046
25399
|
};
|
|
25047
|
-
exports.AuthExceptionFilter =
|
|
25400
|
+
exports.AuthExceptionFilter = _ts_decorate107([
|
|
25048
25401
|
common.Catch()
|
|
25049
25402
|
], exports.AuthExceptionFilter);
|
|
25050
|
-
function
|
|
25403
|
+
function _ts_decorate108(decorators, target, key, desc) {
|
|
25051
25404
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
25052
25405
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
25053
25406
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -25060,7 +25413,7 @@ function _ts_decorate107(decorators, target, key, desc) {
|
|
|
25060
25413
|
}
|
|
25061
25414
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
25062
25415
|
}
|
|
25063
|
-
__name(
|
|
25416
|
+
__name(_ts_decorate108, "_ts_decorate");
|
|
25064
25417
|
function isEmittingClient(client) {
|
|
25065
25418
|
return typeof client?.emit === "function";
|
|
25066
25419
|
}
|
|
@@ -25104,7 +25457,7 @@ exports.WsAuthExceptionFilter = class _WsAuthExceptionFilter {
|
|
|
25104
25457
|
this.logger.error(`refused a request on a client this filter cannot answer: ${describeChannelStatus(exception)}`);
|
|
25105
25458
|
}
|
|
25106
25459
|
};
|
|
25107
|
-
exports.WsAuthExceptionFilter =
|
|
25460
|
+
exports.WsAuthExceptionFilter = _ts_decorate108([
|
|
25108
25461
|
common.Catch(AuthException)
|
|
25109
25462
|
], exports.WsAuthExceptionFilter);
|
|
25110
25463
|
var ServiceKey = /* @__PURE__ */ __name((...scopes) => common.applyDecorators(common.SetMetadata(IS_PUBLIC_KEY, true), ApiKeyScopes(...scopes), common.UseGuards(exports.ApiKeyGuard)), "ServiceKey");
|
|
@@ -25118,7 +25471,7 @@ var CurrentWsWorkspace = common.createParamDecorator((_data, context) => {
|
|
|
25118
25471
|
});
|
|
25119
25472
|
|
|
25120
25473
|
// src/server/utils/workspace-scoped.ts
|
|
25121
|
-
var
|
|
25474
|
+
var UNPAIRED_SURROGATE2 = /[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?<![\uD800-\uDBFF])[\uDC00-\uDFFF]/;
|
|
25122
25475
|
function workspaceScopedName(tenantId, workspaceId, ...parts) {
|
|
25123
25476
|
const pieces = [
|
|
25124
25477
|
tenantId,
|
|
@@ -25130,7 +25483,7 @@ function workspaceScopedName(tenantId, workspaceId, ...parts) {
|
|
|
25130
25483
|
}
|
|
25131
25484
|
__name(workspaceScopedName, "workspaceScopedName");
|
|
25132
25485
|
function decodeWorkspaceScopedName(name) {
|
|
25133
|
-
if (
|
|
25486
|
+
if (UNPAIRED_SURROGATE2.test(name)) throw malformed(name);
|
|
25134
25487
|
const bytes = Buffer.from(name, "utf8");
|
|
25135
25488
|
const pieces = [];
|
|
25136
25489
|
let at = 0;
|
|
@@ -25171,7 +25524,7 @@ function assertPiece(piece, index) {
|
|
|
25171
25524
|
if (hasControl(piece)) {
|
|
25172
25525
|
throw new TypeError(`${label} must not contain a control character`);
|
|
25173
25526
|
}
|
|
25174
|
-
if (
|
|
25527
|
+
if (UNPAIRED_SURROGATE2.test(piece)) throw new TypeError(`${label} must be well-formed Unicode`);
|
|
25175
25528
|
}
|
|
25176
25529
|
__name(assertPiece, "assertPiece");
|
|
25177
25530
|
function malformed(name) {
|
|
@@ -25197,6 +25550,7 @@ exports.AUTH_EMAIL_KINDS = AUTH_EMAIL_KINDS;
|
|
|
25197
25550
|
exports.AUTH_ERROR_CODES = AUTH_ERROR_CODES;
|
|
25198
25551
|
exports.AUTH_ERROR_MESSAGES = AUTH_ERROR_MESSAGES;
|
|
25199
25552
|
exports.AUTH_ERROR_STATUS = AUTH_ERROR_STATUS;
|
|
25553
|
+
exports.AUTH_SECRET_MIN_LENGTH = AUTH_SECRET_MIN_LENGTH;
|
|
25200
25554
|
exports.AUTH_SECURITY_SCHEMES = AUTH_SECURITY_SCHEMES;
|
|
25201
25555
|
exports.AUTH_THROTTLE_CONFIGS = AUTH_THROTTLE_CONFIGS;
|
|
25202
25556
|
exports.AcceptInvitationDto = AcceptInvitationDto;
|
|
@@ -25247,21 +25601,30 @@ exports.ServiceKey = ServiceKey;
|
|
|
25247
25601
|
exports.SkipMfa = SkipMfa;
|
|
25248
25602
|
exports.VerifyEmailDto = VerifyEmailDto;
|
|
25249
25603
|
exports.VerifyOtpDto = VerifyOtpDto;
|
|
25604
|
+
exports.WORKSPACE_CURSOR_MAX_LENGTH = WORKSPACE_CURSOR_MAX_LENGTH;
|
|
25605
|
+
exports.WORKSPACE_CURSOR_PART_MAX_LENGTH = WORKSPACE_CURSOR_PART_MAX_LENGTH;
|
|
25606
|
+
exports.WORKSPACE_ID_MAX_LENGTH = WORKSPACE_ID_MAX_LENGTH;
|
|
25607
|
+
exports.WORKSPACE_OWNER_ROLE_MAX_LENGTH = WORKSPACE_OWNER_ROLE_MAX_LENGTH;
|
|
25250
25608
|
exports.WORKSPACE_PERMISSION_KEY = WORKSPACE_PERMISSION_KEY;
|
|
25251
25609
|
exports.WORKSPACE_ROLES_KEY = WORKSPACE_ROLES_KEY;
|
|
25252
25610
|
exports.WS_TICKET_TTL_SECONDS = WS_TICKET_TTL_SECONDS;
|
|
25253
25611
|
exports.WorkspacePermission = WorkspacePermission;
|
|
25254
25612
|
exports.WorkspaceRoles = WorkspaceRoles;
|
|
25613
|
+
exports.assertWorkspaceId = assertWorkspaceId;
|
|
25255
25614
|
exports.authDocumentSecurity = authDocumentSecurity;
|
|
25256
25615
|
exports.createAuthValidationPipe = createAuthValidationPipe;
|
|
25616
|
+
exports.decodeWorkspaceCursor = decodeWorkspaceCursor;
|
|
25257
25617
|
exports.decodeWorkspaceScopedName = decodeWorkspaceScopedName;
|
|
25258
25618
|
exports.decrypt = decrypt;
|
|
25259
25619
|
exports.describeChannelStatus = describeChannelStatus;
|
|
25260
25620
|
exports.describeError = describeError;
|
|
25621
|
+
exports.encodeWorkspaceCursor = encodeWorkspaceCursor;
|
|
25261
25622
|
exports.encrypt = encrypt;
|
|
25262
25623
|
exports.generateSecureToken = generateSecureToken;
|
|
25263
25624
|
exports.hasRole = hasRole;
|
|
25264
25625
|
exports.hmacSha256 = hmacSha256;
|
|
25626
|
+
exports.isWorkspaceOwnerRole = isWorkspaceOwnerRole;
|
|
25627
|
+
exports.readWorkspacePosition = readWorkspacePosition;
|
|
25265
25628
|
exports.redactSecrets = redactSecrets;
|
|
25266
25629
|
exports.reduceToBaseWord = reduceToBaseWord;
|
|
25267
25630
|
exports.sanitizeHeaders = sanitizeHeaders;
|
|
@@ -25269,4 +25632,6 @@ exports.sha256 = sha256;
|
|
|
25269
25632
|
exports.sleep = sleep;
|
|
25270
25633
|
exports.stampJobContext = stampJobContext;
|
|
25271
25634
|
exports.timingSafeCompare = timingSafeCompare;
|
|
25635
|
+
exports.workspacePositionOf = workspacePositionOf;
|
|
25636
|
+
exports.workspaceQueryKey = workspaceQueryKey;
|
|
25272
25637
|
exports.workspaceScopedName = workspaceScopedName;
|