opal-security 5.1.0 → 5.1.2
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 +38 -31
- package/build/commands/iam-roles/start.d.ts +1 -0
- package/build/commands/iam-roles/start.js +2 -1
- package/build/commands/kube-roles/start.d.ts +1 -0
- package/build/commands/kube-roles/start.js +2 -1
- package/build/commands/login.d.ts +1 -0
- package/build/commands/login.js +10 -7
- package/build/commands/postgres-instances/start.d.ts +1 -0
- package/build/commands/postgres-instances/start.js +2 -1
- package/build/commands/request/create.js +0 -1
- package/build/commands/ssh/copyFrom.d.ts +1 -0
- package/build/commands/ssh/copyFrom.js +2 -1
- package/build/commands/ssh/copyTo.d.ts +1 -0
- package/build/commands/ssh/copyTo.js +2 -1
- package/build/commands/ssh/start.d.ts +1 -0
- package/build/commands/ssh/start.js +2 -1
- package/build/hooks/init/version-check.d.ts +3 -0
- package/build/hooks/init/version-check.js +110 -0
- package/build/lib/flags.d.ts +1 -0
- package/build/lib/flags.js +4 -0
- package/build/lib/mfa.d.ts +1 -1
- package/build/lib/mfa.js +10 -8
- package/build/lib/oidc.d.ts +1 -1
- package/build/lib/oidc.js +10 -8
- package/build/lib/request/displays.js +9 -6
- package/build/lib/resources.d.ts +2 -2
- package/build/lib/resources.js +0 -1
- package/build/lib/sessions.d.ts +1 -1
- package/build/lib/sessions.js +5 -5
- package/oclif.manifest.json +104 -62
- package/package.json +10 -4
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/5.1.
|
|
25
|
+
opal-security/5.1.2 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/v5.1.
|
|
109
|
+
_See code: [src/commands/aws/identity.ts](https://github.com/opalsecurity/opal-cli/blob/v5.1.2/src/commands/aws/identity.ts)_
|
|
110
110
|
|
|
111
111
|
## `opal clear-auth-config`
|
|
112
112
|
|
|
@@ -123,7 +123,7 @@ EXAMPLES
|
|
|
123
123
|
$ opal clear-auth-config
|
|
124
124
|
```
|
|
125
125
|
|
|
126
|
-
_See code: [src/commands/clear-auth-config.ts](https://github.com/opalsecurity/opal-cli/blob/v5.1.
|
|
126
|
+
_See code: [src/commands/clear-auth-config.ts](https://github.com/opalsecurity/opal-cli/blob/v5.1.2/src/commands/clear-auth-config.ts)_
|
|
127
127
|
|
|
128
128
|
## `opal curl-example`
|
|
129
129
|
|
|
@@ -140,7 +140,7 @@ DESCRIPTION
|
|
|
140
140
|
Prints out an example cURL command containing the parameters the CLI uses to query the Opal server.
|
|
141
141
|
```
|
|
142
142
|
|
|
143
|
-
_See code: [src/commands/curl-example.ts](https://github.com/opalsecurity/opal-cli/blob/v5.1.
|
|
143
|
+
_See code: [src/commands/curl-example.ts](https://github.com/opalsecurity/opal-cli/blob/v5.1.2/src/commands/curl-example.ts)_
|
|
144
144
|
|
|
145
145
|
## `opal groups get`
|
|
146
146
|
|
|
@@ -161,7 +161,7 @@ EXAMPLES
|
|
|
161
161
|
$ opal groups:get --id 54052a3e-5375-4392-aeaf-0c6c44c131d4
|
|
162
162
|
```
|
|
163
163
|
|
|
164
|
-
_See code: [src/commands/groups/get.ts](https://github.com/opalsecurity/opal-cli/blob/v5.1.
|
|
164
|
+
_See code: [src/commands/groups/get.ts](https://github.com/opalsecurity/opal-cli/blob/v5.1.2/src/commands/groups/get.ts)_
|
|
165
165
|
|
|
166
166
|
## `opal help [COMMANDS]`
|
|
167
167
|
|
|
@@ -189,12 +189,13 @@ Starts a session to assume an IAM role.
|
|
|
189
189
|
|
|
190
190
|
```
|
|
191
191
|
USAGE
|
|
192
|
-
$ opal iam-roles start [-h] [-i <value>] [--profileName <value>]
|
|
192
|
+
$ opal iam-roles start [-h] [-i <value>] [--openBrowser] [--profileName <value>]
|
|
193
193
|
|
|
194
194
|
FLAGS
|
|
195
195
|
-h, --help Show CLI help.
|
|
196
196
|
-i, --id=<value> The Opal ID of the asset. You can find this from the URL, e.g.
|
|
197
197
|
https://opal.dev/resources/[ID]
|
|
198
|
+
--openBrowser Automatically open the browser without prompting for confirmation.
|
|
198
199
|
--profileName=<value> Uses a custom AWS profile name for the IAM role. Default value is the role's name.
|
|
199
200
|
|
|
200
201
|
DESCRIPTION
|
|
@@ -208,7 +209,7 @@ EXAMPLES
|
|
|
208
209
|
$ opal iam-roles:start --id 51f7176b-0464-4a6f-8369-e951e187b398 --profileName "custom-profile"
|
|
209
210
|
```
|
|
210
211
|
|
|
211
|
-
_See code: [src/commands/iam-roles/start.ts](https://github.com/opalsecurity/opal-cli/blob/v5.1.
|
|
212
|
+
_See code: [src/commands/iam-roles/start.ts](https://github.com/opalsecurity/opal-cli/blob/v5.1.2/src/commands/iam-roles/start.ts)_
|
|
212
213
|
|
|
213
214
|
## `opal kube-roles start`
|
|
214
215
|
|
|
@@ -216,13 +217,14 @@ Starts a session to assume a Kubernetes cluster IAM role.
|
|
|
216
217
|
|
|
217
218
|
```
|
|
218
219
|
USAGE
|
|
219
|
-
$ opal kube-roles start [-h] [-i <value>] [-a <value>]
|
|
220
|
+
$ opal kube-roles start [-h] [-i <value>] [-a <value>] [--openBrowser]
|
|
220
221
|
|
|
221
222
|
FLAGS
|
|
222
223
|
-a, --accessLevelRemoteId=<value> The remote ID of the access level with which to access the resource.
|
|
223
224
|
-h, --help Show CLI help.
|
|
224
225
|
-i, --id=<value> The Opal ID of the asset. You can find this from the URL, e.g.
|
|
225
226
|
https://opal.dev/resources/[ID]
|
|
227
|
+
--openBrowser Automatically open the browser without prompting for confirmation.
|
|
226
228
|
|
|
227
229
|
DESCRIPTION
|
|
228
230
|
Starts a session to assume a Kubernetes cluster IAM role.
|
|
@@ -235,7 +237,7 @@ EXAMPLES
|
|
|
235
237
|
$ opal kube-roles:start --id 51f7176b-0464-4a6f-8369-e951e187b398 --accessLevelRemoteId "arn:aws:iam::712234975475:role/acme-eks-cluster-admin-role"
|
|
236
238
|
```
|
|
237
239
|
|
|
238
|
-
_See code: [src/commands/kube-roles/start.ts](https://github.com/opalsecurity/opal-cli/blob/v5.1.
|
|
240
|
+
_See code: [src/commands/kube-roles/start.ts](https://github.com/opalsecurity/opal-cli/blob/v5.1.2/src/commands/kube-roles/start.ts)_
|
|
239
241
|
|
|
240
242
|
## `opal login`
|
|
241
243
|
|
|
@@ -243,11 +245,12 @@ Authenticates you with the Opal server.
|
|
|
243
245
|
|
|
244
246
|
```
|
|
245
247
|
USAGE
|
|
246
|
-
$ opal login [-h] [--email <value>]
|
|
248
|
+
$ opal login [-h] [--email <value>] [--openBrowser]
|
|
247
249
|
|
|
248
250
|
FLAGS
|
|
249
251
|
-h, --help Show CLI help.
|
|
250
252
|
--email=<value> Email address to login with.
|
|
253
|
+
--openBrowser Automatically open the browser without prompting for confirmation.
|
|
251
254
|
|
|
252
255
|
DESCRIPTION
|
|
253
256
|
Authenticates you with the Opal server.
|
|
@@ -256,7 +259,7 @@ EXAMPLES
|
|
|
256
259
|
$ opal login
|
|
257
260
|
```
|
|
258
261
|
|
|
259
|
-
_See code: [src/commands/login.ts](https://github.com/opalsecurity/opal-cli/blob/v5.1.
|
|
262
|
+
_See code: [src/commands/login.ts](https://github.com/opalsecurity/opal-cli/blob/v5.1.2/src/commands/login.ts)_
|
|
260
263
|
|
|
261
264
|
## `opal logout`
|
|
262
265
|
|
|
@@ -276,7 +279,7 @@ EXAMPLES
|
|
|
276
279
|
$ opal logout
|
|
277
280
|
```
|
|
278
281
|
|
|
279
|
-
_See code: [src/commands/logout.ts](https://github.com/opalsecurity/opal-cli/blob/v5.1.
|
|
282
|
+
_See code: [src/commands/logout.ts](https://github.com/opalsecurity/opal-cli/blob/v5.1.2/src/commands/logout.ts)_
|
|
280
283
|
|
|
281
284
|
## `opal postgres-instances start`
|
|
282
285
|
|
|
@@ -284,7 +287,7 @@ Starts a session to connect to a Postgres database.
|
|
|
284
287
|
|
|
285
288
|
```
|
|
286
289
|
USAGE
|
|
287
|
-
$ opal postgres-instances start [-h] [-i <value>] [-a <value>] [--action open|psql|view]
|
|
290
|
+
$ opal postgres-instances start [-h] [-i <value>] [-a <value>] [--openBrowser] [--action open|psql|view]
|
|
288
291
|
|
|
289
292
|
FLAGS
|
|
290
293
|
-a, --accessLevelRemoteId=<value> The remote ID of the access level with which to access the resource.
|
|
@@ -296,6 +299,7 @@ FLAGS
|
|
|
296
299
|
- psql: Start psql session in shell
|
|
297
300
|
- view: View connection configuration details
|
|
298
301
|
<options: open|psql|view>
|
|
302
|
+
--openBrowser Automatically open the browser without prompting for confirmation.
|
|
299
303
|
|
|
300
304
|
DESCRIPTION
|
|
301
305
|
Starts a session to connect to a Postgres database.
|
|
@@ -310,7 +314,7 @@ EXAMPLES
|
|
|
310
314
|
$ opal postgres-instances:start --id 51f7176b-0464-4a6f-8369-e951e187b398 --accessLevelRemoteId fullaccess --action view
|
|
311
315
|
```
|
|
312
316
|
|
|
313
|
-
_See code: [src/commands/postgres-instances/start.ts](https://github.com/opalsecurity/opal-cli/blob/v5.1.
|
|
317
|
+
_See code: [src/commands/postgres-instances/start.ts](https://github.com/opalsecurity/opal-cli/blob/v5.1.2/src/commands/postgres-instances/start.ts)_
|
|
314
318
|
|
|
315
319
|
## `opal request create`
|
|
316
320
|
|
|
@@ -336,7 +340,7 @@ DESCRIPTION
|
|
|
336
340
|
Creates an Opal access request via an interactive form
|
|
337
341
|
```
|
|
338
342
|
|
|
339
|
-
_See code: [src/commands/request/create.ts](https://github.com/opalsecurity/opal-cli/blob/v5.1.
|
|
343
|
+
_See code: [src/commands/request/create.ts](https://github.com/opalsecurity/opal-cli/blob/v5.1.2/src/commands/request/create.ts)_
|
|
340
344
|
|
|
341
345
|
## `opal request get`
|
|
342
346
|
|
|
@@ -360,7 +364,7 @@ EXAMPLES
|
|
|
360
364
|
$ opal request get --id 54052a3e-5375-4392-aeaf-0c6c44c131d4 --verbose
|
|
361
365
|
```
|
|
362
366
|
|
|
363
|
-
_See code: [src/commands/request/get.ts](https://github.com/opalsecurity/opal-cli/blob/v5.1.
|
|
367
|
+
_See code: [src/commands/request/get.ts](https://github.com/opalsecurity/opal-cli/blob/v5.1.2/src/commands/request/get.ts)_
|
|
364
368
|
|
|
365
369
|
## `opal request list`
|
|
366
370
|
|
|
@@ -392,7 +396,7 @@ EXAMPLES
|
|
|
392
396
|
$ opal request list --n 5 --pending --verbose
|
|
393
397
|
```
|
|
394
398
|
|
|
395
|
-
_See code: [src/commands/request/list.ts](https://github.com/opalsecurity/opal-cli/blob/v5.1.
|
|
399
|
+
_See code: [src/commands/request/list.ts](https://github.com/opalsecurity/opal-cli/blob/v5.1.2/src/commands/request/list.ts)_
|
|
396
400
|
|
|
397
401
|
## `opal request ls`
|
|
398
402
|
|
|
@@ -443,7 +447,7 @@ EXAMPLES
|
|
|
443
447
|
$ opal resources:get --id 54052a3e-5375-4392-aeaf-0c6c44c131d4
|
|
444
448
|
```
|
|
445
449
|
|
|
446
|
-
_See code: [src/commands/resources/get.ts](https://github.com/opalsecurity/opal-cli/blob/v5.1.
|
|
450
|
+
_See code: [src/commands/resources/get.ts](https://github.com/opalsecurity/opal-cli/blob/v5.1.2/src/commands/resources/get.ts)_
|
|
447
451
|
|
|
448
452
|
## `opal set-auth-config`
|
|
449
453
|
|
|
@@ -473,7 +477,7 @@ EXAMPLES
|
|
|
473
477
|
$ opal set-auth-config --organizationID=org-456 --clientID=abc123 --issuerUrl=https://auth.example.com
|
|
474
478
|
```
|
|
475
479
|
|
|
476
|
-
_See code: [src/commands/set-auth-config.ts](https://github.com/opalsecurity/opal-cli/blob/v5.1.
|
|
480
|
+
_See code: [src/commands/set-auth-config.ts](https://github.com/opalsecurity/opal-cli/blob/v5.1.2/src/commands/set-auth-config.ts)_
|
|
477
481
|
|
|
478
482
|
## `opal set-custom-header`
|
|
479
483
|
|
|
@@ -494,7 +498,7 @@ EXAMPLES
|
|
|
494
498
|
$ opal set-custom-header --header 'cf-access-token: $TOKEN'
|
|
495
499
|
```
|
|
496
500
|
|
|
497
|
-
_See code: [src/commands/set-custom-header.ts](https://github.com/opalsecurity/opal-cli/blob/v5.1.
|
|
501
|
+
_See code: [src/commands/set-custom-header.ts](https://github.com/opalsecurity/opal-cli/blob/v5.1.2/src/commands/set-custom-header.ts)_
|
|
498
502
|
|
|
499
503
|
## `opal set-token`
|
|
500
504
|
|
|
@@ -514,7 +518,7 @@ EXAMPLES
|
|
|
514
518
|
$ opal set-token
|
|
515
519
|
```
|
|
516
520
|
|
|
517
|
-
_See code: [src/commands/set-token.ts](https://github.com/opalsecurity/opal-cli/blob/v5.1.
|
|
521
|
+
_See code: [src/commands/set-token.ts](https://github.com/opalsecurity/opal-cli/blob/v5.1.2/src/commands/set-token.ts)_
|
|
518
522
|
|
|
519
523
|
## `opal set-url [URL]`
|
|
520
524
|
|
|
@@ -538,7 +542,7 @@ EXAMPLES
|
|
|
538
542
|
$ opal set-url
|
|
539
543
|
```
|
|
540
544
|
|
|
541
|
-
_See code: [src/commands/set-url.ts](https://github.com/opalsecurity/opal-cli/blob/v5.1.
|
|
545
|
+
_See code: [src/commands/set-url.ts](https://github.com/opalsecurity/opal-cli/blob/v5.1.2/src/commands/set-url.ts)_
|
|
542
546
|
|
|
543
547
|
## `opal ssh copyFrom`
|
|
544
548
|
|
|
@@ -546,12 +550,13 @@ Use SCP to copy files from a compute instance.
|
|
|
546
550
|
|
|
547
551
|
```
|
|
548
552
|
USAGE
|
|
549
|
-
$ opal ssh copyFrom --src <value> [-h] [--dest <value>] [--user <value>] [-i <value>]
|
|
553
|
+
$ opal ssh copyFrom --src <value> [-h] [--dest <value>] [--user <value>] [-i <value>] [--openBrowser]
|
|
550
554
|
|
|
551
555
|
FLAGS
|
|
552
556
|
-h, --help Show CLI help.
|
|
553
557
|
-i, --id=<value> The Opal ID of the asset. You can find this from the URL, e.g. https://opal.dev/resources/[ID]
|
|
554
558
|
--dest=<value> [default: .] The directory you want your files to be copied to.
|
|
559
|
+
--openBrowser Automatically open the browser without prompting for confirmation.
|
|
555
560
|
--src=<value> (required) The directory or file you would like to copy over SCP. Note we only support one file or
|
|
556
561
|
directory at a time.
|
|
557
562
|
--user=<value> [default: ssm-user] The user you want to run SCP over. Keep in mind not all users will have access
|
|
@@ -566,7 +571,7 @@ EXAMPLES
|
|
|
566
571
|
$ opal ssh:copyFrom --src instance/dir --dest my/dir --id 51f7176b-0464-4a6f-8369-e951e187b398
|
|
567
572
|
```
|
|
568
573
|
|
|
569
|
-
_See code: [src/commands/ssh/copyFrom.ts](https://github.com/opalsecurity/opal-cli/blob/v5.1.
|
|
574
|
+
_See code: [src/commands/ssh/copyFrom.ts](https://github.com/opalsecurity/opal-cli/blob/v5.1.2/src/commands/ssh/copyFrom.ts)_
|
|
570
575
|
|
|
571
576
|
## `opal ssh copyTo`
|
|
572
577
|
|
|
@@ -574,12 +579,13 @@ Use SCP to copy files to a compute instance.
|
|
|
574
579
|
|
|
575
580
|
```
|
|
576
581
|
USAGE
|
|
577
|
-
$ opal ssh copyTo --src <value> [-h] [--dest <value>] [--user <value>] [-i <value>]
|
|
582
|
+
$ opal ssh copyTo --src <value> [-h] [--dest <value>] [--user <value>] [-i <value>] [--openBrowser]
|
|
578
583
|
|
|
579
584
|
FLAGS
|
|
580
585
|
-h, --help Show CLI help.
|
|
581
586
|
-i, --id=<value> The Opal ID of the asset. You can find this from the URL, e.g. https://opal.dev/resources/[ID]
|
|
582
587
|
--dest=<value> [default: .] The directory you want your files to be copied to.
|
|
588
|
+
--openBrowser Automatically open the browser without prompting for confirmation.
|
|
583
589
|
--src=<value> (required) The directory or file you would like to copy over SCP. Note we only support one file or
|
|
584
590
|
directory at a time.
|
|
585
591
|
--user=<value> [default: ssm-user] The user you want to run SCP over. Keep in mind not all users will have access
|
|
@@ -594,7 +600,7 @@ EXAMPLES
|
|
|
594
600
|
$ opal ssh:copyTo --src my/dir --dest instance/dir --id 51f7176b-0464-4a6f-8369-e951e187b398
|
|
595
601
|
```
|
|
596
602
|
|
|
597
|
-
_See code: [src/commands/ssh/copyTo.ts](https://github.com/opalsecurity/opal-cli/blob/v5.1.
|
|
603
|
+
_See code: [src/commands/ssh/copyTo.ts](https://github.com/opalsecurity/opal-cli/blob/v5.1.2/src/commands/ssh/copyTo.ts)_
|
|
598
604
|
|
|
599
605
|
## `opal ssh start`
|
|
600
606
|
|
|
@@ -602,11 +608,12 @@ Starts an SSH session to access a compute instance.
|
|
|
602
608
|
|
|
603
609
|
```
|
|
604
610
|
USAGE
|
|
605
|
-
$ opal ssh start [-h] [-i <value>]
|
|
611
|
+
$ opal ssh start [-h] [-i <value>] [--openBrowser]
|
|
606
612
|
|
|
607
613
|
FLAGS
|
|
608
|
-
-h, --help
|
|
609
|
-
-i, --id=<value>
|
|
614
|
+
-h, --help Show CLI help.
|
|
615
|
+
-i, --id=<value> The Opal ID of the asset. You can find this from the URL, e.g. https://opal.dev/resources/[ID]
|
|
616
|
+
--openBrowser Automatically open the browser without prompting for confirmation.
|
|
610
617
|
|
|
611
618
|
DESCRIPTION
|
|
612
619
|
Starts an SSH session to access a compute instance.
|
|
@@ -617,7 +624,7 @@ EXAMPLES
|
|
|
617
624
|
$ opal ssh:start --id 51f7176b-0464-4a6f-8369-e951e187b398
|
|
618
625
|
```
|
|
619
626
|
|
|
620
|
-
_See code: [src/commands/ssh/start.ts](https://github.com/opalsecurity/opal-cli/blob/v5.1.
|
|
627
|
+
_See code: [src/commands/ssh/start.ts](https://github.com/opalsecurity/opal-cli/blob/v5.1.2/src/commands/ssh/start.ts)_
|
|
621
628
|
|
|
622
629
|
## `opal version`
|
|
623
630
|
|
|
@@ -654,5 +661,5 @@ DESCRIPTION
|
|
|
654
661
|
Describes current url set, organization name, and logged in user if applicable.
|
|
655
662
|
```
|
|
656
663
|
|
|
657
|
-
_See code: [src/commands/whoami.ts](https://github.com/opalsecurity/opal-cli/blob/v5.1.
|
|
664
|
+
_See code: [src/commands/whoami.ts](https://github.com/opalsecurity/opal-cli/blob/v5.1.2/src/commands/whoami.ts)_
|
|
658
665
|
<!-- commandsstop -->
|
|
@@ -5,6 +5,7 @@ export default class StartIAMRoleSession extends Command {
|
|
|
5
5
|
static flags: {
|
|
6
6
|
help: import("@oclif/core/lib/interfaces").BooleanFlag<void>;
|
|
7
7
|
id: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
8
|
+
openBrowser: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
8
9
|
profileName: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
9
10
|
};
|
|
10
11
|
run(): Promise<void>;
|
|
@@ -52,7 +52,7 @@ class StartIAMRoleSession extends Command {
|
|
|
52
52
|
if (flags.profileName && flags.profileName !== "") {
|
|
53
53
|
roleName = flags.profileName;
|
|
54
54
|
}
|
|
55
|
-
const session = await createSession(this, roleId, DEFAULT_ACCESS_LEVEL, sessionId, IamSessionMetadataFragment);
|
|
55
|
+
const session = await createSession(this, roleId, DEFAULT_ACCESS_LEVEL, sessionId, IamSessionMetadataFragment, flags.openBrowser);
|
|
56
56
|
if (!session) {
|
|
57
57
|
return;
|
|
58
58
|
}
|
|
@@ -80,6 +80,7 @@ StartIAMRoleSession.examples = [
|
|
|
80
80
|
StartIAMRoleSession.flags = {
|
|
81
81
|
help: SHARED_FLAGS.help,
|
|
82
82
|
id: SHARED_FLAGS.id,
|
|
83
|
+
openBrowser: SHARED_FLAGS.openBrowser,
|
|
83
84
|
profileName: Flags.string({
|
|
84
85
|
multiple: false,
|
|
85
86
|
description: "Uses a custom AWS profile name for the IAM role. Default value is the role's name.",
|
|
@@ -6,6 +6,7 @@ export default class StartKubeIAMRoleSession extends Command {
|
|
|
6
6
|
help: import("@oclif/core/lib/interfaces").BooleanFlag<void>;
|
|
7
7
|
id: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
8
8
|
accessLevelRemoteId: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
9
|
+
openBrowser: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
9
10
|
};
|
|
10
11
|
run(): Promise<void>;
|
|
11
12
|
}
|
|
@@ -34,7 +34,7 @@ class StartKubeIAMRoleSession extends Command {
|
|
|
34
34
|
if (!accessLevel) {
|
|
35
35
|
return;
|
|
36
36
|
}
|
|
37
|
-
const session = await createSession(this, clusterId, accessLevel, sessionId, EksSessionMetadataFragment);
|
|
37
|
+
const session = await createSession(this, clusterId, accessLevel, sessionId, EksSessionMetadataFragment, flags.openBrowser);
|
|
38
38
|
if (!session) {
|
|
39
39
|
return;
|
|
40
40
|
}
|
|
@@ -65,5 +65,6 @@ StartKubeIAMRoleSession.flags = {
|
|
|
65
65
|
help: SHARED_FLAGS.help,
|
|
66
66
|
id: SHARED_FLAGS.id,
|
|
67
67
|
accessLevelRemoteId: SHARED_FLAGS.accessLevelRemoteId,
|
|
68
|
+
openBrowser: SHARED_FLAGS.openBrowser,
|
|
68
69
|
};
|
|
69
70
|
export default StartKubeIAMRoleSession;
|
|
@@ -9,6 +9,7 @@ export default class Login extends Command {
|
|
|
9
9
|
static flags: {
|
|
10
10
|
help: import("@oclif/core/lib/interfaces").BooleanFlag<void>;
|
|
11
11
|
email: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
12
|
+
openBrowser: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
12
13
|
};
|
|
13
14
|
static args: {};
|
|
14
15
|
run(): Promise<void>;
|
package/build/commands/login.js
CHANGED
|
@@ -249,13 +249,15 @@ To continue, please authorize this application in your browser.
|
|
|
249
249
|
• After authenticating, you should be redirected to a page that says Authentication Successful!
|
|
250
250
|
• Never enter your credentials on suspicious-looking pages
|
|
251
251
|
`);
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
252
|
+
if (!flags.openBrowser) {
|
|
253
|
+
await inquirer.prompt([
|
|
254
|
+
{
|
|
255
|
+
type: "input",
|
|
256
|
+
name: "continue",
|
|
257
|
+
message: "Press Enter to open your browser and continue\n",
|
|
258
|
+
},
|
|
259
|
+
]);
|
|
260
|
+
}
|
|
259
261
|
this.log(`
|
|
260
262
|
If your browser doesn't automatically, go to:
|
|
261
263
|
|
|
@@ -330,6 +332,7 @@ Login.flags = {
|
|
|
330
332
|
multiple: false,
|
|
331
333
|
description: "Email address to login with.",
|
|
332
334
|
}),
|
|
335
|
+
openBrowser: SHARED_FLAGS.openBrowser,
|
|
333
336
|
};
|
|
334
337
|
Login.args = {};
|
|
335
338
|
export default Login;
|
|
@@ -6,6 +6,7 @@ export default class StartPostgresInstanceSession extends Command {
|
|
|
6
6
|
help: import("@oclif/core/lib/interfaces").BooleanFlag<void>;
|
|
7
7
|
id: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
8
8
|
accessLevelRemoteId: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
9
|
+
openBrowser: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
9
10
|
action: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
10
11
|
};
|
|
11
12
|
run(): Promise<void>;
|
|
@@ -53,7 +53,7 @@ class StartPostgresInstanceSession extends Command {
|
|
|
53
53
|
if (!accessLevel) {
|
|
54
54
|
return;
|
|
55
55
|
}
|
|
56
|
-
const session = await createSession(this, instanceId, accessLevel, sessionId, RdsSessionMetadataFragment);
|
|
56
|
+
const session = await createSession(this, instanceId, accessLevel, sessionId, RdsSessionMetadataFragment, flags.openBrowser);
|
|
57
57
|
if (!session) {
|
|
58
58
|
return;
|
|
59
59
|
}
|
|
@@ -120,6 +120,7 @@ StartPostgresInstanceSession.flags = {
|
|
|
120
120
|
help: SHARED_FLAGS.help,
|
|
121
121
|
id: SHARED_FLAGS.id,
|
|
122
122
|
accessLevelRemoteId: SHARED_FLAGS.accessLevelRemoteId,
|
|
123
|
+
openBrowser: SHARED_FLAGS.openBrowser,
|
|
123
124
|
action: Flags.string({
|
|
124
125
|
multiple: false,
|
|
125
126
|
description: `Method of connecting to the database.\n${methodChoices.map((c) => `- ${c.value}: ${c.name}`).join("\n")}`,
|
|
@@ -30,7 +30,6 @@ class RequestCreate extends Command {
|
|
|
30
30
|
// Step 1: Select first round of assets from an app
|
|
31
31
|
await selectRequestableItems(this, client, metadata.requestMap);
|
|
32
32
|
// Step 2: Display the selected items in a tree format
|
|
33
|
-
headerMessage(this);
|
|
34
33
|
treeifyRequestMap(this, metadata.requestMap);
|
|
35
34
|
// Step 3: Prompt to add more items, repeat 1-3 if needed
|
|
36
35
|
shouldProceed = await doneSelectingAssets();
|
|
@@ -8,6 +8,7 @@ export default class StartSCPSession extends Command {
|
|
|
8
8
|
dest: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
9
9
|
user: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
10
10
|
id: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
11
|
+
openBrowser: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
11
12
|
};
|
|
12
13
|
run(): Promise<void>;
|
|
13
14
|
}
|
|
@@ -25,7 +25,7 @@ class StartSCPSession extends Command {
|
|
|
25
25
|
instanceId = selectedInstance.id;
|
|
26
26
|
instanceName = selectedInstance.name;
|
|
27
27
|
}
|
|
28
|
-
const session = await createSession(this, instanceId, DEFAULT_ACCESS_LEVEL, sessionId, Ec2SessionMetadataFragment);
|
|
28
|
+
const session = await createSession(this, instanceId, DEFAULT_ACCESS_LEVEL, sessionId, Ec2SessionMetadataFragment, flags.openBrowser);
|
|
29
29
|
if (!session) {
|
|
30
30
|
return;
|
|
31
31
|
}
|
|
@@ -73,5 +73,6 @@ StartSCPSession.flags = {
|
|
|
73
73
|
description: "The user you want to run SCP over. Keep in mind not all users will have access to each other's home directory.",
|
|
74
74
|
}),
|
|
75
75
|
id: SHARED_FLAGS.id,
|
|
76
|
+
openBrowser: SHARED_FLAGS.openBrowser,
|
|
76
77
|
};
|
|
77
78
|
export default StartSCPSession;
|
|
@@ -8,6 +8,7 @@ export default class StartSCPSession extends Command {
|
|
|
8
8
|
dest: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
9
9
|
user: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
10
10
|
id: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
11
|
+
openBrowser: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
11
12
|
};
|
|
12
13
|
run(): Promise<void>;
|
|
13
14
|
}
|
|
@@ -25,7 +25,7 @@ class StartSCPSession extends Command {
|
|
|
25
25
|
instanceId = selectedInstance.id;
|
|
26
26
|
instanceName = selectedInstance.name;
|
|
27
27
|
}
|
|
28
|
-
const session = await createSession(this, instanceId, DEFAULT_ACCESS_LEVEL, sessionId, Ec2SessionMetadataFragment);
|
|
28
|
+
const session = await createSession(this, instanceId, DEFAULT_ACCESS_LEVEL, sessionId, Ec2SessionMetadataFragment, flags.openBrowser);
|
|
29
29
|
if (!session) {
|
|
30
30
|
return;
|
|
31
31
|
}
|
|
@@ -73,5 +73,6 @@ StartSCPSession.flags = {
|
|
|
73
73
|
description: "The user you want to run SCP over. Keep in mind not all users will have access to each other's home directory.",
|
|
74
74
|
}),
|
|
75
75
|
id: SHARED_FLAGS.id,
|
|
76
|
+
openBrowser: SHARED_FLAGS.openBrowser,
|
|
76
77
|
};
|
|
77
78
|
export default StartSCPSession;
|
|
@@ -6,6 +6,7 @@ export default class StartSSHSession extends Command {
|
|
|
6
6
|
static flags: {
|
|
7
7
|
help: import("@oclif/core/lib/interfaces").BooleanFlag<void>;
|
|
8
8
|
id: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
9
|
+
openBrowser: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
9
10
|
};
|
|
10
11
|
run(): Promise<void>;
|
|
11
12
|
}
|
|
@@ -56,7 +56,7 @@ class StartSSHSession extends Command {
|
|
|
56
56
|
}
|
|
57
57
|
instanceName = (resp === null || resp === void 0 ? void 0 : resp.data.resource.resource.name) || "ssh-instance";
|
|
58
58
|
}
|
|
59
|
-
const session = await createSession(this, instanceId, DEFAULT_ACCESS_LEVEL, sessionId, Ec2SessionMetadataFragment);
|
|
59
|
+
const session = await createSession(this, instanceId, DEFAULT_ACCESS_LEVEL, sessionId, Ec2SessionMetadataFragment, flags.openBrowser);
|
|
60
60
|
if (!session) {
|
|
61
61
|
return;
|
|
62
62
|
}
|
|
@@ -86,6 +86,7 @@ StartSSHSession.examples = [
|
|
|
86
86
|
StartSSHSession.flags = {
|
|
87
87
|
help: SHARED_FLAGS.help,
|
|
88
88
|
id: SHARED_FLAGS.id,
|
|
89
|
+
openBrowser: SHARED_FLAGS.openBrowser,
|
|
89
90
|
// TODO: Unfortunately allowing SSM over SSH disables logging
|
|
90
91
|
// user: flags.string({
|
|
91
92
|
// multiple: false,
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import http from "node:http";
|
|
2
|
+
import https from "node:https";
|
|
3
|
+
import chalk from "chalk";
|
|
4
|
+
import { allowSelfSignedCertsKey, getOrCreateConfigData, urlKey, } from "../../lib/config.js";
|
|
5
|
+
// Commands that should skip the version check (e.g., configuration commands)
|
|
6
|
+
const SKIP_VERSION_CHECK_COMMANDS = [
|
|
7
|
+
"set-url",
|
|
8
|
+
"set-token",
|
|
9
|
+
"set-auth-config",
|
|
10
|
+
"version",
|
|
11
|
+
"help",
|
|
12
|
+
"autocomplete",
|
|
13
|
+
];
|
|
14
|
+
const hook = async (opts) => {
|
|
15
|
+
// Skip version check for certain commands
|
|
16
|
+
if (opts.id && SKIP_VERSION_CHECK_COMMANDS.includes(opts.id)) {
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
try {
|
|
20
|
+
const configData = getOrCreateConfigData(opts.config.configDir);
|
|
21
|
+
const baseUrl = configData[urlKey];
|
|
22
|
+
const allowSelfSignedCerts = configData[allowSelfSignedCertsKey];
|
|
23
|
+
if (!baseUrl) {
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
const cliVersion = opts.config.version;
|
|
27
|
+
const url = new URL("/api/cli/version-check", baseUrl);
|
|
28
|
+
url.searchParams.set("version", cliVersion);
|
|
29
|
+
const response = await fetchWithTimeout(url.toString(), {
|
|
30
|
+
method: "GET",
|
|
31
|
+
headers: {
|
|
32
|
+
"User-Agent": `Opal CLI v${cliVersion}`,
|
|
33
|
+
},
|
|
34
|
+
}, allowSelfSignedCerts, 5000);
|
|
35
|
+
if (!response.ok) {
|
|
36
|
+
// Silently fail on non-2xx responses - don't block the CLI
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
const data = JSON.parse(response.body);
|
|
40
|
+
if (data.status === "ok") {
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
// Display message based on status
|
|
44
|
+
const formattedMessage = formatMessage(data.status, data.message);
|
|
45
|
+
if (formattedMessage) {
|
|
46
|
+
process.stderr.write(`${formattedMessage}\n`);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
catch (_a) {
|
|
50
|
+
// Silently fail on any errors (network issues, etc.) - don't block the CLI
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
function formatMessage(status, message) {
|
|
54
|
+
if (!message) {
|
|
55
|
+
return "";
|
|
56
|
+
}
|
|
57
|
+
switch (status) {
|
|
58
|
+
case "error":
|
|
59
|
+
return chalk.red(`❗ ${message}`);
|
|
60
|
+
case "warn":
|
|
61
|
+
return chalk.yellow(`⚠️ ${message}`);
|
|
62
|
+
case "info":
|
|
63
|
+
return chalk.blue(`ℹ️ ${message}`);
|
|
64
|
+
default:
|
|
65
|
+
return message;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
function fetchWithTimeout(url, options, allowSelfSignedCerts, timeoutMs) {
|
|
69
|
+
return new Promise((resolve, reject) => {
|
|
70
|
+
const parsedUrl = new URL(url);
|
|
71
|
+
const isHttps = parsedUrl.protocol === "https:";
|
|
72
|
+
const lib = isHttps ? https : http;
|
|
73
|
+
const requestOptions = {
|
|
74
|
+
hostname: parsedUrl.hostname,
|
|
75
|
+
port: parsedUrl.port || (isHttps ? 443 : 80),
|
|
76
|
+
path: parsedUrl.pathname + parsedUrl.search,
|
|
77
|
+
method: options.method,
|
|
78
|
+
headers: options.headers,
|
|
79
|
+
timeout: timeoutMs,
|
|
80
|
+
};
|
|
81
|
+
if (isHttps) {
|
|
82
|
+
requestOptions.rejectUnauthorized =
|
|
83
|
+
!allowSelfSignedCerts;
|
|
84
|
+
}
|
|
85
|
+
const req = lib.request(requestOptions, (res) => {
|
|
86
|
+
let body = "";
|
|
87
|
+
res.on("data", (chunk) => {
|
|
88
|
+
body += chunk;
|
|
89
|
+
});
|
|
90
|
+
res.on("end", () => {
|
|
91
|
+
resolve({
|
|
92
|
+
ok: res.statusCode !== undefined &&
|
|
93
|
+
res.statusCode >= 200 &&
|
|
94
|
+
res.statusCode !== undefined &&
|
|
95
|
+
res.statusCode >= 200 &&
|
|
96
|
+
res.statusCode < 300,
|
|
97
|
+
status: res.statusCode || 0,
|
|
98
|
+
body,
|
|
99
|
+
});
|
|
100
|
+
});
|
|
101
|
+
});
|
|
102
|
+
req.on("error", reject);
|
|
103
|
+
req.on("timeout", () => {
|
|
104
|
+
req.destroy();
|
|
105
|
+
reject(new Error("Request timed out"));
|
|
106
|
+
});
|
|
107
|
+
req.end();
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
export default hook;
|
package/build/lib/flags.d.ts
CHANGED
|
@@ -2,4 +2,5 @@ export declare const SHARED_FLAGS: {
|
|
|
2
2
|
help: import("@oclif/core/lib/interfaces").BooleanFlag<void>;
|
|
3
3
|
id: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
4
4
|
accessLevelRemoteId: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
5
|
+
openBrowser: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
5
6
|
};
|
package/build/lib/flags.js
CHANGED
|
@@ -11,4 +11,8 @@ export const SHARED_FLAGS = {
|
|
|
11
11
|
char: "a",
|
|
12
12
|
description: "The remote ID of the access level with which to access the resource.",
|
|
13
13
|
}),
|
|
14
|
+
openBrowser: Flags.boolean({
|
|
15
|
+
default: false,
|
|
16
|
+
description: "Automatically open the browser without prompting for confirmation.",
|
|
17
|
+
}),
|
|
14
18
|
};
|
package/build/lib/mfa.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { type Command } from "@oclif/core";
|
|
2
|
-
export declare const waitForMfa: (command: Command) => Promise<void>;
|
|
2
|
+
export declare const waitForMfa: (command: Command, skipPrompt?: boolean) => Promise<void>;
|
package/build/lib/mfa.js
CHANGED
|
@@ -17,7 +17,7 @@ const getLastMfaAt = async (command) => {
|
|
|
17
17
|
});
|
|
18
18
|
return (_a = response.data) === null || _a === void 0 ? void 0 : _a.lastMfaAt;
|
|
19
19
|
};
|
|
20
|
-
export const waitForMfa = async (command) => {
|
|
20
|
+
export const waitForMfa = async (command, skipPrompt = false) => {
|
|
21
21
|
const configData = getOrCreateConfigData(command.config.configDir);
|
|
22
22
|
const baseUrl = configData[urlKey];
|
|
23
23
|
const url = `${baseUrl}/browser-mfa/begin`;
|
|
@@ -30,13 +30,15 @@ To continue, validate your identity:
|
|
|
30
30
|
• Verify the URL starts with: ${url}
|
|
31
31
|
• You should see the Opal logo and a device activation dialog
|
|
32
32
|
`);
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
33
|
+
if (!skipPrompt) {
|
|
34
|
+
await inquirer.prompt([
|
|
35
|
+
{
|
|
36
|
+
type: "input",
|
|
37
|
+
name: "continue",
|
|
38
|
+
message: "Press Enter to open your browser and continue",
|
|
39
|
+
},
|
|
40
|
+
]);
|
|
41
|
+
}
|
|
40
42
|
console.log(`
|
|
41
43
|
If your browser doesn't open automatically, go to:
|
|
42
44
|
|
package/build/lib/oidc.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { type Command } from "@oclif/core";
|
|
2
2
|
import type { OidcProviderType } from "../graphql/graphql.js";
|
|
3
|
-
export declare const waitForValidOidcToken: (command: Command, oidcProviderType: OidcProviderType) => Promise<void>;
|
|
3
|
+
export declare const waitForValidOidcToken: (command: Command, oidcProviderType: OidcProviderType, skipPrompt?: boolean) => Promise<void>;
|
package/build/lib/oidc.js
CHANGED
|
@@ -20,7 +20,7 @@ const hasValidOidcToken = async (command, oidcProviderType) => {
|
|
|
20
20
|
});
|
|
21
21
|
return (_b = (_a = response.data) === null || _a === void 0 ? void 0 : _a.hasValidOidcToken) !== null && _b !== void 0 ? _b : false;
|
|
22
22
|
};
|
|
23
|
-
export const waitForValidOidcToken = async (command, oidcProviderType) => {
|
|
23
|
+
export const waitForValidOidcToken = async (command, oidcProviderType, skipPrompt = false) => {
|
|
24
24
|
const configData = getOrCreateConfigData(command.config.configDir);
|
|
25
25
|
const baseUrl = configData[urlKey];
|
|
26
26
|
const url = `${baseUrl}/browser-oidc/begin?oidc_provider_type=${oidcProviderType}`;
|
|
@@ -33,13 +33,15 @@ To continue, validate your identity with your AWS OIDC provider:
|
|
|
33
33
|
• Verify the URL starts with: ${url}
|
|
34
34
|
• You should see the Opal logo and a device activation dialog
|
|
35
35
|
`);
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
36
|
+
if (!skipPrompt) {
|
|
37
|
+
await inquirer.prompt([
|
|
38
|
+
{
|
|
39
|
+
type: "input",
|
|
40
|
+
name: "continue",
|
|
41
|
+
message: "Press Enter to open your browser and continue",
|
|
42
|
+
},
|
|
43
|
+
]);
|
|
44
|
+
}
|
|
43
45
|
console.log(`
|
|
44
46
|
If your browser doesn't open automatically, go to:
|
|
45
47
|
|
|
@@ -1,9 +1,14 @@
|
|
|
1
1
|
import chalk from "chalk";
|
|
2
2
|
import Table from "cli-table3";
|
|
3
3
|
import { getAppTypeLabel, getAssetTypeLabel } from "../../labels.js";
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
function dividerLine(cmd, withNewline = false) {
|
|
5
|
+
if (withNewline) {
|
|
6
|
+
cmd.log();
|
|
7
|
+
}
|
|
6
8
|
cmd.log("━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━");
|
|
9
|
+
}
|
|
10
|
+
export function headerMessage(cmd) {
|
|
11
|
+
dividerLine(cmd);
|
|
7
12
|
cmd.log("Opal Access Request ✏️");
|
|
8
13
|
cmd.log("Press Ctrl+C to cancel at any time.\n");
|
|
9
14
|
}
|
|
@@ -18,7 +23,7 @@ MongoDB Atlas Test [AppType]
|
|
|
18
23
|
└── admin:test [Role]
|
|
19
24
|
*/
|
|
20
25
|
export function treeifyRequestMap(cmd, requestMap) {
|
|
21
|
-
|
|
26
|
+
cmd.log();
|
|
22
27
|
for (const [_appId, appNode] of Object.entries(requestMap)) {
|
|
23
28
|
// Print App title first (without tree lines)
|
|
24
29
|
const appTypeLabel = appNode.appType
|
|
@@ -45,11 +50,9 @@ export function treeifyRequestMap(cmd, requestMap) {
|
|
|
45
50
|
cmd.log();
|
|
46
51
|
}
|
|
47
52
|
export function displayFinalRequestSummary(cmd, metadata) {
|
|
48
|
-
|
|
49
|
-
cmd.log("━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━");
|
|
53
|
+
dividerLine(cmd, true);
|
|
50
54
|
cmd.log("Final Summary of Request ✏️");
|
|
51
55
|
cmd.log("Press Ctrl+C to cancel at any time.\n");
|
|
52
|
-
cmd.log();
|
|
53
56
|
treeifyRequestMap(cmd, metadata.requestMap);
|
|
54
57
|
const durationInMinutes = metadata.durationInMinutes;
|
|
55
58
|
cmd.log(`Duration: ${durationInMinutes ? formatDuration(durationInMinutes) : "Permanent"}`);
|
package/build/lib/resources.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Command } from "@oclif/core";
|
|
2
|
-
import type {
|
|
2
|
+
import type { ResourceAccessLevelInput } from "../graphql/graphql.js";
|
|
3
3
|
export type ResourceInfo = {
|
|
4
4
|
id: string;
|
|
5
5
|
name: string;
|
|
@@ -11,4 +11,4 @@ export type AccessLevelInfo = {
|
|
|
11
11
|
export declare const DEFAULT_ACCESS_LEVEL: ResourceAccessLevelInput;
|
|
12
12
|
export declare const filterChoices: (input: string, choices: ResourceInfo[] | AccessLevelInfo[]) => ResourceInfo[];
|
|
13
13
|
export declare const promptUserForResource: (command: Command, resourceType: string, message: string) => Promise<ResourceInfo | void>;
|
|
14
|
-
export declare const promptUserForAccessLevels: (command: Command, resourceId: string, instanceType: string, accessLevelRemoteId?: string) => Promise<
|
|
14
|
+
export declare const promptUserForAccessLevels: (command: Command, resourceId: string, instanceType: string, accessLevelRemoteId?: string) => Promise<ResourceAccessLevelInput | void>;
|
package/build/lib/resources.js
CHANGED
package/build/lib/sessions.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { Command } from "@oclif/core";
|
|
2
2
|
import type { CreateSessionResult, ResourceAccessLevelInput, Session } from "../graphql/graphql.js";
|
|
3
|
-
export declare const createSession: (command: Command, resourceId: string, accessLevel: ResourceAccessLevelInput, sessionId: string | undefined, metadataFragment: string) => Promise<CreateSessionResult | undefined>;
|
|
3
|
+
export declare const createSession: (command: Command, resourceId: string, accessLevel: ResourceAccessLevelInput, sessionId: string | undefined, metadataFragment: string, skipBrowserPrompt?: boolean) => Promise<CreateSessionResult | undefined>;
|
|
4
4
|
export declare const getSessionExpirationMessage: (session: Session) => string;
|
package/build/lib/sessions.js
CHANGED
|
@@ -37,7 +37,7 @@ mutation CreateSession($id: ResourceId!, $accessLevel: ResourceAccessLevelInput!
|
|
|
37
37
|
}
|
|
38
38
|
}
|
|
39
39
|
`;
|
|
40
|
-
export const createSession = async (command, resourceId, accessLevel, sessionId, metadataFragment) => {
|
|
40
|
+
export const createSession = async (command, resourceId, accessLevel, sessionId, metadataFragment, skipBrowserPrompt = false) => {
|
|
41
41
|
var _a, _b, _c;
|
|
42
42
|
const { resp, error } = await runMutation({
|
|
43
43
|
command: command,
|
|
@@ -56,12 +56,12 @@ export const createSession = async (command, resourceId, accessLevel, sessionId,
|
|
|
56
56
|
return (_c = resp.data) === null || _c === void 0 ? void 0 : _c.createSession;
|
|
57
57
|
}
|
|
58
58
|
case "MfaInvalidError": {
|
|
59
|
-
await waitForMfa(command);
|
|
60
|
-
return createSession(command, resourceId, accessLevel, sessionId, metadataFragment);
|
|
59
|
+
await waitForMfa(command, skipBrowserPrompt);
|
|
60
|
+
return createSession(command, resourceId, accessLevel, sessionId, metadataFragment, skipBrowserPrompt);
|
|
61
61
|
}
|
|
62
62
|
case "OidcIDTokenNotFoundError": {
|
|
63
|
-
await waitForValidOidcToken(command, OidcProviderType.AwsSession);
|
|
64
|
-
return createSession(command, resourceId, accessLevel, sessionId, metadataFragment);
|
|
63
|
+
await waitForValidOidcToken(command, OidcProviderType.AwsSession, skipBrowserPrompt);
|
|
64
|
+
return createSession(command, resourceId, accessLevel, sessionId, metadataFragment, skipBrowserPrompt);
|
|
65
65
|
}
|
|
66
66
|
default:
|
|
67
67
|
return handleError(command, error, resp);
|
package/oclif.manifest.json
CHANGED
|
@@ -72,6 +72,12 @@
|
|
|
72
72
|
"hasDynamicHelp": false,
|
|
73
73
|
"multiple": false,
|
|
74
74
|
"type": "option"
|
|
75
|
+
},
|
|
76
|
+
"openBrowser": {
|
|
77
|
+
"description": "Automatically open the browser without prompting for confirmation.",
|
|
78
|
+
"name": "openBrowser",
|
|
79
|
+
"allowNo": false,
|
|
80
|
+
"type": "boolean"
|
|
75
81
|
}
|
|
76
82
|
},
|
|
77
83
|
"hasDynamicHelp": false,
|
|
@@ -416,14 +422,14 @@
|
|
|
416
422
|
"get.js"
|
|
417
423
|
]
|
|
418
424
|
},
|
|
419
|
-
"
|
|
425
|
+
"kube-roles:start": {
|
|
420
426
|
"aliases": [],
|
|
421
427
|
"args": {},
|
|
422
|
-
"description": "Starts a session to assume
|
|
428
|
+
"description": "Starts a session to assume a Kubernetes cluster IAM role.",
|
|
423
429
|
"examples": [
|
|
424
|
-
"opal
|
|
425
|
-
"opal
|
|
426
|
-
"opal
|
|
430
|
+
"opal kube-roles:start",
|
|
431
|
+
"opal kube-roles:start --id 51f7176b-0464-4a6f-8369-e951e187b398",
|
|
432
|
+
"opal kube-roles:start --id 51f7176b-0464-4a6f-8369-e951e187b398 --accessLevelRemoteId \"arn:aws:iam::712234975475:role/acme-eks-cluster-admin-role\""
|
|
427
433
|
],
|
|
428
434
|
"flags": {
|
|
429
435
|
"help": {
|
|
@@ -441,17 +447,24 @@
|
|
|
441
447
|
"multiple": false,
|
|
442
448
|
"type": "option"
|
|
443
449
|
},
|
|
444
|
-
"
|
|
445
|
-
"
|
|
446
|
-
"
|
|
450
|
+
"accessLevelRemoteId": {
|
|
451
|
+
"char": "a",
|
|
452
|
+
"description": "The remote ID of the access level with which to access the resource.",
|
|
453
|
+
"name": "accessLevelRemoteId",
|
|
447
454
|
"hasDynamicHelp": false,
|
|
448
455
|
"multiple": false,
|
|
449
456
|
"type": "option"
|
|
457
|
+
},
|
|
458
|
+
"openBrowser": {
|
|
459
|
+
"description": "Automatically open the browser without prompting for confirmation.",
|
|
460
|
+
"name": "openBrowser",
|
|
461
|
+
"allowNo": false,
|
|
462
|
+
"type": "boolean"
|
|
450
463
|
}
|
|
451
464
|
},
|
|
452
465
|
"hasDynamicHelp": false,
|
|
453
466
|
"hiddenAliases": [],
|
|
454
|
-
"id": "
|
|
467
|
+
"id": "kube-roles:start",
|
|
455
468
|
"pluginAlias": "opal-security",
|
|
456
469
|
"pluginName": "opal-security",
|
|
457
470
|
"pluginType": "core",
|
|
@@ -461,18 +474,18 @@
|
|
|
461
474
|
"relativePath": [
|
|
462
475
|
"build",
|
|
463
476
|
"commands",
|
|
464
|
-
"
|
|
477
|
+
"kube-roles",
|
|
465
478
|
"start.js"
|
|
466
479
|
]
|
|
467
480
|
},
|
|
468
|
-
"
|
|
481
|
+
"iam-roles:start": {
|
|
469
482
|
"aliases": [],
|
|
470
483
|
"args": {},
|
|
471
|
-
"description": "Starts a session to assume
|
|
484
|
+
"description": "Starts a session to assume an IAM role.",
|
|
472
485
|
"examples": [
|
|
473
|
-
"opal
|
|
474
|
-
"opal
|
|
475
|
-
"opal
|
|
486
|
+
"opal iam-roles:start",
|
|
487
|
+
"opal iam-roles:start --id 51f7176b-0464-4a6f-8369-e951e187b398",
|
|
488
|
+
"opal iam-roles:start --id 51f7176b-0464-4a6f-8369-e951e187b398 --profileName \"custom-profile\""
|
|
476
489
|
],
|
|
477
490
|
"flags": {
|
|
478
491
|
"help": {
|
|
@@ -490,10 +503,15 @@
|
|
|
490
503
|
"multiple": false,
|
|
491
504
|
"type": "option"
|
|
492
505
|
},
|
|
493
|
-
"
|
|
494
|
-
"
|
|
495
|
-
"
|
|
496
|
-
"
|
|
506
|
+
"openBrowser": {
|
|
507
|
+
"description": "Automatically open the browser without prompting for confirmation.",
|
|
508
|
+
"name": "openBrowser",
|
|
509
|
+
"allowNo": false,
|
|
510
|
+
"type": "boolean"
|
|
511
|
+
},
|
|
512
|
+
"profileName": {
|
|
513
|
+
"description": "Uses a custom AWS profile name for the IAM role. Default value is the role's name.",
|
|
514
|
+
"name": "profileName",
|
|
497
515
|
"hasDynamicHelp": false,
|
|
498
516
|
"multiple": false,
|
|
499
517
|
"type": "option"
|
|
@@ -501,7 +519,7 @@
|
|
|
501
519
|
},
|
|
502
520
|
"hasDynamicHelp": false,
|
|
503
521
|
"hiddenAliases": [],
|
|
504
|
-
"id": "
|
|
522
|
+
"id": "iam-roles:start",
|
|
505
523
|
"pluginAlias": "opal-security",
|
|
506
524
|
"pluginName": "opal-security",
|
|
507
525
|
"pluginType": "core",
|
|
@@ -511,7 +529,7 @@
|
|
|
511
529
|
"relativePath": [
|
|
512
530
|
"build",
|
|
513
531
|
"commands",
|
|
514
|
-
"
|
|
532
|
+
"iam-roles",
|
|
515
533
|
"start.js"
|
|
516
534
|
]
|
|
517
535
|
},
|
|
@@ -549,6 +567,12 @@
|
|
|
549
567
|
"multiple": false,
|
|
550
568
|
"type": "option"
|
|
551
569
|
},
|
|
570
|
+
"openBrowser": {
|
|
571
|
+
"description": "Automatically open the browser without prompting for confirmation.",
|
|
572
|
+
"name": "openBrowser",
|
|
573
|
+
"allowNo": false,
|
|
574
|
+
"type": "boolean"
|
|
575
|
+
},
|
|
552
576
|
"action": {
|
|
553
577
|
"description": "Method of connecting to the database.\n- open: Open external database app\n- psql: Start psql session in shell\n- view: View connection configuration details",
|
|
554
578
|
"name": "action",
|
|
@@ -578,6 +602,46 @@
|
|
|
578
602
|
"start.js"
|
|
579
603
|
]
|
|
580
604
|
},
|
|
605
|
+
"resources:get": {
|
|
606
|
+
"aliases": [],
|
|
607
|
+
"args": {},
|
|
608
|
+
"description": "Get resource info for a particular resource.",
|
|
609
|
+
"examples": [
|
|
610
|
+
"opal resources:get --id 54052a3e-5375-4392-aeaf-0c6c44c131d4"
|
|
611
|
+
],
|
|
612
|
+
"flags": {
|
|
613
|
+
"help": {
|
|
614
|
+
"char": "h",
|
|
615
|
+
"description": "Show CLI help.",
|
|
616
|
+
"name": "help",
|
|
617
|
+
"allowNo": false,
|
|
618
|
+
"type": "boolean"
|
|
619
|
+
},
|
|
620
|
+
"id": {
|
|
621
|
+
"char": "i",
|
|
622
|
+
"description": "The Opal ID of the asset. You can find this from the URL, e.g. https://opal.dev/resources/[ID]",
|
|
623
|
+
"name": "id",
|
|
624
|
+
"hasDynamicHelp": false,
|
|
625
|
+
"multiple": false,
|
|
626
|
+
"type": "option"
|
|
627
|
+
}
|
|
628
|
+
},
|
|
629
|
+
"hasDynamicHelp": false,
|
|
630
|
+
"hiddenAliases": [],
|
|
631
|
+
"id": "resources:get",
|
|
632
|
+
"pluginAlias": "opal-security",
|
|
633
|
+
"pluginName": "opal-security",
|
|
634
|
+
"pluginType": "core",
|
|
635
|
+
"strict": true,
|
|
636
|
+
"enableJsonFlag": false,
|
|
637
|
+
"isESM": true,
|
|
638
|
+
"relativePath": [
|
|
639
|
+
"build",
|
|
640
|
+
"commands",
|
|
641
|
+
"resources",
|
|
642
|
+
"get.js"
|
|
643
|
+
]
|
|
644
|
+
},
|
|
581
645
|
"request:create": {
|
|
582
646
|
"aliases": [],
|
|
583
647
|
"args": {},
|
|
@@ -755,46 +819,6 @@
|
|
|
755
819
|
"list.js"
|
|
756
820
|
]
|
|
757
821
|
},
|
|
758
|
-
"resources:get": {
|
|
759
|
-
"aliases": [],
|
|
760
|
-
"args": {},
|
|
761
|
-
"description": "Get resource info for a particular resource.",
|
|
762
|
-
"examples": [
|
|
763
|
-
"opal resources:get --id 54052a3e-5375-4392-aeaf-0c6c44c131d4"
|
|
764
|
-
],
|
|
765
|
-
"flags": {
|
|
766
|
-
"help": {
|
|
767
|
-
"char": "h",
|
|
768
|
-
"description": "Show CLI help.",
|
|
769
|
-
"name": "help",
|
|
770
|
-
"allowNo": false,
|
|
771
|
-
"type": "boolean"
|
|
772
|
-
},
|
|
773
|
-
"id": {
|
|
774
|
-
"char": "i",
|
|
775
|
-
"description": "The Opal ID of the asset. You can find this from the URL, e.g. https://opal.dev/resources/[ID]",
|
|
776
|
-
"name": "id",
|
|
777
|
-
"hasDynamicHelp": false,
|
|
778
|
-
"multiple": false,
|
|
779
|
-
"type": "option"
|
|
780
|
-
}
|
|
781
|
-
},
|
|
782
|
-
"hasDynamicHelp": false,
|
|
783
|
-
"hiddenAliases": [],
|
|
784
|
-
"id": "resources:get",
|
|
785
|
-
"pluginAlias": "opal-security",
|
|
786
|
-
"pluginName": "opal-security",
|
|
787
|
-
"pluginType": "core",
|
|
788
|
-
"strict": true,
|
|
789
|
-
"enableJsonFlag": false,
|
|
790
|
-
"isESM": true,
|
|
791
|
-
"relativePath": [
|
|
792
|
-
"build",
|
|
793
|
-
"commands",
|
|
794
|
-
"resources",
|
|
795
|
-
"get.js"
|
|
796
|
-
]
|
|
797
|
-
},
|
|
798
822
|
"ssh:copyFrom": {
|
|
799
823
|
"aliases": [],
|
|
800
824
|
"args": {},
|
|
@@ -844,6 +868,12 @@
|
|
|
844
868
|
"hasDynamicHelp": false,
|
|
845
869
|
"multiple": false,
|
|
846
870
|
"type": "option"
|
|
871
|
+
},
|
|
872
|
+
"openBrowser": {
|
|
873
|
+
"description": "Automatically open the browser without prompting for confirmation.",
|
|
874
|
+
"name": "openBrowser",
|
|
875
|
+
"allowNo": false,
|
|
876
|
+
"type": "boolean"
|
|
847
877
|
}
|
|
848
878
|
},
|
|
849
879
|
"hasDynamicHelp": false,
|
|
@@ -911,6 +941,12 @@
|
|
|
911
941
|
"hasDynamicHelp": false,
|
|
912
942
|
"multiple": false,
|
|
913
943
|
"type": "option"
|
|
944
|
+
},
|
|
945
|
+
"openBrowser": {
|
|
946
|
+
"description": "Automatically open the browser without prompting for confirmation.",
|
|
947
|
+
"name": "openBrowser",
|
|
948
|
+
"allowNo": false,
|
|
949
|
+
"type": "boolean"
|
|
914
950
|
}
|
|
915
951
|
},
|
|
916
952
|
"hasDynamicHelp": false,
|
|
@@ -952,6 +988,12 @@
|
|
|
952
988
|
"hasDynamicHelp": false,
|
|
953
989
|
"multiple": false,
|
|
954
990
|
"type": "option"
|
|
991
|
+
},
|
|
992
|
+
"openBrowser": {
|
|
993
|
+
"description": "Automatically open the browser without prompting for confirmation.",
|
|
994
|
+
"name": "openBrowser",
|
|
995
|
+
"allowNo": false,
|
|
996
|
+
"type": "boolean"
|
|
955
997
|
}
|
|
956
998
|
},
|
|
957
999
|
"hasDynamicHelp": false,
|
|
@@ -971,5 +1013,5 @@
|
|
|
971
1013
|
]
|
|
972
1014
|
}
|
|
973
1015
|
},
|
|
974
|
-
"version": "5.1.
|
|
1016
|
+
"version": "5.1.2"
|
|
975
1017
|
}
|
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": "5.1.
|
|
4
|
+
"version": "5.1.2",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"author": "Opal Security",
|
|
7
7
|
"bin": {
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"inquirer": "^9.3.8",
|
|
23
23
|
"inquirer-autocomplete-prompt": "^3.0.1",
|
|
24
24
|
"keychain": "^1.5.0",
|
|
25
|
-
"lodash": "^4.
|
|
25
|
+
"lodash": "^4.18.0",
|
|
26
26
|
"moment": "^2.30.1",
|
|
27
27
|
"node-fetch": "^2.6.7",
|
|
28
28
|
"open": "^8.0.4",
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
"get-graphql-schema": "^2.1.2",
|
|
55
55
|
"nock": "^14.0.2",
|
|
56
56
|
"nyc": "^15.1.0",
|
|
57
|
-
"oclif": "^4.
|
|
57
|
+
"oclif": "^4.22.87",
|
|
58
58
|
"ts-node": "^8.10.2",
|
|
59
59
|
"tsc-alias": "^1.8.16",
|
|
60
60
|
"tsx": "^4.20.6",
|
|
@@ -83,6 +83,9 @@
|
|
|
83
83
|
"@oclif/plugin-autocomplete",
|
|
84
84
|
"@oclif/plugin-version"
|
|
85
85
|
],
|
|
86
|
+
"hooks": {
|
|
87
|
+
"init": "./build/hooks/init/version-check"
|
|
88
|
+
},
|
|
86
89
|
"macos": {
|
|
87
90
|
"identifier": "dev.opal.cli"
|
|
88
91
|
},
|
|
@@ -105,5 +108,8 @@
|
|
|
105
108
|
"get-gql-schema": "get-graphql-schema http://localhost:3000/query > schema.graphql && biome check --write schema.graphql",
|
|
106
109
|
"dev": "tsx ./bin/dev"
|
|
107
110
|
},
|
|
108
|
-
"types": "build/index.d.ts"
|
|
111
|
+
"types": "build/index.d.ts",
|
|
112
|
+
"overrides": {
|
|
113
|
+
"lodash": "^4.18.0"
|
|
114
|
+
}
|
|
109
115
|
}
|