@bymax-one/nest-auth 1.5.1 → 1.5.3
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 +178 -1
- package/README.md +225 -1115
- 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/server/index.cjs +590 -234
- package/dist/server/index.d.cts +1311 -1153
- package/dist/server/index.d.ts +1311 -1153
- package/dist/server/index.mjs +579 -235
- package/package.json +1 -1
package/dist/server/index.mjs
CHANGED
|
@@ -192,12 +192,13 @@ function shannonEntropy(value) {
|
|
|
192
192
|
}, 0);
|
|
193
193
|
}
|
|
194
194
|
__name(shannonEntropy, "shannonEntropy");
|
|
195
|
+
var AUTH_SECRET_MIN_LENGTH = 32;
|
|
195
196
|
function validateSecretStrength(secret, name) {
|
|
196
197
|
if (!secret) {
|
|
197
198
|
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'))"`);
|
|
198
199
|
}
|
|
199
|
-
if (secret.length <
|
|
200
|
-
throw new Error(`[BymaxAuthModule] ${name} must be at least
|
|
200
|
+
if (secret.length < AUTH_SECRET_MIN_LENGTH) {
|
|
201
|
+
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'))"`);
|
|
201
202
|
}
|
|
202
203
|
const entropy = shannonEntropy(secret);
|
|
203
204
|
if (entropy < 3.5) {
|
|
@@ -365,6 +366,112 @@ __name(durationToSeconds, "durationToSeconds");
|
|
|
365
366
|
// src/server/constants/workspace-roles.ts
|
|
366
367
|
var ANY_WORKSPACE_MEMBER = /* @__PURE__ */ Symbol("ANY_WORKSPACE_MEMBER");
|
|
367
368
|
|
|
369
|
+
// src/server/utils/workspace-cursor.ts
|
|
370
|
+
var WORKSPACE_CURSOR_MAX_LENGTH = 4096;
|
|
371
|
+
var WORKSPACE_CURSOR_PART_MAX_LENGTH = 128;
|
|
372
|
+
var WORKSPACE_OWNER_ROLE_MAX_LENGTH = 32;
|
|
373
|
+
var INSTANT_LENGTH = 24;
|
|
374
|
+
var UNPAIRED_SURROGATE = /[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?<![\uD800-\uDBFF])[\uDC00-\uDFFF]/;
|
|
375
|
+
function hasControlCharacter(text) {
|
|
376
|
+
for (const character of text) {
|
|
377
|
+
if (character <= "" || character >= "\x7F" && character <= "\x9F") return true;
|
|
378
|
+
}
|
|
379
|
+
return false;
|
|
380
|
+
}
|
|
381
|
+
__name(hasControlCharacter, "hasControlCharacter");
|
|
382
|
+
function isWorkspaceOwnerRole(role) {
|
|
383
|
+
const length = Array.from(role).length;
|
|
384
|
+
return length >= 1 && length <= WORKSPACE_OWNER_ROLE_MAX_LENGTH && !hasControlCharacter(role) && !UNPAIRED_SURROGATE.test(role);
|
|
385
|
+
}
|
|
386
|
+
__name(isWorkspaceOwnerRole, "isWorkspaceOwnerRole");
|
|
387
|
+
function workspaceQueryKey(...parts) {
|
|
388
|
+
return JSON.stringify(parts);
|
|
389
|
+
}
|
|
390
|
+
__name(workspaceQueryKey, "workspaceQueryKey");
|
|
391
|
+
function workspacePositionOf(at, id) {
|
|
392
|
+
return at.toISOString() + id;
|
|
393
|
+
}
|
|
394
|
+
__name(workspacePositionOf, "workspacePositionOf");
|
|
395
|
+
function readWorkspacePosition(position) {
|
|
396
|
+
const instant = position.slice(0, INSTANT_LENGTH);
|
|
397
|
+
const at = new Date(instant);
|
|
398
|
+
if (Number.isNaN(at.getTime()) || at.toISOString() !== instant) return void 0;
|
|
399
|
+
return {
|
|
400
|
+
at,
|
|
401
|
+
id: position.slice(INSTANT_LENGTH)
|
|
402
|
+
};
|
|
403
|
+
}
|
|
404
|
+
__name(readWorkspacePosition, "readWorkspacePosition");
|
|
405
|
+
function describeOverflow(query, position) {
|
|
406
|
+
const part = keyParts(query).find(({ length }) => length > WORKSPACE_CURSOR_PART_MAX_LENGTH);
|
|
407
|
+
if (part !== void 0) {
|
|
408
|
+
return `query key part ${part.index} is ${part.length} code points, over ${WORKSPACE_CURSOR_PART_MAX_LENGTH}`;
|
|
409
|
+
}
|
|
410
|
+
return `the query key is ${query.length} characters and the position ${position.length}`;
|
|
411
|
+
}
|
|
412
|
+
__name(describeOverflow, "describeOverflow");
|
|
413
|
+
function whyUnreadable(position) {
|
|
414
|
+
if (readWorkspacePosition(position) === void 0) {
|
|
415
|
+
return "it is not a canonical instant followed by an id";
|
|
416
|
+
}
|
|
417
|
+
const id = position.slice(INSTANT_LENGTH);
|
|
418
|
+
if (id === "") return "its id is empty";
|
|
419
|
+
const length = Array.from(id).length;
|
|
420
|
+
if (length > WORKSPACE_CURSOR_PART_MAX_LENGTH) {
|
|
421
|
+
return `position id is ${length} code points, over ${WORKSPACE_CURSOR_PART_MAX_LENGTH}`;
|
|
422
|
+
}
|
|
423
|
+
if (hasControlCharacter(id) || UNPAIRED_SURROGATE.test(id)) {
|
|
424
|
+
return "its id holds a control character or an unpaired surrogate";
|
|
425
|
+
}
|
|
426
|
+
return void 0;
|
|
427
|
+
}
|
|
428
|
+
__name(whyUnreadable, "whyUnreadable");
|
|
429
|
+
function keyParts(query) {
|
|
430
|
+
try {
|
|
431
|
+
const parsed = JSON.parse(query);
|
|
432
|
+
if (!Array.isArray(parsed)) return [];
|
|
433
|
+
return parsed.map((part, index) => ({
|
|
434
|
+
index: index + 1,
|
|
435
|
+
length: typeof part === "string" ? Array.from(part).length : 0
|
|
436
|
+
}));
|
|
437
|
+
} catch {
|
|
438
|
+
return [];
|
|
439
|
+
}
|
|
440
|
+
}
|
|
441
|
+
__name(keyParts, "keyParts");
|
|
442
|
+
function encodeWorkspaceCursor(query, position) {
|
|
443
|
+
const reason = whyUnreadable(position);
|
|
444
|
+
if (reason !== void 0) {
|
|
445
|
+
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`);
|
|
446
|
+
}
|
|
447
|
+
const cursor = Buffer.from(JSON.stringify([
|
|
448
|
+
query,
|
|
449
|
+
position
|
|
450
|
+
])).toString("base64url");
|
|
451
|
+
if (cursor.length > WORKSPACE_CURSOR_MAX_LENGTH) {
|
|
452
|
+
throw new RangeError(`workspace cursor is ${cursor.length} characters, over the ${WORKSPACE_CURSOR_MAX_LENGTH} maximum: ${describeOverflow(query, position)}`);
|
|
453
|
+
}
|
|
454
|
+
return cursor;
|
|
455
|
+
}
|
|
456
|
+
__name(encodeWorkspaceCursor, "encodeWorkspaceCursor");
|
|
457
|
+
function decodeWorkspaceCursor(cursor, query) {
|
|
458
|
+
if (typeof cursor !== "string" || cursor.length > WORKSPACE_CURSOR_MAX_LENGTH) return void 0;
|
|
459
|
+
try {
|
|
460
|
+
const parsed = JSON.parse(Buffer.from(cursor, "base64url").toString("utf8"));
|
|
461
|
+
if (!Array.isArray(parsed) || parsed.length !== 2) return void 0;
|
|
462
|
+
const [issuedFor, position] = parsed;
|
|
463
|
+
if (issuedFor !== query || typeof position !== "string") return void 0;
|
|
464
|
+
if (whyUnreadable(position) !== void 0) return void 0;
|
|
465
|
+
return Buffer.from(JSON.stringify([
|
|
466
|
+
query,
|
|
467
|
+
position
|
|
468
|
+
])).toString("base64url") === cursor ? position : void 0;
|
|
469
|
+
} catch {
|
|
470
|
+
return void 0;
|
|
471
|
+
}
|
|
472
|
+
}
|
|
473
|
+
__name(decodeWorkspaceCursor, "decodeWorkspaceCursor");
|
|
474
|
+
|
|
368
475
|
// src/server/config/workspace-options.ts
|
|
369
476
|
var WORKSPACE_INVITATION_MAX_TTL_SECONDS = 2592e3;
|
|
370
477
|
var WORKSPACE_MEMBERSHIP_CACHE_MAX_TTL_SECONDS = 3600;
|
|
@@ -390,6 +497,9 @@ function validateWorkspaceRoles(roles) {
|
|
|
390
497
|
if (typeof ownerRole !== "string" || !names.has(ownerRole)) {
|
|
391
498
|
throw new Error(`[BymaxAuthModule] workspaces.roles.ownerRole must be a role of the hierarchy.`);
|
|
392
499
|
}
|
|
500
|
+
if (!isWorkspaceOwnerRole(ownerRole)) {
|
|
501
|
+
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).`);
|
|
502
|
+
}
|
|
393
503
|
for (const [role, included] of Object.entries(hierarchy)) {
|
|
394
504
|
if (role !== ownerRole && included.includes(ownerRole)) {
|
|
395
505
|
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.`);
|
|
@@ -457,6 +567,41 @@ function resolveRegistration(userOptions) {
|
|
|
457
567
|
return mode;
|
|
458
568
|
}
|
|
459
569
|
__name(resolveRegistration, "resolveRegistration");
|
|
570
|
+
function assertInvitationControllers(resolved, workspaceController, tenantController) {
|
|
571
|
+
const workspacesEnabled = resolved.workspaces !== void 0;
|
|
572
|
+
if (workspaceController && !workspacesEnabled) {
|
|
573
|
+
throw new Error("[BymaxAuthModule] controllers.workspaceInvitations: true requires workspaces.enabled: true and both workspace repository providers in extraProviders.");
|
|
574
|
+
}
|
|
575
|
+
if (resolved.registration !== "invitation-only") return;
|
|
576
|
+
const workspacePath = missingPieces([
|
|
577
|
+
[
|
|
578
|
+
"workspaces.enabled",
|
|
579
|
+
workspacesEnabled
|
|
580
|
+
],
|
|
581
|
+
[
|
|
582
|
+
"controllers.workspaceInvitations",
|
|
583
|
+
workspaceController
|
|
584
|
+
]
|
|
585
|
+
]);
|
|
586
|
+
const tenantPath = missingPieces([
|
|
587
|
+
[
|
|
588
|
+
"invitations.enabled",
|
|
589
|
+
resolved.invitations.enabled
|
|
590
|
+
],
|
|
591
|
+
[
|
|
592
|
+
"controllers.invitations",
|
|
593
|
+
tenantController
|
|
594
|
+
]
|
|
595
|
+
]);
|
|
596
|
+
if (workspacePath.length > 0 && tenantPath.length > 0) {
|
|
597
|
+
throw new Error(`[BymaxAuthModule] registration: 'invitation-only' leaves no way to create an account. Enable one invitation path: workspaces (missing: ${workspacePath.join(", ")}) or tenant invitations (missing: ${tenantPath.join(", ")}).`);
|
|
598
|
+
}
|
|
599
|
+
}
|
|
600
|
+
__name(assertInvitationControllers, "assertInvitationControllers");
|
|
601
|
+
function missingPieces(pieces) {
|
|
602
|
+
return pieces.filter(([, on]) => !on).map(([name]) => name);
|
|
603
|
+
}
|
|
604
|
+
__name(missingPieces, "missingPieces");
|
|
460
605
|
function resolveWorkspaceOptions(userOptions) {
|
|
461
606
|
const group = userOptions.workspaces;
|
|
462
607
|
if (group?.enabled !== true) return void 0;
|
|
@@ -855,7 +1000,7 @@ function validatePreviousSecrets(jwt) {
|
|
|
855
1000
|
if (typeof secret !== "string") {
|
|
856
1001
|
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.`);
|
|
857
1002
|
}
|
|
858
|
-
validateSecretStrength(secret,
|
|
1003
|
+
validateSecretStrength(secret, `jwt.previousSecrets[${index}]`);
|
|
859
1004
|
if (seen.has(secret)) {
|
|
860
1005
|
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.`);
|
|
861
1006
|
}
|
|
@@ -8908,6 +9053,14 @@ _ts_decorate24([
|
|
|
8908
9053
|
Length(64, 64),
|
|
8909
9054
|
_ts_metadata23("design:type", String)
|
|
8910
9055
|
], ConfirmEmailChangeDto.prototype, "token", void 0);
|
|
9056
|
+
|
|
9057
|
+
// src/server/constants/reproof-counter.ts
|
|
9058
|
+
function reproofCounterId(flow, userId, tenantId, hmacKey) {
|
|
9059
|
+
return hmacSha256(`reauth:${flow}:${userSubject("dashboard", userId, tenantId)}`, hmacKey);
|
|
9060
|
+
}
|
|
9061
|
+
__name(reproofCounterId, "reproofCounterId");
|
|
9062
|
+
|
|
9063
|
+
// src/server/services/email-change.service.ts
|
|
8911
9064
|
function _ts_decorate25(decorators, target, key, desc) {
|
|
8912
9065
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
8913
9066
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
@@ -9004,7 +9157,7 @@ var EmailChangeService = class _EmailChangeService {
|
|
|
9004
9157
|
if (!user?.passwordHash) {
|
|
9005
9158
|
throw new AuthException(AUTH_ERROR_CODES.INVALID_CREDENTIALS);
|
|
9006
9159
|
}
|
|
9007
|
-
const bfIdentifier =
|
|
9160
|
+
const bfIdentifier = reproofCounterId("email-change", userId, tenantId, this.options.hmacKey);
|
|
9008
9161
|
if (await this.bruteForce.isLockedOut(bfIdentifier)) {
|
|
9009
9162
|
this.logger.warn(`requestChange: account locked userId=${logSafe(userId)}`);
|
|
9010
9163
|
throw new AuthException(AUTH_ERROR_CODES.ACCOUNT_LOCKED);
|
|
@@ -10453,52 +10606,26 @@ var MfaFlowLockoutService = class {
|
|
|
10453
10606
|
this.bruteForce = bruteForce;
|
|
10454
10607
|
}
|
|
10455
10608
|
/**
|
|
10456
|
-
* The
|
|
10457
|
-
*
|
|
10458
|
-
*
|
|
10459
|
-
*
|
|
10460
|
-
*
|
|
10461
|
-
* old pod counts a failure under `{flow}:{plane}:{userId}` while a new pod counts it under
|
|
10462
|
-
* `{flow}:{userSubject}`, and either alone leaves a hole: a lockout an old pod filled would not
|
|
10463
|
-
* stop a new pod, and a success on one would not clear the other. So every read consults both
|
|
10464
|
-
* and every write touches both, and the two move as one; the plane-only arm can be dropped once
|
|
10465
|
-
* no pod writes it. On the platform plane the two ids are identical, so the plane-only arm is
|
|
10466
|
-
* skipped: operating it would be the same key a second time, double-counting a failure and
|
|
10467
|
-
* locking a platform admin out at half the threshold. `{flow}` (`challenge` / `disable` /
|
|
10468
|
-
* `reauth`) keeps the three counters isolated from each other.
|
|
10609
|
+
* The brute-force identifier for one MFA flow: the flow and the account's length-prefixed subject,
|
|
10610
|
+
* which carries the tenant on the dashboard plane. Two tenants' user `1` therefore count under
|
|
10611
|
+
* different identifiers, so one tenant's failures can neither lock the other's account out nor be
|
|
10612
|
+
* cleared by it. `{flow}` (`challenge` / `disable` / `reauth`) keeps the three counters isolated
|
|
10613
|
+
* from each other.
|
|
10469
10614
|
*/
|
|
10470
|
-
|
|
10471
|
-
return {
|
|
10472
|
-
legacy: hmacSha256(`${flow}:${context}:${userId}`, this.options.hmacKey),
|
|
10473
|
-
scoped: hmacSha256(`${flow}:${userSubject(context, userId, tenantId)}`, this.options.hmacKey)
|
|
10474
|
-
};
|
|
10615
|
+
counterId(flow, context, userId, tenantId) {
|
|
10616
|
+
return hmacSha256(`${flow}:${userSubject(context, userId, tenantId)}`, this.options.hmacKey);
|
|
10475
10617
|
}
|
|
10476
|
-
/**
|
|
10477
|
-
* Locked out when EITHER the legacy or the tenant-scoped counter has reached the threshold, so
|
|
10478
|
-
* neither a lockout an old pod recorded nor one a new pod recorded can be bypassed mid-migration.
|
|
10479
|
-
*/
|
|
10618
|
+
/** Whether the account's counter for this flow has reached the lockout threshold. */
|
|
10480
10619
|
async isLockedOut(flow, context, userId, tenantId) {
|
|
10481
|
-
|
|
10482
|
-
if (await this.bruteForce.isLockedOut(scoped)) return true;
|
|
10483
|
-
return legacy !== scoped ? this.bruteForce.isLockedOut(legacy) : false;
|
|
10620
|
+
return this.bruteForce.isLockedOut(this.counterId(flow, context, userId, tenantId));
|
|
10484
10621
|
}
|
|
10485
|
-
/**
|
|
10486
|
-
* Records the failure under both counters so the budget an attacker spends is seen by old and
|
|
10487
|
-
* new code alike — but under the scoped id ONCE when the two coincide (platform plane).
|
|
10488
|
-
*/
|
|
10622
|
+
/** Records a failed attempt against the account's counter for this flow. */
|
|
10489
10623
|
async recordFailure(flow, context, userId, tenantId) {
|
|
10490
|
-
|
|
10491
|
-
await this.bruteForce.recordFailure(scoped);
|
|
10492
|
-
if (legacy !== scoped) await this.bruteForce.recordFailure(legacy);
|
|
10624
|
+
await this.bruteForce.recordFailure(this.counterId(flow, context, userId, tenantId));
|
|
10493
10625
|
}
|
|
10494
|
-
/**
|
|
10495
|
-
* Clears both counters on success — resetting only one would leave the other to lock a
|
|
10496
|
-
* legitimately authenticated user out on the next attempt — collapsing to one when they coincide.
|
|
10497
|
-
*/
|
|
10626
|
+
/** Clears the account's counter for this flow, on a success. */
|
|
10498
10627
|
async reset(flow, context, userId, tenantId) {
|
|
10499
|
-
|
|
10500
|
-
await this.bruteForce.resetFailures(scoped);
|
|
10501
|
-
if (legacy !== scoped) await this.bruteForce.resetFailures(legacy);
|
|
10628
|
+
await this.bruteForce.resetFailures(this.counterId(flow, context, userId, tenantId));
|
|
10502
10629
|
}
|
|
10503
10630
|
};
|
|
10504
10631
|
MfaFlowLockoutService = _ts_decorate37([
|
|
@@ -10755,19 +10882,9 @@ var MfaRecordService = class {
|
|
|
10755
10882
|
* @throws {@link AuthException} `MFA_STATE_CONFLICT` when another transition holds the lock.
|
|
10756
10883
|
*/
|
|
10757
10884
|
async transition(context, userId, tenantId, mutate) {
|
|
10758
|
-
const
|
|
10759
|
-
const legacyLockKey = `mfalock:${hmacSha256(`${context}:${userId}`, this.options.hmacKey)}`;
|
|
10760
|
-
const acquireLegacy = legacyLockKey !== scopedLockKey;
|
|
10885
|
+
const lockKey = `mfalock:${hmacSha256(userSubject(context, userId, tenantId), this.options.hmacKey)}`;
|
|
10761
10886
|
const lockToken = randomBytes(16).toString("hex");
|
|
10762
|
-
if (!await this.redis.setIfAbsent(
|
|
10763
|
-
throw new AuthException(AUTH_ERROR_CODES.MFA_STATE_CONFLICT);
|
|
10764
|
-
}
|
|
10765
|
-
if (acquireLegacy && !await this.redis.setIfAbsent(legacyLockKey, lockToken, MFA_TRANSITION_LOCK_TTL_SECONDS)) {
|
|
10766
|
-
await this.redis.eval(RELEASE_LOCK_LUA, [
|
|
10767
|
-
scopedLockKey
|
|
10768
|
-
], [
|
|
10769
|
-
lockToken
|
|
10770
|
-
]);
|
|
10887
|
+
if (!await this.redis.setIfAbsent(lockKey, lockToken, MFA_TRANSITION_LOCK_TTL_SECONDS)) {
|
|
10771
10888
|
throw new AuthException(AUTH_ERROR_CODES.MFA_STATE_CONFLICT);
|
|
10772
10889
|
}
|
|
10773
10890
|
try {
|
|
@@ -10792,17 +10909,10 @@ var MfaRecordService = class {
|
|
|
10792
10909
|
return true;
|
|
10793
10910
|
} finally {
|
|
10794
10911
|
await this.redis.eval(RELEASE_LOCK_LUA, [
|
|
10795
|
-
|
|
10912
|
+
lockKey
|
|
10796
10913
|
], [
|
|
10797
10914
|
lockToken
|
|
10798
10915
|
]);
|
|
10799
|
-
if (acquireLegacy) {
|
|
10800
|
-
await this.redis.eval(RELEASE_LOCK_LUA, [
|
|
10801
|
-
legacyLockKey
|
|
10802
|
-
], [
|
|
10803
|
-
lockToken
|
|
10804
|
-
]);
|
|
10805
|
-
}
|
|
10806
10916
|
}
|
|
10807
10917
|
}
|
|
10808
10918
|
/**
|
|
@@ -10844,21 +10954,13 @@ var MfaRecordService = class {
|
|
|
10844
10954
|
* both the subject and the code value prevents code disclosure in Redis and cross-user,
|
|
10845
10955
|
* cross-tenant and cross-plane replay alike.
|
|
10846
10956
|
*
|
|
10847
|
-
* A second marker under the plane-only preimage `{context}:{userId}:{code}` is written and
|
|
10848
|
-
* required alongside it; see the call site for why both must be fresh while pods of two
|
|
10849
|
-
* versions are live.
|
|
10850
|
-
*
|
|
10851
10957
|
* @returns `true` if the code is valid and has not been replayed, `false` otherwise.
|
|
10852
10958
|
*/
|
|
10853
10959
|
async verifyTotpWithAntiReplay(context, userId, secretBase32, code, window, tenantId) {
|
|
10854
10960
|
if (!verifyTotp(secretBase32, code, window)) return false;
|
|
10855
10961
|
const ttl = totpAntiReplayTtlSeconds(window);
|
|
10856
|
-
const
|
|
10857
|
-
|
|
10858
|
-
const scopedIsNew = await this.redis.setnx(scopedReplayKey, ttl);
|
|
10859
|
-
if (scopedReplayKey === legacyReplayKey) return scopedIsNew;
|
|
10860
|
-
const legacyIsNew = await this.redis.setnx(legacyReplayKey, ttl);
|
|
10861
|
-
return scopedIsNew && legacyIsNew;
|
|
10962
|
+
const replayKey = `tu:${hmacSha256(`${userSubject(context, userId, tenantId)}:${code}`, this.options.hmacKey)}`;
|
|
10963
|
+
return await this.redis.setnx(replayKey, ttl);
|
|
10862
10964
|
}
|
|
10863
10965
|
/**
|
|
10864
10966
|
* Fetches a user from the correct repository based on the MFA context, and refuses one whose
|
|
@@ -13283,7 +13385,7 @@ var PasswordResetService = class _PasswordResetService {
|
|
|
13283
13385
|
if (!user?.passwordHash) {
|
|
13284
13386
|
throw new AuthException(AUTH_ERROR_CODES.INVALID_CREDENTIALS);
|
|
13285
13387
|
}
|
|
13286
|
-
const bfIdentifier =
|
|
13388
|
+
const bfIdentifier = reproofCounterId("change-password", userId, tenantId, this.options.hmacKey);
|
|
13287
13389
|
if (await this.bruteForce.isLockedOut(bfIdentifier)) {
|
|
13288
13390
|
this.logger.warn(`changePassword: account locked userId=${logSafe(userId)}`);
|
|
13289
13391
|
throw new AuthException(AUTH_ERROR_CODES.ACCOUNT_LOCKED);
|
|
@@ -15168,7 +15270,8 @@ var WorkspacePageQueryDto = class {
|
|
|
15168
15270
|
/**
|
|
15169
15271
|
* The `nextCursor` of the previous page; absent for the first page.
|
|
15170
15272
|
*
|
|
15171
|
-
*
|
|
15273
|
+
* The length bound is the one the cursor codec reads, so a cursor the library issues is always one
|
|
15274
|
+
* this accepts, and an oversized value stays away from the repository.
|
|
15172
15275
|
*/
|
|
15173
15276
|
cursor;
|
|
15174
15277
|
/**
|
|
@@ -15182,7 +15285,7 @@ _ts_decorate62([
|
|
|
15182
15285
|
IsOptional(),
|
|
15183
15286
|
IsString(),
|
|
15184
15287
|
IsNotEmpty(),
|
|
15185
|
-
MaxLength(
|
|
15288
|
+
MaxLength(WORKSPACE_CURSOR_MAX_LENGTH),
|
|
15186
15289
|
Matches(NO_CONTROL_CHARACTERS, {
|
|
15187
15290
|
message: "cursor must not contain control characters"
|
|
15188
15291
|
}),
|
|
@@ -15252,8 +15355,8 @@ function membershipCacheKeyBase(tenantId, workspaceId, userId, hmacKey) {
|
|
|
15252
15355
|
__name(membershipCacheKeyBase, "membershipCacheKeyBase");
|
|
15253
15356
|
|
|
15254
15357
|
// src/server/utils/resolve-request-workspace.ts
|
|
15255
|
-
var
|
|
15256
|
-
var WORKSPACE_ID_RULE = `workspaceId must be 1 to ${
|
|
15358
|
+
var WORKSPACE_ID_MAX_LENGTH = 128;
|
|
15359
|
+
var WORKSPACE_ID_RULE = `workspaceId must be 1 to ${WORKSPACE_ID_MAX_LENGTH} code points, not blank, with no control characters`;
|
|
15257
15360
|
function invalidWorkspaceId(message) {
|
|
15258
15361
|
throw new AuthException(AUTH_ERROR_CODES.VALIDATION, [
|
|
15259
15362
|
{
|
|
@@ -15264,7 +15367,7 @@ function invalidWorkspaceId(message) {
|
|
|
15264
15367
|
}
|
|
15265
15368
|
__name(invalidWorkspaceId, "invalidWorkspaceId");
|
|
15266
15369
|
function assertWorkspaceId(value) {
|
|
15267
|
-
if (typeof value !== "string" || value.trim() === "" || exceedsCodePoints(value,
|
|
15370
|
+
if (typeof value !== "string" || value.trim() === "" || exceedsCodePoints(value, WORKSPACE_ID_MAX_LENGTH) || !NO_CONTROL_CHARACTERS.test(value)) {
|
|
15268
15371
|
return invalidWorkspaceId(WORKSPACE_ID_RULE);
|
|
15269
15372
|
}
|
|
15270
15373
|
return value;
|
|
@@ -17602,7 +17705,8 @@ var WorkspaceInvitationService = class {
|
|
|
17602
17705
|
role: record.role,
|
|
17603
17706
|
inviteToken: token,
|
|
17604
17707
|
expiresAt: new Date(Date.parse(record.createdAt) + ttl * 1e3),
|
|
17605
|
-
accountExists
|
|
17708
|
+
accountExists,
|
|
17709
|
+
kind: record.kind
|
|
17606
17710
|
});
|
|
17607
17711
|
} catch (err) {
|
|
17608
17712
|
throw new Error(describeChannelStatus(err));
|
|
@@ -20173,6 +20277,32 @@ function isStoredOAuthState(value) {
|
|
|
20173
20277
|
}
|
|
20174
20278
|
__name(isStoredOAuthState, "isStoredOAuthState");
|
|
20175
20279
|
|
|
20280
|
+
// src/server/oauth/plugin-deadline.ts
|
|
20281
|
+
var OAUTH_PLUGIN_DEFAULT_TIMEOUT_MS = 1e4;
|
|
20282
|
+
var OAUTH_PLUGIN_MAX_TIMEOUT_MS = 12e4;
|
|
20283
|
+
function pluginDeadlineMs(plugin) {
|
|
20284
|
+
const { timeoutMs } = plugin;
|
|
20285
|
+
return typeof timeoutMs === "number" && Number.isInteger(timeoutMs) && timeoutMs >= 1 && timeoutMs <= OAUTH_PLUGIN_MAX_TIMEOUT_MS ? timeoutMs : OAUTH_PLUGIN_DEFAULT_TIMEOUT_MS;
|
|
20286
|
+
}
|
|
20287
|
+
__name(pluginDeadlineMs, "pluginDeadlineMs");
|
|
20288
|
+
async function withDeadline(work, ms) {
|
|
20289
|
+
let timer;
|
|
20290
|
+
const expiry = new Promise((_resolve, reject) => {
|
|
20291
|
+
timer = setTimeout(() => {
|
|
20292
|
+
reject(new Error(`the plugin did not answer within ${ms} ms`));
|
|
20293
|
+
}, ms);
|
|
20294
|
+
});
|
|
20295
|
+
try {
|
|
20296
|
+
return await Promise.race([
|
|
20297
|
+
work(),
|
|
20298
|
+
expiry
|
|
20299
|
+
]);
|
|
20300
|
+
} finally {
|
|
20301
|
+
clearTimeout(timer);
|
|
20302
|
+
}
|
|
20303
|
+
}
|
|
20304
|
+
__name(withDeadline, "withDeadline");
|
|
20305
|
+
|
|
20176
20306
|
// src/server/constants/oauth-state-cookie.ts
|
|
20177
20307
|
var OAUTH_STATE_COOKIE_NAME = "oauth_state";
|
|
20178
20308
|
var OAUTH_STATE_COOKIE_SAME_SITE = "lax";
|
|
@@ -20535,12 +20665,15 @@ var OAuthService = class _OAuthService {
|
|
|
20535
20665
|
* @param code - The authorization code.
|
|
20536
20666
|
* @param codeVerifier - The PKCE verifier stored with the state.
|
|
20537
20667
|
* @returns The normalized profile.
|
|
20538
|
-
* @throws `AuthException(OAUTH_FAILED)` when the exchange or the fetch fails
|
|
20668
|
+
* @throws `AuthException(OAUTH_FAILED)` when the exchange or the fetch fails, or the plugin's
|
|
20669
|
+
* deadline passes first.
|
|
20539
20670
|
*/
|
|
20540
20671
|
async fetchProfile(plugin, provider, code, codeVerifier) {
|
|
20541
20672
|
try {
|
|
20542
|
-
|
|
20543
|
-
|
|
20673
|
+
return await withDeadline(async () => {
|
|
20674
|
+
const tokenResponse = await plugin.exchangeCode(code, codeVerifier);
|
|
20675
|
+
return await plugin.fetchProfile(tokenResponse.access_token);
|
|
20676
|
+
}, pluginDeadlineMs(plugin));
|
|
20544
20677
|
} catch (err) {
|
|
20545
20678
|
this.logger.error(`OAuth plugin '${provider}' failed during code exchange or profile fetch: ` + describeChannelStatus(err));
|
|
20546
20679
|
throw new AuthException(AUTH_ERROR_CODES.OAUTH_FAILED);
|
|
@@ -21260,6 +21393,11 @@ var GoogleOAuthPlugin = class {
|
|
|
21260
21393
|
}
|
|
21261
21394
|
/** Stable provider identifier used as a route segment and storage key. */
|
|
21262
21395
|
name = "google";
|
|
21396
|
+
/**
|
|
21397
|
+
* The library's deadline for the two requests together: each is bounded at 10 s by its own abort
|
|
21398
|
+
* signal, so the pair is 20 s and the library never cuts in before the plugin's own bound.
|
|
21399
|
+
*/
|
|
21400
|
+
timeoutMs = 2e4;
|
|
21263
21401
|
clientId;
|
|
21264
21402
|
/** The Google client secret, withheld from serialization. */
|
|
21265
21403
|
#clientSecret;
|
|
@@ -22153,7 +22291,7 @@ var REQUEST_SCHEMAS = {
|
|
|
22153
22291
|
"cursor": {
|
|
22154
22292
|
"type": "string",
|
|
22155
22293
|
"pattern": "^[^\\u0000-\\u001F\\u007F-\\u009F]+$",
|
|
22156
|
-
"maxLength":
|
|
22294
|
+
"maxLength": 4096,
|
|
22157
22295
|
"minLength": 1
|
|
22158
22296
|
},
|
|
22159
22297
|
"limit": {
|
|
@@ -23099,6 +23237,164 @@ var NoOpEmailProvider = class _NoOpEmailProvider {
|
|
|
23099
23237
|
NoOpEmailProvider = _ts_decorate97([
|
|
23100
23238
|
Injectable()
|
|
23101
23239
|
], NoOpEmailProvider);
|
|
23240
|
+
function _ts_decorate98(decorators, target, key, desc) {
|
|
23241
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
23242
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
23243
|
+
r = Reflect.decorate(decorators, target, key, desc);
|
|
23244
|
+
} else {
|
|
23245
|
+
for (var i = decorators.length - 1; i >= 0; i--) {
|
|
23246
|
+
if (d = decorators[i]) {
|
|
23247
|
+
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
23248
|
+
}
|
|
23249
|
+
}
|
|
23250
|
+
}
|
|
23251
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
23252
|
+
}
|
|
23253
|
+
__name(_ts_decorate98, "_ts_decorate");
|
|
23254
|
+
function _ts_metadata94(metadataKey, metadataValue) {
|
|
23255
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
23256
|
+
return Reflect.metadata(metadataKey, metadataValue);
|
|
23257
|
+
}
|
|
23258
|
+
}
|
|
23259
|
+
__name(_ts_metadata94, "_ts_metadata");
|
|
23260
|
+
function _ts_param59(paramIndex, decorator) {
|
|
23261
|
+
return function(target, key) {
|
|
23262
|
+
decorator(target, key, paramIndex);
|
|
23263
|
+
};
|
|
23264
|
+
}
|
|
23265
|
+
__name(_ts_param59, "_ts_param");
|
|
23266
|
+
var STARTUP_PING_TIMEOUT_MS = 5e3;
|
|
23267
|
+
var STARTUP_PING_RETRY_MS = 250;
|
|
23268
|
+
var CONNECTING_STATES = [
|
|
23269
|
+
"connecting",
|
|
23270
|
+
"connect",
|
|
23271
|
+
"reconnecting"
|
|
23272
|
+
];
|
|
23273
|
+
function commandTimeoutOf(client) {
|
|
23274
|
+
const options = client.options;
|
|
23275
|
+
if (typeof options !== "object" || options === null) return void 0;
|
|
23276
|
+
const own = options.commandTimeout;
|
|
23277
|
+
const nested = options.redisOptions?.commandTimeout;
|
|
23278
|
+
const found = typeof own === "number" ? own : nested;
|
|
23279
|
+
return typeof found === "number" ? found : void 0;
|
|
23280
|
+
}
|
|
23281
|
+
__name(commandTimeoutOf, "commandTimeoutOf");
|
|
23282
|
+
function addressOf(client) {
|
|
23283
|
+
const options = client.options;
|
|
23284
|
+
if (options?.path != null || options?.sentinels != null) return void 0;
|
|
23285
|
+
const host = options?.host;
|
|
23286
|
+
const port = options?.port;
|
|
23287
|
+
if (typeof host !== "string" || typeof port !== "number") return void 0;
|
|
23288
|
+
if (!/^[A-Za-z0-9._:%-]+$/.test(host)) return void 0;
|
|
23289
|
+
return host.includes(":") ? `[${host}]:${port}` : `${host}:${port}`;
|
|
23290
|
+
}
|
|
23291
|
+
__name(addressOf, "addressOf");
|
|
23292
|
+
function pause(ms) {
|
|
23293
|
+
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
23294
|
+
}
|
|
23295
|
+
__name(pause, "pause");
|
|
23296
|
+
var RedisReadinessService = class _RedisReadinessService {
|
|
23297
|
+
static {
|
|
23298
|
+
__name(this, "RedisReadinessService");
|
|
23299
|
+
}
|
|
23300
|
+
redis;
|
|
23301
|
+
logger = new Logger(_RedisReadinessService.name);
|
|
23302
|
+
constructor(redis) {
|
|
23303
|
+
this.redis = redis;
|
|
23304
|
+
}
|
|
23305
|
+
/**
|
|
23306
|
+
* Waits for a client that is on its way to `ready`, and refuses one that has ended. A client in
|
|
23307
|
+
* any other state is left to the command, which is what starts a lazy connection.
|
|
23308
|
+
*
|
|
23309
|
+
* @param timeoutMs - The time left in the budget.
|
|
23310
|
+
* @throws {Error} When the client ends, or does not become ready in time.
|
|
23311
|
+
*/
|
|
23312
|
+
whenReachable(timeoutMs) {
|
|
23313
|
+
const { status } = this.redis;
|
|
23314
|
+
if (status === "end") {
|
|
23315
|
+
return Promise.reject(new Error("the client is closed"));
|
|
23316
|
+
}
|
|
23317
|
+
if (!CONNECTING_STATES.includes(status)) return Promise.resolve();
|
|
23318
|
+
return new Promise((resolve, reject) => {
|
|
23319
|
+
const settle = /* @__PURE__ */ __name((done) => {
|
|
23320
|
+
clearTimeout(timer);
|
|
23321
|
+
this.redis.off("ready", onReady);
|
|
23322
|
+
this.redis.off("end", onEnd);
|
|
23323
|
+
done();
|
|
23324
|
+
}, "settle");
|
|
23325
|
+
const onReady = /* @__PURE__ */ __name(() => {
|
|
23326
|
+
settle(resolve);
|
|
23327
|
+
}, "onReady");
|
|
23328
|
+
const onEnd = /* @__PURE__ */ __name(() => {
|
|
23329
|
+
settle(() => {
|
|
23330
|
+
reject(new Error("the client gave up connecting"));
|
|
23331
|
+
});
|
|
23332
|
+
}, "onEnd");
|
|
23333
|
+
const timer = setTimeout(() => {
|
|
23334
|
+
settle(() => {
|
|
23335
|
+
reject(new Error("the client did not become ready"));
|
|
23336
|
+
});
|
|
23337
|
+
}, timeoutMs);
|
|
23338
|
+
this.redis.once("ready", onReady);
|
|
23339
|
+
this.redis.once("end", onEnd);
|
|
23340
|
+
});
|
|
23341
|
+
}
|
|
23342
|
+
/**
|
|
23343
|
+
* One PING attempt: waits for the client if it is connecting, then sends the command.
|
|
23344
|
+
*
|
|
23345
|
+
* @param timeoutMs - The time left in the budget; the attempt gives up when it runs out.
|
|
23346
|
+
* @throws {Error} When the client is closed, the command fails or the time runs out.
|
|
23347
|
+
*/
|
|
23348
|
+
async attempt(timeoutMs) {
|
|
23349
|
+
let timer;
|
|
23350
|
+
const expiry = new Promise((_resolve, reject) => {
|
|
23351
|
+
timer = setTimeout(() => {
|
|
23352
|
+
reject(new Error("the PING did not complete in time"));
|
|
23353
|
+
}, timeoutMs);
|
|
23354
|
+
});
|
|
23355
|
+
try {
|
|
23356
|
+
await Promise.race([
|
|
23357
|
+
this.whenReachable(timeoutMs).then(() => this.redis.ping()),
|
|
23358
|
+
expiry
|
|
23359
|
+
]);
|
|
23360
|
+
} finally {
|
|
23361
|
+
clearTimeout(timer);
|
|
23362
|
+
}
|
|
23363
|
+
}
|
|
23364
|
+
/**
|
|
23365
|
+
* @throws {Error} When the client cannot PING, or Redis does not answer within the budget. The
|
|
23366
|
+
* message names the address from the client's own `host` and `port` and never repeats what
|
|
23367
|
+
* ioredis raised, which can quote a connection string.
|
|
23368
|
+
*/
|
|
23369
|
+
async onApplicationBootstrap() {
|
|
23370
|
+
if (commandTimeoutOf(this.redis) === void 0) {
|
|
23371
|
+
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.");
|
|
23372
|
+
}
|
|
23373
|
+
if (typeof this.redis.ping !== "function") {
|
|
23374
|
+
throw new Error("[BymaxAuthModule] BYMAX_AUTH_REDIS_CLIENT must be an ioredis client.");
|
|
23375
|
+
}
|
|
23376
|
+
const budgetEnd = Date.now() + STARTUP_PING_TIMEOUT_MS;
|
|
23377
|
+
for (; ; ) {
|
|
23378
|
+
try {
|
|
23379
|
+
await this.attempt(Math.max(budgetEnd - Date.now(), 1));
|
|
23380
|
+
return;
|
|
23381
|
+
} catch {
|
|
23382
|
+
if (this.redis.status === "end" || budgetEnd - Date.now() <= STARTUP_PING_RETRY_MS) break;
|
|
23383
|
+
await pause(STARTUP_PING_RETRY_MS);
|
|
23384
|
+
}
|
|
23385
|
+
}
|
|
23386
|
+
const address = addressOf(this.redis);
|
|
23387
|
+
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.`);
|
|
23388
|
+
}
|
|
23389
|
+
};
|
|
23390
|
+
RedisReadinessService = _ts_decorate98([
|
|
23391
|
+
Injectable(),
|
|
23392
|
+
_ts_param59(0, Inject(BYMAX_AUTH_REDIS_CLIENT)),
|
|
23393
|
+
_ts_metadata94("design:type", Function),
|
|
23394
|
+
_ts_metadata94("design:paramtypes", [
|
|
23395
|
+
typeof Redis === "undefined" ? Object : Redis
|
|
23396
|
+
])
|
|
23397
|
+
], RedisReadinessService);
|
|
23102
23398
|
|
|
23103
23399
|
// src/server/services/api-key-clock.ts
|
|
23104
23400
|
var SystemApiKeyClock = class {
|
|
@@ -23110,7 +23406,7 @@ var SystemApiKeyClock = class {
|
|
|
23110
23406
|
return /* @__PURE__ */ new Date();
|
|
23111
23407
|
}
|
|
23112
23408
|
};
|
|
23113
|
-
function
|
|
23409
|
+
function _ts_decorate99(decorators, target, key, desc) {
|
|
23114
23410
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
23115
23411
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
23116
23412
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -23123,19 +23419,19 @@ function _ts_decorate98(decorators, target, key, desc) {
|
|
|
23123
23419
|
}
|
|
23124
23420
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
23125
23421
|
}
|
|
23126
|
-
__name(
|
|
23127
|
-
function
|
|
23422
|
+
__name(_ts_decorate99, "_ts_decorate");
|
|
23423
|
+
function _ts_metadata95(metadataKey, metadataValue) {
|
|
23128
23424
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
23129
23425
|
return Reflect.metadata(metadataKey, metadataValue);
|
|
23130
23426
|
}
|
|
23131
23427
|
}
|
|
23132
|
-
__name(
|
|
23133
|
-
function
|
|
23428
|
+
__name(_ts_metadata95, "_ts_metadata");
|
|
23429
|
+
function _ts_param60(paramIndex, decorator) {
|
|
23134
23430
|
return function(target, key) {
|
|
23135
23431
|
decorator(target, key, paramIndex);
|
|
23136
23432
|
};
|
|
23137
23433
|
}
|
|
23138
|
-
__name(
|
|
23434
|
+
__name(_ts_param60, "_ts_param");
|
|
23139
23435
|
var ApiKeyScopeAuditService = class {
|
|
23140
23436
|
static {
|
|
23141
23437
|
__name(this, "ApiKeyScopeAuditService");
|
|
@@ -23178,21 +23474,21 @@ var ApiKeyScopeAuditService = class {
|
|
|
23178
23474
|
}
|
|
23179
23475
|
}
|
|
23180
23476
|
};
|
|
23181
|
-
ApiKeyScopeAuditService =
|
|
23477
|
+
ApiKeyScopeAuditService = _ts_decorate99([
|
|
23182
23478
|
Injectable(),
|
|
23183
|
-
|
|
23184
|
-
|
|
23185
|
-
|
|
23186
|
-
|
|
23187
|
-
|
|
23188
|
-
|
|
23479
|
+
_ts_param60(0, Inject(DiscoveryService)),
|
|
23480
|
+
_ts_param60(1, Inject(MetadataScanner)),
|
|
23481
|
+
_ts_param60(2, Inject(Reflector)),
|
|
23482
|
+
_ts_param60(3, Inject(BYMAX_AUTH_OPTIONS)),
|
|
23483
|
+
_ts_metadata95("design:type", Function),
|
|
23484
|
+
_ts_metadata95("design:paramtypes", [
|
|
23189
23485
|
typeof DiscoveryService === "undefined" ? Object : DiscoveryService,
|
|
23190
23486
|
typeof MetadataScanner === "undefined" ? Object : MetadataScanner,
|
|
23191
23487
|
typeof Reflector === "undefined" ? Object : Reflector,
|
|
23192
23488
|
typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions
|
|
23193
23489
|
])
|
|
23194
23490
|
], ApiKeyScopeAuditService);
|
|
23195
|
-
function
|
|
23491
|
+
function _ts_decorate100(decorators, target, key, desc) {
|
|
23196
23492
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
23197
23493
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
23198
23494
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -23205,19 +23501,19 @@ function _ts_decorate99(decorators, target, key, desc) {
|
|
|
23205
23501
|
}
|
|
23206
23502
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
23207
23503
|
}
|
|
23208
|
-
__name(
|
|
23209
|
-
function
|
|
23504
|
+
__name(_ts_decorate100, "_ts_decorate");
|
|
23505
|
+
function _ts_metadata96(metadataKey, metadataValue) {
|
|
23210
23506
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
23211
23507
|
return Reflect.metadata(metadataKey, metadataValue);
|
|
23212
23508
|
}
|
|
23213
23509
|
}
|
|
23214
|
-
__name(
|
|
23215
|
-
function
|
|
23510
|
+
__name(_ts_metadata96, "_ts_metadata");
|
|
23511
|
+
function _ts_param61(paramIndex, decorator) {
|
|
23216
23512
|
return function(target, key) {
|
|
23217
23513
|
decorator(target, key, paramIndex);
|
|
23218
23514
|
};
|
|
23219
23515
|
}
|
|
23220
|
-
__name(
|
|
23516
|
+
__name(_ts_param61, "_ts_param");
|
|
23221
23517
|
var API_KEY_MAX_LABEL_LENGTH = 128;
|
|
23222
23518
|
var API_KEY_MAX_OVERLAP_SECONDS = 2592e3;
|
|
23223
23519
|
var CONTROL_CHARACTERS = /[\p{Cc}\p{Cf}\p{Zl}\p{Zp}]/u;
|
|
@@ -23355,13 +23651,13 @@ var ApiKeyService = class {
|
|
|
23355
23651
|
return value;
|
|
23356
23652
|
}
|
|
23357
23653
|
};
|
|
23358
|
-
ApiKeyService =
|
|
23654
|
+
ApiKeyService = _ts_decorate100([
|
|
23359
23655
|
Injectable(),
|
|
23360
|
-
|
|
23361
|
-
|
|
23362
|
-
|
|
23363
|
-
|
|
23364
|
-
|
|
23656
|
+
_ts_param61(0, Inject(BYMAX_AUTH_API_KEY_REPOSITORY)),
|
|
23657
|
+
_ts_param61(1, Inject(BYMAX_AUTH_API_KEY_CLOCK)),
|
|
23658
|
+
_ts_param61(2, Inject(BYMAX_AUTH_OPTIONS)),
|
|
23659
|
+
_ts_metadata96("design:type", Function),
|
|
23660
|
+
_ts_metadata96("design:paramtypes", [
|
|
23365
23661
|
typeof IApiKeyRepository === "undefined" ? Object : IApiKeyRepository,
|
|
23366
23662
|
typeof ApiKeyClock === "undefined" ? Object : ApiKeyClock,
|
|
23367
23663
|
typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions
|
|
@@ -23443,7 +23739,7 @@ async function assertTenantBinding(options, handshake, tenantId) {
|
|
|
23443
23739
|
__name(assertTenantBinding, "assertTenantBinding");
|
|
23444
23740
|
|
|
23445
23741
|
// src/server/services/auth-token-verifier.service.ts
|
|
23446
|
-
function
|
|
23742
|
+
function _ts_decorate101(decorators, target, key, desc) {
|
|
23447
23743
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
23448
23744
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
23449
23745
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -23456,19 +23752,19 @@ function _ts_decorate100(decorators, target, key, desc) {
|
|
|
23456
23752
|
}
|
|
23457
23753
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
23458
23754
|
}
|
|
23459
|
-
__name(
|
|
23460
|
-
function
|
|
23755
|
+
__name(_ts_decorate101, "_ts_decorate");
|
|
23756
|
+
function _ts_metadata97(metadataKey, metadataValue) {
|
|
23461
23757
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
23462
23758
|
return Reflect.metadata(metadataKey, metadataValue);
|
|
23463
23759
|
}
|
|
23464
23760
|
}
|
|
23465
|
-
__name(
|
|
23466
|
-
function
|
|
23761
|
+
__name(_ts_metadata97, "_ts_metadata");
|
|
23762
|
+
function _ts_param62(paramIndex, decorator) {
|
|
23467
23763
|
return function(target, key) {
|
|
23468
23764
|
decorator(target, key, paramIndex);
|
|
23469
23765
|
};
|
|
23470
23766
|
}
|
|
23471
|
-
__name(
|
|
23767
|
+
__name(_ts_param62, "_ts_param");
|
|
23472
23768
|
var AuthTokenVerifierService = class _AuthTokenVerifierService {
|
|
23473
23769
|
static {
|
|
23474
23770
|
__name(this, "AuthTokenVerifierService");
|
|
@@ -23548,11 +23844,14 @@ var AuthTokenVerifierService = class _AuthTokenVerifierService {
|
|
|
23548
23844
|
};
|
|
23549
23845
|
}
|
|
23550
23846
|
/**
|
|
23551
|
-
* The function that admits a caller to a workspace
|
|
23552
|
-
*
|
|
23847
|
+
* The function that admits a caller to a workspace. On a plane with no workspaces that is a
|
|
23848
|
+
* `TypeError` raised at once, a programmer's error. On a deployment that has not enabled them the
|
|
23849
|
+
* function is returned and refuses with the `auth.validation` error naming `workspaceId` when it is
|
|
23850
|
+
* called, which is after the token has been verified: the id came from a client, and an anonymous
|
|
23851
|
+
* caller must get `TOKEN_INVALID`, not a description of the deployment.
|
|
23553
23852
|
*
|
|
23554
|
-
*
|
|
23555
|
-
* for a malformed id and then the guard's refusals.
|
|
23853
|
+
* Otherwise the returned function admits the caller as `WorkspaceGuard` would a route, with
|
|
23854
|
+
* `auth.validation` for a malformed id and then the guard's refusals.
|
|
23556
23855
|
*/
|
|
23557
23856
|
workspaceResolver(plane) {
|
|
23558
23857
|
if (plane !== "dashboard") {
|
|
@@ -23562,7 +23861,12 @@ var AuthTokenVerifierService = class _AuthTokenVerifierService {
|
|
|
23562
23861
|
const group = this.options.workspaces;
|
|
23563
23862
|
const denied = this.deniedEvents;
|
|
23564
23863
|
if (access === null || group === void 0) {
|
|
23565
|
-
|
|
23864
|
+
return () => Promise.reject(new AuthException(AUTH_ERROR_CODES.VALIDATION, [
|
|
23865
|
+
{
|
|
23866
|
+
field: "workspaceId",
|
|
23867
|
+
message: "workspaceId is not accepted: workspaces are not enabled for this deployment"
|
|
23868
|
+
}
|
|
23869
|
+
]));
|
|
23566
23870
|
}
|
|
23567
23871
|
return async (payload, check) => {
|
|
23568
23872
|
const workspaceId = assertWorkspaceId(check.workspaceId);
|
|
@@ -23670,18 +23974,18 @@ var AuthTokenVerifierService = class _AuthTokenVerifierService {
|
|
|
23670
23974
|
}
|
|
23671
23975
|
}
|
|
23672
23976
|
};
|
|
23673
|
-
AuthTokenVerifierService =
|
|
23977
|
+
AuthTokenVerifierService = _ts_decorate101([
|
|
23674
23978
|
Injectable(),
|
|
23675
|
-
|
|
23676
|
-
|
|
23677
|
-
|
|
23678
|
-
|
|
23679
|
-
|
|
23680
|
-
|
|
23681
|
-
|
|
23682
|
-
|
|
23683
|
-
|
|
23684
|
-
|
|
23979
|
+
_ts_param62(0, Inject(JwtService)),
|
|
23980
|
+
_ts_param62(1, Inject(BYMAX_AUTH_OPTIONS)),
|
|
23981
|
+
_ts_param62(2, Inject(AuthRevocationService)),
|
|
23982
|
+
_ts_param62(3, Inject(AccountStatusService)),
|
|
23983
|
+
_ts_param62(4, Inject(WorkspaceAccessService)),
|
|
23984
|
+
_ts_param62(4, Optional()),
|
|
23985
|
+
_ts_param62(5, Inject(WorkspaceDeniedEventsService)),
|
|
23986
|
+
_ts_param62(5, Optional()),
|
|
23987
|
+
_ts_metadata97("design:type", Function),
|
|
23988
|
+
_ts_metadata97("design:paramtypes", [
|
|
23685
23989
|
typeof JwtService === "undefined" ? Object : JwtService,
|
|
23686
23990
|
typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions,
|
|
23687
23991
|
typeof AuthRevocationService === "undefined" ? Object : AuthRevocationService,
|
|
@@ -23692,7 +23996,7 @@ AuthTokenVerifierService = _ts_decorate100([
|
|
|
23692
23996
|
], AuthTokenVerifierService);
|
|
23693
23997
|
|
|
23694
23998
|
// src/server/bymax-auth.module.ts
|
|
23695
|
-
function
|
|
23999
|
+
function _ts_decorate102(decorators, target, key, desc) {
|
|
23696
24000
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
23697
24001
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
23698
24002
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -23705,7 +24009,7 @@ function _ts_decorate101(decorators, target, key, desc) {
|
|
|
23705
24009
|
}
|
|
23706
24010
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
23707
24011
|
}
|
|
23708
|
-
__name(
|
|
24012
|
+
__name(_ts_decorate102, "_ts_decorate");
|
|
23709
24013
|
function hasProviderToken(providers, token) {
|
|
23710
24014
|
return providers.some((p) => {
|
|
23711
24015
|
if (typeof p === "function") return false;
|
|
@@ -23803,9 +24107,7 @@ var BymaxAuthModule = class _BymaxAuthModule {
|
|
|
23803
24107
|
if (includeWorkspaceController && resolved.workspaces === void 0) {
|
|
23804
24108
|
throw new Error("[BymaxAuthModule] controllers.workspaces: true requires workspaces.enabled: true and both workspace repository providers in extraProviders.");
|
|
23805
24109
|
}
|
|
23806
|
-
|
|
23807
|
-
throw new Error("[BymaxAuthModule] controllers.workspaceInvitations: true requires workspaces.enabled: true and both workspace repository providers in extraProviders.");
|
|
23808
|
-
}
|
|
24110
|
+
assertInvitationControllers(resolved, includeWorkspaceInvitations, includeInvitations);
|
|
23809
24111
|
if (resolved.apiKeys.auditMode === "required" && cannotAuditApiKeys(extraProviders)) {
|
|
23810
24112
|
throw new Error("[BymaxAuthModule] apiKeys.auditMode: 'required' needs an onApiKeyRequest hook, and the BYMAX_AUTH_HOOKS provider has none. Implement it, or use auditMode: 'best-effort'.");
|
|
23811
24113
|
}
|
|
@@ -23979,10 +24281,10 @@ var BymaxAuthModule = class _BymaxAuthModule {
|
|
|
23979
24281
|
...breachCheckerProviders,
|
|
23980
24282
|
...hooksProviders,
|
|
23981
24283
|
// Core services.
|
|
23982
|
-
// AuthRedisService is registered directly (not via AuthRedisModule) so that
|
|
23983
|
-
//
|
|
23984
|
-
// are visible in the same module scope.
|
|
24284
|
+
// AuthRedisService is registered directly (not via AuthRedisModule) so that the client and
|
|
24285
|
+
// the options provided via extraProviders are visible in the same module scope.
|
|
23985
24286
|
AuthRedisService,
|
|
24287
|
+
RedisReadinessService,
|
|
23986
24288
|
AuthRevocationService,
|
|
23987
24289
|
AccountStatusService,
|
|
23988
24290
|
AuthTokenVerifierService,
|
|
@@ -24097,9 +24399,9 @@ var BymaxAuthModule = class _BymaxAuthModule {
|
|
|
24097
24399
|
// exported for the same @UseGuards() reason as the entries around it: the guard is
|
|
24098
24400
|
// re-instantiated in the consumer's injector, where an unexported dep fails their boot.
|
|
24099
24401
|
AccountStatusService,
|
|
24100
|
-
// AuthTokenVerifierService is
|
|
24101
|
-
//
|
|
24102
|
-
//
|
|
24402
|
+
// AuthTokenVerifierService is the one call that establishes everything a guarded route
|
|
24403
|
+
// establishes, which is what a long-lived transport needs and cannot assemble from the
|
|
24404
|
+
// exported parts alone. `WsJwtGuard` depends on it, and a host may call it directly.
|
|
24103
24405
|
AuthTokenVerifierService,
|
|
24104
24406
|
// Same reason, for the two exported guards whose remaining constructor deps are not
|
|
24105
24407
|
// covered by the entries above. Exporting the guard class is necessary but not
|
|
@@ -24108,7 +24410,7 @@ var BymaxAuthModule = class _BymaxAuthModule {
|
|
|
24108
24410
|
// UnknownDependenciesException even though the guard itself is exported.
|
|
24109
24411
|
//
|
|
24110
24412
|
// UserStatusGuard -> AccountStatusService
|
|
24111
|
-
// WsJwtGuard -> WsTicketService
|
|
24413
|
+
// WsJwtGuard -> AuthTokenVerifierService, WsTicketService
|
|
24112
24414
|
//
|
|
24113
24415
|
// Only the DIRECT dependency needs exporting. An exported provider arrives already
|
|
24114
24416
|
// instantiated, so the consumer's injector binds that instance and never re-resolves its
|
|
@@ -24152,7 +24454,7 @@ var BymaxAuthModule = class _BymaxAuthModule {
|
|
|
24152
24454
|
};
|
|
24153
24455
|
}
|
|
24154
24456
|
};
|
|
24155
|
-
BymaxAuthModule =
|
|
24457
|
+
BymaxAuthModule = _ts_decorate102([
|
|
24156
24458
|
Module({})
|
|
24157
24459
|
], BymaxAuthModule);
|
|
24158
24460
|
|
|
@@ -24182,29 +24484,39 @@ function authDocumentSecurity({ guard, tokenDelivery }) {
|
|
|
24182
24484
|
return Object.freeze(schemes.map(requirementFor));
|
|
24183
24485
|
}
|
|
24184
24486
|
__name(authDocumentSecurity, "authDocumentSecurity");
|
|
24185
|
-
|
|
24186
|
-
|
|
24187
|
-
"passwordResetOtp",
|
|
24188
|
-
"emailVerificationOtp",
|
|
24189
|
-
"passwordChanged",
|
|
24190
|
-
"emailChangeVerification",
|
|
24191
|
-
"emailChanged",
|
|
24192
|
-
"mfaEnabled",
|
|
24193
|
-
"mfaDisabled",
|
|
24194
|
-
"newSessionAlert",
|
|
24195
|
-
"invitation"
|
|
24196
|
-
];
|
|
24197
|
-
Object.freeze(AUTH_EMAIL_KINDS);
|
|
24198
|
-
var CREDENTIAL_BEARING_KINDS = /* @__PURE__ */ new Set([
|
|
24199
|
-
"passwordResetToken",
|
|
24200
|
-
"passwordResetOtp",
|
|
24201
|
-
"emailVerificationOtp",
|
|
24202
|
-
"emailChangeVerification",
|
|
24203
|
-
"invitation"
|
|
24204
|
-
]);
|
|
24205
|
-
var KNOWN_EMAIL_KINDS = new Set(AUTH_EMAIL_KINDS);
|
|
24487
|
+
|
|
24488
|
+
// src/server/providers/default-auth-email.messages.ts
|
|
24206
24489
|
var CODE_VALIDITY_TEXT = "It expires shortly, so use it soon.";
|
|
24207
24490
|
var UNEXPECTED_CHANGE_TEXT = "If this was not you, secure your account immediately: change your password and sign out of every session.";
|
|
24491
|
+
function hasInviter(invite) {
|
|
24492
|
+
return invite.inviterName.trim() !== "";
|
|
24493
|
+
}
|
|
24494
|
+
__name(hasInviter, "hasInviter");
|
|
24495
|
+
function workspaceInvitationSubject(invite) {
|
|
24496
|
+
if (invite.kind === "member") {
|
|
24497
|
+
return `${invite.inviterName} invited you to ${invite.workspaceName}`;
|
|
24498
|
+
}
|
|
24499
|
+
return hasInviter(invite) ? `${invite.inviterName} invited you to set up ${invite.workspaceName}` : `You have been invited to set up ${invite.workspaceName}`;
|
|
24500
|
+
}
|
|
24501
|
+
__name(workspaceInvitationSubject, "workspaceInvitationSubject");
|
|
24502
|
+
function workspaceInvitationOpening(invite) {
|
|
24503
|
+
if (invite.kind === "member") {
|
|
24504
|
+
return `${invite.inviterName} invited you to the workspace ${invite.workspaceName} as ${invite.role}.`;
|
|
24505
|
+
}
|
|
24506
|
+
const subject = hasInviter(invite) ? `${invite.inviterName} invited you` : "You have been invited";
|
|
24507
|
+
return `${subject} to set up the workspace ${invite.workspaceName} as its owner.`;
|
|
24508
|
+
}
|
|
24509
|
+
__name(workspaceInvitationOpening, "workspaceInvitationOpening");
|
|
24510
|
+
function workspaceInvitationText(invite) {
|
|
24511
|
+
const step = invite.accountExists ? "Sign in" : "Create your account";
|
|
24512
|
+
return [
|
|
24513
|
+
workspaceInvitationOpening(invite),
|
|
24514
|
+
`${step} and use this token to accept: ${invite.inviteToken}`,
|
|
24515
|
+
`It expires on ${invite.expiresAt.toISOString()}.`,
|
|
24516
|
+
"If you were not expecting this invitation, ignore this message."
|
|
24517
|
+
].join("\n\n");
|
|
24518
|
+
}
|
|
24519
|
+
__name(workspaceInvitationText, "workspaceInvitationText");
|
|
24208
24520
|
var DEFAULT_MESSAGES = {
|
|
24209
24521
|
passwordResetToken: /* @__PURE__ */ __name(({ token }) => ({
|
|
24210
24522
|
subject: "Reset your password",
|
|
@@ -24281,8 +24593,37 @@ Use this token to accept: ${invite.inviteToken}
|
|
|
24281
24593
|
It expires on ${invite.expiresAt.toISOString()}.
|
|
24282
24594
|
|
|
24283
24595
|
If you were not expecting this invitation, ignore this message.`
|
|
24284
|
-
}), "invitation")
|
|
24596
|
+
}), "invitation"),
|
|
24597
|
+
workspaceInvitation: /* @__PURE__ */ __name(({ invite }) => ({
|
|
24598
|
+
subject: workspaceInvitationSubject(invite),
|
|
24599
|
+
text: workspaceInvitationText(invite)
|
|
24600
|
+
}), "workspaceInvitation")
|
|
24285
24601
|
};
|
|
24602
|
+
|
|
24603
|
+
// src/server/providers/default-auth-email.provider.ts
|
|
24604
|
+
var AUTH_EMAIL_KINDS = [
|
|
24605
|
+
"passwordResetToken",
|
|
24606
|
+
"passwordResetOtp",
|
|
24607
|
+
"emailVerificationOtp",
|
|
24608
|
+
"passwordChanged",
|
|
24609
|
+
"emailChangeVerification",
|
|
24610
|
+
"emailChanged",
|
|
24611
|
+
"mfaEnabled",
|
|
24612
|
+
"mfaDisabled",
|
|
24613
|
+
"newSessionAlert",
|
|
24614
|
+
"invitation",
|
|
24615
|
+
"workspaceInvitation"
|
|
24616
|
+
];
|
|
24617
|
+
Object.freeze(AUTH_EMAIL_KINDS);
|
|
24618
|
+
var CREDENTIAL_BEARING_KINDS = /* @__PURE__ */ new Set([
|
|
24619
|
+
"passwordResetToken",
|
|
24620
|
+
"passwordResetOtp",
|
|
24621
|
+
"emailVerificationOtp",
|
|
24622
|
+
"emailChangeVerification",
|
|
24623
|
+
"invitation",
|
|
24624
|
+
"workspaceInvitation"
|
|
24625
|
+
]);
|
|
24626
|
+
var KNOWN_EMAIL_KINDS = new Set(AUTH_EMAIL_KINDS);
|
|
24286
24627
|
function escapeHtml(value) {
|
|
24287
24628
|
return value.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
24288
24629
|
}
|
|
@@ -24309,7 +24650,7 @@ var DefaultAuthEmailProvider = class _DefaultAuthEmailProvider {
|
|
|
24309
24650
|
*
|
|
24310
24651
|
* A `Map`, not the plain object the option accepts. An object lookup walks the prototype chain,
|
|
24311
24652
|
* so `policy['toString']` answers with a function rather than `undefined` — unreachable here,
|
|
24312
|
-
* because the key is a closed union of
|
|
24653
|
+
* because the key is a closed union of literals this file writes, but "the key cannot be
|
|
24313
24654
|
* dangerous" is a property of today's call sites and not of the lookup. A `Map` has no prototype
|
|
24314
24655
|
* chain to walk, which makes it a property of the data structure instead.
|
|
24315
24656
|
*/
|
|
@@ -24435,6 +24776,14 @@ var DefaultAuthEmailProvider = class _DefaultAuthEmailProvider {
|
|
|
24435
24776
|
locale
|
|
24436
24777
|
}), "invitation");
|
|
24437
24778
|
}
|
|
24779
|
+
async sendWorkspaceInvitation(tenantId, email, data, locale) {
|
|
24780
|
+
await this.deliver(tenantId, email, this.messages.workspaceInvitation({
|
|
24781
|
+
tenantId,
|
|
24782
|
+
email,
|
|
24783
|
+
invite: data,
|
|
24784
|
+
locale
|
|
24785
|
+
}), "workspaceInvitation");
|
|
24786
|
+
}
|
|
24438
24787
|
/**
|
|
24439
24788
|
* Renders the body to HTML (unless the message already carries its own), hands the message to the
|
|
24440
24789
|
* channel, and swallows any delivery error.
|
|
@@ -24480,7 +24829,7 @@ var DefaultAuthEmailProvider = class _DefaultAuthEmailProvider {
|
|
|
24480
24829
|
}
|
|
24481
24830
|
}
|
|
24482
24831
|
};
|
|
24483
|
-
function
|
|
24832
|
+
function _ts_decorate103(decorators, target, key, desc) {
|
|
24484
24833
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
24485
24834
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
24486
24835
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -24493,13 +24842,13 @@ function _ts_decorate102(decorators, target, key, desc) {
|
|
|
24493
24842
|
}
|
|
24494
24843
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
24495
24844
|
}
|
|
24496
|
-
__name(
|
|
24497
|
-
function
|
|
24845
|
+
__name(_ts_decorate103, "_ts_decorate");
|
|
24846
|
+
function _ts_metadata98(metadataKey, metadataValue) {
|
|
24498
24847
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
24499
24848
|
return Reflect.metadata(metadataKey, metadataValue);
|
|
24500
24849
|
}
|
|
24501
24850
|
}
|
|
24502
|
-
__name(
|
|
24851
|
+
__name(_ts_metadata98, "_ts_metadata");
|
|
24503
24852
|
var HIBP_RANGE_URL = "https://api.pwnedpasswords.com/range/";
|
|
24504
24853
|
var PREFIX_LENGTH = 5;
|
|
24505
24854
|
var DEFAULT_TIMEOUT_MS = 1500;
|
|
@@ -24556,10 +24905,10 @@ var HibpBreachChecker = class _HibpBreachChecker {
|
|
|
24556
24905
|
}
|
|
24557
24906
|
}
|
|
24558
24907
|
};
|
|
24559
|
-
HibpBreachChecker =
|
|
24908
|
+
HibpBreachChecker = _ts_decorate103([
|
|
24560
24909
|
Injectable(),
|
|
24561
|
-
|
|
24562
|
-
|
|
24910
|
+
_ts_metadata98("design:type", Function),
|
|
24911
|
+
_ts_metadata98("design:paramtypes", [
|
|
24563
24912
|
Number
|
|
24564
24913
|
])
|
|
24565
24914
|
], HibpBreachChecker);
|
|
@@ -24572,10 +24921,10 @@ var AllowAllBreachChecker = class {
|
|
|
24572
24921
|
return false;
|
|
24573
24922
|
}
|
|
24574
24923
|
};
|
|
24575
|
-
AllowAllBreachChecker =
|
|
24924
|
+
AllowAllBreachChecker = _ts_decorate103([
|
|
24576
24925
|
Injectable()
|
|
24577
24926
|
], AllowAllBreachChecker);
|
|
24578
|
-
function
|
|
24927
|
+
function _ts_decorate104(decorators, target, key, desc) {
|
|
24579
24928
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
24580
24929
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
24581
24930
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -24588,7 +24937,7 @@ function _ts_decorate103(decorators, target, key, desc) {
|
|
|
24588
24937
|
}
|
|
24589
24938
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
24590
24939
|
}
|
|
24591
|
-
__name(
|
|
24940
|
+
__name(_ts_decorate104, "_ts_decorate");
|
|
24592
24941
|
var OptionalAuthGuard = class extends JwtAuthGuard {
|
|
24593
24942
|
static {
|
|
24594
24943
|
__name(this, "OptionalAuthGuard");
|
|
@@ -24603,10 +24952,10 @@ var OptionalAuthGuard = class extends JwtAuthGuard {
|
|
|
24603
24952
|
return super.canActivate(context);
|
|
24604
24953
|
}
|
|
24605
24954
|
};
|
|
24606
|
-
OptionalAuthGuard =
|
|
24955
|
+
OptionalAuthGuard = _ts_decorate104([
|
|
24607
24956
|
Injectable()
|
|
24608
24957
|
], OptionalAuthGuard);
|
|
24609
|
-
function
|
|
24958
|
+
function _ts_decorate105(decorators, target, key, desc) {
|
|
24610
24959
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
24611
24960
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
24612
24961
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -24619,19 +24968,19 @@ function _ts_decorate104(decorators, target, key, desc) {
|
|
|
24619
24968
|
}
|
|
24620
24969
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
24621
24970
|
}
|
|
24622
|
-
__name(
|
|
24623
|
-
function
|
|
24971
|
+
__name(_ts_decorate105, "_ts_decorate");
|
|
24972
|
+
function _ts_metadata99(metadataKey, metadataValue) {
|
|
24624
24973
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
24625
24974
|
return Reflect.metadata(metadataKey, metadataValue);
|
|
24626
24975
|
}
|
|
24627
24976
|
}
|
|
24628
|
-
__name(
|
|
24629
|
-
function
|
|
24977
|
+
__name(_ts_metadata99, "_ts_metadata");
|
|
24978
|
+
function _ts_param63(paramIndex, decorator) {
|
|
24630
24979
|
return function(target, key) {
|
|
24631
24980
|
decorator(target, key, paramIndex);
|
|
24632
24981
|
};
|
|
24633
24982
|
}
|
|
24634
|
-
__name(
|
|
24983
|
+
__name(_ts_param63, "_ts_param");
|
|
24635
24984
|
var SelfOrAdminGuard = class {
|
|
24636
24985
|
static {
|
|
24637
24986
|
__name(this, "SelfOrAdminGuard");
|
|
@@ -24667,11 +25016,11 @@ var SelfOrAdminGuard = class {
|
|
|
24667
25016
|
throw new AuthException(AUTH_ERROR_CODES.INSUFFICIENT_ROLE);
|
|
24668
25017
|
}
|
|
24669
25018
|
};
|
|
24670
|
-
SelfOrAdminGuard =
|
|
25019
|
+
SelfOrAdminGuard = _ts_decorate105([
|
|
24671
25020
|
Injectable(),
|
|
24672
|
-
|
|
24673
|
-
|
|
24674
|
-
|
|
25021
|
+
_ts_param63(0, Inject(BYMAX_AUTH_OPTIONS)),
|
|
25022
|
+
_ts_metadata99("design:type", Function),
|
|
25023
|
+
_ts_metadata99("design:paramtypes", [
|
|
24675
25024
|
typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions
|
|
24676
25025
|
])
|
|
24677
25026
|
], SelfOrAdminGuard);
|
|
@@ -24693,7 +25042,7 @@ function isHexLooking(value) {
|
|
|
24693
25042
|
return value.length === 64 && /^[a-fA-F0-9]{64}$/.test(value);
|
|
24694
25043
|
}
|
|
24695
25044
|
__name(isHexLooking, "isHexLooking");
|
|
24696
|
-
function
|
|
25045
|
+
function _ts_decorate106(decorators, target, key, desc) {
|
|
24697
25046
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
24698
25047
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
24699
25048
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -24706,32 +25055,32 @@ function _ts_decorate105(decorators, target, key, desc) {
|
|
|
24706
25055
|
}
|
|
24707
25056
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
24708
25057
|
}
|
|
24709
|
-
__name(
|
|
24710
|
-
function
|
|
25058
|
+
__name(_ts_decorate106, "_ts_decorate");
|
|
25059
|
+
function _ts_metadata100(metadataKey, metadataValue) {
|
|
24711
25060
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
24712
25061
|
return Reflect.metadata(metadataKey, metadataValue);
|
|
24713
25062
|
}
|
|
24714
25063
|
}
|
|
24715
|
-
__name(
|
|
24716
|
-
function
|
|
25064
|
+
__name(_ts_metadata100, "_ts_metadata");
|
|
25065
|
+
function _ts_param64(paramIndex, decorator) {
|
|
24717
25066
|
return function(target, key) {
|
|
24718
25067
|
decorator(target, key, paramIndex);
|
|
24719
25068
|
};
|
|
24720
25069
|
}
|
|
24721
|
-
__name(
|
|
25070
|
+
__name(_ts_param64, "_ts_param");
|
|
24722
25071
|
var WsJwtGuard = class {
|
|
24723
25072
|
static {
|
|
24724
25073
|
__name(this, "WsJwtGuard");
|
|
24725
25074
|
}
|
|
24726
|
-
|
|
24727
|
-
revocation;
|
|
25075
|
+
verifier;
|
|
24728
25076
|
wsTickets;
|
|
24729
25077
|
options;
|
|
24730
|
-
|
|
24731
|
-
|
|
24732
|
-
this.
|
|
25078
|
+
reflector;
|
|
25079
|
+
constructor(verifier, wsTickets, options, reflector) {
|
|
25080
|
+
this.verifier = verifier;
|
|
24733
25081
|
this.wsTickets = wsTickets;
|
|
24734
25082
|
this.options = options;
|
|
25083
|
+
this.reflector = reflector;
|
|
24735
25084
|
}
|
|
24736
25085
|
/**
|
|
24737
25086
|
* Verifies that `@nestjs/websockets` is installed and throws a descriptive
|
|
@@ -24763,37 +25112,32 @@ var WsJwtGuard = class {
|
|
|
24763
25112
|
if (!token) {
|
|
24764
25113
|
throw new AuthException(AUTH_ERROR_CODES.TOKEN_INVALID);
|
|
24765
25114
|
}
|
|
24766
|
-
|
|
24767
|
-
|
|
24768
|
-
|
|
24769
|
-
|
|
24770
|
-
|
|
24771
|
-
|
|
24772
|
-
|
|
24773
|
-
|
|
24774
|
-
|
|
24775
|
-
|
|
24776
|
-
|
|
24777
|
-
if (await this.revocation.isAccessTokenRevoked(payload)) {
|
|
24778
|
-
throw new AuthException(AUTH_ERROR_CODES.TOKEN_INVALID);
|
|
24779
|
-
}
|
|
24780
|
-
await assertTenantBinding(this.options, bindingInput(handshake), payload.tenantId);
|
|
24781
|
-
client.data.user = payload;
|
|
25115
|
+
const skipMfa = this.reflector.getAllAndOverride(SKIP_MFA_KEY, [
|
|
25116
|
+
context.getHandler(),
|
|
25117
|
+
context.getClass()
|
|
25118
|
+
]) === true;
|
|
25119
|
+
const verified = await this.verifier.verifyAccessToken(token, {
|
|
25120
|
+
plane: "dashboard",
|
|
25121
|
+
requireMfa: !skipMfa,
|
|
25122
|
+
checkStatus: true,
|
|
25123
|
+
request: bindingInput(handshake)
|
|
25124
|
+
});
|
|
25125
|
+
client.data.user = verified.payload;
|
|
24782
25126
|
return true;
|
|
24783
25127
|
}
|
|
24784
25128
|
};
|
|
24785
|
-
WsJwtGuard =
|
|
25129
|
+
WsJwtGuard = _ts_decorate106([
|
|
24786
25130
|
Injectable(),
|
|
24787
|
-
|
|
24788
|
-
|
|
24789
|
-
|
|
24790
|
-
|
|
24791
|
-
|
|
24792
|
-
|
|
24793
|
-
typeof
|
|
24794
|
-
typeof AuthRevocationService === "undefined" ? Object : AuthRevocationService,
|
|
25131
|
+
_ts_param64(0, Inject(AuthTokenVerifierService)),
|
|
25132
|
+
_ts_param64(1, Inject(WsTicketService)),
|
|
25133
|
+
_ts_param64(2, Inject(BYMAX_AUTH_OPTIONS)),
|
|
25134
|
+
_ts_param64(3, Inject(Reflector)),
|
|
25135
|
+
_ts_metadata100("design:type", Function),
|
|
25136
|
+
_ts_metadata100("design:paramtypes", [
|
|
25137
|
+
typeof AuthTokenVerifierService === "undefined" ? Object : AuthTokenVerifierService,
|
|
24795
25138
|
typeof WsTicketService === "undefined" ? Object : WsTicketService,
|
|
24796
|
-
typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions
|
|
25139
|
+
typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions,
|
|
25140
|
+
typeof Reflector === "undefined" ? Object : Reflector
|
|
24797
25141
|
])
|
|
24798
25142
|
], WsJwtGuard);
|
|
24799
25143
|
function assertDashboardSnapshot(snapshot) {
|
|
@@ -24829,7 +25173,7 @@ function bindingInput(handshake) {
|
|
|
24829
25173
|
};
|
|
24830
25174
|
}
|
|
24831
25175
|
__name(bindingInput, "bindingInput");
|
|
24832
|
-
function
|
|
25176
|
+
function _ts_decorate107(decorators, target, key, desc) {
|
|
24833
25177
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
24834
25178
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
24835
25179
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -24842,7 +25186,7 @@ function _ts_decorate106(decorators, target, key, desc) {
|
|
|
24842
25186
|
}
|
|
24843
25187
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
24844
25188
|
}
|
|
24845
|
-
__name(
|
|
25189
|
+
__name(_ts_decorate107, "_ts_decorate");
|
|
24846
25190
|
function isAuthEnvelope(body) {
|
|
24847
25191
|
if (typeof body !== "object" || body === null) return false;
|
|
24848
25192
|
const error = body.error;
|
|
@@ -24961,10 +25305,10 @@ var AuthExceptionFilter = class _AuthExceptionFilter {
|
|
|
24961
25305
|
});
|
|
24962
25306
|
}
|
|
24963
25307
|
};
|
|
24964
|
-
AuthExceptionFilter =
|
|
25308
|
+
AuthExceptionFilter = _ts_decorate107([
|
|
24965
25309
|
Catch()
|
|
24966
25310
|
], AuthExceptionFilter);
|
|
24967
|
-
function
|
|
25311
|
+
function _ts_decorate108(decorators, target, key, desc) {
|
|
24968
25312
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
24969
25313
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
24970
25314
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -24977,7 +25321,7 @@ function _ts_decorate107(decorators, target, key, desc) {
|
|
|
24977
25321
|
}
|
|
24978
25322
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
24979
25323
|
}
|
|
24980
|
-
__name(
|
|
25324
|
+
__name(_ts_decorate108, "_ts_decorate");
|
|
24981
25325
|
function isEmittingClient(client) {
|
|
24982
25326
|
return typeof client?.emit === "function";
|
|
24983
25327
|
}
|
|
@@ -25021,7 +25365,7 @@ var WsAuthExceptionFilter = class _WsAuthExceptionFilter {
|
|
|
25021
25365
|
this.logger.error(`refused a request on a client this filter cannot answer: ${describeChannelStatus(exception)}`);
|
|
25022
25366
|
}
|
|
25023
25367
|
};
|
|
25024
|
-
WsAuthExceptionFilter =
|
|
25368
|
+
WsAuthExceptionFilter = _ts_decorate108([
|
|
25025
25369
|
Catch(AuthException)
|
|
25026
25370
|
], WsAuthExceptionFilter);
|
|
25027
25371
|
var ServiceKey = /* @__PURE__ */ __name((...scopes) => applyDecorators(SetMetadata(IS_PUBLIC_KEY, true), ApiKeyScopes(...scopes), UseGuards(ApiKeyGuard)), "ServiceKey");
|
|
@@ -25035,7 +25379,7 @@ var CurrentWsWorkspace = createParamDecorator((_data, context) => {
|
|
|
25035
25379
|
});
|
|
25036
25380
|
|
|
25037
25381
|
// src/server/utils/workspace-scoped.ts
|
|
25038
|
-
var
|
|
25382
|
+
var UNPAIRED_SURROGATE2 = /[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?<![\uD800-\uDBFF])[\uDC00-\uDFFF]/;
|
|
25039
25383
|
function workspaceScopedName(tenantId, workspaceId, ...parts) {
|
|
25040
25384
|
const pieces = [
|
|
25041
25385
|
tenantId,
|
|
@@ -25047,7 +25391,7 @@ function workspaceScopedName(tenantId, workspaceId, ...parts) {
|
|
|
25047
25391
|
}
|
|
25048
25392
|
__name(workspaceScopedName, "workspaceScopedName");
|
|
25049
25393
|
function decodeWorkspaceScopedName(name) {
|
|
25050
|
-
if (
|
|
25394
|
+
if (UNPAIRED_SURROGATE2.test(name)) throw malformed(name);
|
|
25051
25395
|
const bytes = Buffer.from(name, "utf8");
|
|
25052
25396
|
const pieces = [];
|
|
25053
25397
|
let at = 0;
|
|
@@ -25088,7 +25432,7 @@ function assertPiece(piece, index) {
|
|
|
25088
25432
|
if (hasControl(piece)) {
|
|
25089
25433
|
throw new TypeError(`${label} must not contain a control character`);
|
|
25090
25434
|
}
|
|
25091
|
-
if (
|
|
25435
|
+
if (UNPAIRED_SURROGATE2.test(piece)) throw new TypeError(`${label} must be well-formed Unicode`);
|
|
25092
25436
|
}
|
|
25093
25437
|
__name(assertPiece, "assertPiece");
|
|
25094
25438
|
function malformed(name) {
|
|
@@ -25106,4 +25450,4 @@ function stampJobContext(workspace) {
|
|
|
25106
25450
|
}
|
|
25107
25451
|
__name(stampJobContext, "stampJobContext");
|
|
25108
25452
|
|
|
25109
|
-
export { ALLOW_PENDING_WORKSPACE_KEY, ANY_WORKSPACE_MEMBER, API_KEY_MAX_LABEL_LENGTH, API_KEY_MAX_OVERLAP_SECONDS, AUTH_EMAIL_KINDS, AUTH_ERROR_CODES, AUTH_ERROR_MESSAGES, AUTH_ERROR_STATUS, AUTH_SECURITY_SCHEMES, AUTH_THROTTLE_CONFIGS, AcceptInvitationDto, AccountStatusService, AllowAllBreachChecker, AllowPendingWorkspace, ApiKeyGuard, ApiKeyScopes, ApiKeyService, AuthException, AuthExceptionFilter, AuthRateLimit, AuthRateLimitGuard, AuthRevocationService, AuthService, AuthTokenVerifierService, Authenticated, BYMAX_AUTH_API_KEY_CLOCK, BYMAX_AUTH_API_KEY_REPOSITORY, BYMAX_AUTH_BREACH_CHECKER, BYMAX_AUTH_EMAIL_PROVIDER, BYMAX_AUTH_HOOKS, BYMAX_AUTH_MEMBERSHIP_REPOSITORY, BYMAX_AUTH_OPTIONS, BYMAX_AUTH_PLATFORM_USER_REPOSITORY, BYMAX_AUTH_REDIS_CLIENT, BYMAX_AUTH_USER_REPOSITORY, BYMAX_AUTH_WORKSPACE_REPOSITORY, BruteForceService, BymaxAuthModule, ChangePasswordDto, CommonPasswordChecker, CreateInvitationDto, CurrentApiKey, CurrentUser, CurrentWorkspace, CurrentWsWorkspace, DefaultAuthEmailProvider, EmailChangeService, ForgotPasswordDto, HibpBreachChecker, IS_PUBLIC_KEY, InvitationService, JwtAuthGuard, JwtPlatformGuard, LoginDto, MembershipBumpFailedError, MembershipService, MfaChallengeDto, MfaDisableDto, MfaRegenerateRecoveryCodesDto, MfaRequiredGuard, MfaService, MfaVerifyDto, NoOpAuthHooks, NoOpEmailProvider, OAuthService, OptionalAuthGuard, OtpService, PLATFORM_ROLES_KEY, PasswordResetService, PlatformAuthService, PlatformLoginDto, PlatformRoles, PlatformRolesGuard, Public, ROLES_KEY, ReauthenticationService, RegisterDto, RequestEncoding, RequestEncodingGuard, ResendOtpDto, ResendVerificationDto, ResetPasswordDto, Roles, RolesGuard, SKIP_MFA_KEY, SelfOrAdminGuard, ServiceKey, SessionService, SkipMfa, TokenDeliveryService, TrustedOriginGuard, UserStatusGuard, VerifyEmailDto, VerifyOtpDto, WORKSPACE_PERMISSION_KEY, WORKSPACE_ROLES_KEY, WS_TICKET_TTL_SECONDS, WorkspaceAccessService, WorkspaceActionsService, WorkspaceCallerService, WorkspaceGuard, WorkspaceInvitationService, WorkspacePermission, WorkspaceRoles, WorkspaceService, WsAuthExceptionFilter, WsJwtGuard, WsTicketService, WsWorkspaceGuard, authDocumentSecurity, createAuthValidationPipe, decodeWorkspaceScopedName, decrypt, describeChannelStatus, describeError, encrypt, generateSecureToken, hasRole, hmacSha256, redactSecrets, reduceToBaseWord, sanitizeHeaders, sha256, sleep, stampJobContext, timingSafeCompare, workspaceScopedName };
|
|
25453
|
+
export { ALLOW_PENDING_WORKSPACE_KEY, ANY_WORKSPACE_MEMBER, API_KEY_MAX_LABEL_LENGTH, API_KEY_MAX_OVERLAP_SECONDS, AUTH_EMAIL_KINDS, AUTH_ERROR_CODES, AUTH_ERROR_MESSAGES, AUTH_ERROR_STATUS, AUTH_SECRET_MIN_LENGTH, AUTH_SECURITY_SCHEMES, AUTH_THROTTLE_CONFIGS, AcceptInvitationDto, AccountStatusService, AllowAllBreachChecker, AllowPendingWorkspace, ApiKeyGuard, ApiKeyScopes, ApiKeyService, AuthException, AuthExceptionFilter, AuthRateLimit, AuthRateLimitGuard, AuthRevocationService, AuthService, AuthTokenVerifierService, Authenticated, BYMAX_AUTH_API_KEY_CLOCK, BYMAX_AUTH_API_KEY_REPOSITORY, BYMAX_AUTH_BREACH_CHECKER, BYMAX_AUTH_EMAIL_PROVIDER, BYMAX_AUTH_HOOKS, BYMAX_AUTH_MEMBERSHIP_REPOSITORY, BYMAX_AUTH_OPTIONS, BYMAX_AUTH_PLATFORM_USER_REPOSITORY, BYMAX_AUTH_REDIS_CLIENT, BYMAX_AUTH_USER_REPOSITORY, BYMAX_AUTH_WORKSPACE_REPOSITORY, BruteForceService, BymaxAuthModule, ChangePasswordDto, CommonPasswordChecker, CreateInvitationDto, CurrentApiKey, CurrentUser, CurrentWorkspace, CurrentWsWorkspace, DefaultAuthEmailProvider, EmailChangeService, ForgotPasswordDto, HibpBreachChecker, IS_PUBLIC_KEY, InvitationService, JwtAuthGuard, JwtPlatformGuard, LoginDto, MembershipBumpFailedError, MembershipService, MfaChallengeDto, MfaDisableDto, MfaRegenerateRecoveryCodesDto, MfaRequiredGuard, MfaService, MfaVerifyDto, NoOpAuthHooks, NoOpEmailProvider, OAuthService, OptionalAuthGuard, OtpService, PLATFORM_ROLES_KEY, PasswordResetService, PlatformAuthService, PlatformLoginDto, PlatformRoles, PlatformRolesGuard, Public, ROLES_KEY, ReauthenticationService, RegisterDto, RequestEncoding, RequestEncodingGuard, ResendOtpDto, ResendVerificationDto, ResetPasswordDto, Roles, RolesGuard, SKIP_MFA_KEY, SelfOrAdminGuard, ServiceKey, SessionService, SkipMfa, TokenDeliveryService, TrustedOriginGuard, UserStatusGuard, VerifyEmailDto, VerifyOtpDto, WORKSPACE_CURSOR_MAX_LENGTH, WORKSPACE_CURSOR_PART_MAX_LENGTH, WORKSPACE_ID_MAX_LENGTH, WORKSPACE_OWNER_ROLE_MAX_LENGTH, WORKSPACE_PERMISSION_KEY, WORKSPACE_ROLES_KEY, WS_TICKET_TTL_SECONDS, WorkspaceAccessService, WorkspaceActionsService, WorkspaceCallerService, WorkspaceGuard, WorkspaceInvitationService, WorkspacePermission, WorkspaceRoles, WorkspaceService, WsAuthExceptionFilter, WsJwtGuard, WsTicketService, WsWorkspaceGuard, assertWorkspaceId, authDocumentSecurity, createAuthValidationPipe, decodeWorkspaceCursor, decodeWorkspaceScopedName, decrypt, describeChannelStatus, describeError, encodeWorkspaceCursor, encrypt, generateSecureToken, hasRole, hmacSha256, isWorkspaceOwnerRole, readWorkspacePosition, redactSecrets, reduceToBaseWord, sanitizeHeaders, sha256, sleep, stampJobContext, timingSafeCompare, workspacePositionOf, workspaceQueryKey, workspaceScopedName };
|