opal-security 3.2.2 → 3.2.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. package/README.md +22 -22
  2. package/lib/commands/login.js +11 -11
  3. package/lib/commands/request/get.js +2 -1
  4. package/lib/graphql/graphql.d.ts +855 -158
  5. package/lib/graphql/graphql.js +107 -10
  6. package/lib/handler.d.ts +6 -6
  7. package/lib/handler.js +1 -1
  8. package/lib/labels.js +3 -0
  9. package/lib/lib/apollo.d.ts +3 -3
  10. package/lib/lib/apollo.js +24 -47
  11. package/lib/lib/request/api/mutations/create-request.d.ts +2 -2
  12. package/lib/lib/request/api/queries/apps.d.ts +2 -2
  13. package/lib/lib/request/api/queries/assets.d.ts +3 -3
  14. package/lib/lib/request/api/queries/assets.js +5 -5
  15. package/lib/lib/request/api/queries/request-defaults.d.ts +2 -2
  16. package/lib/lib/request/api/queries/request-defaults.js +2 -1
  17. package/lib/lib/request/api/queries/requests.d.ts +4 -4
  18. package/lib/lib/request/api/queries/roles.d.ts +3 -3
  19. package/lib/lib/request/api/queries/roles.js +9 -9
  20. package/lib/lib/request/displays.d.ts +3 -3
  21. package/lib/lib/request/displays.js +15 -15
  22. package/lib/lib/request/prompts/apps-prompt.d.ts +2 -2
  23. package/lib/lib/request/prompts/asset-prompt.d.ts +3 -3
  24. package/lib/lib/request/prompts/asset-prompt.js +27 -43
  25. package/lib/lib/request/prompts/duration-prompt.js +3 -0
  26. package/lib/lib/request/prompts/index.d.ts +0 -1
  27. package/lib/lib/request/prompts/index.js +1 -2
  28. package/lib/lib/request/prompts/role-prompt.d.ts +2 -2
  29. package/lib/lib/request/prompts/role-prompt.js +7 -16
  30. package/lib/lib/request/request-utils.d.ts +7 -8
  31. package/lib/lib/request/request-utils.js +17 -16
  32. package/lib/lib/resources.d.ts +1 -1
  33. package/lib/lib/sessions.d.ts +1 -1
  34. package/lib/lib/sessions.js +3 -2
  35. package/oclif.manifest.json +1 -1
  36. package/package.json +4 -3
package/README.md CHANGED
@@ -22,7 +22,7 @@ $ npm install -g opal-security
22
22
  $ opal COMMAND
23
23
  running command...
24
24
  $ opal (--version)
25
- opal-security/3.2.2 darwin-arm64 node-v18.20.4
25
+ opal-security/3.2.4 darwin-arm64 node-v18.20.4
26
26
  $ opal --help [COMMAND]
27
27
  USAGE
28
28
  $ opal COMMAND
@@ -106,7 +106,7 @@ EXAMPLES
106
106
  $ opal aws:identity
107
107
  ```
108
108
 
109
- _See code: [src/commands/aws/identity.ts](https://github.com/opalsecurity/opal-cli/blob/v3.2.2/src/commands/aws/identity.ts)_
109
+ _See code: [src/commands/aws/identity.ts](https://github.com/opalsecurity/opal-cli/blob/v3.2.4/src/commands/aws/identity.ts)_
110
110
 
111
111
  ## `opal clear-auth-provider`
112
112
 
@@ -126,7 +126,7 @@ EXAMPLES
126
126
  $ opal clear-auth-provider
127
127
  ```
128
128
 
129
- _See code: [src/commands/clear-auth-provider.ts](https://github.com/opalsecurity/opal-cli/blob/v3.2.2/src/commands/clear-auth-provider.ts)_
129
+ _See code: [src/commands/clear-auth-provider.ts](https://github.com/opalsecurity/opal-cli/blob/v3.2.4/src/commands/clear-auth-provider.ts)_
130
130
 
131
131
  ## `opal curl-example`
132
132
 
@@ -143,7 +143,7 @@ DESCRIPTION
143
143
  Prints out an example cURL command containing the parameters the CLI uses to query the Opal server.
144
144
  ```
145
145
 
146
- _See code: [src/commands/curl-example.ts](https://github.com/opalsecurity/opal-cli/blob/v3.2.2/src/commands/curl-example.ts)_
146
+ _See code: [src/commands/curl-example.ts](https://github.com/opalsecurity/opal-cli/blob/v3.2.4/src/commands/curl-example.ts)_
147
147
 
148
148
  ## `opal groups get`
149
149
 
@@ -164,7 +164,7 @@ EXAMPLES
164
164
  $ opal groups:get --id 54052a3e-5375-4392-aeaf-0c6c44c131d4
165
165
  ```
166
166
 
167
- _See code: [src/commands/groups/get.ts](https://github.com/opalsecurity/opal-cli/blob/v3.2.2/src/commands/groups/get.ts)_
167
+ _See code: [src/commands/groups/get.ts](https://github.com/opalsecurity/opal-cli/blob/v3.2.4/src/commands/groups/get.ts)_
168
168
 
169
169
  ## `opal help [COMMANDS]`
170
170
 
@@ -214,7 +214,7 @@ EXAMPLES
214
214
  $ opal iam-roles:start --id 51f7176b-0464-4a6f-8369-e951e187b398 --profileName "custom-profile"
215
215
  ```
216
216
 
217
- _See code: [src/commands/iam-roles/start.ts](https://github.com/opalsecurity/opal-cli/blob/v3.2.2/src/commands/iam-roles/start.ts)_
217
+ _See code: [src/commands/iam-roles/start.ts](https://github.com/opalsecurity/opal-cli/blob/v3.2.4/src/commands/iam-roles/start.ts)_
218
218
 
219
219
  ## `opal kube-roles start`
220
220
 
@@ -245,7 +245,7 @@ EXAMPLES
245
245
  $ opal kube-roles:start --id 51f7176b-0464-4a6f-8369-e951e187b398 --accessLevelRemoteId "arn:aws:iam::712234975475:role/acme-eks-cluster-admin-role"
246
246
  ```
247
247
 
248
- _See code: [src/commands/kube-roles/start.ts](https://github.com/opalsecurity/opal-cli/blob/v3.2.2/src/commands/kube-roles/start.ts)_
248
+ _See code: [src/commands/kube-roles/start.ts](https://github.com/opalsecurity/opal-cli/blob/v3.2.4/src/commands/kube-roles/start.ts)_
249
249
 
250
250
  ## `opal login`
251
251
 
@@ -266,7 +266,7 @@ EXAMPLES
266
266
  $ opal login
267
267
  ```
268
268
 
269
- _See code: [src/commands/login.ts](https://github.com/opalsecurity/opal-cli/blob/v3.2.2/src/commands/login.ts)_
269
+ _See code: [src/commands/login.ts](https://github.com/opalsecurity/opal-cli/blob/v3.2.4/src/commands/login.ts)_
270
270
 
271
271
  ## `opal logout`
272
272
 
@@ -286,7 +286,7 @@ EXAMPLES
286
286
  $ opal logout
287
287
  ```
288
288
 
289
- _See code: [src/commands/logout.ts](https://github.com/opalsecurity/opal-cli/blob/v3.2.2/src/commands/logout.ts)_
289
+ _See code: [src/commands/logout.ts](https://github.com/opalsecurity/opal-cli/blob/v3.2.4/src/commands/logout.ts)_
290
290
 
291
291
  ## `opal postgres-instances start`
292
292
 
@@ -324,7 +324,7 @@ EXAMPLES
324
324
  $ opal postgres-instances:start --id 51f7176b-0464-4a6f-8369-e951e187b398 --accessLevelRemoteId fullaccess --action view
325
325
  ```
326
326
 
327
- _See code: [src/commands/postgres-instances/start.ts](https://github.com/opalsecurity/opal-cli/blob/v3.2.2/src/commands/postgres-instances/start.ts)_
327
+ _See code: [src/commands/postgres-instances/start.ts](https://github.com/opalsecurity/opal-cli/blob/v3.2.4/src/commands/postgres-instances/start.ts)_
328
328
 
329
329
  ## `opal request create`
330
330
 
@@ -350,7 +350,7 @@ DESCRIPTION
350
350
  Creates an Opal access request via an interactive form
351
351
  ```
352
352
 
353
- _See code: [src/commands/request/create.ts](https://github.com/opalsecurity/opal-cli/blob/v3.2.2/src/commands/request/create.ts)_
353
+ _See code: [src/commands/request/create.ts](https://github.com/opalsecurity/opal-cli/blob/v3.2.4/src/commands/request/create.ts)_
354
354
 
355
355
  ## `opal request get`
356
356
 
@@ -374,7 +374,7 @@ EXAMPLES
374
374
  $ opal request get --id 54052a3e-5375-4392-aeaf-0c6c44c131d4 --verbose
375
375
  ```
376
376
 
377
- _See code: [src/commands/request/get.ts](https://github.com/opalsecurity/opal-cli/blob/v3.2.2/src/commands/request/get.ts)_
377
+ _See code: [src/commands/request/get.ts](https://github.com/opalsecurity/opal-cli/blob/v3.2.4/src/commands/request/get.ts)_
378
378
 
379
379
  ## `opal request list`
380
380
 
@@ -406,7 +406,7 @@ EXAMPLES
406
406
  $ opal request list --n 5 --pending --verbose
407
407
  ```
408
408
 
409
- _See code: [src/commands/request/list.ts](https://github.com/opalsecurity/opal-cli/blob/v3.2.2/src/commands/request/list.ts)_
409
+ _See code: [src/commands/request/list.ts](https://github.com/opalsecurity/opal-cli/blob/v3.2.4/src/commands/request/list.ts)_
410
410
 
411
411
  ## `opal request ls`
412
412
 
@@ -457,7 +457,7 @@ EXAMPLES
457
457
  $ opal resources:get --id 54052a3e-5375-4392-aeaf-0c6c44c131d4
458
458
  ```
459
459
 
460
- _See code: [src/commands/resources/get.ts](https://github.com/opalsecurity/opal-cli/blob/v3.2.2/src/commands/resources/get.ts)_
460
+ _See code: [src/commands/resources/get.ts](https://github.com/opalsecurity/opal-cli/blob/v3.2.4/src/commands/resources/get.ts)_
461
461
 
462
462
  ## `opal set-auth-provider`
463
463
 
@@ -483,7 +483,7 @@ EXAMPLES
483
483
  $ opal set-auth-provider --clientID 1234asdf --issuerUrl https://auth.example.com
484
484
  ```
485
485
 
486
- _See code: [src/commands/set-auth-provider.ts](https://github.com/opalsecurity/opal-cli/blob/v3.2.2/src/commands/set-auth-provider.ts)_
486
+ _See code: [src/commands/set-auth-provider.ts](https://github.com/opalsecurity/opal-cli/blob/v3.2.4/src/commands/set-auth-provider.ts)_
487
487
 
488
488
  ## `opal set-custom-header`
489
489
 
@@ -504,7 +504,7 @@ EXAMPLES
504
504
  $ opal set-custom-header --header 'cf-access-token: $TOKEN'
505
505
  ```
506
506
 
507
- _See code: [src/commands/set-custom-header.ts](https://github.com/opalsecurity/opal-cli/blob/v3.2.2/src/commands/set-custom-header.ts)_
507
+ _See code: [src/commands/set-custom-header.ts](https://github.com/opalsecurity/opal-cli/blob/v3.2.4/src/commands/set-custom-header.ts)_
508
508
 
509
509
  ## `opal set-token`
510
510
 
@@ -524,7 +524,7 @@ EXAMPLES
524
524
  $ opal set-token
525
525
  ```
526
526
 
527
- _See code: [src/commands/set-token.ts](https://github.com/opalsecurity/opal-cli/blob/v3.2.2/src/commands/set-token.ts)_
527
+ _See code: [src/commands/set-token.ts](https://github.com/opalsecurity/opal-cli/blob/v3.2.4/src/commands/set-token.ts)_
528
528
 
529
529
  ## `opal set-url [URL]`
530
530
 
@@ -548,7 +548,7 @@ EXAMPLES
548
548
  $ opal set-url
549
549
  ```
550
550
 
551
- _See code: [src/commands/set-url.ts](https://github.com/opalsecurity/opal-cli/blob/v3.2.2/src/commands/set-url.ts)_
551
+ _See code: [src/commands/set-url.ts](https://github.com/opalsecurity/opal-cli/blob/v3.2.4/src/commands/set-url.ts)_
552
552
 
553
553
  ## `opal ssh copyFrom`
554
554
 
@@ -579,7 +579,7 @@ EXAMPLES
579
579
  $ opal ssh:copyFrom --src instance/dir --dest my/dir --id 51f7176b-0464-4a6f-8369-e951e187b398
580
580
  ```
581
581
 
582
- _See code: [src/commands/ssh/copyFrom.ts](https://github.com/opalsecurity/opal-cli/blob/v3.2.2/src/commands/ssh/copyFrom.ts)_
582
+ _See code: [src/commands/ssh/copyFrom.ts](https://github.com/opalsecurity/opal-cli/blob/v3.2.4/src/commands/ssh/copyFrom.ts)_
583
583
 
584
584
  ## `opal ssh copyTo`
585
585
 
@@ -610,7 +610,7 @@ EXAMPLES
610
610
  $ opal ssh:copyTo --src my/dir --dest instance/dir --id 51f7176b-0464-4a6f-8369-e951e187b398
611
611
  ```
612
612
 
613
- _See code: [src/commands/ssh/copyTo.ts](https://github.com/opalsecurity/opal-cli/blob/v3.2.2/src/commands/ssh/copyTo.ts)_
613
+ _See code: [src/commands/ssh/copyTo.ts](https://github.com/opalsecurity/opal-cli/blob/v3.2.4/src/commands/ssh/copyTo.ts)_
614
614
 
615
615
  ## `opal ssh start`
616
616
 
@@ -637,7 +637,7 @@ EXAMPLES
637
637
  $ opal ssh:start --id 51f7176b-0464-4a6f-8369-e951e187b398
638
638
  ```
639
639
 
640
- _See code: [src/commands/ssh/start.ts](https://github.com/opalsecurity/opal-cli/blob/v3.2.2/src/commands/ssh/start.ts)_
640
+ _See code: [src/commands/ssh/start.ts](https://github.com/opalsecurity/opal-cli/blob/v3.2.4/src/commands/ssh/start.ts)_
641
641
 
642
642
  ## `opal version`
643
643
 
@@ -674,5 +674,5 @@ DESCRIPTION
674
674
  Describes current url set, organization name, and logged in user if applicable.
675
675
  ```
676
676
 
677
- _See code: [src/commands/whoami.ts](https://github.com/opalsecurity/opal-cli/blob/v3.2.2/src/commands/whoami.ts)_
677
+ _See code: [src/commands/whoami.ts](https://github.com/opalsecurity/opal-cli/blob/v3.2.4/src/commands/whoami.ts)_
678
678
  <!-- commandsstop -->
@@ -4,6 +4,7 @@ exports.CLITokenExchangeName = exports.CLIAuthSessionCheckDocument = exports.CLI
4
4
  const core_1 = require("@oclif/core");
5
5
  const open = require("open");
6
6
  const openid_client_1 = require("openid-client");
7
+ const client_1 = require("@apollo/client");
7
8
  const inquirer = require("inquirer");
8
9
  const handler_1 = require("../handler");
9
10
  const apollo_1 = require("../lib/apollo");
@@ -80,7 +81,7 @@ mutation CLITokenExchange($input: CLITokenExchangeInput!) {
80
81
  `;
81
82
  class Login extends core_1.Command {
82
83
  async run() {
83
- var _a, _b, _c, _d, _e, _f, _g;
84
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
84
85
  try {
85
86
  await (0, apollo_1.initClient)(this, false);
86
87
  const { flags } = await this.parse(Login);
@@ -123,9 +124,8 @@ class Login extends core_1.Command {
123
124
  query: CLISignInMethodDocument,
124
125
  variables: { input: { email } },
125
126
  });
126
- if (error === null || error === void 0 ? void 0 : error.networkError) {
127
- if ("statusCode" in error.networkError &&
128
- error.networkError.statusCode === 422) {
127
+ if (error) {
128
+ if (client_1.ServerError.is(error) && error.statusCode === 422) {
129
129
  const { resp, error: legacyError } = await (0, handler_1.runQueryDeprecated)({
130
130
  command: this,
131
131
  query: CLISignInMethodDocumentLegacy,
@@ -142,11 +142,11 @@ class Login extends core_1.Command {
142
142
  return (0, apollo_1.handleError)(this, "Could not connect to Opal. Did you set the right URL? (`opal set-url --help`)");
143
143
  }
144
144
  }
145
- const signInOrganizations = ((_a = signInOrganizationsResponse === null || signInOrganizationsResponse === void 0 ? void 0 : signInOrganizationsResponse.data.signInMethod) === null || _a === void 0 ? void 0 : _a.__typename) ===
145
+ const signInOrganizations = ((_b = (_a = signInOrganizationsResponse === null || signInOrganizationsResponse === void 0 ? void 0 : signInOrganizationsResponse.data) === null || _a === void 0 ? void 0 : _a.signInMethod) === null || _b === void 0 ? void 0 : _b.__typename) ===
146
146
  "SignInMethodResult"
147
147
  ? signInOrganizationsResponse.data.signInMethod.signInOrganizations
148
- : ((_b = signInOrganizationsLegacyResponse === null || signInOrganizationsLegacyResponse === void 0 ? void 0 : signInOrganizationsLegacyResponse.data.signInMethod) === null || _b === void 0 ? void 0 : _b.__typename) === "SignInMethodResult"
149
- ? (_c = signInOrganizationsLegacyResponse === null || signInOrganizationsLegacyResponse === void 0 ? void 0 : signInOrganizationsLegacyResponse.data.signInMethod) === null || _c === void 0 ? void 0 : _c.signInOrganizations
148
+ : ((_d = (_c = signInOrganizationsLegacyResponse === null || signInOrganizationsLegacyResponse === void 0 ? void 0 : signInOrganizationsLegacyResponse.data) === null || _c === void 0 ? void 0 : _c.signInMethod) === null || _d === void 0 ? void 0 : _d.__typename) === "SignInMethodResult"
149
+ ? (_e = signInOrganizationsLegacyResponse === null || signInOrganizationsLegacyResponse === void 0 ? void 0 : signInOrganizationsLegacyResponse.data.signInMethod) === null || _e === void 0 ? void 0 : _e.signInOrganizations
150
150
  : undefined;
151
151
  if (signInOrganizations && signInOrganizations.length > 0) {
152
152
  if (signInOrganizations.length === 1) {
@@ -161,7 +161,7 @@ class Login extends core_1.Command {
161
161
  message: "Select an organization:",
162
162
  type: "list",
163
163
  choices: signInOrganizations.map((signInOrganization) => ({
164
- name: signInOrganization.organizationName,
164
+ name: signInOrganization === null || signInOrganization === void 0 ? void 0 : signInOrganization.organizationName,
165
165
  value: signInOrganization,
166
166
  })),
167
167
  },
@@ -183,7 +183,7 @@ class Login extends core_1.Command {
183
183
  input: { organizationId },
184
184
  },
185
185
  });
186
- const state = (_d = signInResp === null || signInResp === void 0 ? void 0 : signInResp.data.signIn) === null || _d === void 0 ? void 0 : _d.state;
186
+ const state = (_g = (_f = signInResp === null || signInResp === void 0 ? void 0 : signInResp.data) === null || _f === void 0 ? void 0 : _f.signIn) === null || _g === void 0 ? void 0 : _g.state;
187
187
  let issuer;
188
188
  // issuerURL may come from configData if set by set-airgap-auth
189
189
  if (configData.issuerURL) {
@@ -221,7 +221,7 @@ class Login extends core_1.Command {
221
221
  // Add the mfa:skip scope to the scopes according to appropriate org settings
222
222
  // This scope is evaluated in Auth0 "MFA Rule" Action to skip or enabled MFA
223
223
  let scopes = "openid email profile";
224
- if (!(signInResp === null || signInResp === void 0 ? void 0 : signInResp.data.signIn.forceExtraStep)) {
224
+ if (!((_j = (_h = signInResp === null || signInResp === void 0 ? void 0 : signInResp.data) === null || _h === void 0 ? void 0 : _h.signIn) === null || _j === void 0 ? void 0 : _j.forceExtraStep)) {
225
225
  scopes += " mfa:skip";
226
226
  }
227
227
  const handle = await client.deviceAuthorization({
@@ -261,7 +261,7 @@ class Login extends core_1.Command {
261
261
  variables: {},
262
262
  });
263
263
  if (authCheckErr ||
264
- !((_g = (_f = (_e = authCheckResp === null || authCheckResp === void 0 ? void 0 : authCheckResp.data) === null || _e === void 0 ? void 0 : _e.organizationSettings) === null || _f === void 0 ? void 0 : _f.settings) === null || _g === void 0 ? void 0 : _g.id)) {
264
+ !((_m = (_l = (_k = authCheckResp === null || authCheckResp === void 0 ? void 0 : authCheckResp.data) === null || _k === void 0 ? void 0 : _k.organizationSettings) === null || _l === void 0 ? void 0 : _l.settings) === null || _m === void 0 ? void 0 : _m.id)) {
265
265
  this.log("Error verifying log in. Authenticated commands may fail. Please double check your URL and use `opal logout; opal login` to try again.\n");
266
266
  await (0, credentials_1.removeOpalCredentials)(this);
267
267
  process.exit(1);
@@ -10,6 +10,7 @@ const api_1 = require("../../lib/request/api");
10
10
  const displays_1 = require("../../lib/request/displays");
11
11
  class GetRequest extends core_1.Command {
12
12
  async run() {
13
+ var _a;
13
14
  (0, cmd_1.setMostRecentCommand)(this);
14
15
  const configData = (0, config_1.getOrCreateConfigData)(this.config.configDir);
15
16
  const client = await (0, apollo_1.getClient)(this, true);
@@ -21,7 +22,7 @@ class GetRequest extends core_1.Command {
21
22
  return;
22
23
  }
23
24
  const resp = await (0, api_1.queryRequest)(client, flags.id);
24
- switch (resp.data.request.__typename) {
25
+ switch ((_a = resp.data) === null || _a === void 0 ? void 0 : _a.request.__typename) {
25
26
  case "RequestResult": {
26
27
  if (flags.verbose) {
27
28
  (0, apollo_1.printResponse)(this, resp);