opal-security 3.1.1-beta.7e1cc21 → 3.1.1-beta.8ec7545

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/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.1.1-beta.7e1cc21 linux-x64 node-v20.19.2
25
+ opal-security/3.1.1-beta.8ec7545 linux-x64 node-v20.19.2
26
26
  $ opal --help [COMMAND]
27
27
  USAGE
28
28
  $ opal COMMAND
@@ -44,9 +44,6 @@ USAGE
44
44
  * [`opal login`](#opal-login)
45
45
  * [`opal logout`](#opal-logout)
46
46
  * [`opal postgres-instances start`](#opal-postgres-instances-start)
47
- * [`opal request create`](#opal-request-create)
48
- * [`opal request get`](#opal-request-get)
49
- * [`opal request list`](#opal-request-list)
50
47
  * [`opal resources get`](#opal-resources-get)
51
48
  * [`opal set-auth-provider`](#opal-set-auth-provider)
52
49
  * [`opal set-custom-header`](#opal-set-custom-header)
@@ -56,7 +53,6 @@ USAGE
56
53
  * [`opal ssh copyTo`](#opal-ssh-copyto)
57
54
  * [`opal ssh start`](#opal-ssh-start)
58
55
  * [`opal version`](#opal-version)
59
- * [`opal whoami`](#opal-whoami)
60
56
 
61
57
  ## `opal autocomplete [SHELL]`
62
58
 
@@ -105,7 +101,7 @@ EXAMPLES
105
101
  $ opal aws:identity
106
102
  ```
107
103
 
108
- _See code: [src/commands/aws/identity.ts](https://github.com/opalsecurity/opal-cli/blob/v3.1.1-beta.7e1cc21/src/commands/aws/identity.ts)_
104
+ _See code: [src/commands/aws/identity.ts](https://github.com/opalsecurity/opal-cli/blob/v3.1.1-beta.8ec7545/src/commands/aws/identity.ts)_
109
105
 
110
106
  ## `opal clear-auth-provider`
111
107
 
@@ -125,7 +121,7 @@ EXAMPLES
125
121
  $ opal clear-auth-provider
126
122
  ```
127
123
 
128
- _See code: [src/commands/clear-auth-provider.ts](https://github.com/opalsecurity/opal-cli/blob/v3.1.1-beta.7e1cc21/src/commands/clear-auth-provider.ts)_
124
+ _See code: [src/commands/clear-auth-provider.ts](https://github.com/opalsecurity/opal-cli/blob/v3.1.1-beta.8ec7545/src/commands/clear-auth-provider.ts)_
129
125
 
130
126
  ## `opal curl-example`
131
127
 
@@ -142,7 +138,7 @@ DESCRIPTION
142
138
  Prints out an example cURL command containing the parameters the CLI uses to query the Opal server.
143
139
  ```
144
140
 
145
- _See code: [src/commands/curl-example.ts](https://github.com/opalsecurity/opal-cli/blob/v3.1.1-beta.7e1cc21/src/commands/curl-example.ts)_
141
+ _See code: [src/commands/curl-example.ts](https://github.com/opalsecurity/opal-cli/blob/v3.1.1-beta.8ec7545/src/commands/curl-example.ts)_
146
142
 
147
143
  ## `opal groups get`
148
144
 
@@ -163,7 +159,7 @@ EXAMPLES
163
159
  $ opal groups:get --id 54052a3e-5375-4392-aeaf-0c6c44c131d4
164
160
  ```
165
161
 
166
- _See code: [src/commands/groups/get.ts](https://github.com/opalsecurity/opal-cli/blob/v3.1.1-beta.7e1cc21/src/commands/groups/get.ts)_
162
+ _See code: [src/commands/groups/get.ts](https://github.com/opalsecurity/opal-cli/blob/v3.1.1-beta.8ec7545/src/commands/groups/get.ts)_
167
163
 
168
164
  ## `opal help [COMMANDS]`
169
165
 
@@ -213,7 +209,7 @@ EXAMPLES
213
209
  $ opal iam-roles:start --id 51f7176b-0464-4a6f-8369-e951e187b398 --profileName "custom-profile"
214
210
  ```
215
211
 
216
- _See code: [src/commands/iam-roles/start.ts](https://github.com/opalsecurity/opal-cli/blob/v3.1.1-beta.7e1cc21/src/commands/iam-roles/start.ts)_
212
+ _See code: [src/commands/iam-roles/start.ts](https://github.com/opalsecurity/opal-cli/blob/v3.1.1-beta.8ec7545/src/commands/iam-roles/start.ts)_
217
213
 
218
214
  ## `opal kube-roles start`
219
215
 
@@ -244,7 +240,7 @@ EXAMPLES
244
240
  $ opal kube-roles:start --id 51f7176b-0464-4a6f-8369-e951e187b398 --accessLevelRemoteId "arn:aws:iam::712234975475:role/acme-eks-cluster-admin-role"
245
241
  ```
246
242
 
247
- _See code: [src/commands/kube-roles/start.ts](https://github.com/opalsecurity/opal-cli/blob/v3.1.1-beta.7e1cc21/src/commands/kube-roles/start.ts)_
243
+ _See code: [src/commands/kube-roles/start.ts](https://github.com/opalsecurity/opal-cli/blob/v3.1.1-beta.8ec7545/src/commands/kube-roles/start.ts)_
248
244
 
249
245
  ## `opal login`
250
246
 
@@ -265,7 +261,7 @@ EXAMPLES
265
261
  $ opal login
266
262
  ```
267
263
 
268
- _See code: [src/commands/login.ts](https://github.com/opalsecurity/opal-cli/blob/v3.1.1-beta.7e1cc21/src/commands/login.ts)_
264
+ _See code: [src/commands/login.ts](https://github.com/opalsecurity/opal-cli/blob/v3.1.1-beta.8ec7545/src/commands/login.ts)_
269
265
 
270
266
  ## `opal logout`
271
267
 
@@ -285,7 +281,7 @@ EXAMPLES
285
281
  $ opal logout
286
282
  ```
287
283
 
288
- _See code: [src/commands/logout.ts](https://github.com/opalsecurity/opal-cli/blob/v3.1.1-beta.7e1cc21/src/commands/logout.ts)_
284
+ _See code: [src/commands/logout.ts](https://github.com/opalsecurity/opal-cli/blob/v3.1.1-beta.8ec7545/src/commands/logout.ts)_
289
285
 
290
286
  ## `opal postgres-instances start`
291
287
 
@@ -322,82 +318,7 @@ EXAMPLES
322
318
  $ opal postgres-instances:start --id 51f7176b-0464-4a6f-8369-e951e187b398 --accessLevelRemoteId fullaccess --action view
323
319
  ```
324
320
 
325
- _See code: [src/commands/postgres-instances/start.ts](https://github.com/opalsecurity/opal-cli/blob/v3.1.1-beta.7e1cc21/src/commands/postgres-instances/start.ts)_
326
-
327
- ## `opal request create`
328
-
329
- Creates an Opal access request via an interactive form
330
-
331
- ```
332
- USAGE
333
- $ opal request create [-h] [-a <value>...] [-r <value>] [-d <value>]
334
-
335
- FLAGS
336
- -a, --assets=<value>... The ids of the assets (resource, group) to request access to. Append a role ID using a colon
337
- if needed, e.g. `--assets 123:456`.
338
- If not provided, an interactive selection flow will be available to select assets to request.
339
- -d, --duration=<value> The duration of access for the request in minutes. If not provided, you will be prompted.
340
- -h, --help Show CLI help.
341
- -r, --reason=<value> The reason for the request, contained in quotes. If not provided, you will be prompted.
342
-
343
- DESCRIPTION
344
- Creates an Opal access request via an interactive form
345
- ```
346
-
347
- _See code: [src/commands/request/create.ts](https://github.com/opalsecurity/opal-cli/blob/v3.1.1-beta.7e1cc21/src/commands/request/create.ts)_
348
-
349
- ## `opal request get`
350
-
351
- Lists access requests
352
-
353
- ```
354
- USAGE
355
- $ opal request get [-h] [-i <value>] [-v]
356
-
357
- FLAGS
358
- -h, --help Show CLI help.
359
- -i, --id=<value> The Opal ID of the asset. You can find this from the URL, e.g. https://opal.dev/resources/[ID]
360
- -v, --verbose Enable verbose output, prints full response in JSON format. Defaults to false.
361
-
362
- DESCRIPTION
363
- Lists access requests
364
-
365
- EXAMPLES
366
- $ opal request get --id 54052a3e-5375-4392-aeaf-0c6c44c131d4
367
-
368
- $ opal request get --id 54052a3e-5375-4392-aeaf-0c6c44c131d4 --verbose
369
- ```
370
-
371
- _See code: [src/commands/request/get.ts](https://github.com/opalsecurity/opal-cli/blob/v3.1.1-beta.7e1cc21/src/commands/request/get.ts)_
372
-
373
- ## `opal request list`
374
-
375
- Lists your n recent outgoing access requests
376
-
377
- ```
378
- USAGE
379
- $ opal request list [-h] [-n <value>] [-p] [-v]
380
-
381
- FLAGS
382
- -h, --help Show CLI help.
383
- -n, --n=<value> [default: 10] Defines number of requests to be returned. 1 <= n <= 100.
384
- -p, --pending Show only pending requests. Defaults to false.
385
- -v, --verbose Enable verbose output, prints full response in JSON format. Defaults to false.
386
-
387
- DESCRIPTION
388
- Lists your n recent outgoing access requests
389
-
390
- EXAMPLES
391
- $ opal request list --n 5
392
-
393
- $ opal request list --n 5 --pending
394
-
395
- $ opal request list --n 5 --verbose
396
-
397
- $ opal request list --n 5 --pending --verbose
398
- ```
399
-
400
- _See code: [src/commands/request/list.ts](https://github.com/opalsecurity/opal-cli/blob/v3.1.1-beta.7e1cc21/src/commands/request/list.ts)_
321
+ _See code: [src/commands/postgres-instances/start.ts](https://github.com/opalsecurity/opal-cli/blob/v3.1.1-beta.8ec7545/src/commands/postgres-instances/start.ts)_
401
322
 
402
323
  ## `opal resources get`
403
324
 
@@ -418,7 +339,7 @@ EXAMPLES
418
339
  $ opal resources:get --id 54052a3e-5375-4392-aeaf-0c6c44c131d4
419
340
  ```
420
341
 
421
- _See code: [src/commands/resources/get.ts](https://github.com/opalsecurity/opal-cli/blob/v3.1.1-beta.7e1cc21/src/commands/resources/get.ts)_
342
+ _See code: [src/commands/resources/get.ts](https://github.com/opalsecurity/opal-cli/blob/v3.1.1-beta.8ec7545/src/commands/resources/get.ts)_
422
343
 
423
344
  ## `opal set-auth-provider`
424
345
 
@@ -444,7 +365,7 @@ EXAMPLES
444
365
  $ opal set-auth-provider --clientID 1234asdf --issuerUrl https://auth.example.com
445
366
  ```
446
367
 
447
- _See code: [src/commands/set-auth-provider.ts](https://github.com/opalsecurity/opal-cli/blob/v3.1.1-beta.7e1cc21/src/commands/set-auth-provider.ts)_
368
+ _See code: [src/commands/set-auth-provider.ts](https://github.com/opalsecurity/opal-cli/blob/v3.1.1-beta.8ec7545/src/commands/set-auth-provider.ts)_
448
369
 
449
370
  ## `opal set-custom-header`
450
371
 
@@ -465,7 +386,7 @@ EXAMPLES
465
386
  $ opal set-custom-header --header 'cf-access-token: $TOKEN'
466
387
  ```
467
388
 
468
- _See code: [src/commands/set-custom-header.ts](https://github.com/opalsecurity/opal-cli/blob/v3.1.1-beta.7e1cc21/src/commands/set-custom-header.ts)_
389
+ _See code: [src/commands/set-custom-header.ts](https://github.com/opalsecurity/opal-cli/blob/v3.1.1-beta.8ec7545/src/commands/set-custom-header.ts)_
469
390
 
470
391
  ## `opal set-token`
471
392
 
@@ -485,7 +406,7 @@ EXAMPLES
485
406
  $ opal set-token
486
407
  ```
487
408
 
488
- _See code: [src/commands/set-token.ts](https://github.com/opalsecurity/opal-cli/blob/v3.1.1-beta.7e1cc21/src/commands/set-token.ts)_
409
+ _See code: [src/commands/set-token.ts](https://github.com/opalsecurity/opal-cli/blob/v3.1.1-beta.8ec7545/src/commands/set-token.ts)_
489
410
 
490
411
  ## `opal set-url [URL]`
491
412
 
@@ -509,7 +430,7 @@ EXAMPLES
509
430
  $ opal set-url
510
431
  ```
511
432
 
512
- _See code: [src/commands/set-url.ts](https://github.com/opalsecurity/opal-cli/blob/v3.1.1-beta.7e1cc21/src/commands/set-url.ts)_
433
+ _See code: [src/commands/set-url.ts](https://github.com/opalsecurity/opal-cli/blob/v3.1.1-beta.8ec7545/src/commands/set-url.ts)_
513
434
 
514
435
  ## `opal ssh copyFrom`
515
436
 
@@ -540,7 +461,7 @@ EXAMPLES
540
461
  $ opal ssh:copyFrom --src instance/dir --dest my/dir --id 51f7176b-0464-4a6f-8369-e951e187b398
541
462
  ```
542
463
 
543
- _See code: [src/commands/ssh/copyFrom.ts](https://github.com/opalsecurity/opal-cli/blob/v3.1.1-beta.7e1cc21/src/commands/ssh/copyFrom.ts)_
464
+ _See code: [src/commands/ssh/copyFrom.ts](https://github.com/opalsecurity/opal-cli/blob/v3.1.1-beta.8ec7545/src/commands/ssh/copyFrom.ts)_
544
465
 
545
466
  ## `opal ssh copyTo`
546
467
 
@@ -571,7 +492,7 @@ EXAMPLES
571
492
  $ opal ssh:copyTo --src my/dir --dest instance/dir --id 51f7176b-0464-4a6f-8369-e951e187b398
572
493
  ```
573
494
 
574
- _See code: [src/commands/ssh/copyTo.ts](https://github.com/opalsecurity/opal-cli/blob/v3.1.1-beta.7e1cc21/src/commands/ssh/copyTo.ts)_
495
+ _See code: [src/commands/ssh/copyTo.ts](https://github.com/opalsecurity/opal-cli/blob/v3.1.1-beta.8ec7545/src/commands/ssh/copyTo.ts)_
575
496
 
576
497
  ## `opal ssh start`
577
498
 
@@ -598,7 +519,7 @@ EXAMPLES
598
519
  $ opal ssh:start --id 51f7176b-0464-4a6f-8369-e951e187b398
599
520
  ```
600
521
 
601
- _See code: [src/commands/ssh/start.ts](https://github.com/opalsecurity/opal-cli/blob/v3.1.1-beta.7e1cc21/src/commands/ssh/start.ts)_
522
+ _See code: [src/commands/ssh/start.ts](https://github.com/opalsecurity/opal-cli/blob/v3.1.1-beta.8ec7545/src/commands/ssh/start.ts)_
602
523
 
603
524
  ## `opal version`
604
525
 
@@ -619,21 +540,4 @@ FLAG DESCRIPTIONS
619
540
  ```
620
541
 
621
542
  _See code: [@oclif/plugin-version](https://github.com/oclif/plugin-version/blob/v2.2.27/src/commands/version.ts)_
622
-
623
- ## `opal whoami`
624
-
625
- Describes current url set, organization name, and logged in user if applicabled.
626
-
627
- ```
628
- USAGE
629
- $ opal whoami [-h]
630
-
631
- FLAGS
632
- -h, --help Show CLI help.
633
-
634
- DESCRIPTION
635
- Describes current url set, organization name, and logged in user if applicabled.
636
- ```
637
-
638
- _See code: [src/commands/whoami.ts](https://github.com/opalsecurity/opal-cli/blob/v3.1.1-beta.7e1cc21/src/commands/whoami.ts)_
639
543
  <!-- commandsstop -->
@@ -88,14 +88,12 @@ class Login extends core_1.Command {
88
88
  const configData = (0, config_1.getOrCreateConfigData)(configDir);
89
89
  let email = flags.email;
90
90
  let organizationId;
91
- let organizationName;
92
91
  let clientIDCandidate;
93
92
  const existingCreds = await (0, credentials_1.getOpalCredentials)(this, false);
94
93
  // Only use the previous email + organizationID if email isn't explicitly specified.
95
94
  if (!email) {
96
95
  email = existingCreds.email;
97
96
  organizationId = existingCreds.organizationID;
98
- organizationName = existingCreds.organizationName;
99
97
  clientIDCandidate = existingCreds.clientIDCandidate;
100
98
  }
101
99
  await (0, credentials_1.removeOpalCredentials)(this);
@@ -151,7 +149,6 @@ class Login extends core_1.Command {
151
149
  if (signInOrganizations && signInOrganizations.length > 0) {
152
150
  if (signInOrganizations.length === 1) {
153
151
  organizationId = signInOrganizations[0].organizationId;
154
- organizationName = signInOrganizations[0].organizationName;
155
152
  clientIDCandidate = signInOrganizations[0].cliClientId;
156
153
  }
157
154
  else {
@@ -167,7 +164,6 @@ class Login extends core_1.Command {
167
164
  },
168
165
  ]);
169
166
  organizationId = responses.signInOrganization.organizationId;
170
- organizationName = responses.signInOrganization.organizationName;
171
167
  clientIDCandidate = responses.signInOrganization.cliClientId;
172
168
  }
173
169
  }
@@ -242,10 +238,10 @@ class Login extends core_1.Command {
242
238
  if (tokenExchangeError) {
243
239
  this.log("WARN: Failed to exchange access token for session in Opal. Falling back to using access token for authenticating requests\n");
244
240
  // TODO: consider adding a warn line recommending upgrading Opal to version XYZ, once accompanying PR is pushed to prod
245
- await (0, credentials_1.setOpalCredentials)(this, email, organizationId !== null && organizationId !== void 0 ? organizationId : "", clientIDCandidate, (tokenSet === null || tokenSet === void 0 ? void 0 : tokenSet.access_token) || "", credentials_1.SecretType.ApiToken, organizationName);
241
+ await (0, credentials_1.setOpalCredentials)(this, email, organizationId !== null && organizationId !== void 0 ? organizationId : "", clientIDCandidate, (tokenSet === null || tokenSet === void 0 ? void 0 : tokenSet.access_token) || "", credentials_1.SecretType.ApiToken);
246
242
  }
247
243
  else {
248
- await (0, credentials_1.setOpalCredentials)(this, email, organizationId !== null && organizationId !== void 0 ? organizationId : "", clientIDCandidate, apollo_1.cookieStr, credentials_1.SecretType.Cookie, organizationName);
244
+ await (0, credentials_1.setOpalCredentials)(this, email, organizationId !== null && organizationId !== void 0 ? organizationId : "", clientIDCandidate, apollo_1.cookieStr, credentials_1.SecretType.Cookie);
249
245
  }
250
246
  // "Representative" authenticated call to check the log-in worked as expected.
251
247
  const { resp: authCheckResp, error: authCheckErr } = await (0, handler_1.runQueryDeprecated)({
@@ -1,9 +1,10 @@
1
1
  import { Command } from "@oclif/core";
2
2
  export default class RequestCreate extends Command {
3
+ static hidden: boolean;
3
4
  static description: string;
4
5
  static flags: {
5
6
  help: import("@oclif/core/lib/interfaces").BooleanFlag<void>;
6
- assets: import("@oclif/core/lib/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
7
+ id: import("@oclif/core/lib/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
7
8
  reason: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
8
9
  duration: import("@oclif/core/lib/interfaces").OptionFlag<number | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
9
10
  };
@@ -2,20 +2,20 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const core_1 = require("@oclif/core");
4
4
  const apollo_1 = require("../../lib/apollo");
5
- const cmd_1 = require("../../lib/cmd");
6
5
  const flags_1 = require("../../lib/flags");
7
6
  const requests_1 = require("../../lib/requests");
8
7
  const displays_1 = require("../../utils/displays");
8
+ const utils_1 = require("../../utils/utils");
9
9
  class RequestCreate extends core_1.Command {
10
10
  async run() {
11
- (0, cmd_1.setMostRecentCommand)(this);
12
11
  await (0, apollo_1.initClient)(this, true);
13
12
  const client = await (0, apollo_1.getClient)(this, true);
13
+ (0, utils_1.restrictToDev)(); //TODO: Remove after development is complete
14
14
  const { flags } = await this.parse(RequestCreate);
15
15
  const metadata = (0, requests_1.initEmptyRequestMetadata)();
16
- if (flags.assets) {
16
+ if (flags.id) {
17
17
  // if IDs are provided, bypass the interactive selection process
18
- await (0, requests_1.bypassRequestSelection)(this, client, flags.assets, metadata);
18
+ await (0, requests_1.bypassRequestSelection)(this, client, flags.id, metadata);
19
19
  }
20
20
  else {
21
21
  (0, displays_1.headerMessage)(this);
@@ -36,9 +36,7 @@ class RequestCreate extends core_1.Command {
36
36
  if (flags.reason) {
37
37
  metadata.reason = flags.reason;
38
38
  }
39
- else if (!(metadata.requestDefaults.reasonOptional &&
40
- flags.assets &&
41
- flags.duration)) {
39
+ else {
42
40
  await (0, requests_1.promptForReason)(metadata);
43
41
  }
44
42
  // Step 5: Prompt for expiration
@@ -50,9 +48,7 @@ class RequestCreate extends core_1.Command {
50
48
  }
51
49
  // Step 6: Display final summary of request
52
50
  let canSubmit = true;
53
- if (!(flags.assets &&
54
- flags.duration &&
55
- (metadata.requestDefaults.reasonOptional || flags.reason))) {
51
+ if (!(flags.id && flags.reason && flags.duration)) {
56
52
  canSubmit = await (0, requests_1.promptRequestSubmission)(this, metadata);
57
53
  }
58
54
  // Step 7: Prompt for final submission
@@ -60,13 +56,14 @@ class RequestCreate extends core_1.Command {
60
56
  await (0, requests_1.submitFinalRequest)(this, client, metadata);
61
57
  }
62
58
  }
59
+ RequestCreate.hidden = true;
63
60
  RequestCreate.description = "Creates an Opal access request via an interactive form";
64
61
  RequestCreate.flags = {
65
62
  help: flags_1.SHARED_FLAGS.help,
66
- assets: core_1.Flags.string({
67
- char: "a",
63
+ id: core_1.Flags.string({
64
+ char: "i",
68
65
  multiple: true,
69
- description: "The ids of the assets (resource, group) to request access to. Append a role ID using a colon if needed, e.g. `--assets 123:456`.\
66
+ description: "The id of the asset (resource, group) to request access to. Append a role ID using a colon if needed, e.g. `--id 123:456`.\
70
67
  \n If not provided, an interactive selection flow will be available to select assets to request.",
71
68
  }),
72
69
  reason: core_1.Flags.string({
@@ -1,5 +1,6 @@
1
1
  import { Command } from "@oclif/core";
2
2
  export default class GetRequest extends Command {
3
+ static hidden: boolean;
3
4
  static description: string;
4
5
  static flags: {
5
6
  help: import("@oclif/core/lib/interfaces").BooleanFlag<void>;
@@ -8,6 +8,7 @@ const cmd_1 = require("../../lib/cmd");
8
8
  const config_1 = require("../../lib/config");
9
9
  const flags_1 = require("../../lib/flags");
10
10
  const displays_1 = require("../../utils/displays");
11
+ const utils_1 = require("../../utils/utils");
11
12
  const GET_REQUEST = (0, graphql_1.graphql)(`
12
13
  query GetRequest(
13
14
  $id: RequestId!
@@ -57,13 +58,14 @@ const GET_REQUEST = (0, graphql_1.graphql)(`
57
58
  `);
58
59
  class GetRequest extends core_1.Command {
59
60
  async run() {
61
+ (0, utils_1.restrictToDev)(); //TODO: Remove after development is complete
60
62
  (0, cmd_1.setMostRecentCommand)(this);
61
63
  const configData = (0, config_1.getOrCreateConfigData)(this.config.configDir);
62
64
  const client = await (0, apollo_1.getClient)(this, true);
63
65
  // Verify id tag was provided
64
66
  const { flags } = await this.parse(GetRequest);
65
67
  if (!flags.id) {
66
- this.log("Error: Please provide a request ID using the --id flag.");
68
+ this.log("Error: Please provide a group ID using the --id flag.");
67
69
  this.log("ex. opal request get --id 54052a3e-5375-4392-aeaf-0c6c44c131d4");
68
70
  return;
69
71
  }
@@ -94,6 +96,7 @@ class GetRequest extends core_1.Command {
94
96
  }
95
97
  }
96
98
  }
99
+ GetRequest.hidden = true;
97
100
  GetRequest.description = "Lists access requests";
98
101
  GetRequest.flags = {
99
102
  help: flags_1.SHARED_FLAGS.help,
@@ -1,5 +1,6 @@
1
1
  import { Command } from "@oclif/core";
2
2
  export default class ListRequests extends Command {
3
+ static hidden: boolean;
3
4
  static description: string;
4
5
  static examples: string[];
5
6
  static flags: {
@@ -6,6 +6,7 @@ const apollo_1 = require("../../lib/apollo");
6
6
  const cmd_1 = require("../../lib/cmd");
7
7
  const flags_1 = require("../../lib/flags");
8
8
  const displays_1 = require("../../utils/displays");
9
+ const utils_1 = require("../../utils/utils");
9
10
  // Add date filters, search query,
10
11
  const GET_REQUESTS = (0, graphql_1.graphql)(`
11
12
  query GetRequests($pageSize: Int, $showPendingOnly: Boolean!) {
@@ -58,6 +59,7 @@ const GET_REQUESTS = (0, graphql_1.graphql)(`
58
59
  }`);
59
60
  class ListRequests extends core_1.Command {
60
61
  async run() {
62
+ (0, utils_1.restrictToDev)(); //TODO: Remove after development is complete
61
63
  (0, cmd_1.setMostRecentCommand)(this);
62
64
  const client = await (0, apollo_1.getClient)(this, true);
63
65
  let pageSize = 10;
@@ -86,6 +88,7 @@ class ListRequests extends core_1.Command {
86
88
  }
87
89
  }
88
90
  }
91
+ ListRequests.hidden = true;
89
92
  ListRequests.description = "Lists your n recent outgoing access requests";
90
93
  ListRequests.examples = [
91
94
  "opal request list --n 5",
@@ -5,13 +5,12 @@ interface OpalCredentials {
5
5
  clientIDCandidate?: string;
6
6
  secret?: string;
7
7
  secretType?: SecretType;
8
- organizationName?: string;
9
8
  }
10
9
  export declare enum SecretType {
11
10
  Cookie = "COOKIE",
12
11
  ApiToken = "API_TOKEN"
13
12
  }
14
- export declare const setOpalCredentials: (command: Command, email: string | undefined, organizationID: string, clientIDCandidate: string | undefined | null, secret: string, secretType: SecretType, organizationName?: string) => Promise<void>;
13
+ export declare const setOpalCredentials: (command: Command, email: string | undefined, organizationID: string, clientIDCandidate: string | undefined | null, secret: string, secretType: SecretType) => Promise<void>;
15
14
  export declare const getOpalCredentials: (command: Command, includeAuthSecret?: boolean) => Promise<OpalCredentials>;
16
15
  export declare const removeOpalCredentials: (command: Command) => Promise<void>;
17
16
  export {};
@@ -9,14 +9,13 @@ var SecretType;
9
9
  SecretType["Cookie"] = "COOKIE";
10
10
  SecretType["ApiToken"] = "API_TOKEN";
11
11
  })(SecretType || (exports.SecretType = SecretType = {}));
12
- const setOpalCredentials = async (command, email, organizationID, clientIDCandidate, secret, secretType, organizationName) => {
12
+ const setOpalCredentials = async (command, email, organizationID, clientIDCandidate, secret, secretType) => {
13
13
  const givenEmail = email || "email-unset";
14
14
  const configData = (0, config_1.getOrCreateConfigData)(command.config.configDir);
15
15
  configData.creds = {
16
16
  clientIDCandidate,
17
17
  email,
18
18
  organizationID,
19
- organizationName,
20
19
  secretType,
21
20
  };
22
21
  (0, config_1.writeConfigData)(command.config.configDir, configData);
@@ -19,7 +19,6 @@ type RoleNode = {
19
19
  roleName: string;
20
20
  };
21
21
  export type RequestMap = Record<string, AppNode>;
22
- export declare const DISPLAY_LABELS: Partial<Record<EntityType, string>>;
23
22
  type DurationOption = {
24
23
  durationInMinutes: number;
25
24
  label: string;
@@ -1,6 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.DISPLAY_LABELS = void 0;
4
3
  exports.initEmptyRequestMetadata = initEmptyRequestMetadata;
5
4
  exports.selectRequestableItems = selectRequestableItems;
6
5
  exports.doneSelectingAssets = doneSelectingAssets;
@@ -16,7 +15,7 @@ const graphql_1 = require("../graphql");
16
15
  const graphql_2 = require("../graphql/graphql");
17
16
  const displays_1 = require("../utils/displays");
18
17
  const config_1 = require("./config");
19
- const { AutoComplete, Select, prompt, Form } = require("enquirer");
18
+ const { AutoComplete, Select, prompt, Form, confirm } = require("enquirer");
20
19
  function entityTypeFromString(str) {
21
20
  const capStr = str === null || str === void 0 ? void 0 : str.toLocaleUpperCase();
22
21
  if (capStr === "RESOURCE") {
@@ -28,10 +27,6 @@ function entityTypeFromString(str) {
28
27
  // if type unknown, default to resource
29
28
  return graphql_2.EntityType.Resource;
30
29
  }
31
- exports.DISPLAY_LABELS = {
32
- [graphql_2.EntityType.Resource]: "Resource",
33
- [graphql_2.EntityType.Group]: "Group",
34
- };
35
30
  function initEmptyRequestMetadata() {
36
31
  // Initialize with empty defaults
37
32
  const requestDefaults = {
@@ -243,7 +238,7 @@ async function queryAssetRoles(cmd, client, assetType, assetId) {
243
238
  var _a, _b, _c, _d, _e, _f, _g, _h;
244
239
  try {
245
240
  switch (assetType) {
246
- case graphql_2.EntityType.Resource: {
241
+ case "Resource": {
247
242
  const resp = await client.query({
248
243
  query: RESOURCE_ROLES_QUERY,
249
244
  variables: {
@@ -272,7 +267,7 @@ async function queryAssetRoles(cmd, client, assetType, assetId) {
272
267
  }
273
268
  return;
274
269
  }
275
- case graphql_2.EntityType.Group: {
270
+ case "Group": {
276
271
  const resp = await client.query({
277
272
  query: GROUP_ROLES_QUERY,
278
273
  variables: {
@@ -702,7 +697,7 @@ function appRolesFromEdge(edge) {
702
697
  value: {
703
698
  id: edge.node.id + accessLevel.accessLevelRemoteId,
704
699
  name: accessLevel.accessLevelName,
705
- type: exports.DISPLAY_LABELS[graphql_2.EntityType.Resource],
700
+ type: graphql_2.EntityType.Resource,
706
701
  toString: () => accessLevel.accessLevelName,
707
702
  },
708
703
  }));
@@ -713,7 +708,7 @@ function appRolesFromEdge(edge) {
713
708
  value: {
714
709
  id: edge.node.id,
715
710
  name: (_b = edge.alias) !== null && _b !== void 0 ? _b : edge.node.name,
716
- type: exports.DISPLAY_LABELS[graphql_2.EntityType.Resource],
711
+ type: graphql_2.EntityType.Resource,
717
712
  toString: () => { var _a; return (_a = edge.alias) !== null && _a !== void 0 ? _a : edge.node.name; },
718
713
  },
719
714
  },
@@ -722,11 +717,11 @@ function appRolesFromEdge(edge) {
722
717
  case "Group":
723
718
  return [
724
719
  {
725
- message: `${(_c = edge.alias) !== null && _c !== void 0 ? _c : edge.node.name} ${graphql_2.EntityType.Group}`,
720
+ message: (_c = edge.alias) !== null && _c !== void 0 ? _c : edge.node.name,
726
721
  value: {
727
722
  id: edge.node.id,
728
723
  name: (_d = edge.alias) !== null && _d !== void 0 ? _d : edge.node.name,
729
- type: exports.DISPLAY_LABELS[graphql_2.EntityType.Group],
724
+ type: graphql_2.EntityType.Group,
730
725
  toString: () => { var _a; return (_a = edge.alias) !== null && _a !== void 0 ? _a : edge.node.name; },
731
726
  },
732
727
  },
@@ -918,7 +913,6 @@ async function promptForExpiration(metadata) {
918
913
  const expirationSelect = new AutoComplete({
919
914
  name: "expiration",
920
915
  message: "When should access expire?",
921
- hint: "Type to filter",
922
916
  type: "list",
923
917
  choices: durations,
924
918
  pageSize: 15,
@@ -1074,10 +1068,8 @@ async function bypassRequestSelection(cmd, client, flagValue, metadata) {
1074
1068
  var _a, _b;
1075
1069
  try {
1076
1070
  // Query Catalog Item endpoint to identify what the id belongs to (resource or group)
1077
- for (const val of flagValue) {
1078
- const delimiterIndex = val.indexOf(":");
1079
- const assetId = val.substring(0, delimiterIndex);
1080
- const roleName = val.substring(delimiterIndex + 1);
1071
+ for (const id of flagValue) {
1072
+ const [assetId, roleName] = id.split(":");
1081
1073
  const resp = await client.query({
1082
1074
  query: CATALOG_ITEM,
1083
1075
  variables: {
@@ -1104,7 +1096,7 @@ async function bypassRequestSelection(cmd, client, flagValue, metadata) {
1104
1096
  assets: {},
1105
1097
  };
1106
1098
  }
1107
- const assetEntry = metadata.requestMap[appId].assets[assetId];
1099
+ const assetEntry = metadata.requestMap[appId].assets[id];
1108
1100
  if (!assetEntry) {
1109
1101
  metadata.requestMap[appId].assets[assetId] = {
1110
1102
  assetId: assetId,
@@ -1,7 +1,7 @@
1
1
  import type { ApolloQueryResult } from "@apollo/client";
2
2
  import type { Command } from "@oclif/core/lib/command";
3
3
  import type { GetRequestQuery, GetRequestsQuery } from "../graphql/graphql";
4
- import { type RequestMap, type RequestMetadata } from "../lib/requests";
4
+ import type { RequestMap, RequestMetadata } from "../lib/requests";
5
5
  export declare function headerMessage(cmd: Command): void;
6
6
  export declare function treeifyRequestMap(cmd: Command, requestMap: RequestMap): void;
7
7
  export declare function displayFinalRequestSummary(cmd: Command, metadata: RequestMetadata): void;
@@ -7,7 +7,6 @@ exports.getStyledStatus = getStyledStatus;
7
7
  exports.displayRequestDetails = displayRequestDetails;
8
8
  exports.displayRequestListTable = displayRequestListTable;
9
9
  const chalk_1 = require("chalk");
10
- const requests_1 = require("../lib/requests");
11
10
  const Table = require("cli-table3");
12
11
  const treeify = require("object-treeify").default;
13
12
  function headerMessage(cmd) {
@@ -31,7 +30,7 @@ function treeifyRequestMap(cmd, requestMap) {
31
30
  for (const [_assetId, assetNode] of Object.entries(appNode.assets)) {
32
31
  // If okta/azure asset with no role, change asset name
33
32
  const assetName = assetNode.assetName || "No Role (Direct access)";
34
- const assetKey = `${assetName} ${chalk_1.default.dim(`[${requests_1.DISPLAY_LABELS[assetNode.type]}]`)}`;
33
+ const assetKey = `${assetName} ${chalk_1.default.dim(`[${assetNode.type}]`)}`;
35
34
  if (assetNode.roles !== undefined) {
36
35
  assetsTree[assetKey] = {};
37
36
  for (const [_roleId, roleNode] of Object.entries(assetNode.roles)) {
@@ -316,34 +316,6 @@
316
316
  "set-url.js"
317
317
  ]
318
318
  },
319
- "whoami": {
320
- "aliases": [],
321
- "args": {},
322
- "description": "Describes current url set, organization name, and logged in user if applicabled.",
323
- "flags": {
324
- "help": {
325
- "char": "h",
326
- "description": "Show CLI help.",
327
- "name": "help",
328
- "allowNo": false,
329
- "type": "boolean"
330
- }
331
- },
332
- "hasDynamicHelp": false,
333
- "hiddenAliases": [],
334
- "id": "whoami",
335
- "pluginAlias": "opal-security",
336
- "pluginName": "opal-security",
337
- "pluginType": "core",
338
- "strict": true,
339
- "enableJsonFlag": false,
340
- "isESM": false,
341
- "relativePath": [
342
- "lib",
343
- "commands",
344
- "whoami.js"
345
- ]
346
- },
347
319
  "aws:identity": {
348
320
  "aliases": [],
349
321
  "args": {},
@@ -416,14 +388,14 @@
416
388
  "get.js"
417
389
  ]
418
390
  },
419
- "kube-roles:start": {
391
+ "iam-roles:start": {
420
392
  "aliases": [],
421
393
  "args": {},
422
- "description": "Starts a session to assume a Kubernetes cluster IAM role.",
394
+ "description": "Starts a session to assume an IAM role.",
423
395
  "examples": [
424
- "opal kube-roles:start",
425
- "opal kube-roles:start --id 51f7176b-0464-4a6f-8369-e951e187b398",
426
- "opal kube-roles:start --id 51f7176b-0464-4a6f-8369-e951e187b398 --accessLevelRemoteId \"arn:aws:iam::712234975475:role/acme-eks-cluster-admin-role\""
396
+ "opal iam-roles:start",
397
+ "opal iam-roles:start --id 51f7176b-0464-4a6f-8369-e951e187b398",
398
+ "opal iam-roles:start --id 51f7176b-0464-4a6f-8369-e951e187b398 --profileName \"custom-profile\""
427
399
  ],
428
400
  "flags": {
429
401
  "help": {
@@ -441,14 +413,6 @@
441
413
  "multiple": false,
442
414
  "type": "option"
443
415
  },
444
- "accessLevelRemoteId": {
445
- "char": "a",
446
- "description": "The remote ID of the access level with which to access the resource.",
447
- "name": "accessLevelRemoteId",
448
- "hasDynamicHelp": false,
449
- "multiple": false,
450
- "type": "option"
451
- },
452
416
  "sessionId": {
453
417
  "char": "s",
454
418
  "description": "The Opal ID of the session to connect to. Uses an existing session that was created via the web flow.",
@@ -463,11 +427,18 @@
463
427
  "name": "refresh",
464
428
  "allowNo": false,
465
429
  "type": "boolean"
430
+ },
431
+ "profileName": {
432
+ "description": "Uses a custom AWS profile name for the IAM role. Default value is the role's name.",
433
+ "name": "profileName",
434
+ "hasDynamicHelp": false,
435
+ "multiple": false,
436
+ "type": "option"
466
437
  }
467
438
  },
468
439
  "hasDynamicHelp": false,
469
440
  "hiddenAliases": [],
470
- "id": "kube-roles:start",
441
+ "id": "iam-roles:start",
471
442
  "pluginAlias": "opal-security",
472
443
  "pluginName": "opal-security",
473
444
  "pluginType": "core",
@@ -477,18 +448,18 @@
477
448
  "relativePath": [
478
449
  "lib",
479
450
  "commands",
480
- "kube-roles",
451
+ "iam-roles",
481
452
  "start.js"
482
453
  ]
483
454
  },
484
- "iam-roles:start": {
455
+ "kube-roles:start": {
485
456
  "aliases": [],
486
457
  "args": {},
487
- "description": "Starts a session to assume an IAM role.",
458
+ "description": "Starts a session to assume a Kubernetes cluster IAM role.",
488
459
  "examples": [
489
- "opal iam-roles:start",
490
- "opal iam-roles:start --id 51f7176b-0464-4a6f-8369-e951e187b398",
491
- "opal iam-roles:start --id 51f7176b-0464-4a6f-8369-e951e187b398 --profileName \"custom-profile\""
460
+ "opal kube-roles:start",
461
+ "opal kube-roles:start --id 51f7176b-0464-4a6f-8369-e951e187b398",
462
+ "opal kube-roles:start --id 51f7176b-0464-4a6f-8369-e951e187b398 --accessLevelRemoteId \"arn:aws:iam::712234975475:role/acme-eks-cluster-admin-role\""
492
463
  ],
493
464
  "flags": {
494
465
  "help": {
@@ -506,6 +477,14 @@
506
477
  "multiple": false,
507
478
  "type": "option"
508
479
  },
480
+ "accessLevelRemoteId": {
481
+ "char": "a",
482
+ "description": "The remote ID of the access level with which to access the resource.",
483
+ "name": "accessLevelRemoteId",
484
+ "hasDynamicHelp": false,
485
+ "multiple": false,
486
+ "type": "option"
487
+ },
509
488
  "sessionId": {
510
489
  "char": "s",
511
490
  "description": "The Opal ID of the session to connect to. Uses an existing session that was created via the web flow.",
@@ -520,18 +499,11 @@
520
499
  "name": "refresh",
521
500
  "allowNo": false,
522
501
  "type": "boolean"
523
- },
524
- "profileName": {
525
- "description": "Uses a custom AWS profile name for the IAM role. Default value is the role's name.",
526
- "name": "profileName",
527
- "hasDynamicHelp": false,
528
- "multiple": false,
529
- "type": "option"
530
502
  }
531
503
  },
532
504
  "hasDynamicHelp": false,
533
505
  "hiddenAliases": [],
534
- "id": "iam-roles:start",
506
+ "id": "kube-roles:start",
535
507
  "pluginAlias": "opal-security",
536
508
  "pluginName": "opal-security",
537
509
  "pluginType": "core",
@@ -541,7 +513,7 @@
541
513
  "relativePath": [
542
514
  "lib",
543
515
  "commands",
544
- "iam-roles",
516
+ "kube-roles",
545
517
  "start.js"
546
518
  ]
547
519
  },
@@ -634,10 +606,10 @@
634
606
  "allowNo": false,
635
607
  "type": "boolean"
636
608
  },
637
- "assets": {
638
- "char": "a",
639
- "description": "The ids of the assets (resource, group) to request access to. Append a role ID using a colon if needed, e.g. `--assets 123:456`. \n If not provided, an interactive selection flow will be available to select assets to request.",
640
- "name": "assets",
609
+ "id": {
610
+ "char": "i",
611
+ "description": "The id of the asset (resource, group) to request access to. Append a role ID using a colon if needed, e.g. `--id 123:456`. \n If not provided, an interactive selection flow will be available to select assets to request.",
612
+ "name": "id",
641
613
  "hasDynamicHelp": false,
642
614
  "multiple": true,
643
615
  "type": "option"
@@ -660,6 +632,7 @@
660
632
  }
661
633
  },
662
634
  "hasDynamicHelp": false,
635
+ "hidden": true,
663
636
  "hiddenAliases": [],
664
637
  "id": "request:create",
665
638
  "pluginAlias": "opal-security",
@@ -708,6 +681,7 @@
708
681
  }
709
682
  },
710
683
  "hasDynamicHelp": false,
684
+ "hidden": true,
711
685
  "hiddenAliases": [],
712
686
  "id": "request:get",
713
687
  "pluginAlias": "opal-security",
@@ -766,6 +740,7 @@
766
740
  }
767
741
  },
768
742
  "hasDynamicHelp": false,
743
+ "hidden": true,
769
744
  "hiddenAliases": [],
770
745
  "id": "request:list",
771
746
  "pluginAlias": "opal-security",
@@ -1028,5 +1003,5 @@
1028
1003
  ]
1029
1004
  }
1030
1005
  },
1031
- "version": "3.1.1-beta.7e1cc21"
1006
+ "version": "3.1.1-beta.8ec7545"
1032
1007
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "opal-security",
3
3
  "description": "Opal allows you to centrally manage access to all of your sensitive systems.",
4
- "version": "3.1.1-beta.7e1cc21",
4
+ "version": "3.1.1-beta.8ec7545",
5
5
  "author": "Stephen Cobbe",
6
6
  "bin": {
7
7
  "opal": "./bin/run"
@@ -1,8 +0,0 @@
1
- import { Command } from "@oclif/core";
2
- export default class WhoAmI extends Command {
3
- static description: string;
4
- static flags: {
5
- help: import("@oclif/core/lib/interfaces").BooleanFlag<void>;
6
- };
7
- run(): Promise<void>;
8
- }
@@ -1,34 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const core_1 = require("@oclif/core");
4
- const config_1 = require("../lib/config");
5
- const credentials_1 = require("../lib/credentials");
6
- const flags_1 = require("../lib/flags");
7
- class WhoAmI extends core_1.Command {
8
- async run() {
9
- const opalCreds = await (0, credentials_1.getOpalCredentials)(this, false);
10
- const organizationName = opalCreds === null || opalCreds === void 0 ? void 0 : opalCreds.organizationName;
11
- const email = opalCreds === null || opalCreds === void 0 ? void 0 : opalCreds.email;
12
- const configData = (0, config_1.getOrCreateConfigData)(this.config.configDir);
13
- const url = configData[config_1.urlKey];
14
- if (email) {
15
- this.log(`User: ${email}`);
16
- }
17
- if (organizationName) {
18
- if (organizationName === "unset-org-id") {
19
- this.log("Authenticated with Opal API Token.");
20
- }
21
- else {
22
- this.log(`Organization: ${organizationName}`);
23
- }
24
- }
25
- if (url) {
26
- this.log(`Server: ${url}`);
27
- }
28
- }
29
- }
30
- WhoAmI.description = "Describes current url set, organization name, and logged in user if applicabled.";
31
- WhoAmI.flags = {
32
- help: flags_1.SHARED_FLAGS.help,
33
- };
34
- exports.default = WhoAmI;