@rockcarver/frodo-cli 3.0.2 → 3.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -9,11 +9,21 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
9
9
 
10
10
  ### Changed
11
11
 
12
+ - Update to frodo-lib 3.0.3
13
+
14
+ ### Fixed
15
+
16
+ - \#479: Fixes issues introduced by a recent PingOne Advanced Identity Cloud release (16747.0 on 27 Feb 2025) which prevented Frodo from correctly determining the deployment type of `cloud` and led to failures in the `frodo conn save` and `frodo conn add` commands when Frodo was attempting to create service accounts with scopes that are not available in an environment.
17
+
18
+ ## [3.0.2] - 2025-03-11
19
+
20
+ ### Changed
21
+
12
22
  - Update to frodo-lib 3.0.2
13
23
 
14
24
  ### Fixed
15
25
 
16
- - #479: Fixes issues introduced by a recent PingOne Advanced Identity Cloud release (16747.0 on 27 Feb 2025) which prevented Frodo from correctly determining the deployment type of `cloud` and led to failures in the `frodo conn save` and `frodo conn add` commands when Frodo was attempting to create service accounts with scopes that are not available in an environment.
26
+ - \#479: Fixes issues introduced by a recent PingOne Advanced Identity Cloud release (16747.0 on 27 Feb 2025) which prevented Frodo from correctly determining the deployment type of `cloud` and led to failures in the `frodo conn save` and `frodo conn add` commands when Frodo was attempting to create service accounts with scopes that are not available in an environment.
17
27
  - Updated dependencies with vulnerabilities
18
28
 
19
29
  ## [3.0.1] - 2025-02-06
@@ -2024,7 +2034,8 @@ Frodo CLI 2.x automatically refreshes session and access tokens before they expi
2024
2034
  - Fixed problem with adding connection profiles
2025
2035
  - Miscellaneous bug fixes
2026
2036
 
2027
- [unreleased]: https://github.com/rockcarver/frodo-cli/compare/v3.0.1...HEAD
2037
+ [unreleased]: https://github.com/rockcarver/frodo-cli/compare/v3.0.2...HEAD
2038
+ [3.0.2]: https://github.com/rockcarver/frodo-cli/compare/v3.0.1...v3.0.2
2028
2039
  [3.0.1]: https://github.com/rockcarver/frodo-cli/compare/v3.0.0...v3.0.1
2029
2040
  [3.0.0]: https://github.com/rockcarver/frodo-cli/compare/v2.1.0...v3.0.0
2030
2041
  [2.1.0]: https://github.com/rockcarver/frodo-cli/compare/v2.0.6-2...v2.1.0
package/dist/app.cjs CHANGED
@@ -85898,7 +85898,7 @@ function stringify(obj) {
85898
85898
  }
85899
85899
  var package_default = {
85900
85900
  name: "@rockcarver/frodo-lib",
85901
- version: "3.0.2",
85901
+ version: "3.0.3",
85902
85902
  type: "commonjs",
85903
85903
  main: "./dist/index.js",
85904
85904
  module: "./dist/index.mjs",
@@ -117086,14 +117086,72 @@ async function getServerVersionInfo({ state: state2 }) {
117086
117086
  }).get(urlString, {});
117087
117087
  return data2;
117088
117088
  }
117089
+ var serviceAccountScopes = "%s/environment/scopes/service-accounts";
117090
+ var apiVersion12 = "protocol=1.0,resource=1.0";
117091
+ var getApiConfig13 = () => {
117092
+ return {
117093
+ apiVersion: apiVersion12
117094
+ };
117095
+ };
117096
+ async function getServiceAccountScopes({
117097
+ state: state2
117098
+ }) {
117099
+ const urlString = _util2.default.format(
117100
+ serviceAccountScopes,
117101
+ getHostOnlyUrl(state2.getHost())
117102
+ );
117103
+ const { data: data2 } = await generateEnvApi({
117104
+ resource: getApiConfig13(),
117105
+ requestOverride: {
117106
+ headers: {
117107
+ Cookie: `${state2.getCookieName()}=${state2.getCookieValue()}`
117108
+ }
117109
+ },
117110
+ state: state2
117111
+ }).get(urlString, {
117112
+ withCredentials: true
117113
+ });
117114
+ return data2;
117115
+ }
117116
+ var EnvServiceAccountScopesOps_default = (state2) => {
117117
+ return {
117118
+ async readServiceAccountScopes(flatten) {
117119
+ return readServiceAccountScopes({ flatten, state: state2 });
117120
+ }
117121
+ };
117122
+ };
117123
+ function flattenScopes(scopes) {
117124
+ const flattenedScopes = [];
117125
+ for (const scope of scopes) {
117126
+ flattenedScopes.push(scope.scope);
117127
+ if (scope.childScopes) {
117128
+ flattenedScopes.push(...flattenScopes(scope.childScopes));
117129
+ }
117130
+ }
117131
+ return flattenedScopes;
117132
+ }
117133
+ async function readServiceAccountScopes({
117134
+ flatten = false,
117135
+ state: state2
117136
+ }) {
117137
+ try {
117138
+ const scopes = await getServiceAccountScopes({ state: state2 });
117139
+ if (flatten) {
117140
+ return flattenScopes(scopes);
117141
+ }
117142
+ return scopes;
117143
+ } catch (error2) {
117144
+ throw new FrodoError(`Error reading service account scopes`, error2);
117145
+ }
117146
+ }
117089
117147
  var envInfoURLTemplate = "%s/feature?_queryFilter=true";
117090
- var getApiConfig13 = () => ({});
117148
+ var getApiConfig14 = () => ({});
117091
117149
  async function getFeatures({ state: state2 }) {
117092
117150
  const urlString = _util2.default.format(
117093
117151
  envInfoURLTemplate,
117094
117152
  getHostOnlyUrl(state2.getHost())
117095
117153
  );
117096
- const { data: data2 } = await generateAmApi({ resource: getApiConfig13(), state: state2 }).get(
117154
+ const { data: data2 } = await generateAmApi({ resource: getApiConfig14(), state: state2 }).get(
117097
117155
  urlString,
117098
117156
  {
117099
117157
  withCredentials: true
@@ -117375,64 +117433,6 @@ var DataProtection = class {
117375
117433
  }
117376
117434
  };
117377
117435
  var DataProtection_default = DataProtection;
117378
- var serviceAccountScopes = "%s/environment/scopes/service-accounts";
117379
- var apiVersion12 = "protocol=1.0,resource=1.0";
117380
- var getApiConfig14 = () => {
117381
- return {
117382
- apiVersion: apiVersion12
117383
- };
117384
- };
117385
- async function getServiceAccountScopes({
117386
- state: state2
117387
- }) {
117388
- const urlString = _util2.default.format(
117389
- serviceAccountScopes,
117390
- getHostOnlyUrl(state2.getHost())
117391
- );
117392
- const { data: data2 } = await generateEnvApi({
117393
- resource: getApiConfig14(),
117394
- requestOverride: {
117395
- headers: {
117396
- Cookie: `${state2.getCookieName()}=${state2.getCookieValue()}`
117397
- }
117398
- },
117399
- state: state2
117400
- }).get(urlString, {
117401
- withCredentials: true
117402
- });
117403
- return data2;
117404
- }
117405
- var EnvServiceAccountScopesOps_default = (state2) => {
117406
- return {
117407
- async readServiceAccountScopes(flatten) {
117408
- return readServiceAccountScopes({ flatten, state: state2 });
117409
- }
117410
- };
117411
- };
117412
- function flattenScopes(scopes) {
117413
- const flattenedScopes = [];
117414
- for (const scope of scopes) {
117415
- flattenedScopes.push(scope.scope);
117416
- if (scope.childScopes) {
117417
- flattenedScopes.push(...flattenScopes(scope.childScopes));
117418
- }
117419
- }
117420
- return flattenedScopes;
117421
- }
117422
- async function readServiceAccountScopes({
117423
- flatten = false,
117424
- state: state2
117425
- }) {
117426
- try {
117427
- const scopes = await getServiceAccountScopes({ state: state2 });
117428
- if (flatten) {
117429
- return flattenScopes(scopes);
117430
- }
117431
- return scopes;
117432
- } catch (error2) {
117433
- throw new FrodoError(`Error reading service account scopes`, error2);
117434
- }
117435
- }
117436
117436
  var ConnectionProfileOps_default = (state2) => {
117437
117437
  return {
117438
117438
  getConnectionProfilesPath() {
@@ -118571,6 +118571,20 @@ var AuthenticateOps_default = (state2) => {
118571
118571
  var adminClientPassword = "doesnotmatter";
118572
118572
  var redirectUrlTemplate = "/platform/appAuthHelperRedirect.html";
118573
118573
  var s3 = Constants_default.AVAILABLE_SCOPES;
118574
+ var CLOUD_ADMIN_MINIMAL_SCOPES = [
118575
+ s3.AnalyticsFullScope,
118576
+ s3.CertificateFullScope,
118577
+ s3.ContentSecurityPolicyFullScope,
118578
+ s3.CookieDomainsFullScope,
118579
+ s3.CustomDomainFullScope,
118580
+ s3.ESVFullScope,
118581
+ s3.AdminFederationFullScope,
118582
+ s3.IdmFullScope,
118583
+ s3.OpenIdScope,
118584
+ s3.PromotionScope,
118585
+ s3.ReleaseFullScope,
118586
+ s3.SSOCookieFullScope
118587
+ ];
118574
118588
  var CLOUD_ADMIN_DEFAULT_SCOPES = [
118575
118589
  s3.AnalyticsFullScope,
118576
118590
  s3.AutoAccessFullScope,
@@ -118589,7 +118603,6 @@ var CLOUD_ADMIN_DEFAULT_SCOPES = [
118589
118603
  s3.ProxyConnectFullScope
118590
118604
  ];
118591
118605
  var FORGEOPS_ADMIN_DEFAULT_SCOPES = [s3.IdmFullScope, s3.OpenIdScope];
118592
- var cloudAdminScopes = CLOUD_ADMIN_DEFAULT_SCOPES.join(" ");
118593
118606
  var forgeopsAdminScopes = FORGEOPS_ADMIN_DEFAULT_SCOPES.join(" ");
118594
118607
  var serviceAccountDefaultScopes = SERVICE_ACCOUNT_DEFAULT_SCOPES.join(" ");
118595
118608
  var fidcClientId = "idmAdminClient";
@@ -118914,9 +118927,57 @@ async function getUserSessionToken(otpCallback, state2) {
118914
118927
  });
118915
118928
  return token;
118916
118929
  }
118930
+ async function getAdminUserScopes({ state: state2 }) {
118931
+ debugMessage({
118932
+ message: `AuthenticateOps.getAdminUserScopes: start`,
118933
+ state: state2
118934
+ });
118935
+ if (state2.getDeploymentType() === Constants_default.FORGEOPS_DEPLOYMENT_TYPE_KEY) {
118936
+ debugMessage({
118937
+ message: `AuthenticateOps.getAdminUserScopes: end with forgeops scopes ${forgeopsAdminScopes}`,
118938
+ state: state2
118939
+ });
118940
+ return forgeopsAdminScopes;
118941
+ } else if (state2.getDeploymentType() === Constants_default.CLOUD_DEPLOYMENT_TYPE_KEY) {
118942
+ try {
118943
+ const availableScopes = await readServiceAccountScopes({
118944
+ flatten: true,
118945
+ state: state2
118946
+ });
118947
+ availableScopes.push(s3.OpenIdScope);
118948
+ const cloudAdminScopes = CLOUD_ADMIN_DEFAULT_SCOPES.filter(
118949
+ (scope) => availableScopes.includes(scope)
118950
+ );
118951
+ debugMessage({
118952
+ message: `AuthenticateOps.getAdminUserScopes: end with cloud scopes ${cloudAdminScopes.join(" ")}`,
118953
+ state: state2
118954
+ });
118955
+ return cloudAdminScopes.join(" ");
118956
+ } catch (error2) {
118957
+ debugMessage({
118958
+ message: `AuthenticateOps.getAdminUserScopes: end with minimal cloud scopes ${CLOUD_ADMIN_MINIMAL_SCOPES.join(" ")}`,
118959
+ state: state2
118960
+ });
118961
+ return CLOUD_ADMIN_MINIMAL_SCOPES.join(" ");
118962
+ }
118963
+ }
118964
+ debugMessage({
118965
+ message: `AuthenticateOps.getAdminUserScopes: end without scopes: Unsupported deployment type: ${state2.getDeploymentType()}, expected ${Constants_default.FORGEOPS_DEPLOYMENT_TYPE_KEY} or ${Constants_default.CLOUD_DEPLOYMENT_TYPE_KEY}`,
118966
+ state: state2
118967
+ });
118968
+ throw new FrodoError(
118969
+ `Unsupported deployment type: ${state2.getDeploymentType()}, expected ${Constants_default.FORGEOPS_DEPLOYMENT_TYPE_KEY} or ${Constants_default.CLOUD_DEPLOYMENT_TYPE_KEY}`
118970
+ );
118971
+ }
118917
118972
  async function getAuthCode(redirectUri, codeChallenge, codeChallengeMethod, state2) {
118973
+ debugMessage({
118974
+ message: `AuthenticateOps.getAuthCode: start`,
118975
+ state: state2
118976
+ });
118918
118977
  try {
118919
- const bodyFormData = `redirect_uri=${redirectUri}&scope=${state2.getDeploymentType() === Constants_default.CLOUD_DEPLOYMENT_TYPE_KEY ? cloudAdminScopes : forgeopsAdminScopes}&response_type=code&client_id=${adminClientId}&csrf=${state2.getCookieValue()}&decision=allow&code_challenge=${codeChallenge}&code_challenge_method=${codeChallengeMethod}`;
118978
+ const bodyFormData = `redirect_uri=${redirectUri}&scope=${await getAdminUserScopes(
118979
+ { state: state2 }
118980
+ )}&response_type=code&client_id=${adminClientId}&csrf=${state2.getCookieValue()}&decision=allow&code_challenge=${codeChallenge}&code_challenge_method=${codeChallengeMethod}`;
118920
118981
  const config = {
118921
118982
  headers: {
118922
118983
  "Content-Type": "application/x-www-form-urlencoded"
@@ -118940,10 +119001,22 @@ async function getAuthCode(redirectUri, codeChallenge, codeChallengeMethod, stat
118940
119001
  const redirectLocationURL = _optionalChain([response, 'access', _156 => _156.headers, 'optionalAccess', _157 => _157.location]);
118941
119002
  const queryObject = _url2.default.parse(redirectLocationURL, true).query;
118942
119003
  if ("code" in queryObject) {
119004
+ debugMessage({
119005
+ message: `AuthenticateOps.getAuthCode: end with code`,
119006
+ state: state2
119007
+ });
118943
119008
  return queryObject.code;
118944
119009
  }
119010
+ debugMessage({
119011
+ message: `AuthenticateOps.getAuthCode: end without code`,
119012
+ state: state2
119013
+ });
118945
119014
  throw new FrodoError(`Authz code not found`);
118946
119015
  } catch (error2) {
119016
+ debugMessage({
119017
+ message: `AuthenticateOps.getAuthCode: end without code`,
119018
+ state: state2
119019
+ });
118947
119020
  throw new FrodoError(`Error getting authz code`, error2);
118948
119021
  }
118949
119022
  }
@@ -160324,7 +160397,7 @@ var compareVersions = (v12, v2) => {
160324
160397
  // package.json
160325
160398
  var package_default2 = {
160326
160399
  name: "@rockcarver/frodo-cli",
160327
- version: "3.0.2",
160400
+ version: "3.0.3",
160328
160401
  type: "module",
160329
160402
  description: "A command line interface to manage ForgeRock Identity Cloud tenants, ForgeOps deployments, and classic deployments.",
160330
160403
  keywords: [
@@ -160438,7 +160511,7 @@ var package_default2 = {
160438
160511
  ]
160439
160512
  },
160440
160513
  devDependencies: {
160441
- "@rockcarver/frodo-lib": "3.0.2",
160514
+ "@rockcarver/frodo-lib": "3.0.3",
160442
160515
  "@types/colors": "^1.2.1",
160443
160516
  "@types/fs-extra": "^11.0.1",
160444
160517
  "@types/jest": "^29.2.3",