@rockcarver/frodo-cli 5.0.0-28 → 5.0.0-29

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/app.cjs CHANGED
@@ -34931,6 +34931,248 @@ function setup$399() {
34931
34931
  });
34932
34932
  return program;
34933
34933
  }
34934
+ // src/ops/AgentFileShape.ts
34935
+ /** What is left out of a result: not a value, and not `undefined`, which a value never is. */
34936
+ const LEFT_OUT = Symbol("left out");
34937
+ const isObject$1 = (item) => typeof item === "object" && item !== null && !Array.isArray(item);
34938
+ /**
34939
+ * Whether an object is AM's writable wrapper: it has only the members `inherited` and `value`, and
34940
+ * `inherited` is a boolean. An object that merely has a member called `inherited` among others is
34941
+ * not a wrapper.
34942
+ * @param {Record<string, unknown>} item the object
34943
+ * @param {boolean} lenient also accept `{ value }` without `inherited` (an overrides file)
34944
+ * @returns {boolean} true for a wrapper
34945
+ */
34946
+ function isWrapper(item, lenient) {
34947
+ const keys = Object.keys(item);
34948
+ if (keys.length === 0) return false;
34949
+ if (!keys.every((key) => key === "inherited" || key === "value")) return false;
34950
+ if (typeof item.inherited === "boolean") return true;
34951
+ return lenient && !("inherited" in item) && "value" in item;
34952
+ }
34953
+ function walk(item, context) {
34954
+ if (item === void 0) return LEFT_OUT;
34955
+ if (item === null) {
34956
+ if (!context.nullIsUnset) return null;
34957
+ context.leftOut++;
34958
+ return LEFT_OUT;
34959
+ }
34960
+ if (Array.isArray(item)) {
34961
+ const result = [];
34962
+ for (const element of item) {
34963
+ if (element === null) {
34964
+ result.push(null);
34965
+ continue;
34966
+ }
34967
+ const kept = walk(element, context);
34968
+ if (kept !== LEFT_OUT) result.push(kept);
34969
+ }
34970
+ return result;
34971
+ }
34972
+ if (!isObject$1(item)) return item;
34973
+ if (isWrapper(item, context.lenient)) {
34974
+ if (item.inherited === true || item.value === null || item.value === void 0) {
34975
+ context.leftOut++;
34976
+ return LEFT_OUT;
34977
+ }
34978
+ return walk(item.value, context);
34979
+ }
34980
+ const result = {};
34981
+ for (const [key, member] of Object.entries(item)) {
34982
+ const kept = walk(member, context);
34983
+ if (kept !== LEFT_OUT) result[key] = kept;
34984
+ }
34985
+ return result;
34986
+ }
34987
+ /**
34988
+ * The object as it is written to a file: every property that is set on it as its plain value, and
34989
+ * no property that is unset, inherited or `null`. One function for every writer of agent files.
34990
+ * @param {Record<string, unknown>} object an agent object as AM answers a single read (the writable
34991
+ * shape) or the list read (plain values and `null`), or an overrides entry
34992
+ * @param {PlainShapeOptions} options how to read the input; the default is for a pulled object
34993
+ * @returns {PlainShape} a new object and the number of properties left out; the input is not changed
34994
+ */
34995
+ function toPlainShape(object, options = {}) {
34996
+ const context = {
34997
+ lenient: options.lenientWrapper === true,
34998
+ nullIsUnset: options.nullIsUnset !== false,
34999
+ leftOut: 0
35000
+ };
35001
+ const kept = walk(object, context);
35002
+ return {
35003
+ value: kept === LEFT_OUT || !isObject$1(kept) ? {} : kept,
35004
+ leftOut: context.leftOut
35005
+ };
35006
+ }
35007
+ /**
35008
+ * The overrides of an entry of an overrides file, read for a file in the plain shape: an override
35009
+ * written for the wrapped files of the first 5.0.0 prereleases (`{ "value": ... }` or `{
35010
+ * "inherited": false, "value": ... }`) is the value, so such an overrides file keeps working.
35011
+ * @param {Record<string, unknown>} overrides the `overrides` of one entry
35012
+ * @returns {Record<string, unknown>} the overrides to merge into the plain object
35013
+ */
35014
+ function plainOverrides(overrides) {
35015
+ return toPlainShape(overrides, {
35016
+ lenientWrapper: true,
35017
+ nullIsUnset: false
35018
+ }).value;
35019
+ }
35020
+ /**
35021
+ * The sentence of the verbose output that says how much was left out of the files of a pull.
35022
+ * @param {number} leftOut the number of properties left out
35023
+ * @param {number} objects the number of objects written
35024
+ * @param {string} label what one object is called
35025
+ * @param {string} plural what several objects are called
35026
+ * @returns {string} the sentence
35027
+ */
35028
+ function leftOutMessage(leftOut, objects, label, plural) {
35029
+ return `Left ${leftOut} unset or inherited ${leftOut === 1 ? "property" : "properties"} out of ${objects} ${objects === 1 ? label : plural} written: a file holds only what is set on the object.`;
35030
+ }
35031
+ // src/ops/AgentKeySets.ts
35032
+ /**
35033
+ * Private and secret key material in the agent files that `config-manager` writes (decision record
35034
+ * https://github.com/rockcarver/frodo-cli/blob/main/docs/decisions/0055-a-pull-never-writes-private-or-secret-key-material-into-an-agent-file.md,
35035
+ * which applies core record 0013, secrets are never exported in the clear, to key sets).
35036
+ *
35037
+ * A trusted JWT issuer, a software publisher, a remote consent agent and an OAuth2 client have a
35038
+ * `jwkSet`: the JSON Web Key Set of the other party, which AM uses to verify what that party signs.
35039
+ * It is meant to hold public keys. When it holds a private or a symmetric key (a member `d`, `p`,
35040
+ * `q`, `dp`, `dq`, `qi`, `oth` or `k`) a pull must not write it into a file that goes into version
35041
+ * control: it writes the placeholder `${<ID>_JWKSET}` instead and says so, and a push fills the
35042
+ * placeholder from the variable of that name.
35043
+ *
35044
+ * This module imports nothing from the library on purpose, like `AgentFileShape.ts`: the generic
35045
+ * kind lives in the deprecated `src/configManagerOps/` layer and many tests mock the library. What
35046
+ * needs the library's state (the values of the placeholders) is passed in.
35047
+ */
35048
+ /** The members of a JWK (RFC 7517 and 7518) that only a private or a symmetric key has. */
35049
+ const SECRET_JWK_MEMBERS = [
35050
+ "d",
35051
+ "p",
35052
+ "q",
35053
+ "dp",
35054
+ "dq",
35055
+ "qi",
35056
+ "oth",
35057
+ "k"
35058
+ ];
35059
+ /**
35060
+ * Where an agent file keeps a key set, as the path of the property: the top level (trusted JWT
35061
+ * issuers, software publishers, remote consent agents) and the signing and encryption group of an
35062
+ * OAuth2 client.
35063
+ */
35064
+ const KEY_SET_FIELDS = [["jwkSet"], ["signEncOAuth2ClientConfig", "jwkSet"]];
35065
+ /**
35066
+ * Whether the `jwkSet` of an object holds private or secret key material: a JWK with a private or a
35067
+ * symmetric member. The value may be wrapped (`{ inherited, value }`), and is a string of JSON, the
35068
+ * way AM stores it, or already an object. A key set that cannot be read as JSON holds nothing that
35069
+ * can be told apart. Nothing of the key is returned or printed.
35070
+ * @param {unknown} jwkSet the `jwkSet` property of the object
35071
+ * @returns {boolean} true if a key in it is private or symmetric
35072
+ */
35073
+ function holdsSecretKeyMaterial(jwkSet) {
35074
+ let value = jwkSet;
35075
+ if (value && typeof value === "object" && "value" in value) value = value.value;
35076
+ if (typeof value === "string") try {
35077
+ value = JSON.parse(value);
35078
+ } catch {
35079
+ return false;
35080
+ }
35081
+ if (!value || typeof value !== "object") return false;
35082
+ return (Array.isArray(value.keys) ? value.keys : [value]).some((key) => key && typeof key === "object" && SECRET_JWK_MEMBERS.some((member) => member in key));
35083
+ }
35084
+ /**
35085
+ * The name of the variable that holds the key set of an object: the id in upper case with `-`
35086
+ * as `_` (the way `esvToEnv` in `src/utils/FrConfig.ts` names the variable of a secret, record
35087
+ * 0054 rule 7), every other character that a variable name cannot have as `_`, and `_JWKSET`.
35088
+ * @param {string} id the id of the object
35089
+ * @returns {string} the name of the variable, e.g. `ZION_ISSUER_JWKSET`
35090
+ */
35091
+ function keySetVariable(id) {
35092
+ return `${id.toUpperCase().replace(/-/g, "_").replace(/[^A-Z0-9_]/g, "_")}_JWKSET`;
35093
+ }
35094
+ const isRecord$1 = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
35095
+ /**
35096
+ * Replace every key set of an object that holds private or secret key material with the
35097
+ * placeholder of its variable, in place. A key set with public keys only, one that is unset, and
35098
+ * one that already is a placeholder (an overrides file may have put one there) are not touched. A
35099
+ * key set with one private key among public ones is replaced as a whole: half of a secret is not
35100
+ * written either.
35101
+ * @param {Record<string, unknown>} config the object in the plain shape, after the overrides were merged; it is changed
35102
+ * @param {string} id the id of the object, which names the variable
35103
+ * @returns {RedactedKeySet[]} what was replaced, none if the object holds no private key material
35104
+ */
35105
+ function redactKeySets(config, id) {
35106
+ const redacted = [];
35107
+ for (const path of KEY_SET_FIELDS) {
35108
+ let holder = config;
35109
+ for (const step of path.slice(0, -1)) holder = isRecord$1(holder) ? holder[step] : void 0;
35110
+ const field = path[path.length - 1];
35111
+ if (!isRecord$1(holder) || !holdsSecretKeyMaterial(holder[field])) continue;
35112
+ const variable = redacted.length === 0 ? keySetVariable(id) : `${keySetVariable(id)}_${redacted.length + 1}`;
35113
+ holder[field] = `\${${variable}}`;
35114
+ redacted.push({
35115
+ field: path.join("."),
35116
+ variable
35117
+ });
35118
+ }
35119
+ return redacted;
35120
+ }
35121
+ /**
35122
+ * The warning for an object whose key set was not written. It names the object, the property and
35123
+ * the variable, and never a part of the key.
35124
+ * @param {string} label what one object is called, e.g. `trusted JWT issuer`
35125
+ * @param {string} id the id of the object
35126
+ * @param {string} realm the realm, as the state names it
35127
+ * @param {RedactedKeySet} redacted what was replaced
35128
+ * @returns {string} the message
35129
+ */
35130
+ function redactedKeySetMessage(label, id, realm, redacted) {
35131
+ return `${label.charAt(0).toUpperCase()}${label.slice(1)} '${id}' of realm '${realm}' holds private or secret key material in ${redacted.field}: it is not written. The file has \${${redacted.variable}} in its place; set that variable to the key set when you push.`;
35132
+ }
35133
+ /** A key set in a file that is only a placeholder: `"jwkSet": "${NAME}"`. */
35134
+ const KEY_SET_PLACEHOLDER = /"jwkSet"\s*:\s*"\$\{([A-Za-z0-9_]+)\}"/g;
35135
+ /** Whether a variable holds a key set as JSON text: an object, not text that merely parses. */
35136
+ function isJsonObject$1(value) {
35137
+ try {
35138
+ const parsed = JSON.parse(value);
35139
+ return typeof parsed === "object" && parsed !== null;
35140
+ } catch {
35141
+ return false;
35142
+ }
35143
+ }
35144
+ /**
35145
+ * Read an agent file for a push. The library fills a placeholder into the text of the file before
35146
+ * it is parsed, so a key set (JSON text, with quotes) in a variable would break the string it is
35147
+ * put into. For the variables that stand for a whole `jwkSet`, and only for them, the value that
35148
+ * is put in is the JSON-escaped form of the key set, so that the variable holds the key set as it
35149
+ * is, as the pull asks. A value that is not a JSON object (one that was already escaped by hand,
35150
+ * or an unset variable) is left to the library: it is filled as it is, or it fails and names the
35151
+ * variable. The values of the state are put back whatever happens.
35152
+ * @param {string} file the path of the file
35153
+ * @param {(file: string) => T} read the library's read of a file with the placeholders filled
35154
+ * @param {PlaceholderEnvironment} env the state of the library
35155
+ * @returns {T} what `read` answers
35156
+ */
35157
+ function readAgentFile(file, read, env) {
35158
+ let text = "";
35159
+ try {
35160
+ text = fs.default.readFileSync(file, "utf8");
35161
+ } catch {}
35162
+ const escaped = /* @__PURE__ */ new Map();
35163
+ for (const [, name] of text.matchAll(KEY_SET_PLACEHOLDER)) {
35164
+ const value = env.getEnv(name) ?? (env.getUseProcessEnvironmentForPlaceholders?.() === true ? process.env[name] : void 0);
35165
+ if (value !== void 0 && isJsonObject$1(value)) escaped.set(name, JSON.stringify(value).slice(1, -1));
35166
+ }
35167
+ if (escaped.size === 0) return read(file);
35168
+ const before = { ...env.getEnvs() };
35169
+ try {
35170
+ for (const [name, value] of escaped) env.setEnv(name, value);
35171
+ return read(file);
35172
+ } finally {
35173
+ env.setEnvs(before, true);
35174
+ }
35175
+ }
34934
35176
  // src/ops/ConfigManagerAgentKind.ts
34935
35177
  /**
34936
35178
  * The type-independent parts of a config-manager kind that works with one agent type under
@@ -35171,6 +35413,8 @@ async function pullAgentKind(kind, hooks, { name, realm, quiet = false, allowFai
35171
35413
  let namedFailed = false;
35172
35414
  let found = 0;
35173
35415
  let realmsRead = 0;
35416
+ let leftOut = 0;
35417
+ let written = 0;
35174
35418
  for (const currentRealm of realms) {
35175
35419
  require_dist$2.state.setRealm(currentRealm);
35176
35420
  visited.add(currentRealm);
@@ -35220,16 +35464,21 @@ async function pullAgentKind(kind, hooks, { name, realm, quiet = false, allowFai
35220
35464
  const fileName = names.get(item.id);
35221
35465
  if (fileName === void 0) continue;
35222
35466
  const succeeded = await runWithCause(run, `${realmDir}/${item.id}`, async () => {
35223
- let config = escapePlaceholders$3(await item.read());
35467
+ const plain = toPlainShape(await item.read());
35468
+ let config = escapePlaceholders$3(plain.value);
35224
35469
  const own = overridesOf(overrides, currentRealm, item.id, matched);
35225
- if (own) config = mergeDeep$1(config, own);
35470
+ if (own) config = mergeDeep$1(config, plainOverrides(own));
35471
+ for (const redacted of redactKeySets(config, item.id)) require_Console.printMessage(redactedKeySetMessage(kind.label, item.id, currentRealm, redacted), "warn");
35226
35472
  hooks.inspect?.(currentRealm, item.id, config);
35227
35473
  saveJsonToFile$52(config, getFilePath$53(agentKindFilePath(kind.agentType, currentRealm, fileName), true), false, false, true);
35474
+ leftOut += plain.leftOut;
35475
+ written++;
35228
35476
  });
35229
35477
  if (name && !succeeded) namedFailed = true;
35230
35478
  }
35231
35479
  }
35232
35480
  for (const { realm: entryRealm, id } of unmatchedOverrides(overrides, matched, visited)) require_Console.printMessage(`The overrides file names ${kind.label} '${id}' in realm '${entryRealm}', which does not exist; its overrides were not applied.`, "warn");
35481
+ if (leftOut > 0) require_Console.verboseMessage(leftOutMessage(leftOut, written, kind.label, kind.plural));
35233
35482
  if (found === 0 && realmsRead > 0 && !namedFailed && !quiet) require_Console.printMessage(`No ${kind.plural} found.`, "info");
35234
35483
  return run.finish() && !namedFailed;
35235
35484
  } catch (error) {
@@ -35333,7 +35582,7 @@ async function pushAgentKind(kind, hooks, { name, realm, allowFailures = false }
35333
35582
  const label = `${realmDir}/${file}`;
35334
35583
  let object;
35335
35584
  try {
35336
- object = readJsonFile$36(`${dir}/${file}`);
35585
+ object = readAgentFile(`${dir}/${file}`, (path) => readJsonFile$36(path), require_dist$2.state);
35337
35586
  if (typeof object !== "object" || object === null || Array.isArray(object)) throw new require_dist$2.FrodoError(`${file} is not a JSON object`);
35338
35587
  } catch (error) {
35339
35588
  require_Console.printError(error);
@@ -35583,19 +35832,17 @@ async function showAgentKindDeletePlan(kind, hooks, name, realm) {
35583
35832
  * - the type exists on Cloud today and on self-hosted deployments with PingAM 9.0, so every
35584
35833
  * deployment advertises it in its agent type list and a realm without it is a non-event, not a
35585
35834
  * failure;
35586
- * - a profile holds no secret: the file is what a read of the profile by its id answers, without
35587
- * `_rev`: the wrapped shape (`{ "inherited": false, "value": ... }` for each property), the one
35588
- * `pull oauth2-agents` wrote for this type and `pull oauth-issuers` writes for trusted JWT issuers,
35589
- * so that every file under `realms/<realm>/realm-config/agents/**` has one shape. The library's
35590
- * list answers the plain shape, so the list only tells which profiles a realm holds; each profile
35591
- * is then read once more by its id.
35835
+ * - a profile holds no secret: the file is the profile in the plain shape (record 0054, rule 6: a
35836
+ * property that is set on the object as its value; nothing for one that is unset, inherited or
35837
+ * null), without `_rev`, like every file under `realms/<realm>/realm-config/agents/**`. The
35838
+ * library's list answers plain values and `null` for what is not set, and the writer
35839
+ * (`toPlainShape`) leaves those out, which gives the file that the read of one profile by its id
35840
+ * gives (checked on the library's recordings): the one list request of a realm is all a pull needs.
35592
35841
  */
35593
35842
  const { cimd } = require_dist$2.frodo.oauth2oidc;
35594
- /** The agent type of a CIMD profile, which names the folder of its files. */
35595
- const CIMD_PROFILE_AGENT_TYPE = "CIMDProfile";
35596
35843
  /** What the kind is called in its messages. */
35597
35844
  const CIMD_PROFILE_KIND = {
35598
- agentType: CIMD_PROFILE_AGENT_TYPE,
35845
+ agentType: "CIMDProfile",
35599
35846
  label: "CIMD profile",
35600
35847
  plural: "CIMD profiles"
35601
35848
  };
@@ -35603,9 +35850,8 @@ const CIMD_PROFILE_KIND = {
35603
35850
  * Export the CIMD profiles of every realm (or one realm, or one profile) as one file per profile.
35604
35851
  * The profiles are listed once per realm, also for a named one, so that a pull with and without
35605
35852
  * `-n` writes the same bytes and an id the server holds ignoring case (or with a character outside
35606
- * the basic multilingual plane) is found; the stored id names the file. The list answers the plain
35607
- * shape and the file holds the wrapped one, so each profile is then read by its stored id, with
35608
- * the generic read of an agent of a type (one request more per profile).
35853
+ * the basic multilingual plane) is found; the stored id names the file. The list item is the
35854
+ * profile: one request per realm, and no request by id.
35609
35855
  *
35610
35856
  * A realm or a deployment that does not offer CIMD profiles has nothing to export: it is
35611
35857
  * success, no profile is requested, and (unless `quiet`) one line says so. With a name it fails.
@@ -35627,7 +35873,7 @@ async function configManagerExportCIMDProfiles(name, realm, quiet = false, allow
35627
35873
  const profiles = await cimd.readCIMDProfiles();
35628
35874
  return (wanted ? profiles.filter((p) => p._id.toLowerCase() === wanted.toLowerCase()) : profiles).map((profile) => ({
35629
35875
  id: profile._id,
35630
- read: async () => await require_dist$2.frodo.agent.readAgentByTypeAndId(CIMD_PROFILE_AGENT_TYPE, profile._id)
35876
+ read: async () => profile
35631
35877
  }));
35632
35878
  }
35633
35879
  }, {
@@ -36231,12 +36477,12 @@ function setup$396() {
36231
36477
  * the family follows are in that module; what is specific to issuers is here:
36232
36478
  * - the type exists on every deployment, so there is no availability check: a realm that cannot be
36233
36479
  * read is a failed realm;
36234
- * - the file is the object that `pull oauth2-agents` writes today, byte for byte, so that no
36235
- * existing tree changes: the single read of the issuer (every property wrapped as
36236
- * `{ inherited, value }`), not the list read;
36237
- * - an issuer is a trust anchor: a `jwkSet` that holds private or secret key material is written
36238
- * (the user asked for the issuer) with a warning that never prints the key, and a push says what
36239
- * it replaces and never deletes.
36480
+ * - the file is the single read of the issuer in the plain shape (record 0054, rule 6: a property
36481
+ * that is set on the object as its value; nothing for one that is unset or inherited), the same
36482
+ * file that `pull oauth2-agents` writes for the types it handles;
36483
+ * - an issuer is a trust anchor: a `jwkSet` that holds private or secret key material is not
36484
+ * written (record 0055): the file has `${<ID>_JWKSET}` in its place, a warning says so and never
36485
+ * prints the key, and a push fills the variable and says what it replaces and never deletes.
36240
36486
  */
36241
36487
  const { issuer } = require_dist$2.frodo.oauth2oidc;
36242
36488
  /** The agent type of a trusted JWT issuer, which names the folder of its files. */
@@ -36247,34 +36493,6 @@ const TRUSTED_JWT_ISSUER_KIND = {
36247
36493
  label: "trusted JWT issuer",
36248
36494
  plural: "trusted JWT issuers"
36249
36495
  };
36250
- /** The members of a JWK that only a private or a symmetric key has. */
36251
- const SECRET_JWK_MEMBERS = [
36252
- "d",
36253
- "p",
36254
- "q",
36255
- "dp",
36256
- "dq",
36257
- "qi",
36258
- "k"
36259
- ];
36260
- /**
36261
- * Whether the `jwkSet` of an issuer holds private or secret key material: a JWK with a private or a
36262
- * symmetric member. The value may be wrapped (`{ inherited, value }`), and is a string of JSON.
36263
- * Nothing of the key is returned or printed.
36264
- * @param {unknown} jwkSet the `jwkSet` property of the issuer
36265
- * @returns {boolean} true if a key in it is private or symmetric
36266
- */
36267
- function holdsSecretKeyMaterial(jwkSet) {
36268
- let value = jwkSet;
36269
- if (value && typeof value === "object" && "value" in value) value = value.value;
36270
- if (typeof value === "string") try {
36271
- value = JSON.parse(value);
36272
- } catch {
36273
- return false;
36274
- }
36275
- if (!value || typeof value !== "object") return false;
36276
- return (Array.isArray(value.keys) ? value.keys : [value]).some((key) => key && typeof key === "object" && SECRET_JWK_MEMBERS.some((member) => member in key));
36277
- }
36278
36496
  /**
36279
36497
  * Export the trusted JWT issuers of every realm (or one realm, or one issuer) as one file per
36280
36498
  * issuer. The content is the single read of the issuer, the object that `pull oauth2-agents`
@@ -36286,7 +36504,8 @@ function holdsSecretKeyMaterial(jwkSet) {
36286
36504
  * written, and a realm whose issuers cannot be listed, are named in one summary and the others are
36287
36505
  * still pulled. A named issuer that does not exist, a name without a single realm and an
36288
36506
  * overrides file that cannot be read fail the command whatever `--allow-failures` says. A `jwkSet`
36289
- * with private or secret key material is a warning, not a failure, and the key is never printed.
36507
+ * with private or secret key material is replaced by a placeholder and a warning, not a failure,
36508
+ * and the key is never printed (record 0055).
36290
36509
  * @param {string} name optional name: pull only that issuer (needs a single realm)
36291
36510
  * @param {string} realm optional realm: pull only from that realm. Default: every realm (the root realm of a Cloud tenant has no trusted JWT issuers)
36292
36511
  * @param {boolean} quiet true for the step of `pull all`: say nothing when there is nothing to export
@@ -36295,17 +36514,12 @@ function holdsSecretKeyMaterial(jwkSet) {
36295
36514
  * @returns {Promise<boolean>} true if successful, false otherwise
36296
36515
  */
36297
36516
  async function configManagerExportTrustedJwtIssuers(name, realm, quiet = false, allowFailures = false, overridesFile) {
36298
- return pullAgentKind(TRUSTED_JWT_ISSUER_KIND, {
36299
- items: async (wanted) => {
36300
- return (wanted ? [wanted] : (await issuer.readOAuth2TrustedJwtIssuers()).map((item) => item._id)).map((id) => ({
36301
- id,
36302
- read: async () => await issuer.readOAuth2TrustedJwtIssuer(id)
36303
- }));
36304
- },
36305
- inspect: (currentRealm, id, object) => {
36306
- if (holdsSecretKeyMaterial(object.jwkSet)) require_Console.printMessage(`Trusted JWT issuer '${id}' of realm '${currentRealm}' stores private or secret key material in jwkSet; the file contains it. Replace it with a placeholder in the overrides file.`, "warn");
36307
- }
36308
- }, {
36517
+ return pullAgentKind(TRUSTED_JWT_ISSUER_KIND, { items: async (wanted) => {
36518
+ return (wanted ? [wanted] : (await issuer.readOAuth2TrustedJwtIssuers()).map((item) => item._id)).map((id) => ({
36519
+ id,
36520
+ read: async () => await issuer.readOAuth2TrustedJwtIssuer(id)
36521
+ }));
36522
+ } }, {
36309
36523
  name,
36310
36524
  realm,
36311
36525
  quiet,
@@ -36494,12 +36708,13 @@ function setup$395() {
36494
36708
  * list fails the realm);
36495
36709
  * - a realm offers the type when its list of agent types names it; a realm that does not has
36496
36710
  * nothing to pull, push or delete, which is not a failure (with a name it is);
36497
- * - the file is the object that `pull oauth2-agents` wrote before it left the type to this kind,
36498
- * byte for byte, so that no existing tree changes: the single read of the publisher (every
36499
- * property wrapped as `{ inherited, value }`), not the list read;
36711
+ * - the file is the single read of the publisher in the plain shape (record 0054, rule 6: a
36712
+ * property that is set on the object as its value; nothing for one that is unset or inherited),
36713
+ * the same file that `pull oauth2-agents` writes for the types it handles;
36500
36714
  * - a publisher holds no secret property, but its `jwkSet` is a key set: one that holds private or
36501
- * secret key material is written (the user asked for the publisher) with a warning that never
36502
- * prints the key, and a push says what it replaces and never deletes.
36715
+ * secret key material is not written (record 0055): the file has `${<ID>_JWKSET}` in its place,
36716
+ * a warning says so and never prints the key, and a push fills the variable and says what it
36717
+ * replaces and never deletes.
36503
36718
  */
36504
36719
  /** The agent type of a software publisher, which names the folder of its files. */
36505
36720
  const SOFTWARE_PUBLISHER_AGENT_TYPE = "SoftwarePublisher";
@@ -36546,7 +36761,8 @@ async function listSoftwarePublishers() {
36546
36761
  * are still pulled. A named publisher that does not exist, a name without a single realm and an
36547
36762
  * overrides file that cannot be read fail the command whatever `--allow-failures` says. A realm
36548
36763
  * that does not offer the type has nothing to export, which is not a failure. A `jwkSet` with
36549
- * private or secret key material is a warning, not a failure, and the key is never printed.
36764
+ * private or secret key material is replaced by a placeholder and a warning, not a failure, and
36765
+ * the key is never printed (record 0055).
36550
36766
  * @param {string} name optional name: pull only that publisher (needs a single realm)
36551
36767
  * @param {string} realm optional realm: pull only from that realm. Default: every realm
36552
36768
  * @param {boolean} quiet true for the step of `pull all`: say nothing when there is nothing to export
@@ -36562,9 +36778,6 @@ async function configManagerExportSoftwarePublishers(name, realm, quiet = false,
36562
36778
  id,
36563
36779
  read: async () => await require_dist$2.frodo.agent.readAgentByTypeAndId(SOFTWARE_PUBLISHER_AGENT_TYPE, id)
36564
36780
  }));
36565
- },
36566
- inspect: (currentRealm, id, object) => {
36567
- if (holdsSecretKeyMaterial(object.jwkSet)) require_Console.printMessage(`Software publisher '${id}' of realm '${currentRealm}' stores private or secret key material in jwkSet; the file contains it. Replace it with a placeholder in the overrides file.`, "warn");
36568
36781
  }
36569
36782
  }, {
36570
36783
  name,
@@ -39483,17 +39696,23 @@ function isConfidentialClient(client) {
39483
39696
  }
39484
39697
  /**
39485
39698
  * The OAuth2 client of an application as it is written to `oauth2-client.json`:
39486
- * the format of the `oauth2-agents` kind, with literal `${` escaped, and for a
39487
- * confidential client the secret as a placeholder (the library masks it on
39488
- * reads, and a secret is never written in the clear: core record 0013).
39699
+ * the format of the `oauth2-agents` kind (the plain shape of record 0054, rule 6),
39700
+ * with literal `${` escaped, and for a confidential client the secret as a
39701
+ * placeholder (the library masks it on reads, and a secret is never written in
39702
+ * the clear: core record 0013).
39489
39703
  * @param {any} client the OAuth2 client as the library reads it
39490
39704
  * @param {string} applicationName the name of the application
39491
- * @returns {object} the content of the file
39705
+ * @returns {{ file: object; leftOut: number }} the content of the file and how many
39706
+ * properties were left out of it (unset, inherited or null)
39492
39707
  */
39493
39708
  function clientFile(client, applicationName) {
39494
- const file = escapePlaceholders$2(client);
39709
+ const plain = toPlainShape(client);
39710
+ const file = escapePlaceholders$2(plain.value);
39495
39711
  if (isConfidentialClient(client)) file.userpassword = `\${${clientSecretVariable(applicationName)}}`;
39496
- return file;
39712
+ return {
39713
+ file,
39714
+ leftOut: plain.leftOut
39715
+ };
39497
39716
  }
39498
39717
  /** The text that names a reference that could not be followed, for the summary. */
39499
39718
  function describeProblem(problem) {
@@ -39649,7 +39868,9 @@ async function pullApplication(application, realm, folder, readMappings) {
39649
39868
  for (const client of owned("oauth2Client")) await piece(`OAuth2 client ${client.id}`, async () => {
39650
39869
  const agent = await require_dist$2.frodo.agent.readAgentByTypeAndId("OAuth2Client", client.id);
39651
39870
  if (isConfidentialClient(agent)) require_Console.verboseMessage(`The secret of the OAuth2 client of application '${application.name}' is written as \${${clientSecretVariable(application.name)}}; set that variable when you push.`);
39652
- saveJsonToFile$40(clientFile(agent, application.name), getFilePath$41(`${folder}/oauth2-client.json`, true), false, false, true);
39871
+ const { file, leftOut } = clientFile(agent, application.name);
39872
+ saveJsonToFile$40(file, getFilePath$41(`${folder}/oauth2-client.json`, true), false, false, true);
39873
+ if (leftOut > 0) require_Console.verboseMessage(leftOutMessage(leftOut, 1, "OAuth2 client", "OAuth2 clients"));
39653
39874
  });
39654
39875
  for (const provider of owned("saml2Provider")) await piece(`SAML provider ${provider.id}`, async () => {
39655
39876
  const { config, metadata } = await readSamlProviderForFile(provider.id);
@@ -42752,6 +42973,8 @@ async function configManagerExportOAuth2Agents(configFile, allowFailures = false
42752
42973
  allowFailures
42753
42974
  });
42754
42975
  const owned = skipsOwnedObjects(layout) ? new OwnedObjects() : void 0;
42976
+ let leftOut = 0;
42977
+ let written = 0;
42755
42978
  for (const realm of Object.keys(configFileData)) {
42756
42979
  if (realm === "/" && require_dist$2.state.getDeploymentType() === CLOUD_DEPLOYMENT_TYPE_KEY$172) continue;
42757
42980
  require_dist$2.state.setRealm(realm);
@@ -42778,14 +43001,18 @@ async function configManagerExportOAuth2Agents(configFile, allowFailures = false
42778
43001
  continue;
42779
43002
  }
42780
43003
  await run.run(`${realm === "/" ? "root" : realm}/${agentType}/${agent.id}`, async () => {
42781
- const agentResponse = await readAgentByTypeAndId(agentType, agent.id);
42782
- let config = escapePlaceholders$1(agentResponse);
42783
- if (agent.overrides) config = mergeDeep(config, agent.overrides);
43004
+ const plain = toPlainShape(await readAgentByTypeAndId(agentType, agent.id));
43005
+ let config = escapePlaceholders$1(plain.value);
43006
+ if (agent.overrides) config = mergeDeep(config, plainOverrides(agent.overrides));
43007
+ for (const redacted of redactKeySets(config, agent.id)) require_Console.printMessage(redactedKeySetMessage(agentType, agent.id, realm, redacted), "warn");
42784
43008
  saveJsonToFile$24(config, getFilePath$25(`realms/${realm === "/" ? "root" : realm}/realm-config/agents/${agentType}/${agent.id}.json`, true), false, false, true);
43009
+ leftOut += plain.leftOut;
43010
+ written++;
42785
43011
  });
42786
43012
  }
42787
43013
  }
42788
43014
  }
43015
+ if (leftOut > 0) require_Console.verboseMessage(leftOutMessage(leftOut, written, "agent", "agents"));
42789
43016
  return run.finish();
42790
43017
  } catch (error) {
42791
43018
  require_Console.printError(error, "Error exporting OAuth2 agents");
@@ -42869,7 +43096,7 @@ async function configManagerImportAgents(allowFailures = false) {
42869
43096
  continue;
42870
43097
  }
42871
43098
  await run.run(`${realmDir}/${agentType}/${file}`, async () => {
42872
- const agent = readJsonFile$8(path.default.join(agentTypeDir, file));
43099
+ const agent = readAgentFile(path.default.join(agentTypeDir, file), (agentFile) => readJsonFile$8(agentFile), require_dist$2.state);
42873
43100
  const agentId = agent._id;
42874
43101
  clearOperationalAttributes(agent);
42875
43102
  await importAgent(agentId, { agent: { [agentId]: agent } }, false);
@@ -44694,12 +44921,12 @@ function setup$351() {
44694
44921
  // src/cli/config-manager/config-manager-pull/config-manager-pull-oauth-cimd-profiles.ts
44695
44922
  function setup$350() {
44696
44923
  const program = new FrodoCommand("frodo config-manager pull oauth-cimd-profiles");
44697
- program.summary("Export CIMD profiles, one file per profile.").description("Export the CIMD profiles (the allow-list of client ID URL patterns for OAuth 2.0 clients that identify themselves with a Client ID Metadata Document) of all realms or of one realm to realms/<realm>/realm-config/agents/CIMDProfile/<name>.json, one file for each. The object is written as the server lists it, without its revision; it contains no secrets. A realm or a deployment that does not offer CIMD profiles has nothing to export, which is not an error.").addOption(new Option("-n, --name <name>", "CIMD profile name. If specified, pulls only the profile with the given name. Needs a single realm.")).addOption(new Option("--config-file <file>", `A JSON file with overrides for values that differ between environments, e.g. "${cimdOverridesFile}".`)).addHelpText("after", "Usage Examples:\n Pull all CIMD profiles of all realms to realms/<realm>/realm-config/agents/CIMDProfile/<name>.json:\n" + require_Console.theme.command(` $ frodo config-manager pull oauth-cimd-profiles ${connId}\n`) + ` Pull the CIMD profiles of one realm:\n` + require_Console.theme.command(` $ frodo config-manager pull oauth-cimd-profiles ${connId} ${realm}\n`) + ` Pull one CIMD profile of a realm:\n` + require_Console.theme.command(` $ frodo config-manager pull oauth-cimd-profiles -n ${cimdProfileId} ${connId} ${realm}\n`) + ` Replace values that differ between environments with placeholders from a file:\n` + require_Console.theme.command(` $ frodo config-manager pull oauth-cimd-profiles --config-file ${cimdOverridesFile} ${connId}\n`)).addHelpText("after", `\nOverrides file example (${cimdOverridesFile}): for each realm a list of profiles and the values to replace, in the form of the file (every property is wrapped as inherited and value). An array is replaced element by element, so list every element that should change.\n{
44924
+ program.summary("Export CIMD profiles, one file per profile.").description("Export the CIMD profiles (the allow-list of client ID URL patterns for OAuth 2.0 clients that identify themselves with a Client ID Metadata Document) of all realms or of one realm to realms/<realm>/realm-config/agents/CIMDProfile/<name>.json, one file for each. The object is written as the server lists it, without its revision; it contains no secrets. A realm or a deployment that does not offer CIMD profiles has nothing to export, which is not an error.").addOption(new Option("-n, --name <name>", "CIMD profile name. If specified, pulls only the profile with the given name. Needs a single realm.")).addOption(new Option("--config-file <file>", `A JSON file with overrides for values that differ between environments, e.g. "${cimdOverridesFile}".`)).addHelpText("after", "Usage Examples:\n Pull all CIMD profiles of all realms to realms/<realm>/realm-config/agents/CIMDProfile/<name>.json:\n" + require_Console.theme.command(` $ frodo config-manager pull oauth-cimd-profiles ${connId}\n`) + ` Pull the CIMD profiles of one realm:\n` + require_Console.theme.command(` $ frodo config-manager pull oauth-cimd-profiles ${connId} ${realm}\n`) + ` Pull one CIMD profile of a realm:\n` + require_Console.theme.command(` $ frodo config-manager pull oauth-cimd-profiles -n ${cimdProfileId} ${connId} ${realm}\n`) + ` Replace values that differ between environments with placeholders from a file:\n` + require_Console.theme.command(` $ frodo config-manager pull oauth-cimd-profiles --config-file ${cimdOverridesFile} ${connId}\n`)).addHelpText("after", `\nOverrides file example (${cimdOverridesFile}): for each realm a list of profiles and the values to replace, in the form of the file (a property that is set is its value; a value written as { "value": ... } of the first 5.0.0 prereleases still works). An array is replaced element by element, so list every element that should change.\n{
44698
44925
  "alpha": [
44699
44926
  {
44700
44927
  "id": "${cimdProfileId}",\n "overrides": {
44701
44928
  "cimdConfig": {
44702
- "cimdClientIdUrlPatterns": { "value": ["\${ZION_AGENTS_URL_PATTERN}"] }
44929
+ "cimdClientIdUrlPatterns": ["\${ZION_AGENTS_URL_PATTERN}"]
44703
44930
  }
44704
44931
  }
44705
44932
  }
@@ -44715,15 +44942,36 @@ When the files are pushed, each \${NAME} is filled from -E/--env NAME=value, els
44715
44942
  });
44716
44943
  return program;
44717
44944
  }
44945
+ // src/utils/PlaceholderValues.ts
44946
+ /**
44947
+ * Where the value of a `${NAME}` placeholder in a file that the config-manager
44948
+ * commands push comes from, said once so that the help texts that mention
44949
+ * placeholders cannot say different things. A test checks that they contain it
44950
+ * and that it is still true: the library fills a placeholder from the values
44951
+ * that `-E/--env` and `--env-file` put into its state and, for a push, last from
44952
+ * the environment variable of the process (the switch of the library's state
44953
+ * that the config-manager push commands turn on, see
44954
+ * `FrodoCommand.fillsPlaceholdersFromProcessEnvironment`).
44955
+ */
44956
+ const PLACEHOLDER_VALUES_RULE = "is filled from -E/--env NAME=value, else from --env-file, else from the environment variable NAME of the process (a file that names a variable copies its value into what is pushed).";
44957
+ /** The rule as a sentence of its own. */
44958
+ const PLACEHOLDER_VALUES_SENTENCE = `Each \${NAME} ${PLACEHOLDER_VALUES_RULE}`;
44959
+ /**
44960
+ * What a pull does with a key set that holds a private or secret key (decision record 0055, core
44961
+ * record 0013), for the help of the pull commands of the kinds that have a `jwkSet`.
44962
+ */
44963
+ const KEY_SET_PULL_SENTENCE = "A key set that holds a private or secret key is not written: the file has ${<ID>_JWKSET} in its place (the id of the object in upper case) and a warning says so.";
44964
+ /** What a push does with that placeholder, for the help of the push commands of the same kinds. */
44965
+ const KEY_SET_PUSH_SENTENCE = "A file that has ${<ID>_JWKSET} as its key set (a pull writes it for a key set with a private or secret key) is filled from that variable, which holds the key set as JSON text.";
44718
44966
  // src/cli/config-manager/config-manager-pull/config-manager-pull-oauth-issuers.ts
44719
44967
  function setup$349() {
44720
44968
  const program = new FrodoCommand("frodo config-manager pull oauth-issuers");
44721
- program.summary("Export trusted JWT issuers, one file per issuer.").description("Export the OAuth2 trusted JWT issuers (the issuers whose signed JWTs an OAuth 2.0 provider accepts as grants) of all realms or of one realm to realms/<realm>/realm-config/agents/TrustedJwtIssuer/<name>.json, one file for each. The file is the one that \"pull oauth2-agents\" writes for the same issuer, at the same path. A warning says when the key set of an issuer holds a private or secret key. Trusted JWT issuers are dynamic configuration: they are part of \"pull all\" and not of \"pull all-static\".").addOption(new Option("-n, --name <name>", "Trusted JWT issuer name, the name of the object and not its iss URL. If specified, pulls only that issuer. Needs a single realm.")).addOption(new Option("--config-file <file>", `A JSON file with overrides for values that differ between environments, e.g. "${trustedJwtIssuersOverridesFile}".`)).addHelpText("after", "Usage Examples:\n Pull all trusted JWT issuers of all realms to realms/<realm>/realm-config/agents/TrustedJwtIssuer/<name>.json:\n" + require_Console.theme.command(` $ frodo config-manager pull oauth-issuers ${connId}\n`) + ` Pull the trusted JWT issuers of one realm:\n` + require_Console.theme.command(` $ frodo config-manager pull oauth-issuers ${connId} ${realm}\n`) + ` Pull one trusted JWT issuer of a realm:\n` + require_Console.theme.command(` $ frodo config-manager pull oauth-issuers -n ${trustedJwtIssuerId} ${connId} ${realm}\n`) + ` Replace values that differ between environments with placeholders from a file:\n` + require_Console.theme.command(` $ frodo config-manager pull oauth-issuers --config-file ${trustedJwtIssuersOverridesFile} ${connId}\n`)).addHelpText("after", `\nOverrides file example (${trustedJwtIssuersOverridesFile}): for each realm a list of issuers and the values to replace, in the form of the file (every property is wrapped as inherited and value). The properties that usually differ between environments are issuer, jwksUri, jwkSet and allowedSubjects.\n{
44969
+ program.summary("Export trusted JWT issuers, one file per issuer.").description(`Export the OAuth2 trusted JWT issuers (the issuers whose signed JWTs an OAuth 2.0 provider accepts as grants) of all realms or of one realm to realms/<realm>/realm-config/agents/TrustedJwtIssuer/<name>.json, one file for each. The file is the one that "pull oauth2-agents" writes for the same issuer, at the same path. ${KEY_SET_PULL_SENTENCE} Trusted JWT issuers are dynamic configuration: they are part of "pull all" and not of "pull all-static".`).addOption(new Option("-n, --name <name>", "Trusted JWT issuer name, the name of the object and not its iss URL. If specified, pulls only that issuer. Needs a single realm.")).addOption(new Option("--config-file <file>", `A JSON file with overrides for values that differ between environments, e.g. "${trustedJwtIssuersOverridesFile}".`)).addHelpText("after", "Usage Examples:\n Pull all trusted JWT issuers of all realms to realms/<realm>/realm-config/agents/TrustedJwtIssuer/<name>.json:\n" + require_Console.theme.command(` $ frodo config-manager pull oauth-issuers ${connId}\n`) + ` Pull the trusted JWT issuers of one realm:\n` + require_Console.theme.command(` $ frodo config-manager pull oauth-issuers ${connId} ${realm}\n`) + ` Pull one trusted JWT issuer of a realm:\n` + require_Console.theme.command(` $ frodo config-manager pull oauth-issuers -n ${trustedJwtIssuerId} ${connId} ${realm}\n`) + ` Replace values that differ between environments with placeholders from a file:\n` + require_Console.theme.command(` $ frodo config-manager pull oauth-issuers --config-file ${trustedJwtIssuersOverridesFile} ${connId}\n`)).addHelpText("after", `\nOverrides file example (${trustedJwtIssuersOverridesFile}): for each realm a list of issuers and the values to replace, in the form of the file (a property that is set is its value; a value written as { "value": ... } of the first 5.0.0 prereleases still works). The properties that usually differ between environments are issuer, jwksUri, jwkSet and allowedSubjects.\n{
44722
44970
  "alpha": [
44723
44971
  {
44724
44972
  "id": "${trustedJwtIssuerId}",\n "overrides": {
44725
- "issuer": { "value": "\${ZION_ISSUER_URL}" },
44726
- "jwksUri": { "value": "\${ZION_JWKS_URI}" }
44973
+ "issuer": "\${ZION_ISSUER_URL}",
44974
+ "jwksUri": "\${ZION_JWKS_URI}"
44727
44975
  }
44728
44976
  }
44729
44977
  ]
@@ -44738,29 +44986,15 @@ When the files are pushed, each \${NAME} is filled from -E/--env NAME=value, els
44738
44986
  });
44739
44987
  return program;
44740
44988
  }
44741
- // src/utils/PlaceholderValues.ts
44742
- /**
44743
- * Where the value of a `${NAME}` placeholder in a file that the config-manager
44744
- * commands push comes from, said once so that the help texts that mention
44745
- * placeholders cannot say different things. A test checks that they contain it
44746
- * and that it is still true: the library fills a placeholder from the values
44747
- * that `-E/--env` and `--env-file` put into its state and, for a push, last from
44748
- * the environment variable of the process (the switch of the library's state
44749
- * that the config-manager push commands turn on, see
44750
- * `FrodoCommand.fillsPlaceholdersFromProcessEnvironment`).
44751
- */
44752
- const PLACEHOLDER_VALUES_RULE = "is filled from -E/--env NAME=value, else from --env-file, else from the environment variable NAME of the process (a file that names a variable copies its value into what is pushed).";
44753
- /** The rule as a sentence of its own. */
44754
- const PLACEHOLDER_VALUES_SENTENCE = `Each \${NAME} ${PLACEHOLDER_VALUES_RULE}`;
44755
44989
  // src/cli/config-manager/config-manager-pull/config-manager-pull-oauth-software-publishers.ts
44756
44990
  function setup$348() {
44757
44991
  const program = new FrodoCommand("frodo config-manager pull oauth-software-publishers");
44758
- program.summary("Export software publishers, one file per publisher.").description("Export the OAuth2 software publishers (the publishers whose signed software statements an OAuth 2.0 provider accepts when a client registers itself dynamically) of all realms or of one realm to realms/<realm>/realm-config/agents/SoftwarePublisher/<name>.json, one file for each. The file is the one that \"pull oauth2-agents\" wrote for the same publisher, at the same path. A warning says when the key set of a publisher holds a private or secret key. A realm that does not offer the agent type has nothing to export. Software publishers are dynamic configuration: they are part of \"pull all\" and not of \"pull all-static\".").addOption(new Option("-n, --name <name>", "Software publisher name, the name of the object. If specified, pulls only that publisher. Needs a single realm.")).addOption(new Option("--config-file <file>", `A JSON file with overrides for values that differ between environments, e.g. "${softwarePublishersOverridesFile}".`)).addHelpText("after", "Usage Examples:\n Pull all software publishers of all realms to realms/<realm>/realm-config/agents/SoftwarePublisher/<name>.json:\n" + require_Console.theme.command(` $ frodo config-manager pull oauth-software-publishers ${connId}\n`) + ` Pull the software publishers of one realm:\n` + require_Console.theme.command(` $ frodo config-manager pull oauth-software-publishers ${connId} ${realm}\n`) + ` Pull one software publisher of a realm:\n` + require_Console.theme.command(` $ frodo config-manager pull oauth-software-publishers -n ${softwarePublisherId} ${connId} ${realm}\n`) + ` Replace values that differ between environments with placeholders from a file:\n` + require_Console.theme.command(` $ frodo config-manager pull oauth-software-publishers --config-file ${softwarePublishersOverridesFile} ${connId}\n`)).addHelpText("after", `\nOverrides file example (${softwarePublishersOverridesFile}): for each realm a list of publishers and the values to replace, in the form of the file (every property is wrapped as inherited and value). The properties that usually differ between environments are issuer, jwksUri and jwkSet.\n{
44992
+ program.summary("Export software publishers, one file per publisher.").description(`Export the OAuth2 software publishers (the publishers whose signed software statements an OAuth 2.0 provider accepts when a client registers itself dynamically) of all realms or of one realm to realms/<realm>/realm-config/agents/SoftwarePublisher/<name>.json, one file for each. The file is the one that "pull oauth2-agents" wrote for the same publisher, at the same path. ${KEY_SET_PULL_SENTENCE} A realm that does not offer the agent type has nothing to export. Software publishers are dynamic configuration: they are part of "pull all" and not of "pull all-static".`).addOption(new Option("-n, --name <name>", "Software publisher name, the name of the object. If specified, pulls only that publisher. Needs a single realm.")).addOption(new Option("--config-file <file>", `A JSON file with overrides for values that differ between environments, e.g. "${softwarePublishersOverridesFile}".`)).addHelpText("after", "Usage Examples:\n Pull all software publishers of all realms to realms/<realm>/realm-config/agents/SoftwarePublisher/<name>.json:\n" + require_Console.theme.command(` $ frodo config-manager pull oauth-software-publishers ${connId}\n`) + ` Pull the software publishers of one realm:\n` + require_Console.theme.command(` $ frodo config-manager pull oauth-software-publishers ${connId} ${realm}\n`) + ` Pull one software publisher of a realm:\n` + require_Console.theme.command(` $ frodo config-manager pull oauth-software-publishers -n ${softwarePublisherId} ${connId} ${realm}\n`) + ` Replace values that differ between environments with placeholders from a file:\n` + require_Console.theme.command(` $ frodo config-manager pull oauth-software-publishers --config-file ${softwarePublishersOverridesFile} ${connId}\n`)).addHelpText("after", `\nOverrides file example (${softwarePublishersOverridesFile}): for each realm a list of publishers and the values to replace, in the form of the file (a property that is set is its value; a value written as { "value": ... } of the first 5.0.0 prereleases still works). The properties that usually differ between environments are issuer, jwksUri and jwkSet.\n{
44759
44993
  "alpha": [
44760
44994
  {
44761
44995
  "id": "${softwarePublisherId}",\n "overrides": {
44762
- "issuer": { "value": "\${ZION_PUBLISHER_ISSUER}" },
44763
- "jwksUri": { "value": "\${ZION_PUBLISHER_JWKS_URI}" }
44996
+ "issuer": "\${ZION_PUBLISHER_ISSUER}",
44997
+ "jwksUri": "\${ZION_PUBLISHER_JWKS_URI}"
44764
44998
  }
44765
44999
  }
44766
45000
  ]
@@ -44840,7 +45074,11 @@ Example command: frodo config-manager pull oauth2-agents -f oauth2-agents.json -
44840
45074
  "bravo": {}
44841
45075
  }
44842
45076
  * --------------------------------------------------------------------------------------------
44843
- `).addHelpText("after", "\nAgent types: IdentityGatewayAgent, J2EEAgent, WebAgent, 2.2_Agent and SharedAgent (these have a password: use an override with a placeholder, as in the example), OAuth2Client, RemoteConsentAgent, SoapSTSAgent (it exists only in classic deployments) and OAuth2Thing (it exists only where the deployment has enabled it).\nThe agent types CIMDProfile, TrustedJwtIssuer and SoftwarePublisher have a kind of their own: \"frodo config-manager pull oauth-cimd-profiles\", \"frodo config-manager pull oauth-issuers\" and \"frodo config-manager pull oauth-software-publishers\". An entry of one of these types in this file is skipped here with a warning and its overrides are not applied; the file is not changed. Move the entry to the overrides file of that command (--config-file).\nAn entry you write is a request: if the deployment cannot serve its type (for example OAuth2Thing where it is not enabled), that entry fails with the text of the server, the other entries are still pulled, and the command exits with 1 unless --allow-failures is given. The kind for CIMD profiles is different: a deployment that does not have them is nothing to do (a note, exit code 0) unless a name is given.\n").addHelpText("after", ownedObjectsHelp("OAuth2 clients")).multiOp().action(async (host, realm, user, password, options, command) => {
45077
+ `).addHelpText("after", `
45078
+ Agent types: IdentityGatewayAgent, J2EEAgent, WebAgent, 2.2_Agent and SharedAgent (these have a password: use an override with a placeholder, as in the example), OAuth2Client, RemoteConsentAgent, SoapSTSAgent (it exists only in classic deployments) and OAuth2Thing (it exists only where the deployment has enabled it).
45079
+ The agent types CIMDProfile, TrustedJwtIssuer and SoftwarePublisher have a kind of their own: "frodo config-manager pull oauth-cimd-profiles", "frodo config-manager pull oauth-issuers" and "frodo config-manager pull oauth-software-publishers". An entry of one of these types in this file is skipped here with a warning and its overrides are not applied; the file is not changed. Move the entry to the overrides file of that command (--config-file).
45080
+ ${KEY_SET_PULL_SENTENCE} The types with a key set are OAuth2Client and RemoteConsentAgent.\nAn entry you write is a request: if the deployment cannot serve its type (for example OAuth2Thing where it is not enabled), that entry fails with the text of the server, the other entries are still pulled, and the command exits with 1 unless --allow-failures is given. The kind for CIMD profiles is different: a deployment that does not have them is nothing to do (a note, exit code 0) unless a name is given.
45081
+ `).addHelpText("after", ownedObjectsHelp("OAuth2 clients")).multiOp().action(async (host, realm, user, password, options, command) => {
44844
45082
  command.handleDefaultArgsAndOpts(host, realm, user, password, options, command);
44845
45083
  if (!await getTokens()) {
44846
45084
  process.exitCode = 1;
@@ -45693,7 +45931,7 @@ function setup$302() {
45693
45931
  // src/cli/config-manager/config-manager-push/config-manager-push-oauth-issuers.ts
45694
45932
  function setup$301() {
45695
45933
  const program = new FrodoCommand("frodo config-manager push oauth-issuers");
45696
- program.summary("Import trusted JWT issuers from the files written by pull.").description("Import OAuth2 trusted JWT issuers from the files realms/<realm>/realm-config/agents/TrustedJwtIssuer/<name>.json that \"pull oauth-issuers\" and \"pull oauth2-agents\" write, from the working directory (-D). An issuer that does not exist is created and one that does is replaced by the file. When the server refuses an attribute of a file (it does not know the attribute), the issuer stays stored without it, nothing is rolled back, the push names the attributes and fails with exit code 1 unless --allow-failures is given. Each ${NAME} in a file is filled from -E/--env NAME=value, else from --env-file, else from the environment variable NAME of the process (a file that names a variable copies its value into what is pushed). No issuer is ever deleted. A trusted JWT issuer is a trust anchor: a JWT signed by it is accepted as a grant, so read the files before you push them.").addOption(new Option("-n, --name <name>", "Trusted JWT issuer name (the name of the object, not its iss URL). If specified, pushes only the issuer of the file with that name. Needs a single realm.")).addHelpText("after", "Usage Examples:\n Push all trusted JWT issuer files of all realms from the working directory to the tenant:\n" + require_Console.theme.command(` $ frodo config-manager push oauth-issuers ${connId}\n`) + ` Push the trusted JWT issuer files of one realm:\n` + require_Console.theme.command(` $ frodo config-manager push oauth-issuers ${connId} ${realm}\n`) + ` Push one trusted JWT issuer of a realm:\n` + require_Console.theme.command(` $ frodo config-manager push oauth-issuers -n ${trustedJwtIssuerId} ${connId} ${realm}\n`) + ` Push from a config directory other than the working directory:\n` + require_Console.theme.command(` $ frodo config-manager push oauth-issuers -D ./config ${connId}\n`)).multiOp().usesRealm().action(async (host, realm, user, password, options, command) => {
45934
+ program.summary("Import trusted JWT issuers from the files written by pull.").description(`Import OAuth2 trusted JWT issuers from the files realms/<realm>/realm-config/agents/TrustedJwtIssuer/<name>.json that "pull oauth-issuers" and "pull oauth2-agents" write, from the working directory (-D). An issuer that does not exist is created and one that does is replaced by the file. When the server refuses an attribute of a file (it does not know the attribute), the issuer stays stored without it, nothing is rolled back, the push names the attributes and fails with exit code 1 unless --allow-failures is given. Each \${NAME} in a file is filled from -E/--env NAME=value, else from --env-file, else from the environment variable NAME of the process (a file that names a variable copies its value into what is pushed). ${KEY_SET_PUSH_SENTENCE} No issuer is ever deleted. A trusted JWT issuer is a trust anchor: a JWT signed by it is accepted as a grant, so read the files before you push them.`).addOption(new Option("-n, --name <name>", "Trusted JWT issuer name (the name of the object, not its iss URL). If specified, pushes only the issuer of the file with that name. Needs a single realm.")).addHelpText("after", "Usage Examples:\n Push all trusted JWT issuer files of all realms from the working directory to the tenant:\n" + require_Console.theme.command(` $ frodo config-manager push oauth-issuers ${connId}\n`) + ` Push the trusted JWT issuer files of one realm:\n` + require_Console.theme.command(` $ frodo config-manager push oauth-issuers ${connId} ${realm}\n`) + ` Push one trusted JWT issuer of a realm:\n` + require_Console.theme.command(` $ frodo config-manager push oauth-issuers -n ${trustedJwtIssuerId} ${connId} ${realm}\n`) + ` Push from a config directory other than the working directory:\n` + require_Console.theme.command(` $ frodo config-manager push oauth-issuers -D ./config ${connId}\n`)).multiOp().usesRealm().action(async (host, realm, user, password, options, command) => {
45697
45935
  command.handleDefaultArgsAndOpts(host, realm, user, password, options, command);
45698
45936
  if (await getTokens()) {
45699
45937
  require_Console.verboseMessage(options.name ? `Importing trusted JWT issuer "${options.name}".` : "Importing trusted JWT issuers.");
@@ -45705,7 +45943,7 @@ function setup$301() {
45705
45943
  // src/cli/config-manager/config-manager-push/config-manager-push-oauth-software-publishers.ts
45706
45944
  function setup$300() {
45707
45945
  const program = new FrodoCommand("frodo config-manager push oauth-software-publishers");
45708
- program.summary("Import software publishers from the files written by pull.").description(`Import OAuth2 software publishers from the files realms/<realm>/realm-config/agents/SoftwarePublisher/<name>.json that "pull oauth-software-publishers" and "pull oauth2-agents" write, from the working directory (-D). A publisher that does not exist is created and one that does is replaced by the file. A realm that does not offer the agent type is skipped with a warning. ${PLACEHOLDER_VALUES_SENTENCE} No publisher is ever deleted. A software publisher is a trust anchor: a software statement it signs is accepted when a client registers itself, so read the files before you push them.`).addOption(new Option("-n, --name <name>", "Software publisher name (the name of the object). If specified, pushes only the publisher of the file with that name. Needs a single realm.")).addHelpText("after", "Usage Examples:\n Push all software publisher files of all realms from the working directory to the tenant:\n" + require_Console.theme.command(` $ frodo config-manager push oauth-software-publishers ${connId}\n`) + ` Push the software publisher files of one realm:\n` + require_Console.theme.command(` $ frodo config-manager push oauth-software-publishers ${connId} ${realm}\n`) + ` Push one software publisher of a realm:\n` + require_Console.theme.command(` $ frodo config-manager push oauth-software-publishers -n ${softwarePublisherId} ${connId} ${realm}\n`) + ` Push from a config directory other than the working directory:\n` + require_Console.theme.command(` $ frodo config-manager push oauth-software-publishers -D ./config ${connId}\n`)).multiOp().usesRealm().action(async (host, realm, user, password, options, command) => {
45946
+ program.summary("Import software publishers from the files written by pull.").description(`Import OAuth2 software publishers from the files realms/<realm>/realm-config/agents/SoftwarePublisher/<name>.json that "pull oauth-software-publishers" and "pull oauth2-agents" write, from the working directory (-D). A publisher that does not exist is created and one that does is replaced by the file. A realm that does not offer the agent type is skipped with a warning. ${PLACEHOLDER_VALUES_SENTENCE} ${KEY_SET_PUSH_SENTENCE} No publisher is ever deleted. A software publisher is a trust anchor: a software statement it signs is accepted when a client registers itself, so read the files before you push them.`).addOption(new Option("-n, --name <name>", "Software publisher name (the name of the object). If specified, pushes only the publisher of the file with that name. Needs a single realm.")).addHelpText("after", "Usage Examples:\n Push all software publisher files of all realms from the working directory to the tenant:\n" + require_Console.theme.command(` $ frodo config-manager push oauth-software-publishers ${connId}\n`) + ` Push the software publisher files of one realm:\n` + require_Console.theme.command(` $ frodo config-manager push oauth-software-publishers ${connId} ${realm}\n`) + ` Push one software publisher of a realm:\n` + require_Console.theme.command(` $ frodo config-manager push oauth-software-publishers -n ${softwarePublisherId} ${connId} ${realm}\n`) + ` Push from a config directory other than the working directory:\n` + require_Console.theme.command(` $ frodo config-manager push oauth-software-publishers -D ./config ${connId}\n`)).multiOp().usesRealm().action(async (host, realm, user, password, options, command) => {
45709
45947
  command.handleDefaultArgsAndOpts(host, realm, user, password, options, command);
45710
45948
  if (await getTokens()) {
45711
45949
  require_Console.verboseMessage(options.name ? `Importing software publisher "${options.name}".` : "Importing software publishers.");
@@ -45720,7 +45958,7 @@ function setup$299() {
45720
45958
  program.description("Import Oauth2 agents.").addHelpText("after", "Usage Examples:\n Push every agent file of the tree in the working directory (realms/<realm>/realm-config/agents/<type>/<id>.json) to the tenant:\n" + require_Console.theme.command(` $ frodo config-manager push oauth2-agents ${connId}\n`) + ` Push from a config directory other than the working directory:\n` + require_Console.theme.command(` $ frodo config-manager push oauth2-agents -D ./config ${connId}\n`) + ` Succeed although some agents could not be pushed (the failures are still summarised):\n` + require_Console.theme.command(` $ frodo config-manager push oauth2-agents --allow-failures ${connId}\n`)).addHelpText("after", `
45721
45959
  The folders of these agent types are pushed: IdentityGatewayAgent, J2EEAgent, WebAgent, 2.2_Agent, SharedAgent, OAuth2Client, RemoteConsentAgent, SoapSTSAgent (it exists only in classic deployments) and OAuth2Thing (it exists only where the deployment has enabled it), as realms/<realm>/realm-config/agents/<type>/<id>.json.
45722
45960
  The agent types CIMDProfile, TrustedJwtIssuer and SoftwarePublisher have a kind of their own: "frodo config-manager push oauth-cimd-profiles", "frodo config-manager push oauth-issuers" and "frodo config-manager push oauth-software-publishers". The folders of those types are skipped here with a warning; no file in them is read or changed.
45723
- Each \${NAME} in a file ${PLACEHOLDER_VALUES_RULE} The agents with a password (IdentityGatewayAgent, J2EEAgent, WebAgent, 2.2_Agent, SharedAgent and the OAuth2 client secret) are pulled with an override that holds such a placeholder.\nA file you push is a request: if the deployment cannot serve its type (SoapSTSAgent outside a classic deployment, OAuth2Thing where it is not enabled), that file fails with the text of the library or of the server, the other files are still pushed, and the command exits with 1 unless --allow-failures is given. The kind for CIMD profiles is different: a deployment that does not have them is skipped with a note unless a name is given.
45961
+ Each \${NAME} in a file ${PLACEHOLDER_VALUES_RULE} The agents with a password (IdentityGatewayAgent, J2EEAgent, WebAgent, 2.2_Agent, SharedAgent and the OAuth2 client secret) are pulled with an override that holds such a placeholder. ${KEY_SET_PUSH_SENTENCE}\nA file you push is a request: if the deployment cannot serve its type (SoapSTSAgent outside a classic deployment, OAuth2Thing where it is not enabled), that file fails with the text of the library or of the server, the other files are still pushed, and the command exits with 1 unless --allow-failures is given. The kind for CIMD profiles is different: a deployment that does not have them is skipped with a note unless a name is given.
45724
45962
  `).addHelpText("after", ownedObjectsPushHelp("OAuth2 clients")).multiOp().action(async (host, realm, user, password, options, command) => {
45725
45963
  command.handleDefaultArgsAndOpts(host, realm, user, password, options, command);
45726
45964
  if (!await getTokens()) {
@@ -58281,7 +58519,7 @@ function setup$122() {
58281
58519
  return program;
58282
58520
  }
58283
58521
  // package.json
58284
- var version$1 = "5.0.0-28";
58522
+ var version$1 = "5.0.0-29";
58285
58523
  // node_modules/@modelcontextprotocol/server/dist/chunk-vYduTEsO.mjs
58286
58524
  var __create = Object.create;
58287
58525
  var __defProp = Object.defineProperty;
@@ -60408,7 +60646,7 @@ const $ZodObject = /*@__PURE__*/ $constructor("$ZodObject", (inst, def) => {
60408
60646
  }
60409
60647
  return propValues;
60410
60648
  });
60411
- const isObject$1 = isObject;
60649
+ const isObject$2 = isObject;
60412
60650
  const catchall = def.catchall;
60413
60651
  let value;
60414
60652
  const memo = globalConfig.memoizer;
@@ -60416,7 +60654,7 @@ const $ZodObject = /*@__PURE__*/ $constructor("$ZodObject", (inst, def) => {
60416
60654
  inst._zod.parse = (payload, ctx) => {
60417
60655
  value ?? (value = _normalized.value);
60418
60656
  const input = payload.value;
60419
- if (!isObject$1(input)) {
60657
+ if (!isObject$2(input)) {
60420
60658
  payload.issues.push({
60421
60659
  expected: "object",
60422
60660
  code: "invalid_type",
@@ -60546,7 +60784,7 @@ const $ZodObjectJIT = /*@__PURE__*/ $constructor("$ZodObjectJIT", (inst, def) =>
60546
60784
  return doc.compile();
60547
60785
  };
60548
60786
  let fastpass;
60549
- const isObject$2 = isObject;
60787
+ const isObject$3 = isObject;
60550
60788
  const jit = !globalConfig.jitless;
60551
60789
  const fastEnabled = jit && allowsEval.value;
60552
60790
  const catchall = def.catchall;
@@ -60554,7 +60792,7 @@ const $ZodObjectJIT = /*@__PURE__*/ $constructor("$ZodObjectJIT", (inst, def) =>
60554
60792
  inst._zod.parse = (payload, ctx) => {
60555
60793
  value ?? (value = _normalized.value);
60556
60794
  const input = payload.value;
60557
- if (!isObject$2(input)) {
60795
+ if (!isObject$3(input)) {
60558
60796
  payload.issues.push({
60559
60797
  expected: "object",
60560
60798
  code: "invalid_type",
@@ -84060,7 +84298,7 @@ const { getVersion, getBuildTimestamp, getAllVersions } = require_dist$2.frodo.u
84060
84298
  * rather than a tsup build, since no bundler ever substitutes the
84061
84299
  * identifier there.
84062
84300
  */
84063
- const getCliBuildTimestamp = () => "2026-11-16T17:02:54.493Z";
84301
+ const getCliBuildTimestamp = () => "2026-11-17T01:19:47.048Z";
84064
84302
  const VERSION_CACHE_FILE = `${os.default.homedir()}/.frodo/Versions.json`;
84065
84303
  const VERSION_CHECK_INTERVAL = 86400;
84066
84304
  const VERSION_CHECK_TIMEOUT = 5e3;