@ibgib/space-gib 0.0.16 → 0.0.18
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/dist/client/bootstrap.mjs +34 -35
- package/dist/client/chunk-3KXGJIIO.mjs +18 -0
- package/dist/client/chunk-UWWP4CK6.mjs +2665 -0
- package/dist/client/index.mjs +7 -12
- package/dist/client/script.mjs +1 -2
- package/dist/server/server.mjs +372 -358
- package/ibgib_e2e_error.log +85 -0
- package/package.json +6 -6
- package/src/client/AUTO-GENERATED-version.mts +1 -1
- package/src/client/bootstrap.mts +18 -2
- package/src/server/server.mts +16 -4
- package/dist/client/bootstrap.mjs.map +0 -7
- package/dist/client/chunk-6BYQ5JSY.mjs +0 -19
- package/dist/client/chunk-6BYQ5JSY.mjs.map +0 -7
- package/dist/client/chunk-QPR6ILY2.mjs +0 -2507
- package/dist/client/chunk-QPR6ILY2.mjs.map +0 -7
- package/dist/client/index.mjs.map +0 -7
- package/dist/client/script.mjs.map +0 -7
- package/dist/server/server.mjs.map +0 -7
package/dist/server/server.mjs
CHANGED
|
@@ -12,6 +12,7 @@ var ERROR_MSG_LOCATION_ONLY_REGEXP = /^(\[.+\]).+$/;
|
|
|
12
12
|
var HEXADECIMAL_HASH_STRING_REGEXP_32 = /^[0-9a-fA-F]{32}$/;
|
|
13
13
|
var HEXADECIMAL_HASH_STRING_REGEXP_64 = /^[0-9a-fA-F]{64}$/;
|
|
14
14
|
var DEFAULT_DATA_PATH_DELIMITER = "/";
|
|
15
|
+
var ONLY_HAS_NON_ALPHANUMERICS = "_nonalphanumerics_";
|
|
15
16
|
|
|
16
17
|
// ../../libs/helper-gib/dist/helpers/utils-helper.mjs
|
|
17
18
|
var logalot = HELPER_LOG_A_LOT || false;
|
|
@@ -307,6 +308,99 @@ async function getIdPool({ n }) {
|
|
|
307
308
|
}
|
|
308
309
|
}
|
|
309
310
|
}
|
|
311
|
+
function getSaferSubstring({ text, length, keepLiterals = ["-"], replaceMap }) {
|
|
312
|
+
const lc2 = `[${getSaferSubstring.name}]`;
|
|
313
|
+
try {
|
|
314
|
+
if (logalot) {
|
|
315
|
+
console.log(`${lc2} starting... (I: 27437e312e5aa621adfebb84e059c822)`);
|
|
316
|
+
}
|
|
317
|
+
if (!text) {
|
|
318
|
+
throw new Error(`text required (E: 87e0493613c8b30dfade83e1d2862a22)`);
|
|
319
|
+
}
|
|
320
|
+
let saferText = text;
|
|
321
|
+
let tokenToKeepMap = {};
|
|
322
|
+
keepLiterals = keepLiterals ?? [];
|
|
323
|
+
for (let i = 0; i < keepLiterals.length; i++) {
|
|
324
|
+
const keep = keepLiterals[i];
|
|
325
|
+
let tmpToken;
|
|
326
|
+
do {
|
|
327
|
+
tmpToken = pickRandom_Letters({ count: 10 });
|
|
328
|
+
} while (tmpToken.includes(keep) || keep.includes(tmpToken) || text.includes(tmpToken));
|
|
329
|
+
if (saferText.includes(keep)) {
|
|
330
|
+
tokenToKeepMap[tmpToken] = keep;
|
|
331
|
+
while (saferText.includes(keep)) {
|
|
332
|
+
saferText = saferText.replace(keep, tmpToken);
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
if (replaceMap && Object.keys(replaceMap).length > 0) {
|
|
337
|
+
for (let i = 0; i < Object.keys(replaceMap).length; i++) {
|
|
338
|
+
const toReplace = Object.keys(replaceMap)[i];
|
|
339
|
+
const replaceWith = replaceMap[toReplace];
|
|
340
|
+
while (saferText.includes(toReplace)) {
|
|
341
|
+
saferText = saferText.replace(toReplace, replaceWith);
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
saferText = saferText.replace(/\W/g, "");
|
|
346
|
+
const tokens = Object.keys(tokenToKeepMap);
|
|
347
|
+
for (let i = 0; i < tokens.length; i++) {
|
|
348
|
+
const token = tokens[i];
|
|
349
|
+
while (saferText.includes(token)) {
|
|
350
|
+
saferText = saferText.replace(token, tokenToKeepMap[token]);
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
if (length && length > 0) {
|
|
354
|
+
if (saferText.length > length) {
|
|
355
|
+
if (logalot) {
|
|
356
|
+
console.log(`${lc2} curtailing length (I: d7a28e05daa5979c7686b4c1cf519b23)`);
|
|
357
|
+
}
|
|
358
|
+
saferText = saferText.substring(0, length);
|
|
359
|
+
}
|
|
360
|
+
}
|
|
361
|
+
if (saferText.length === 0) {
|
|
362
|
+
saferText = ONLY_HAS_NON_ALPHANUMERICS;
|
|
363
|
+
}
|
|
364
|
+
return saferText;
|
|
365
|
+
} catch (error) {
|
|
366
|
+
console.error(`${lc2} ${error.message}`);
|
|
367
|
+
throw error;
|
|
368
|
+
} finally {
|
|
369
|
+
if (logalot) {
|
|
370
|
+
console.log(`${lc2} complete.`);
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
}
|
|
374
|
+
function pickRandom({ x }) {
|
|
375
|
+
if ((x ?? []).length === 0) {
|
|
376
|
+
return void 0;
|
|
377
|
+
}
|
|
378
|
+
let randomIndex = Math.floor(Math.random() * x.length);
|
|
379
|
+
return x[randomIndex];
|
|
380
|
+
}
|
|
381
|
+
function pickRandom_Letters({ count }) {
|
|
382
|
+
const lc2 = `${pickRandom_Letters.name}]`;
|
|
383
|
+
try {
|
|
384
|
+
if (!Number.isInteger(count)) {
|
|
385
|
+
throw new Error(`count required to be a number. (E: c0a21d884ebd9afc4b2e8025207e0522)`);
|
|
386
|
+
}
|
|
387
|
+
let result = "";
|
|
388
|
+
for (let i = 0; i < count; i++) {
|
|
389
|
+
result += pickRandom({ x: "a b c d e f g h i j k l m n o p q r s t u v w x y z".split(" ") });
|
|
390
|
+
}
|
|
391
|
+
if (result.length !== count) {
|
|
392
|
+
throw new Error(`${lc2} (UNEXPECTED) result.length !== count ? (E: 9bec4ec8f78610d8055e565415392a22)`);
|
|
393
|
+
}
|
|
394
|
+
return result;
|
|
395
|
+
} catch (error) {
|
|
396
|
+
console.error(`${lc2} ${error.message}`);
|
|
397
|
+
throw error;
|
|
398
|
+
} finally {
|
|
399
|
+
if (logalot) {
|
|
400
|
+
console.log(`${lc2} complete.`);
|
|
401
|
+
}
|
|
402
|
+
}
|
|
403
|
+
}
|
|
310
404
|
function mergeMapsOrArrays_Naive({ dominant, recessive }) {
|
|
311
405
|
const lc2 = `[${mergeMapsOrArrays_Naive.name}]`;
|
|
312
406
|
try {
|
|
@@ -1358,7 +1452,7 @@ function patch(obj, patchInfo) {
|
|
|
1358
1452
|
|
|
1359
1453
|
// ../../libs/ts-gib/dist/V1/transforms/rel8.mjs
|
|
1360
1454
|
async function rel8(opts) {
|
|
1361
|
-
const { noTimestamp, dna, linkedRel8ns, rel8nsToAddByAddr, rel8nsToRemoveByAddr, type = "rel8" } = opts;
|
|
1455
|
+
const { noTimestamp, dna, linkedRel8ns, rel8nsToAddByAddr, rel8nsToRemoveByAddr, rel8nsToReplaceByAddr, type = "rel8" } = opts;
|
|
1362
1456
|
let src = opts.src;
|
|
1363
1457
|
const lc2 = "[rel8_v1]";
|
|
1364
1458
|
if (type !== "rel8") {
|
|
@@ -1390,8 +1484,9 @@ async function rel8(opts) {
|
|
|
1390
1484
|
}
|
|
1391
1485
|
const isAdding = rel8nsToAddByAddr && Object.keys(rel8nsToAddByAddr).length > 0;
|
|
1392
1486
|
const isRemoving = rel8nsToRemoveByAddr && Object.keys(rel8nsToRemoveByAddr).length > 0;
|
|
1393
|
-
|
|
1394
|
-
|
|
1487
|
+
const isReplacing = rel8nsToReplaceByAddr && Object.keys(rel8nsToReplaceByAddr).length > 0;
|
|
1488
|
+
if (!(isAdding || isRemoving || isReplacing)) {
|
|
1489
|
+
throw new Error(`${lc2} gotta provide relations to add, remove, or replace.`);
|
|
1395
1490
|
}
|
|
1396
1491
|
const srcAddr = getIbGibAddr({ ib: src.ib, gib: src.gib });
|
|
1397
1492
|
if (opts.srcAddr && srcAddr !== opts.srcAddr) {
|
|
@@ -1411,6 +1506,11 @@ async function rel8(opts) {
|
|
|
1411
1506
|
throw new Error(`${lc2} Invalid remove rel8n attempt. Must be valid ibGibs. Did you include a delimiter (^)?`);
|
|
1412
1507
|
}
|
|
1413
1508
|
});
|
|
1509
|
+
Object.keys(rel8nsToReplaceByAddr || {}).map((x) => (rel8nsToReplaceByAddr || {})[x]).forEach((replacements) => {
|
|
1510
|
+
if (!(replacements && replacements.every((r) => r && fnValidIbGibAddr(r.oldAddr) && fnValidIbGibAddr(r.newAddr)))) {
|
|
1511
|
+
throw new Error(`${lc2} Invalid replace rel8n attempt. Must be valid ibGibs with oldAddr and newAddr. Did you include a delimiter (^)?`);
|
|
1512
|
+
}
|
|
1513
|
+
});
|
|
1414
1514
|
let dto = { ib: src.ib, gib: src.gib };
|
|
1415
1515
|
if (src.data && Object.keys(src.data).length > 0) {
|
|
1416
1516
|
dto.data = src.data;
|
|
@@ -1443,6 +1543,28 @@ async function rel8(opts) {
|
|
|
1443
1543
|
data.timestampMs = date.getMilliseconds();
|
|
1444
1544
|
}
|
|
1445
1545
|
const rel8ns = clone(src.rel8ns || {});
|
|
1546
|
+
Object.keys(rel8nsToReplaceByAddr || {}).forEach((rel8nName) => {
|
|
1547
|
+
if (FORBIDDEN_ADD_RENAME_REMOVE_REL8N_NAMES.includes(rel8nName)) {
|
|
1548
|
+
throw new Error(`${lc2} Cannot manually replace relationship: ${rel8nName}.`);
|
|
1549
|
+
}
|
|
1550
|
+
const existingRel8d = rel8ns[rel8nName] || [];
|
|
1551
|
+
const replacements = rel8nsToReplaceByAddr[rel8nName] || [];
|
|
1552
|
+
const updatedRel8d = [...existingRel8d];
|
|
1553
|
+
for (const replacement of replacements) {
|
|
1554
|
+
const { oldAddr, newAddr } = replacement;
|
|
1555
|
+
let found = false;
|
|
1556
|
+
for (let i = 0; i < updatedRel8d.length; i++) {
|
|
1557
|
+
if (updatedRel8d[i] === oldAddr) {
|
|
1558
|
+
updatedRel8d[i] = newAddr;
|
|
1559
|
+
found = true;
|
|
1560
|
+
}
|
|
1561
|
+
}
|
|
1562
|
+
if (!found) {
|
|
1563
|
+
throw new Error(`${lc2} Cannot replace oldAddr '${oldAddr}' in rel8n '${rel8nName}' - oldAddr not found in existing relationships.`);
|
|
1564
|
+
}
|
|
1565
|
+
}
|
|
1566
|
+
rel8ns[rel8nName] = updatedRel8d;
|
|
1567
|
+
});
|
|
1446
1568
|
Object.keys(rel8nsToAddByAddr || {}).forEach((rel8nName) => {
|
|
1447
1569
|
if (FORBIDDEN_ADD_RENAME_REMOVE_REL8N_NAMES.includes(rel8nName)) {
|
|
1448
1570
|
throw new Error(`${lc2} Cannot manually add relationship: ${rel8nName}.`);
|
|
@@ -14497,7 +14619,6 @@ var MetaspaceBase = class _MetaspaceBase {
|
|
|
14497
14619
|
console.timeLog(timerName);
|
|
14498
14620
|
}
|
|
14499
14621
|
await this.initializeSpecialIbGibs_required({ timerName });
|
|
14500
|
-
await this.initializeSpecialIbGibs_outerspaces({ timerName });
|
|
14501
14622
|
await this.initializeSpecialIbGibs_other({ timerName });
|
|
14502
14623
|
if (logalot33) {
|
|
14503
14624
|
console.timeEnd(timerName);
|
|
@@ -14531,26 +14652,10 @@ var MetaspaceBase = class _MetaspaceBase {
|
|
|
14531
14652
|
if (logalot33) {
|
|
14532
14653
|
console.timeLog(timerName);
|
|
14533
14654
|
}
|
|
14534
|
-
await this.getSpecialIbGib({ type: SpecialIbGibType.aliases, initialize: true });
|
|
14535
|
-
if (logalot33) {
|
|
14536
|
-
console.timeLog(timerName);
|
|
14537
|
-
}
|
|
14538
|
-
await this.getSpecialIbGib({ type: "robbots", initialize: true });
|
|
14539
|
-
if (logalot33) {
|
|
14540
|
-
console.timeLog(timerName);
|
|
14541
|
-
}
|
|
14542
14655
|
await this.getSpecialIbGib({ type: "apps", initialize: true });
|
|
14543
14656
|
if (logalot33) {
|
|
14544
14657
|
console.timeLog(timerName);
|
|
14545
14658
|
}
|
|
14546
|
-
await this.getSpecialIbGib({ type: "secrets", initialize: true });
|
|
14547
|
-
if (logalot33) {
|
|
14548
|
-
console.timeLog(timerName);
|
|
14549
|
-
}
|
|
14550
|
-
await this.getSpecialIbGib({ type: "encryptions", initialize: true });
|
|
14551
|
-
if (logalot33) {
|
|
14552
|
-
console.timeLog(timerName);
|
|
14553
|
-
}
|
|
14554
14659
|
} catch (error) {
|
|
14555
14660
|
console.error(`${lc2} ${error.message}`);
|
|
14556
14661
|
throw error;
|
|
@@ -20340,7 +20445,7 @@ var KeystoneService_V1 = class _KeystoneService_V1 {
|
|
|
20340
20445
|
}
|
|
20341
20446
|
}
|
|
20342
20447
|
/**
|
|
20343
|
-
* Evolve the keystone by rotating the primary user manage pool (`manage`) to a new master secret (
|
|
20448
|
+
* Evolve the keystone by rotating the primary user manage pool (`manage`) to a new master secret (password).
|
|
20344
20449
|
* This creates a new frame signed by the specified `signingPoolId` using `signingSecret`.
|
|
20345
20450
|
*
|
|
20346
20451
|
* Supports recovery (signing via `custodian-manage` using the custodian secret) and normal rotation
|
|
@@ -20491,7 +20596,7 @@ var KeystoneService_V1 = class _KeystoneService_V1 {
|
|
|
20491
20596
|
}
|
|
20492
20597
|
}
|
|
20493
20598
|
/**
|
|
20494
|
-
* Verifies if a candidate signing secret (
|
|
20599
|
+
* Verifies if a candidate signing secret (password) is correct for a specific challenge pool.
|
|
20495
20600
|
* Does not mutate any state.
|
|
20496
20601
|
*/
|
|
20497
20602
|
async verifySigningSecret({ keystoneIbGib, signingSecret, poolId }) {
|
|
@@ -20888,12 +20993,21 @@ async function savePendingCodeRecord({ pendingDir, code, maxAttempts = 5, ttlMs
|
|
|
20888
20993
|
await fs2.writeFile(codeFilePath, JSON.stringify(record, null, 2), "utf-8");
|
|
20889
20994
|
}
|
|
20890
20995
|
function createDefaultEmailSender() {
|
|
20996
|
+
const rawMode = process.env.EMAIL_MODE;
|
|
20997
|
+
if (!rawMode || !rawMode.trim()) {
|
|
20998
|
+
throw new Error('EMAIL_MODE environment variable is missing. Expected "aws" or "mock". (E: 7a8b9c0d1e2f3456789abcdef0123456)');
|
|
20999
|
+
}
|
|
21000
|
+
const mode = rawMode.trim().toLowerCase();
|
|
20891
21001
|
const isProd = true;
|
|
20892
|
-
const mode = (process.env.EMAIL_MODE || (isProd ? "aws" : "mock")).toLowerCase();
|
|
20893
21002
|
if (mode === "aws") {
|
|
21003
|
+
const accessKeyId = process.env.AWS_ACCESS_KEY_ID;
|
|
21004
|
+
const secretAccessKey = process.env.AWS_SECRET_ACCESS_KEY;
|
|
21005
|
+
if (!accessKeyId || !secretAccessKey) {
|
|
21006
|
+
throw new Error("EMAIL_MODE=aws requires AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY environment variables. (E: 5e6f7890123456789abcdef5a6b7c8d9)");
|
|
21007
|
+
}
|
|
20894
21008
|
return new EmailSenderAws({
|
|
20895
|
-
accessKeyId
|
|
20896
|
-
secretAccessKey
|
|
21009
|
+
accessKeyId,
|
|
21010
|
+
secretAccessKey,
|
|
20897
21011
|
region: process.env.AWS_REGION || "us-east-1"
|
|
20898
21012
|
});
|
|
20899
21013
|
} else if (mode === "mock") {
|
|
@@ -22792,57 +22906,124 @@ function createPoolConfigFromJson({ template, salt }) {
|
|
|
22792
22906
|
}).forVerbs(template.allowedVerbs).build();
|
|
22793
22907
|
}
|
|
22794
22908
|
|
|
22795
|
-
// ../../libs/core-gib/dist/keystone/policy/profiles/profile
|
|
22796
|
-
var
|
|
22797
|
-
$schema: "
|
|
22909
|
+
// ../../libs/core-gib/dist/keystone/policy/profiles/primary/primary-profile.dev.json
|
|
22910
|
+
var primary_profile_dev_default = {
|
|
22911
|
+
$schema: "../../schemas/primary/primary-keystone.schema.json",
|
|
22798
22912
|
metadata: {
|
|
22799
|
-
name: "
|
|
22800
|
-
securityLevel: "
|
|
22913
|
+
name: "Primary Identity Profile (Dev)",
|
|
22914
|
+
securityLevel: "low"
|
|
22801
22915
|
},
|
|
22802
22916
|
pools: {
|
|
22803
|
-
|
|
22804
|
-
id: "
|
|
22917
|
+
manage: {
|
|
22918
|
+
id: "manage",
|
|
22805
22919
|
allowedVerbs: [
|
|
22806
|
-
"
|
|
22920
|
+
"manage",
|
|
22921
|
+
"revoke"
|
|
22922
|
+
],
|
|
22923
|
+
algo: "SHA-256",
|
|
22924
|
+
rounds: 1,
|
|
22925
|
+
behavior: {
|
|
22926
|
+
size: 10,
|
|
22927
|
+
replenish: "replace-all",
|
|
22928
|
+
selectSequentially: 1,
|
|
22929
|
+
selectRandomly: 1,
|
|
22930
|
+
targetBindingCount: 2
|
|
22931
|
+
}
|
|
22932
|
+
}
|
|
22933
|
+
}
|
|
22934
|
+
};
|
|
22935
|
+
|
|
22936
|
+
// ../../libs/core-gib/dist/keystone/policy/profiles/primary/primary-profile.staging.json
|
|
22937
|
+
var primary_profile_staging_default = {
|
|
22938
|
+
$schema: "../../schemas/primary/primary-keystone.schema.json",
|
|
22939
|
+
metadata: {
|
|
22940
|
+
name: "Primary Identity Profile (Staging)",
|
|
22941
|
+
securityLevel: "medium"
|
|
22942
|
+
},
|
|
22943
|
+
pools: {
|
|
22944
|
+
manage: {
|
|
22945
|
+
id: "manage",
|
|
22946
|
+
allowedVerbs: [
|
|
22947
|
+
"manage",
|
|
22948
|
+
"revoke"
|
|
22807
22949
|
],
|
|
22808
22950
|
algo: "SHA-512",
|
|
22809
|
-
rounds:
|
|
22951
|
+
rounds: 3,
|
|
22810
22952
|
behavior: {
|
|
22811
|
-
size:
|
|
22812
|
-
replenish: "
|
|
22813
|
-
selectSequentially:
|
|
22814
|
-
selectRandomly:
|
|
22815
|
-
targetBindingCount:
|
|
22953
|
+
size: 500,
|
|
22954
|
+
replenish: "replace-all",
|
|
22955
|
+
selectSequentially: 4,
|
|
22956
|
+
selectRandomly: 4,
|
|
22957
|
+
targetBindingCount: 6
|
|
22816
22958
|
}
|
|
22817
|
-
}
|
|
22959
|
+
}
|
|
22960
|
+
}
|
|
22961
|
+
};
|
|
22962
|
+
|
|
22963
|
+
// ../../libs/core-gib/dist/keystone/policy/profiles/primary/primary-profile.prod.json
|
|
22964
|
+
var primary_profile_prod_default = {
|
|
22965
|
+
$schema: "../../schemas/primary/primary-keystone.schema.json",
|
|
22966
|
+
metadata: {
|
|
22967
|
+
name: "Primary Identity Profile (Prod)",
|
|
22968
|
+
securityLevel: "high"
|
|
22969
|
+
},
|
|
22970
|
+
pools: {
|
|
22818
22971
|
manage: {
|
|
22819
22972
|
id: "manage",
|
|
22820
22973
|
allowedVerbs: [
|
|
22821
|
-
"manage"
|
|
22974
|
+
"manage",
|
|
22975
|
+
"revoke"
|
|
22822
22976
|
],
|
|
22823
22977
|
algo: "SHA-512",
|
|
22824
|
-
rounds:
|
|
22978
|
+
rounds: 6,
|
|
22825
22979
|
behavior: {
|
|
22826
22980
|
size: 2e3,
|
|
22827
22981
|
replenish: "replace-all",
|
|
22828
|
-
selectSequentially:
|
|
22829
|
-
selectRandomly:
|
|
22982
|
+
selectSequentially: 12,
|
|
22983
|
+
selectRandomly: 12,
|
|
22830
22984
|
targetBindingCount: 16
|
|
22831
22985
|
}
|
|
22986
|
+
}
|
|
22987
|
+
}
|
|
22988
|
+
};
|
|
22989
|
+
|
|
22990
|
+
// ../../libs/core-gib/dist/keystone/policy/profiles/sync/sync-profile.dev.json
|
|
22991
|
+
var sync_profile_dev_default = {
|
|
22992
|
+
$schema: "../../schemas/sync/sync-keystone.schema.json",
|
|
22993
|
+
metadata: {
|
|
22994
|
+
name: "Sync Delegate Profile (Dev)",
|
|
22995
|
+
securityLevel: "low"
|
|
22996
|
+
},
|
|
22997
|
+
pools: {
|
|
22998
|
+
sync: {
|
|
22999
|
+
id: "sync",
|
|
23000
|
+
allowedVerbs: [
|
|
23001
|
+
"sync"
|
|
23002
|
+
],
|
|
23003
|
+
algo: "SHA-256",
|
|
23004
|
+
rounds: 1,
|
|
23005
|
+
behavior: {
|
|
23006
|
+
size: 10,
|
|
23007
|
+
replenish: "top-up",
|
|
23008
|
+
selectSequentially: 1,
|
|
23009
|
+
selectRandomly: 1,
|
|
23010
|
+
targetBindingCount: 2
|
|
23011
|
+
}
|
|
22832
23012
|
},
|
|
22833
|
-
|
|
22834
|
-
id: "
|
|
23013
|
+
manage: {
|
|
23014
|
+
id: "manage",
|
|
22835
23015
|
allowedVerbs: [
|
|
23016
|
+
"manage",
|
|
22836
23017
|
"revoke"
|
|
22837
23018
|
],
|
|
22838
|
-
algo: "SHA-
|
|
22839
|
-
rounds:
|
|
23019
|
+
algo: "SHA-256",
|
|
23020
|
+
rounds: 2,
|
|
22840
23021
|
behavior: {
|
|
22841
|
-
size:
|
|
22842
|
-
replenish: "
|
|
22843
|
-
selectSequentially:
|
|
22844
|
-
selectRandomly:
|
|
22845
|
-
targetBindingCount:
|
|
23022
|
+
size: 10,
|
|
23023
|
+
replenish: "replace-all",
|
|
23024
|
+
selectSequentially: 1,
|
|
23025
|
+
selectRandomly: 1,
|
|
23026
|
+
targetBindingCount: 2
|
|
22846
23027
|
}
|
|
22847
23028
|
},
|
|
22848
23029
|
connect: {
|
|
@@ -22850,14 +23031,14 @@ var profile_high_default = {
|
|
|
22850
23031
|
allowedVerbs: [
|
|
22851
23032
|
"connect"
|
|
22852
23033
|
],
|
|
22853
|
-
algo: "SHA-
|
|
22854
|
-
rounds:
|
|
23034
|
+
algo: "SHA-256",
|
|
23035
|
+
rounds: 1,
|
|
22855
23036
|
behavior: {
|
|
22856
|
-
size:
|
|
23037
|
+
size: 10,
|
|
22857
23038
|
replenish: "top-up",
|
|
22858
|
-
selectSequentially:
|
|
22859
|
-
selectRandomly:
|
|
22860
|
-
targetBindingCount:
|
|
23039
|
+
selectSequentially: 1,
|
|
23040
|
+
selectRandomly: 1,
|
|
23041
|
+
targetBindingCount: 2
|
|
22861
23042
|
}
|
|
22862
23043
|
},
|
|
22863
23044
|
sign: {
|
|
@@ -22865,24 +23046,24 @@ var profile_high_default = {
|
|
|
22865
23046
|
allowedVerbs: [
|
|
22866
23047
|
"sign"
|
|
22867
23048
|
],
|
|
22868
|
-
algo: "SHA-
|
|
22869
|
-
rounds:
|
|
23049
|
+
algo: "SHA-256",
|
|
23050
|
+
rounds: 2,
|
|
22870
23051
|
behavior: {
|
|
22871
|
-
size:
|
|
23052
|
+
size: 10,
|
|
22872
23053
|
replenish: "top-up",
|
|
22873
|
-
selectSequentially:
|
|
22874
|
-
selectRandomly:
|
|
22875
|
-
targetBindingCount:
|
|
23054
|
+
selectSequentially: 1,
|
|
23055
|
+
selectRandomly: 1,
|
|
23056
|
+
targetBindingCount: 2
|
|
22876
23057
|
}
|
|
22877
23058
|
}
|
|
22878
23059
|
}
|
|
22879
23060
|
};
|
|
22880
23061
|
|
|
22881
|
-
// ../../libs/core-gib/dist/keystone/policy/profiles/profile
|
|
22882
|
-
var
|
|
22883
|
-
$schema: "
|
|
23062
|
+
// ../../libs/core-gib/dist/keystone/policy/profiles/sync/sync-profile.staging.json
|
|
23063
|
+
var sync_profile_staging_default = {
|
|
23064
|
+
$schema: "../../schemas/sync/sync-keystone.schema.json",
|
|
22884
23065
|
metadata: {
|
|
22885
|
-
name: "
|
|
23066
|
+
name: "Sync Delegate Profile (Staging)",
|
|
22886
23067
|
securityLevel: "medium"
|
|
22887
23068
|
},
|
|
22888
23069
|
pools: {
|
|
@@ -22894,41 +23075,27 @@ var profile_medium_default = {
|
|
|
22894
23075
|
algo: "SHA-256",
|
|
22895
23076
|
rounds: 2,
|
|
22896
23077
|
behavior: {
|
|
22897
|
-
size:
|
|
23078
|
+
size: 100,
|
|
22898
23079
|
replenish: "top-up",
|
|
22899
|
-
selectSequentially:
|
|
22900
|
-
selectRandomly:
|
|
22901
|
-
targetBindingCount:
|
|
23080
|
+
selectSequentially: 2,
|
|
23081
|
+
selectRandomly: 2,
|
|
23082
|
+
targetBindingCount: 4
|
|
22902
23083
|
}
|
|
22903
23084
|
},
|
|
22904
23085
|
manage: {
|
|
22905
23086
|
id: "manage",
|
|
22906
23087
|
allowedVerbs: [
|
|
22907
|
-
"manage"
|
|
22908
|
-
],
|
|
22909
|
-
algo: "SHA-256",
|
|
22910
|
-
rounds: 2,
|
|
22911
|
-
behavior: {
|
|
22912
|
-
size: 500,
|
|
22913
|
-
replenish: "replace-all",
|
|
22914
|
-
selectSequentially: 5,
|
|
22915
|
-
selectRandomly: 5,
|
|
22916
|
-
targetBindingCount: 10
|
|
22917
|
-
}
|
|
22918
|
-
},
|
|
22919
|
-
revoke: {
|
|
22920
|
-
id: "revoke",
|
|
22921
|
-
allowedVerbs: [
|
|
23088
|
+
"manage",
|
|
22922
23089
|
"revoke"
|
|
22923
23090
|
],
|
|
22924
|
-
algo: "SHA-
|
|
22925
|
-
rounds:
|
|
23091
|
+
algo: "SHA-512",
|
|
23092
|
+
rounds: 3,
|
|
22926
23093
|
behavior: {
|
|
22927
|
-
size:
|
|
22928
|
-
replenish: "
|
|
22929
|
-
selectSequentially:
|
|
22930
|
-
selectRandomly:
|
|
22931
|
-
targetBindingCount:
|
|
23094
|
+
size: 250,
|
|
23095
|
+
replenish: "replace-all",
|
|
23096
|
+
selectSequentially: 4,
|
|
23097
|
+
selectRandomly: 4,
|
|
23098
|
+
targetBindingCount: 6
|
|
22932
23099
|
}
|
|
22933
23100
|
},
|
|
22934
23101
|
connect: {
|
|
@@ -22939,11 +23106,11 @@ var profile_medium_default = {
|
|
|
22939
23106
|
algo: "SHA-256",
|
|
22940
23107
|
rounds: 2,
|
|
22941
23108
|
behavior: {
|
|
22942
|
-
size:
|
|
23109
|
+
size: 100,
|
|
22943
23110
|
replenish: "top-up",
|
|
22944
|
-
selectSequentially:
|
|
22945
|
-
selectRandomly:
|
|
22946
|
-
targetBindingCount:
|
|
23111
|
+
selectSequentially: 2,
|
|
23112
|
+
selectRandomly: 2,
|
|
23113
|
+
targetBindingCount: 4
|
|
22947
23114
|
}
|
|
22948
23115
|
},
|
|
22949
23116
|
sign: {
|
|
@@ -22954,22 +23121,22 @@ var profile_medium_default = {
|
|
|
22954
23121
|
algo: "SHA-256",
|
|
22955
23122
|
rounds: 2,
|
|
22956
23123
|
behavior: {
|
|
22957
|
-
size:
|
|
23124
|
+
size: 100,
|
|
22958
23125
|
replenish: "top-up",
|
|
22959
|
-
selectSequentially:
|
|
22960
|
-
selectRandomly:
|
|
22961
|
-
targetBindingCount:
|
|
23126
|
+
selectSequentially: 2,
|
|
23127
|
+
selectRandomly: 2,
|
|
23128
|
+
targetBindingCount: 4
|
|
22962
23129
|
}
|
|
22963
23130
|
}
|
|
22964
23131
|
}
|
|
22965
23132
|
};
|
|
22966
23133
|
|
|
22967
|
-
// ../../libs/core-gib/dist/keystone/policy/profiles/profile
|
|
22968
|
-
var
|
|
22969
|
-
$schema: "
|
|
23134
|
+
// ../../libs/core-gib/dist/keystone/policy/profiles/sync/sync-profile.prod.json
|
|
23135
|
+
var sync_profile_prod_default = {
|
|
23136
|
+
$schema: "../../schemas/sync/sync-keystone.schema.json",
|
|
22970
23137
|
metadata: {
|
|
22971
|
-
name: "
|
|
22972
|
-
securityLevel: "
|
|
23138
|
+
name: "Sync Delegate Profile (Prod)",
|
|
23139
|
+
securityLevel: "high"
|
|
22973
23140
|
},
|
|
22974
23141
|
pools: {
|
|
22975
23142
|
sync: {
|
|
@@ -22977,44 +23144,30 @@ var profile_low_default = {
|
|
|
22977
23144
|
allowedVerbs: [
|
|
22978
23145
|
"sync"
|
|
22979
23146
|
],
|
|
22980
|
-
algo: "SHA-
|
|
22981
|
-
rounds:
|
|
23147
|
+
algo: "SHA-512",
|
|
23148
|
+
rounds: 4,
|
|
22982
23149
|
behavior: {
|
|
22983
|
-
size:
|
|
23150
|
+
size: 500,
|
|
22984
23151
|
replenish: "top-up",
|
|
22985
|
-
selectSequentially:
|
|
22986
|
-
selectRandomly:
|
|
22987
|
-
targetBindingCount:
|
|
23152
|
+
selectSequentially: 4,
|
|
23153
|
+
selectRandomly: 4,
|
|
23154
|
+
targetBindingCount: 6
|
|
22988
23155
|
}
|
|
22989
23156
|
},
|
|
22990
23157
|
manage: {
|
|
22991
23158
|
id: "manage",
|
|
22992
23159
|
allowedVerbs: [
|
|
22993
|
-
"manage"
|
|
22994
|
-
],
|
|
22995
|
-
algo: "SHA-256",
|
|
22996
|
-
rounds: 2,
|
|
22997
|
-
behavior: {
|
|
22998
|
-
size: 100,
|
|
22999
|
-
replenish: "replace-all",
|
|
23000
|
-
selectSequentially: 3,
|
|
23001
|
-
selectRandomly: 3,
|
|
23002
|
-
targetBindingCount: 8
|
|
23003
|
-
}
|
|
23004
|
-
},
|
|
23005
|
-
revoke: {
|
|
23006
|
-
id: "revoke",
|
|
23007
|
-
allowedVerbs: [
|
|
23160
|
+
"manage",
|
|
23008
23161
|
"revoke"
|
|
23009
23162
|
],
|
|
23010
|
-
algo: "SHA-
|
|
23011
|
-
rounds:
|
|
23163
|
+
algo: "SHA-512",
|
|
23164
|
+
rounds: 6,
|
|
23012
23165
|
behavior: {
|
|
23013
|
-
size:
|
|
23014
|
-
replenish: "
|
|
23015
|
-
selectSequentially:
|
|
23016
|
-
selectRandomly:
|
|
23017
|
-
targetBindingCount:
|
|
23166
|
+
size: 1e3,
|
|
23167
|
+
replenish: "replace-all",
|
|
23168
|
+
selectSequentially: 8,
|
|
23169
|
+
selectRandomly: 8,
|
|
23170
|
+
targetBindingCount: 10
|
|
23018
23171
|
}
|
|
23019
23172
|
},
|
|
23020
23173
|
connect: {
|
|
@@ -23022,14 +23175,14 @@ var profile_low_default = {
|
|
|
23022
23175
|
allowedVerbs: [
|
|
23023
23176
|
"connect"
|
|
23024
23177
|
],
|
|
23025
|
-
algo: "SHA-
|
|
23026
|
-
rounds:
|
|
23178
|
+
algo: "SHA-512",
|
|
23179
|
+
rounds: 4,
|
|
23027
23180
|
behavior: {
|
|
23028
|
-
size:
|
|
23181
|
+
size: 500,
|
|
23029
23182
|
replenish: "top-up",
|
|
23030
|
-
selectSequentially:
|
|
23031
|
-
selectRandomly:
|
|
23032
|
-
targetBindingCount:
|
|
23183
|
+
selectSequentially: 4,
|
|
23184
|
+
selectRandomly: 4,
|
|
23185
|
+
targetBindingCount: 6
|
|
23033
23186
|
}
|
|
23034
23187
|
},
|
|
23035
23188
|
sign: {
|
|
@@ -23037,14 +23190,14 @@ var profile_low_default = {
|
|
|
23037
23190
|
allowedVerbs: [
|
|
23038
23191
|
"sign"
|
|
23039
23192
|
],
|
|
23040
|
-
algo: "SHA-
|
|
23041
|
-
rounds:
|
|
23193
|
+
algo: "SHA-512",
|
|
23194
|
+
rounds: 4,
|
|
23042
23195
|
behavior: {
|
|
23043
|
-
size:
|
|
23196
|
+
size: 500,
|
|
23044
23197
|
replenish: "top-up",
|
|
23045
|
-
selectSequentially:
|
|
23046
|
-
selectRandomly:
|
|
23047
|
-
targetBindingCount:
|
|
23198
|
+
selectSequentially: 4,
|
|
23199
|
+
selectRandomly: 4,
|
|
23200
|
+
targetBindingCount: 6
|
|
23048
23201
|
}
|
|
23049
23202
|
}
|
|
23050
23203
|
}
|
|
@@ -23136,132 +23289,6 @@ var profile_session_default = {
|
|
|
23136
23289
|
}
|
|
23137
23290
|
};
|
|
23138
23291
|
|
|
23139
|
-
// ../../libs/core-gib/dist/keystone/policy/profiles/profile-test.json
|
|
23140
|
-
var profile_test_default = {
|
|
23141
|
-
$schema: "../schemas/keystone.low.schema.json",
|
|
23142
|
-
metadata: {
|
|
23143
|
-
name: "Domain Identity Profile",
|
|
23144
|
-
securityLevel: "low"
|
|
23145
|
-
},
|
|
23146
|
-
pools: {
|
|
23147
|
-
manage: {
|
|
23148
|
-
id: "manage",
|
|
23149
|
-
allowedVerbs: [
|
|
23150
|
-
"manage",
|
|
23151
|
-
"revoke"
|
|
23152
|
-
],
|
|
23153
|
-
algo: "SHA-256",
|
|
23154
|
-
rounds: 1,
|
|
23155
|
-
behavior: {
|
|
23156
|
-
size: 10,
|
|
23157
|
-
replenish: "replace-all",
|
|
23158
|
-
selectSequentially: 1,
|
|
23159
|
-
selectRandomly: 1,
|
|
23160
|
-
targetBindingCount: 2
|
|
23161
|
-
}
|
|
23162
|
-
}
|
|
23163
|
-
}
|
|
23164
|
-
};
|
|
23165
|
-
|
|
23166
|
-
// ../../libs/core-gib/dist/keystone/policy/profiles/profile-domain.json
|
|
23167
|
-
var profile_domain_default = {
|
|
23168
|
-
$schema: "../schemas/keystone.high.schema.json",
|
|
23169
|
-
metadata: {
|
|
23170
|
-
name: "Domain Identity Profile",
|
|
23171
|
-
securityLevel: "high"
|
|
23172
|
-
},
|
|
23173
|
-
pools: {
|
|
23174
|
-
manage: {
|
|
23175
|
-
id: "manage",
|
|
23176
|
-
allowedVerbs: [
|
|
23177
|
-
"manage",
|
|
23178
|
-
"revoke"
|
|
23179
|
-
],
|
|
23180
|
-
algo: "SHA-512",
|
|
23181
|
-
rounds: 6,
|
|
23182
|
-
behavior: {
|
|
23183
|
-
size: 2e3,
|
|
23184
|
-
replenish: "replace-all",
|
|
23185
|
-
selectSequentially: 12,
|
|
23186
|
-
selectRandomly: 12,
|
|
23187
|
-
targetBindingCount: 16
|
|
23188
|
-
}
|
|
23189
|
-
}
|
|
23190
|
-
}
|
|
23191
|
-
};
|
|
23192
|
-
|
|
23193
|
-
// ../../libs/core-gib/dist/keystone/policy/profiles/profile-sync.json
|
|
23194
|
-
var profile_sync_default = {
|
|
23195
|
-
$schema: "../schemas/keystone.low.schema.json",
|
|
23196
|
-
metadata: {
|
|
23197
|
-
name: "Sync Delegate Profile",
|
|
23198
|
-
securityLevel: "low"
|
|
23199
|
-
},
|
|
23200
|
-
pools: {
|
|
23201
|
-
sync: {
|
|
23202
|
-
id: "sync",
|
|
23203
|
-
allowedVerbs: [
|
|
23204
|
-
"sync"
|
|
23205
|
-
],
|
|
23206
|
-
algo: "SHA-256",
|
|
23207
|
-
rounds: 1,
|
|
23208
|
-
behavior: {
|
|
23209
|
-
size: 10,
|
|
23210
|
-
replenish: "top-up",
|
|
23211
|
-
selectSequentially: 1,
|
|
23212
|
-
selectRandomly: 1,
|
|
23213
|
-
targetBindingCount: 2
|
|
23214
|
-
}
|
|
23215
|
-
},
|
|
23216
|
-
manage: {
|
|
23217
|
-
id: "manage",
|
|
23218
|
-
allowedVerbs: [
|
|
23219
|
-
"manage",
|
|
23220
|
-
"revoke"
|
|
23221
|
-
],
|
|
23222
|
-
algo: "SHA-256",
|
|
23223
|
-
rounds: 2,
|
|
23224
|
-
behavior: {
|
|
23225
|
-
size: 10,
|
|
23226
|
-
replenish: "replace-all",
|
|
23227
|
-
selectSequentially: 1,
|
|
23228
|
-
selectRandomly: 1,
|
|
23229
|
-
targetBindingCount: 2
|
|
23230
|
-
}
|
|
23231
|
-
},
|
|
23232
|
-
connect: {
|
|
23233
|
-
id: "connect",
|
|
23234
|
-
allowedVerbs: [
|
|
23235
|
-
"connect"
|
|
23236
|
-
],
|
|
23237
|
-
algo: "SHA-256",
|
|
23238
|
-
rounds: 1,
|
|
23239
|
-
behavior: {
|
|
23240
|
-
size: 10,
|
|
23241
|
-
replenish: "top-up",
|
|
23242
|
-
selectSequentially: 1,
|
|
23243
|
-
selectRandomly: 1,
|
|
23244
|
-
targetBindingCount: 2
|
|
23245
|
-
}
|
|
23246
|
-
},
|
|
23247
|
-
sign: {
|
|
23248
|
-
id: "default",
|
|
23249
|
-
allowedVerbs: [
|
|
23250
|
-
"sign"
|
|
23251
|
-
],
|
|
23252
|
-
algo: "SHA-256",
|
|
23253
|
-
rounds: 2,
|
|
23254
|
-
behavior: {
|
|
23255
|
-
size: 10,
|
|
23256
|
-
replenish: "top-up",
|
|
23257
|
-
selectSequentially: 1,
|
|
23258
|
-
selectRandomly: 1,
|
|
23259
|
-
targetBindingCount: 2
|
|
23260
|
-
}
|
|
23261
|
-
}
|
|
23262
|
-
}
|
|
23263
|
-
};
|
|
23264
|
-
|
|
23265
23292
|
// ../../libs/core-gib/dist/keystone/policy/keystone-profile-builder.mjs
|
|
23266
23293
|
var KeystoneProfileBuilder = class _KeystoneProfileBuilder {
|
|
23267
23294
|
_template;
|
|
@@ -23274,34 +23301,38 @@ var KeystoneProfileBuilder = class _KeystoneProfileBuilder {
|
|
|
23274
23301
|
this._template = JSON.parse(JSON.stringify(template));
|
|
23275
23302
|
}
|
|
23276
23303
|
static buildKeystone(profileName) {
|
|
23277
|
-
if (profileName
|
|
23278
|
-
throw new Error(`
|
|
23304
|
+
if (!profileName || typeof profileName !== "string") {
|
|
23305
|
+
throw new Error(`Profile name is required for KeystoneProfileBuilder. (E: 9a8b7c6d5e4f3210987654321fedcba0)`);
|
|
23306
|
+
}
|
|
23307
|
+
const isDevProfile = profileName.endsWith(".dev") || profileName.startsWith("test");
|
|
23308
|
+
if (isDevProfile) {
|
|
23309
|
+
throw new Error(`Security Violation: Development keystone profile '${profileName}' is prohibited when NODE_ENV=production. (E: 8a9b0c1d2e3f4a5b6c7d8e9f0a1b2c3d)`);
|
|
23279
23310
|
}
|
|
23280
23311
|
let selected;
|
|
23281
23312
|
switch (profileName) {
|
|
23282
|
-
case "
|
|
23283
|
-
selected =
|
|
23313
|
+
case "primary-profile.dev":
|
|
23314
|
+
selected = primary_profile_dev_default;
|
|
23284
23315
|
break;
|
|
23285
|
-
case "
|
|
23286
|
-
selected =
|
|
23316
|
+
case "primary-profile.staging":
|
|
23317
|
+
selected = primary_profile_staging_default;
|
|
23287
23318
|
break;
|
|
23288
|
-
case "
|
|
23289
|
-
selected =
|
|
23319
|
+
case "primary-profile.prod":
|
|
23320
|
+
selected = primary_profile_prod_default;
|
|
23290
23321
|
break;
|
|
23291
|
-
case "
|
|
23292
|
-
selected =
|
|
23322
|
+
case "sync-profile.dev":
|
|
23323
|
+
selected = sync_profile_dev_default;
|
|
23293
23324
|
break;
|
|
23294
|
-
case "
|
|
23295
|
-
selected =
|
|
23325
|
+
case "sync-profile.staging":
|
|
23326
|
+
selected = sync_profile_staging_default;
|
|
23296
23327
|
break;
|
|
23297
|
-
case "
|
|
23298
|
-
selected =
|
|
23328
|
+
case "sync-profile.prod":
|
|
23329
|
+
selected = sync_profile_prod_default;
|
|
23299
23330
|
break;
|
|
23300
|
-
case "
|
|
23301
|
-
selected =
|
|
23331
|
+
case "session":
|
|
23332
|
+
selected = profile_session_default;
|
|
23302
23333
|
break;
|
|
23303
23334
|
default:
|
|
23304
|
-
throw new Error(`Unknown profile name: ${profileName} (E: fc10a8ad482ef2bda871ac567d268d26)`);
|
|
23335
|
+
throw new Error(`Unknown keystone profile name: '${profileName}' (E: fc10a8ad482ef2bda871ac567d268d26)`);
|
|
23305
23336
|
}
|
|
23306
23337
|
return new _KeystoneProfileBuilder(selected);
|
|
23307
23338
|
}
|
|
@@ -23513,7 +23544,8 @@ var SsoLoginHandler = class _SsoLoginHandler extends ServeGibHandlerBase {
|
|
|
23513
23544
|
return this.error(400, `No email address returned from SSO provider ${providerId} (E: 3c3d4e5f67890123c4d5e6f789012345)`);
|
|
23514
23545
|
}
|
|
23515
23546
|
const email = userInfo.email.trim().toLowerCase();
|
|
23516
|
-
const
|
|
23547
|
+
const rawSSOName = userInfo.name || "";
|
|
23548
|
+
const username = getSaferSubstring({ text: rawSSOName || email.split("@")[0], length: 62, keepLiterals: ["_", "-"] });
|
|
23517
23549
|
const ssoConfig = loadSsoServerConfig();
|
|
23518
23550
|
const serverSecret = ssoConfig.ssoServerKdfSecret;
|
|
23519
23551
|
const primarySecret = await hash({ s: `${serverSecret}_custodian_${email}` });
|
|
@@ -23526,18 +23558,26 @@ var SsoLoginHandler = class _SsoLoginHandler extends ServeGibHandlerBase {
|
|
|
23526
23558
|
primaryTjpAddr = existingLookup.primaryTjpAddr;
|
|
23527
23559
|
const domainMetaspace = await bootstrapDomainMetaspace(primaryTjpAddr, reqCtx.dataDir);
|
|
23528
23560
|
const space = await domainMetaspace.getLocalUserSpace({ lock: false });
|
|
23529
|
-
const
|
|
23530
|
-
|
|
23531
|
-
|
|
23561
|
+
const keystoneService = new KeystoneService_V1();
|
|
23562
|
+
primaryKeystone = await keystoneService.getLatestKeystone({
|
|
23563
|
+
addr: primaryTjpAddr,
|
|
23564
|
+
metaspace: domainMetaspace,
|
|
23565
|
+
space
|
|
23566
|
+
});
|
|
23532
23567
|
} else {
|
|
23533
23568
|
isNewIdentity = true;
|
|
23534
23569
|
const tempId = await getUUID();
|
|
23535
23570
|
const tempDomainMetaspace = await bootstrapDomainMetaspace(`temp^${tempId}`, reqCtx.dataDir);
|
|
23536
23571
|
const tempSpace = await tempDomainMetaspace.getLocalUserSpace({ lock: false });
|
|
23537
|
-
const
|
|
23572
|
+
const primaryProfileName = "primary-profile.dev";
|
|
23573
|
+
if (!primaryProfileName || !primaryProfileName.trim()) {
|
|
23574
|
+
throw new Error('KEYSTONE_PROFILE_CUSTODIAN_PRIMARY environment variable is missing. Expected valid profile name like "primary-profile.dev" or "primary-profile.prod". (E: 2b3c4d5e6f7890123456789abcdef2)');
|
|
23575
|
+
}
|
|
23576
|
+
const primaryBuilder = KeystoneProfileBuilder.buildKeystone(primaryProfileName.trim()).withUsername(username).withEmails([email]).withDetails({
|
|
23538
23577
|
client: "space-gib-server",
|
|
23539
23578
|
role: "custodian-primary",
|
|
23540
|
-
custodianProvider: providerId
|
|
23579
|
+
custodianProvider: providerId,
|
|
23580
|
+
[`rawSSOName-${providerId}`]: rawSSOName
|
|
23541
23581
|
});
|
|
23542
23582
|
const configs = await primaryBuilder.compileConfigs();
|
|
23543
23583
|
const keystoneService = new KeystoneService_V1();
|
|
@@ -23647,15 +23687,22 @@ var KeystoneCustodianGenesisHandler = class _KeystoneCustodianGenesisHandler ext
|
|
|
23647
23687
|
const metaspace = await bootstrapDomainMetaspace(primaryTjpAddr, reqCtx.dataDir);
|
|
23648
23688
|
const space = await metaspace.getLocalUserSpace({ lock: false });
|
|
23649
23689
|
if (space) {
|
|
23650
|
-
const
|
|
23651
|
-
|
|
23652
|
-
|
|
23690
|
+
const keystoneService = new KeystoneService_V1();
|
|
23691
|
+
primaryKeystone = await keystoneService.getLatestKeystone({
|
|
23692
|
+
addr: primaryTjpAddr,
|
|
23693
|
+
metaspace,
|
|
23694
|
+
space
|
|
23695
|
+
});
|
|
23653
23696
|
}
|
|
23654
23697
|
} else {
|
|
23655
23698
|
isNewIdentity = true;
|
|
23656
23699
|
console.log(`${lc2} Creating new custodian primary identity for ${normEmail} (I: f123456789abcdef0123456789b0006)`);
|
|
23657
23700
|
const defaultUsername = username || normEmail.split("@")[0];
|
|
23658
|
-
const
|
|
23701
|
+
const primaryProfileName = "primary-profile.dev";
|
|
23702
|
+
if (!primaryProfileName || !primaryProfileName.trim()) {
|
|
23703
|
+
throw new Error('KEYSTONE_PROFILE_CUSTODIAN_PRIMARY environment variable is missing. Expected valid profile name like "primary-profile.dev" or "primary-profile.prod". (E: 1a2b3c4d5e6f7890123456789abcdef1)');
|
|
23704
|
+
}
|
|
23705
|
+
const primaryBuilder = KeystoneProfileBuilder.buildKeystone(primaryProfileName.trim()).withUsername(defaultUsername).withDescription(`Full Custodian Primary Identity for ${normEmail}`).withDetails({
|
|
23659
23706
|
emails: [normEmail],
|
|
23660
23707
|
custodyMode: "full"
|
|
23661
23708
|
});
|
|
@@ -23812,9 +23859,11 @@ var KeystoneCustodianRegisterDelegateHandler = class _KeystoneCustodianRegisterD
|
|
|
23812
23859
|
if (!space) {
|
|
23813
23860
|
return this.error(500, `Could not load domain space for primary identity ${custodianReqs.primaryTjpAddr}`);
|
|
23814
23861
|
}
|
|
23815
|
-
const
|
|
23816
|
-
|
|
23817
|
-
|
|
23862
|
+
const parentKeystone = await keystoneService.getLatestKeystone({
|
|
23863
|
+
addr: custodianReqs.primaryTjpAddr,
|
|
23864
|
+
metaspace,
|
|
23865
|
+
space
|
|
23866
|
+
});
|
|
23818
23867
|
if (!parentKeystone) {
|
|
23819
23868
|
return this.error(404, `Primary identity keystone not found for address ${custodianReqs.primaryTjpAddr}`);
|
|
23820
23869
|
}
|
|
@@ -24010,26 +24059,7 @@ var EmailOutboundHandler = class _EmailOutboundHandler extends ServeGibHandlerBa
|
|
|
24010
24059
|
sender;
|
|
24011
24060
|
constructor(options = {}) {
|
|
24012
24061
|
super();
|
|
24013
|
-
|
|
24014
|
-
this.sender = options.sender;
|
|
24015
|
-
} else {
|
|
24016
|
-
const isProd = true;
|
|
24017
|
-
const mode = (process.env.EMAIL_MODE || (isProd ? "aws" : "mock")).toLowerCase();
|
|
24018
|
-
if (mode === "aws") {
|
|
24019
|
-
this.sender = new EmailSenderAws({
|
|
24020
|
-
accessKeyId: process.env.AWS_ACCESS_KEY_ID || "",
|
|
24021
|
-
secretAccessKey: process.env.AWS_SECRET_ACCESS_KEY || "",
|
|
24022
|
-
region: process.env.AWS_REGION || "us-east-1"
|
|
24023
|
-
});
|
|
24024
|
-
} else if (mode === "mock") {
|
|
24025
|
-
if (isProd) {
|
|
24026
|
-
throw new Error("EMAIL_MODE=mock is prohibited when NODE_ENV=production. (E: 897a6b5c4d3e2f10987654321fedcba0)");
|
|
24027
|
-
}
|
|
24028
|
-
this.sender = new EmailSenderMock();
|
|
24029
|
-
} else {
|
|
24030
|
-
throw new Error(`Unsupported EMAIL_MODE '${mode}'. Must be 'aws' or 'mock'. (E: 987a6b5c4d3e2f10987654321fedcba1)`);
|
|
24031
|
-
}
|
|
24032
|
-
}
|
|
24062
|
+
this.sender = options.sender || createDefaultEmailSender();
|
|
24033
24063
|
}
|
|
24034
24064
|
async handleRouteImpl(reqCtx) {
|
|
24035
24065
|
const lc2 = `${this.lc}[${this.handleRouteImpl.name}]`;
|
|
@@ -24071,26 +24101,7 @@ var EmailVerificationCodeHandler = class _EmailVerificationCodeHandler extends S
|
|
|
24071
24101
|
sender;
|
|
24072
24102
|
constructor(options = {}) {
|
|
24073
24103
|
super();
|
|
24074
|
-
|
|
24075
|
-
this.sender = options.sender;
|
|
24076
|
-
} else {
|
|
24077
|
-
const isProd = true;
|
|
24078
|
-
const mode = (process.env.EMAIL_MODE || (isProd ? "aws" : "mock")).toLowerCase();
|
|
24079
|
-
if (mode === "aws") {
|
|
24080
|
-
this.sender = new EmailSenderAws({
|
|
24081
|
-
accessKeyId: process.env.AWS_ACCESS_KEY_ID || "",
|
|
24082
|
-
secretAccessKey: process.env.AWS_SECRET_ACCESS_KEY || "",
|
|
24083
|
-
region: process.env.AWS_REGION || "us-east-1"
|
|
24084
|
-
});
|
|
24085
|
-
} else if (mode === "mock") {
|
|
24086
|
-
if (isProd) {
|
|
24087
|
-
throw new Error("EMAIL_MODE=mock is prohibited when NODE_ENV=production. (E: 897a6b5c4d3e2f10987654321fedcba0)");
|
|
24088
|
-
}
|
|
24089
|
-
this.sender = new EmailSenderMock();
|
|
24090
|
-
} else {
|
|
24091
|
-
throw new Error(`Unsupported EMAIL_MODE '${mode}'. Must be 'aws' or 'mock'. (E: 987a6b5c4d3e2f10987654321fedcba1)`);
|
|
24092
|
-
}
|
|
24093
|
-
}
|
|
24104
|
+
this.sender = options.sender || createDefaultEmailSender();
|
|
24094
24105
|
}
|
|
24095
24106
|
async handleRouteImpl(reqCtx) {
|
|
24096
24107
|
const lc2 = `${this.lc}[${this.handleRouteImpl.name}]`;
|
|
@@ -24814,7 +24825,7 @@ function isGraftInfo(ibGib) {
|
|
|
24814
24825
|
}
|
|
24815
24826
|
|
|
24816
24827
|
// ../../libs/core-gib/dist/sync/sync-helpers.mjs
|
|
24817
|
-
var logalot62 = GLOBAL_LOG_A_LOT3;
|
|
24828
|
+
var logalot62 = GLOBAL_LOG_A_LOT3 || true;
|
|
24818
24829
|
async function getSyncIb({ data }) {
|
|
24819
24830
|
const lc2 = `[${getSyncIb.name}]`;
|
|
24820
24831
|
try {
|
|
@@ -24933,11 +24944,6 @@ ${pretty(sagaIbGib)} (I: 2a35685bfe038f63182c7db39b44c826)`);
|
|
|
24933
24944
|
});
|
|
24934
24945
|
resGraphs.push(graph);
|
|
24935
24946
|
}
|
|
24936
|
-
if (logalot62) {
|
|
24937
|
-
console.log(`${lc2} resGraphs:...
|
|
24938
|
-
${pretty(resGraphs).split("\n").join("\n ")}
|
|
24939
|
-
...(I: d8e11827d88a3454d887ff05fb4ff526)`);
|
|
24940
|
-
}
|
|
24941
24947
|
return resGraphs;
|
|
24942
24948
|
} catch (error) {
|
|
24943
24949
|
console.error(`${lc2} ${extractErrorMsg(error)}`);
|
|
@@ -25196,7 +25202,7 @@ async function deriveSessionSecret({ senderSecret, sagaId }) {
|
|
|
25196
25202
|
}
|
|
25197
25203
|
|
|
25198
25204
|
// ../../libs/core-gib/dist/sync/sync-saga-context/sync-saga-context-helpers.mjs
|
|
25199
|
-
var logalot63 = GLOBAL_LOG_A_LOT3;
|
|
25205
|
+
var logalot63 = GLOBAL_LOG_A_LOT3 || true;
|
|
25200
25206
|
async function getSyncSagaContextIb({ data }) {
|
|
25201
25207
|
const lc2 = `[${getSyncSagaContextIb.name}]`;
|
|
25202
25208
|
try {
|
|
@@ -27194,7 +27200,7 @@ var GraftStrategyService = class _GraftStrategyService {
|
|
|
27194
27200
|
};
|
|
27195
27201
|
|
|
27196
27202
|
// ../../libs/core-gib/dist/sync/sync-saga-coordinator.mjs
|
|
27197
|
-
var logalot71 = GLOBAL_LOG_A_LOT3;
|
|
27203
|
+
var logalot71 = GLOBAL_LOG_A_LOT3 || true;
|
|
27198
27204
|
var logalotControlDomain = false;
|
|
27199
27205
|
var lcControlDomain = "[ControlDomain]";
|
|
27200
27206
|
var SyncSagaCoordinator = class _SyncSagaCoordinator {
|
|
@@ -29566,16 +29572,25 @@ async function main() {
|
|
|
29566
29572
|
try {
|
|
29567
29573
|
console.log(`${lc2} starting...`);
|
|
29568
29574
|
console.log(`${lc2} dataDir: ${DATA_DIR}`);
|
|
29569
|
-
|
|
29575
|
+
const custodianPrimaryProfile = "primary-profile.dev".trim();
|
|
29576
|
+
if (!custodianPrimaryProfile) {
|
|
29577
|
+
throw new Error(`${lc2} Fatal Error: KEYSTONE_PROFILE_CUSTODIAN_PRIMARY environment variable is missing or blank. (E: 8a9b0c1d2e3f4567890123456789abcd)`);
|
|
29578
|
+
}
|
|
29579
|
+
const isProdEnv = true;
|
|
29580
|
+
if (isProdEnv && !custodianPrimaryProfile.endsWith(".prod")) {
|
|
29581
|
+
throw new Error(`${lc2} Security Violation: Non-production keystone profile '${custodianPrimaryProfile}' is prohibited when NODE_ENV=production. (E: 9b0c1d2e3f4567890123456789abcdef)`);
|
|
29582
|
+
}
|
|
29583
|
+
console.log(`${lc2} KEYSTONE_PROFILE_CUSTODIAN_PRIMARY: ${custodianPrimaryProfile} (I: 961014e2dd082293b83b917835c97e26)`);
|
|
29584
|
+
if (custodianPrimaryProfile.endsWith(".dev")) {
|
|
29570
29585
|
console.warn(`
|
|
29571
29586
|
==========================================================
|
|
29572
|
-
\u26A0\uFE0F WARNING:
|
|
29573
|
-
|
|
29587
|
+
\u26A0\uFE0F WARNING: CUSTODIAN KEYSTONE PROFILE IS SET TO DEVELOPMENT ('${custodianPrimaryProfile}')!
|
|
29588
|
+
CUSTODIAL KEYSTONES WILL USE LOW-SECURITY DEV PARAMETERS.
|
|
29574
29589
|
FOR LOCAL TESTING ONLY \u2014 DO NOT USE FOR REAL SECRETS OR PRODUCTION DATA!
|
|
29575
29590
|
==========================================================
|
|
29576
29591
|
(W: 890123456789abcdef0123456789a123)`);
|
|
29577
|
-
} else {
|
|
29578
|
-
console.
|
|
29592
|
+
} else if (custodianPrimaryProfile.endsWith(".staging")) {
|
|
29593
|
+
console.info(`${lc2} \u2139\uFE0F STAGING CUSTODIAN KEYSTONE PROFILE ACTIVE ('${custodianPrimaryProfile}')`);
|
|
29579
29594
|
}
|
|
29580
29595
|
const syncUpgradeHandler = new SyncUpgradeHandler();
|
|
29581
29596
|
const serveGib = new ServeGib_V1({
|
|
@@ -29606,4 +29621,3 @@ FOR LOCAL TESTING ONLY \u2014 DO NOT USE FOR REAL SECRETS OR PRODUCTION DATA!
|
|
|
29606
29621
|
}
|
|
29607
29622
|
}
|
|
29608
29623
|
main();
|
|
29609
|
-
//# sourceMappingURL=server.mjs.map
|