opal-security 3.1.1-beta.00e96a4 → 3.1.1-beta.01fe2fd
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 +156 -26
- package/lib/commands/login.js +6 -2
- package/lib/commands/request/create.d.ts +6 -1
- package/lib/commands/request/create.js +61 -19
- package/lib/commands/request/get.d.ts +1 -1
- package/lib/commands/request/get.js +12 -7
- package/lib/commands/request/list.d.ts +5 -3
- package/lib/commands/request/list.js +46 -23
- package/lib/commands/whoami.d.ts +8 -0
- package/lib/commands/whoami.js +34 -0
- package/lib/graphql/gql.d.ts +28 -8
- package/lib/graphql/gql.js +8 -4
- package/lib/graphql/graphql.d.ts +193 -2
- package/lib/graphql/graphql.js +1258 -32
- package/lib/lib/apollo.js +3 -4
- package/lib/lib/credentials/index.d.ts +2 -1
- package/lib/lib/credentials/index.js +2 -1
- package/lib/lib/flags.js +1 -1
- package/lib/lib/requests.d.ts +30 -18
- package/lib/lib/requests.js +821 -138
- package/lib/utils/displays.d.ts +6 -4
- package/lib/utils/displays.js +182 -87
- package/oclif.manifest.json +105 -28
- package/package.json +6 -5
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.
|
|
25
|
+
opal-security/3.1.1-beta.01fe2fd linux-x64 node-v20.19.2
|
|
26
26
|
$ opal --help [COMMAND]
|
|
27
27
|
USAGE
|
|
28
28
|
$ opal COMMAND
|
|
@@ -44,6 +44,10 @@ 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
|
+
* [`opal request ls`](#opal-request-ls)
|
|
47
51
|
* [`opal resources get`](#opal-resources-get)
|
|
48
52
|
* [`opal set-auth-provider`](#opal-set-auth-provider)
|
|
49
53
|
* [`opal set-custom-header`](#opal-set-custom-header)
|
|
@@ -53,6 +57,7 @@ USAGE
|
|
|
53
57
|
* [`opal ssh copyTo`](#opal-ssh-copyto)
|
|
54
58
|
* [`opal ssh start`](#opal-ssh-start)
|
|
55
59
|
* [`opal version`](#opal-version)
|
|
60
|
+
* [`opal whoami`](#opal-whoami)
|
|
56
61
|
|
|
57
62
|
## `opal autocomplete [SHELL]`
|
|
58
63
|
|
|
@@ -101,7 +106,7 @@ EXAMPLES
|
|
|
101
106
|
$ opal aws:identity
|
|
102
107
|
```
|
|
103
108
|
|
|
104
|
-
_See code: [src/commands/aws/identity.ts](https://github.com/opalsecurity/opal-cli/blob/v3.1.1-beta.
|
|
109
|
+
_See code: [src/commands/aws/identity.ts](https://github.com/opalsecurity/opal-cli/blob/v3.1.1-beta.01fe2fd/src/commands/aws/identity.ts)_
|
|
105
110
|
|
|
106
111
|
## `opal clear-auth-provider`
|
|
107
112
|
|
|
@@ -121,7 +126,7 @@ EXAMPLES
|
|
|
121
126
|
$ opal clear-auth-provider
|
|
122
127
|
```
|
|
123
128
|
|
|
124
|
-
_See code: [src/commands/clear-auth-provider.ts](https://github.com/opalsecurity/opal-cli/blob/v3.1.1-beta.
|
|
129
|
+
_See code: [src/commands/clear-auth-provider.ts](https://github.com/opalsecurity/opal-cli/blob/v3.1.1-beta.01fe2fd/src/commands/clear-auth-provider.ts)_
|
|
125
130
|
|
|
126
131
|
## `opal curl-example`
|
|
127
132
|
|
|
@@ -138,7 +143,7 @@ DESCRIPTION
|
|
|
138
143
|
Prints out an example cURL command containing the parameters the CLI uses to query the Opal server.
|
|
139
144
|
```
|
|
140
145
|
|
|
141
|
-
_See code: [src/commands/curl-example.ts](https://github.com/opalsecurity/opal-cli/blob/v3.1.1-beta.
|
|
146
|
+
_See code: [src/commands/curl-example.ts](https://github.com/opalsecurity/opal-cli/blob/v3.1.1-beta.01fe2fd/src/commands/curl-example.ts)_
|
|
142
147
|
|
|
143
148
|
## `opal groups get`
|
|
144
149
|
|
|
@@ -150,7 +155,7 @@ USAGE
|
|
|
150
155
|
|
|
151
156
|
FLAGS
|
|
152
157
|
-h, --help Show CLI help.
|
|
153
|
-
-i, --id=<value> The Opal ID of the
|
|
158
|
+
-i, --id=<value> The Opal ID of the asset. You can find this from the URL, e.g. https://opal.dev/resources/[ID]
|
|
154
159
|
|
|
155
160
|
DESCRIPTION
|
|
156
161
|
Get group info for a particular group.
|
|
@@ -159,7 +164,7 @@ EXAMPLES
|
|
|
159
164
|
$ opal groups:get --id 54052a3e-5375-4392-aeaf-0c6c44c131d4
|
|
160
165
|
```
|
|
161
166
|
|
|
162
|
-
_See code: [src/commands/groups/get.ts](https://github.com/opalsecurity/opal-cli/blob/v3.1.1-beta.
|
|
167
|
+
_See code: [src/commands/groups/get.ts](https://github.com/opalsecurity/opal-cli/blob/v3.1.1-beta.01fe2fd/src/commands/groups/get.ts)_
|
|
163
168
|
|
|
164
169
|
## `opal help [COMMANDS]`
|
|
165
170
|
|
|
@@ -191,7 +196,7 @@ USAGE
|
|
|
191
196
|
|
|
192
197
|
FLAGS
|
|
193
198
|
-h, --help Show CLI help.
|
|
194
|
-
-i, --id=<value> The Opal ID of the
|
|
199
|
+
-i, --id=<value> The Opal ID of the asset. You can find this from the URL, e.g.
|
|
195
200
|
https://opal.dev/resources/[ID]
|
|
196
201
|
-r, --refresh Starts a new session even if one already exists. Useful if a session is about to expire.
|
|
197
202
|
-s, --sessionId=<value> The Opal ID of the session to connect to. Uses an existing session that was created via the
|
|
@@ -209,7 +214,7 @@ EXAMPLES
|
|
|
209
214
|
$ opal iam-roles:start --id 51f7176b-0464-4a6f-8369-e951e187b398 --profileName "custom-profile"
|
|
210
215
|
```
|
|
211
216
|
|
|
212
|
-
_See code: [src/commands/iam-roles/start.ts](https://github.com/opalsecurity/opal-cli/blob/v3.1.1-beta.
|
|
217
|
+
_See code: [src/commands/iam-roles/start.ts](https://github.com/opalsecurity/opal-cli/blob/v3.1.1-beta.01fe2fd/src/commands/iam-roles/start.ts)_
|
|
213
218
|
|
|
214
219
|
## `opal kube-roles start`
|
|
215
220
|
|
|
@@ -222,7 +227,7 @@ USAGE
|
|
|
222
227
|
FLAGS
|
|
223
228
|
-a, --accessLevelRemoteId=<value> The remote ID of the access level with which to access the resource.
|
|
224
229
|
-h, --help Show CLI help.
|
|
225
|
-
-i, --id=<value> The Opal ID of the
|
|
230
|
+
-i, --id=<value> The Opal ID of the asset. You can find this from the URL, e.g.
|
|
226
231
|
https://opal.dev/resources/[ID]
|
|
227
232
|
-r, --refresh Starts a new session even if one already exists. Useful if a session is about to
|
|
228
233
|
expire.
|
|
@@ -240,7 +245,7 @@ EXAMPLES
|
|
|
240
245
|
$ opal kube-roles:start --id 51f7176b-0464-4a6f-8369-e951e187b398 --accessLevelRemoteId "arn:aws:iam::712234975475:role/acme-eks-cluster-admin-role"
|
|
241
246
|
```
|
|
242
247
|
|
|
243
|
-
_See code: [src/commands/kube-roles/start.ts](https://github.com/opalsecurity/opal-cli/blob/v3.1.1-beta.
|
|
248
|
+
_See code: [src/commands/kube-roles/start.ts](https://github.com/opalsecurity/opal-cli/blob/v3.1.1-beta.01fe2fd/src/commands/kube-roles/start.ts)_
|
|
244
249
|
|
|
245
250
|
## `opal login`
|
|
246
251
|
|
|
@@ -261,7 +266,7 @@ EXAMPLES
|
|
|
261
266
|
$ opal login
|
|
262
267
|
```
|
|
263
268
|
|
|
264
|
-
_See code: [src/commands/login.ts](https://github.com/opalsecurity/opal-cli/blob/v3.1.1-beta.
|
|
269
|
+
_See code: [src/commands/login.ts](https://github.com/opalsecurity/opal-cli/blob/v3.1.1-beta.01fe2fd/src/commands/login.ts)_
|
|
265
270
|
|
|
266
271
|
## `opal logout`
|
|
267
272
|
|
|
@@ -281,7 +286,7 @@ EXAMPLES
|
|
|
281
286
|
$ opal logout
|
|
282
287
|
```
|
|
283
288
|
|
|
284
|
-
_See code: [src/commands/logout.ts](https://github.com/opalsecurity/opal-cli/blob/v3.1.1-beta.
|
|
289
|
+
_See code: [src/commands/logout.ts](https://github.com/opalsecurity/opal-cli/blob/v3.1.1-beta.01fe2fd/src/commands/logout.ts)_
|
|
285
290
|
|
|
286
291
|
## `opal postgres-instances start`
|
|
287
292
|
|
|
@@ -294,7 +299,7 @@ USAGE
|
|
|
294
299
|
FLAGS
|
|
295
300
|
-a, --accessLevelRemoteId=<value> The remote ID of the access level with which to access the resource.
|
|
296
301
|
-h, --help Show CLI help.
|
|
297
|
-
-i, --id=<value> The Opal ID of the
|
|
302
|
+
-i, --id=<value> The Opal ID of the asset. You can find this from the URL, e.g.
|
|
298
303
|
https://opal.dev/resources/[ID]
|
|
299
304
|
-r, --refresh Starts a new session even if one already exists. Useful if a session is about to
|
|
300
305
|
expire.
|
|
@@ -318,7 +323,115 @@ EXAMPLES
|
|
|
318
323
|
$ opal postgres-instances:start --id 51f7176b-0464-4a6f-8369-e951e187b398 --accessLevelRemoteId fullaccess --action view
|
|
319
324
|
```
|
|
320
325
|
|
|
321
|
-
_See code: [src/commands/postgres-instances/start.ts](https://github.com/opalsecurity/opal-cli/blob/v3.1.1-beta.
|
|
326
|
+
_See code: [src/commands/postgres-instances/start.ts](https://github.com/opalsecurity/opal-cli/blob/v3.1.1-beta.01fe2fd/src/commands/postgres-instances/start.ts)_
|
|
327
|
+
|
|
328
|
+
## `opal request create`
|
|
329
|
+
|
|
330
|
+
Creates an Opal access request via an interactive form
|
|
331
|
+
|
|
332
|
+
```
|
|
333
|
+
USAGE
|
|
334
|
+
$ opal request create [-h] [-a <value>...] [-r <value>] [-d <value>]
|
|
335
|
+
|
|
336
|
+
FLAGS
|
|
337
|
+
-a, --assets=<value>... The ids of the assets (resource, group) to request access to. Append a role ID using a colon
|
|
338
|
+
if needed, e.g. `--assets 123:456`.
|
|
339
|
+
If not provided, an interactive selection flow will be available to select assets to request.
|
|
340
|
+
-d, --duration=<value> The duration of access for the request in minutes. If not provided, you will be prompted.
|
|
341
|
+
-h, --help Show CLI help.
|
|
342
|
+
-r, --reason=<value> The reason for the request, contained in quotes. If not provided, you will be prompted.
|
|
343
|
+
|
|
344
|
+
DESCRIPTION
|
|
345
|
+
Creates an Opal access request via an interactive form
|
|
346
|
+
```
|
|
347
|
+
|
|
348
|
+
_See code: [src/commands/request/create.ts](https://github.com/opalsecurity/opal-cli/blob/v3.1.1-beta.01fe2fd/src/commands/request/create.ts)_
|
|
349
|
+
|
|
350
|
+
## `opal request get`
|
|
351
|
+
|
|
352
|
+
Lists access requests
|
|
353
|
+
|
|
354
|
+
```
|
|
355
|
+
USAGE
|
|
356
|
+
$ opal request get [-h] [-i <value>] [-v]
|
|
357
|
+
|
|
358
|
+
FLAGS
|
|
359
|
+
-h, --help Show CLI help.
|
|
360
|
+
-i, --id=<value> The Opal ID of the asset. You can find this from the URL, e.g. https://opal.dev/resources/[ID]
|
|
361
|
+
-v, --verbose Enable verbose output, prints full response in JSON format. Defaults to false.
|
|
362
|
+
|
|
363
|
+
DESCRIPTION
|
|
364
|
+
Lists access requests
|
|
365
|
+
|
|
366
|
+
EXAMPLES
|
|
367
|
+
$ opal request get --id 54052a3e-5375-4392-aeaf-0c6c44c131d4
|
|
368
|
+
|
|
369
|
+
$ opal request get --id 54052a3e-5375-4392-aeaf-0c6c44c131d4 --verbose
|
|
370
|
+
```
|
|
371
|
+
|
|
372
|
+
_See code: [src/commands/request/get.ts](https://github.com/opalsecurity/opal-cli/blob/v3.1.1-beta.01fe2fd/src/commands/request/get.ts)_
|
|
373
|
+
|
|
374
|
+
## `opal request list`
|
|
375
|
+
|
|
376
|
+
Lists your n recent outgoing access requests
|
|
377
|
+
|
|
378
|
+
```
|
|
379
|
+
USAGE
|
|
380
|
+
$ opal request list [-h] [-n <value>] [-p] [-v]
|
|
381
|
+
|
|
382
|
+
FLAGS
|
|
383
|
+
-h, --help Show CLI help.
|
|
384
|
+
-n, --n=<value> [default: 10] Defines number of requests to be returned. 1 <= n <= 100.
|
|
385
|
+
-p, --pending Show only pending requests. Defaults to false.
|
|
386
|
+
-v, --verbose Enable verbose output, prints full response in JSON format. Defaults to false.
|
|
387
|
+
|
|
388
|
+
DESCRIPTION
|
|
389
|
+
Lists your n recent outgoing access requests
|
|
390
|
+
|
|
391
|
+
ALIASES
|
|
392
|
+
$ opal request ls
|
|
393
|
+
|
|
394
|
+
EXAMPLES
|
|
395
|
+
$ opal request list --n 5
|
|
396
|
+
|
|
397
|
+
$ opal request list --n 5 --pending
|
|
398
|
+
|
|
399
|
+
$ opal request list --n 5 --verbose
|
|
400
|
+
|
|
401
|
+
$ opal request list --n 5 --pending --verbose
|
|
402
|
+
```
|
|
403
|
+
|
|
404
|
+
_See code: [src/commands/request/list.ts](https://github.com/opalsecurity/opal-cli/blob/v3.1.1-beta.01fe2fd/src/commands/request/list.ts)_
|
|
405
|
+
|
|
406
|
+
## `opal request ls`
|
|
407
|
+
|
|
408
|
+
Lists your n recent outgoing access requests
|
|
409
|
+
|
|
410
|
+
```
|
|
411
|
+
USAGE
|
|
412
|
+
$ opal request ls [-h] [-n <value>] [-p] [-v]
|
|
413
|
+
|
|
414
|
+
FLAGS
|
|
415
|
+
-h, --help Show CLI help.
|
|
416
|
+
-n, --n=<value> [default: 10] Defines number of requests to be returned. 1 <= n <= 100.
|
|
417
|
+
-p, --pending Show only pending requests. Defaults to false.
|
|
418
|
+
-v, --verbose Enable verbose output, prints full response in JSON format. Defaults to false.
|
|
419
|
+
|
|
420
|
+
DESCRIPTION
|
|
421
|
+
Lists your n recent outgoing access requests
|
|
422
|
+
|
|
423
|
+
ALIASES
|
|
424
|
+
$ opal request ls
|
|
425
|
+
|
|
426
|
+
EXAMPLES
|
|
427
|
+
$ opal request list --n 5
|
|
428
|
+
|
|
429
|
+
$ opal request list --n 5 --pending
|
|
430
|
+
|
|
431
|
+
$ opal request list --n 5 --verbose
|
|
432
|
+
|
|
433
|
+
$ opal request list --n 5 --pending --verbose
|
|
434
|
+
```
|
|
322
435
|
|
|
323
436
|
## `opal resources get`
|
|
324
437
|
|
|
@@ -330,7 +443,7 @@ USAGE
|
|
|
330
443
|
|
|
331
444
|
FLAGS
|
|
332
445
|
-h, --help Show CLI help.
|
|
333
|
-
-i, --id=<value> The Opal ID of the
|
|
446
|
+
-i, --id=<value> The Opal ID of the asset. You can find this from the URL, e.g. https://opal.dev/resources/[ID]
|
|
334
447
|
|
|
335
448
|
DESCRIPTION
|
|
336
449
|
Get resource info for a particular resource.
|
|
@@ -339,7 +452,7 @@ EXAMPLES
|
|
|
339
452
|
$ opal resources:get --id 54052a3e-5375-4392-aeaf-0c6c44c131d4
|
|
340
453
|
```
|
|
341
454
|
|
|
342
|
-
_See code: [src/commands/resources/get.ts](https://github.com/opalsecurity/opal-cli/blob/v3.1.1-beta.
|
|
455
|
+
_See code: [src/commands/resources/get.ts](https://github.com/opalsecurity/opal-cli/blob/v3.1.1-beta.01fe2fd/src/commands/resources/get.ts)_
|
|
343
456
|
|
|
344
457
|
## `opal set-auth-provider`
|
|
345
458
|
|
|
@@ -365,7 +478,7 @@ EXAMPLES
|
|
|
365
478
|
$ opal set-auth-provider --clientID 1234asdf --issuerUrl https://auth.example.com
|
|
366
479
|
```
|
|
367
480
|
|
|
368
|
-
_See code: [src/commands/set-auth-provider.ts](https://github.com/opalsecurity/opal-cli/blob/v3.1.1-beta.
|
|
481
|
+
_See code: [src/commands/set-auth-provider.ts](https://github.com/opalsecurity/opal-cli/blob/v3.1.1-beta.01fe2fd/src/commands/set-auth-provider.ts)_
|
|
369
482
|
|
|
370
483
|
## `opal set-custom-header`
|
|
371
484
|
|
|
@@ -386,7 +499,7 @@ EXAMPLES
|
|
|
386
499
|
$ opal set-custom-header --header 'cf-access-token: $TOKEN'
|
|
387
500
|
```
|
|
388
501
|
|
|
389
|
-
_See code: [src/commands/set-custom-header.ts](https://github.com/opalsecurity/opal-cli/blob/v3.1.1-beta.
|
|
502
|
+
_See code: [src/commands/set-custom-header.ts](https://github.com/opalsecurity/opal-cli/blob/v3.1.1-beta.01fe2fd/src/commands/set-custom-header.ts)_
|
|
390
503
|
|
|
391
504
|
## `opal set-token`
|
|
392
505
|
|
|
@@ -406,7 +519,7 @@ EXAMPLES
|
|
|
406
519
|
$ opal set-token
|
|
407
520
|
```
|
|
408
521
|
|
|
409
|
-
_See code: [src/commands/set-token.ts](https://github.com/opalsecurity/opal-cli/blob/v3.1.1-beta.
|
|
522
|
+
_See code: [src/commands/set-token.ts](https://github.com/opalsecurity/opal-cli/blob/v3.1.1-beta.01fe2fd/src/commands/set-token.ts)_
|
|
410
523
|
|
|
411
524
|
## `opal set-url [URL]`
|
|
412
525
|
|
|
@@ -430,7 +543,7 @@ EXAMPLES
|
|
|
430
543
|
$ opal set-url
|
|
431
544
|
```
|
|
432
545
|
|
|
433
|
-
_See code: [src/commands/set-url.ts](https://github.com/opalsecurity/opal-cli/blob/v3.1.1-beta.
|
|
546
|
+
_See code: [src/commands/set-url.ts](https://github.com/opalsecurity/opal-cli/blob/v3.1.1-beta.01fe2fd/src/commands/set-url.ts)_
|
|
434
547
|
|
|
435
548
|
## `opal ssh copyFrom`
|
|
436
549
|
|
|
@@ -442,7 +555,7 @@ USAGE
|
|
|
442
555
|
|
|
443
556
|
FLAGS
|
|
444
557
|
-h, --help Show CLI help.
|
|
445
|
-
-i, --id=<value> The Opal ID of the
|
|
558
|
+
-i, --id=<value> The Opal ID of the asset. You can find this from the URL, e.g.
|
|
446
559
|
https://opal.dev/resources/[ID]
|
|
447
560
|
-s, --sessionId=<value> The Opal ID of the session to connect to. Uses an existing session that was created via the
|
|
448
561
|
web flow.
|
|
@@ -461,7 +574,7 @@ EXAMPLES
|
|
|
461
574
|
$ opal ssh:copyFrom --src instance/dir --dest my/dir --id 51f7176b-0464-4a6f-8369-e951e187b398
|
|
462
575
|
```
|
|
463
576
|
|
|
464
|
-
_See code: [src/commands/ssh/copyFrom.ts](https://github.com/opalsecurity/opal-cli/blob/v3.1.1-beta.
|
|
577
|
+
_See code: [src/commands/ssh/copyFrom.ts](https://github.com/opalsecurity/opal-cli/blob/v3.1.1-beta.01fe2fd/src/commands/ssh/copyFrom.ts)_
|
|
465
578
|
|
|
466
579
|
## `opal ssh copyTo`
|
|
467
580
|
|
|
@@ -473,7 +586,7 @@ USAGE
|
|
|
473
586
|
|
|
474
587
|
FLAGS
|
|
475
588
|
-h, --help Show CLI help.
|
|
476
|
-
-i, --id=<value> The Opal ID of the
|
|
589
|
+
-i, --id=<value> The Opal ID of the asset. You can find this from the URL, e.g.
|
|
477
590
|
https://opal.dev/resources/[ID]
|
|
478
591
|
-s, --sessionId=<value> The Opal ID of the session to connect to. Uses an existing session that was created via the
|
|
479
592
|
web flow.
|
|
@@ -492,7 +605,7 @@ EXAMPLES
|
|
|
492
605
|
$ opal ssh:copyTo --src my/dir --dest instance/dir --id 51f7176b-0464-4a6f-8369-e951e187b398
|
|
493
606
|
```
|
|
494
607
|
|
|
495
|
-
_See code: [src/commands/ssh/copyTo.ts](https://github.com/opalsecurity/opal-cli/blob/v3.1.1-beta.
|
|
608
|
+
_See code: [src/commands/ssh/copyTo.ts](https://github.com/opalsecurity/opal-cli/blob/v3.1.1-beta.01fe2fd/src/commands/ssh/copyTo.ts)_
|
|
496
609
|
|
|
497
610
|
## `opal ssh start`
|
|
498
611
|
|
|
@@ -504,7 +617,7 @@ USAGE
|
|
|
504
617
|
|
|
505
618
|
FLAGS
|
|
506
619
|
-h, --help Show CLI help.
|
|
507
|
-
-i, --id=<value> The Opal ID of the
|
|
620
|
+
-i, --id=<value> The Opal ID of the asset. You can find this from the URL, e.g.
|
|
508
621
|
https://opal.dev/resources/[ID]
|
|
509
622
|
-r, --refresh Starts a new session even if one already exists. Useful if a session is about to expire.
|
|
510
623
|
-s, --sessionId=<value> The Opal ID of the session to connect to. Uses an existing session that was created via the
|
|
@@ -519,7 +632,7 @@ EXAMPLES
|
|
|
519
632
|
$ opal ssh:start --id 51f7176b-0464-4a6f-8369-e951e187b398
|
|
520
633
|
```
|
|
521
634
|
|
|
522
|
-
_See code: [src/commands/ssh/start.ts](https://github.com/opalsecurity/opal-cli/blob/v3.1.1-beta.
|
|
635
|
+
_See code: [src/commands/ssh/start.ts](https://github.com/opalsecurity/opal-cli/blob/v3.1.1-beta.01fe2fd/src/commands/ssh/start.ts)_
|
|
523
636
|
|
|
524
637
|
## `opal version`
|
|
525
638
|
|
|
@@ -540,4 +653,21 @@ FLAG DESCRIPTIONS
|
|
|
540
653
|
```
|
|
541
654
|
|
|
542
655
|
_See code: [@oclif/plugin-version](https://github.com/oclif/plugin-version/blob/v2.2.27/src/commands/version.ts)_
|
|
656
|
+
|
|
657
|
+
## `opal whoami`
|
|
658
|
+
|
|
659
|
+
Describes current url set, organization name, and logged in user if applicable.
|
|
660
|
+
|
|
661
|
+
```
|
|
662
|
+
USAGE
|
|
663
|
+
$ opal whoami [-h]
|
|
664
|
+
|
|
665
|
+
FLAGS
|
|
666
|
+
-h, --help Show CLI help.
|
|
667
|
+
|
|
668
|
+
DESCRIPTION
|
|
669
|
+
Describes current url set, organization name, and logged in user if applicable.
|
|
670
|
+
```
|
|
671
|
+
|
|
672
|
+
_See code: [src/commands/whoami.ts](https://github.com/opalsecurity/opal-cli/blob/v3.1.1-beta.01fe2fd/src/commands/whoami.ts)_
|
|
543
673
|
<!-- commandsstop -->
|
package/lib/commands/login.js
CHANGED
|
@@ -88,12 +88,14 @@ 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;
|
|
91
92
|
let clientIDCandidate;
|
|
92
93
|
const existingCreds = await (0, credentials_1.getOpalCredentials)(this, false);
|
|
93
94
|
// Only use the previous email + organizationID if email isn't explicitly specified.
|
|
94
95
|
if (!email) {
|
|
95
96
|
email = existingCreds.email;
|
|
96
97
|
organizationId = existingCreds.organizationID;
|
|
98
|
+
organizationName = existingCreds.organizationName;
|
|
97
99
|
clientIDCandidate = existingCreds.clientIDCandidate;
|
|
98
100
|
}
|
|
99
101
|
await (0, credentials_1.removeOpalCredentials)(this);
|
|
@@ -149,6 +151,7 @@ class Login extends core_1.Command {
|
|
|
149
151
|
if (signInOrganizations && signInOrganizations.length > 0) {
|
|
150
152
|
if (signInOrganizations.length === 1) {
|
|
151
153
|
organizationId = signInOrganizations[0].organizationId;
|
|
154
|
+
organizationName = signInOrganizations[0].organizationName;
|
|
152
155
|
clientIDCandidate = signInOrganizations[0].cliClientId;
|
|
153
156
|
}
|
|
154
157
|
else {
|
|
@@ -164,6 +167,7 @@ class Login extends core_1.Command {
|
|
|
164
167
|
},
|
|
165
168
|
]);
|
|
166
169
|
organizationId = responses.signInOrganization.organizationId;
|
|
170
|
+
organizationName = responses.signInOrganization.organizationName;
|
|
167
171
|
clientIDCandidate = responses.signInOrganization.cliClientId;
|
|
168
172
|
}
|
|
169
173
|
}
|
|
@@ -238,10 +242,10 @@ class Login extends core_1.Command {
|
|
|
238
242
|
if (tokenExchangeError) {
|
|
239
243
|
this.log("WARN: Failed to exchange access token for session in Opal. Falling back to using access token for authenticating requests\n");
|
|
240
244
|
// TODO: consider adding a warn line recommending upgrading Opal to version XYZ, once accompanying PR is pushed to prod
|
|
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);
|
|
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);
|
|
242
246
|
}
|
|
243
247
|
else {
|
|
244
|
-
await (0, credentials_1.setOpalCredentials)(this, email, organizationId !== null && organizationId !== void 0 ? organizationId : "", clientIDCandidate, apollo_1.cookieStr, credentials_1.SecretType.Cookie);
|
|
248
|
+
await (0, credentials_1.setOpalCredentials)(this, email, organizationId !== null && organizationId !== void 0 ? organizationId : "", clientIDCandidate, apollo_1.cookieStr, credentials_1.SecretType.Cookie, organizationName);
|
|
245
249
|
}
|
|
246
250
|
// "Representative" authenticated call to check the log-in worked as expected.
|
|
247
251
|
const { resp: authCheckResp, error: authCheckErr } = await (0, handler_1.runQueryDeprecated)({
|
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
import { Command } from "@oclif/core";
|
|
2
2
|
export default class RequestCreate extends Command {
|
|
3
|
-
static hidden: boolean;
|
|
4
3
|
static description: string;
|
|
4
|
+
static flags: {
|
|
5
|
+
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
|
+
reason: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
8
|
+
duration: import("@oclif/core/lib/interfaces").OptionFlag<number | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
9
|
+
};
|
|
5
10
|
run(): Promise<void>;
|
|
6
11
|
}
|
|
@@ -2,38 +2,80 @@
|
|
|
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
|
+
const flags_1 = require("../../lib/flags");
|
|
5
7
|
const requests_1 = require("../../lib/requests");
|
|
6
8
|
const displays_1 = require("../../utils/displays");
|
|
7
|
-
const utils_1 = require("../../utils/utils");
|
|
8
9
|
class RequestCreate extends core_1.Command {
|
|
9
10
|
async run() {
|
|
11
|
+
(0, cmd_1.setMostRecentCommand)(this);
|
|
10
12
|
await (0, apollo_1.initClient)(this, true);
|
|
11
13
|
const client = await (0, apollo_1.getClient)(this, true);
|
|
12
|
-
|
|
13
|
-
const metadata = (0, requests_1.
|
|
14
|
-
(
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
// Step 2: Display the selected items in a tree format
|
|
14
|
+
const { flags } = await this.parse(RequestCreate);
|
|
15
|
+
const metadata = (0, requests_1.initEmptyRequestMetadata)();
|
|
16
|
+
if (flags.assets) {
|
|
17
|
+
// if IDs are provided, bypass the interactive selection process
|
|
18
|
+
await (0, requests_1.bypassRequestSelection)(this, client, flags.assets, metadata);
|
|
19
|
+
}
|
|
20
|
+
else {
|
|
20
21
|
(0, displays_1.headerMessage)(this);
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
22
|
+
let shouldProceed = false;
|
|
23
|
+
while (!shouldProceed) {
|
|
24
|
+
// Step 1: Select first round of assets from an app
|
|
25
|
+
await (0, requests_1.selectRequestableItems)(this, client, metadata.requestMap);
|
|
26
|
+
// Step 2: Display the selected items in a tree format
|
|
27
|
+
(0, displays_1.headerMessage)(this);
|
|
28
|
+
(0, displays_1.treeifyRequestMap)(this, metadata.requestMap);
|
|
29
|
+
// Step 3: Prompt to add more items, repeat 1-3 if needed
|
|
30
|
+
shouldProceed = await (0, requests_1.doneSelectingAssets)();
|
|
31
|
+
}
|
|
24
32
|
}
|
|
25
33
|
// Step 4: Set Request Defaults
|
|
26
34
|
await (0, requests_1.setRequestDefaults)(this, client, metadata);
|
|
27
35
|
// Step 4: Prompt for request reason
|
|
28
|
-
|
|
36
|
+
if (flags.reason) {
|
|
37
|
+
metadata.reason = flags.reason;
|
|
38
|
+
}
|
|
39
|
+
else if (!(metadata.requestDefaults.reasonOptional &&
|
|
40
|
+
flags.assets &&
|
|
41
|
+
flags.duration)) {
|
|
42
|
+
await (0, requests_1.promptForReason)(metadata);
|
|
43
|
+
}
|
|
29
44
|
// Step 5: Prompt for expiration
|
|
30
|
-
|
|
45
|
+
if (flags.duration) {
|
|
46
|
+
(0, requests_1.bypassDuration)(this, flags.duration, metadata);
|
|
47
|
+
}
|
|
48
|
+
else {
|
|
49
|
+
await (0, requests_1.promptForExpiration)(metadata);
|
|
50
|
+
}
|
|
31
51
|
// Step 6: Display final summary of request
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
52
|
+
let canSubmit = true;
|
|
53
|
+
if (!(flags.assets &&
|
|
54
|
+
flags.duration &&
|
|
55
|
+
(metadata.requestDefaults.reasonOptional || flags.reason))) {
|
|
56
|
+
canSubmit = await (0, requests_1.promptRequestSubmission)(this, metadata);
|
|
57
|
+
}
|
|
58
|
+
// Step 7: Prompt for final submission
|
|
59
|
+
if (canSubmit)
|
|
60
|
+
await (0, requests_1.submitFinalRequest)(this, client, metadata);
|
|
35
61
|
}
|
|
36
62
|
}
|
|
37
|
-
RequestCreate.
|
|
38
|
-
RequestCreate.
|
|
63
|
+
RequestCreate.description = "Creates an Opal access request via an interactive form";
|
|
64
|
+
RequestCreate.flags = {
|
|
65
|
+
help: flags_1.SHARED_FLAGS.help,
|
|
66
|
+
assets: core_1.Flags.string({
|
|
67
|
+
char: "a",
|
|
68
|
+
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`.\
|
|
70
|
+
\n If not provided, an interactive selection flow will be available to select assets to request.",
|
|
71
|
+
}),
|
|
72
|
+
reason: core_1.Flags.string({
|
|
73
|
+
char: "r",
|
|
74
|
+
description: "The reason for the request, contained in quotes. If not provided, you will be prompted.",
|
|
75
|
+
}),
|
|
76
|
+
duration: core_1.Flags.integer({
|
|
77
|
+
char: "d",
|
|
78
|
+
description: "The duration of access for the request in minutes. If not provided, you will be prompted.",
|
|
79
|
+
}),
|
|
80
|
+
};
|
|
39
81
|
exports.default = RequestCreate;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { Command } from "@oclif/core";
|
|
2
2
|
export default class GetRequest extends Command {
|
|
3
|
-
static hidden: boolean;
|
|
4
3
|
static description: string;
|
|
5
4
|
static flags: {
|
|
6
5
|
help: import("@oclif/core/lib/interfaces").BooleanFlag<void>;
|
|
7
6
|
id: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
8
7
|
verbose: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
9
8
|
};
|
|
9
|
+
static examples: string[];
|
|
10
10
|
run(): Promise<void>;
|
|
11
11
|
}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const core_1 = require("@oclif/core");
|
|
4
|
+
const chalk_1 = require("chalk");
|
|
4
5
|
const graphql_1 = require("../../graphql");
|
|
5
6
|
const apollo_1 = require("../../lib/apollo");
|
|
6
7
|
const cmd_1 = require("../../lib/cmd");
|
|
7
8
|
const config_1 = require("../../lib/config");
|
|
8
9
|
const flags_1 = require("../../lib/flags");
|
|
9
10
|
const displays_1 = require("../../utils/displays");
|
|
10
|
-
const utils_1 = require("../../utils/utils");
|
|
11
11
|
const GET_REQUEST = (0, graphql_1.graphql)(`
|
|
12
12
|
query GetRequest(
|
|
13
13
|
$id: RequestId!
|
|
@@ -17,6 +17,7 @@ const GET_REQUEST = (0, graphql_1.graphql)(`
|
|
|
17
17
|
... on RequestResult {
|
|
18
18
|
request {
|
|
19
19
|
id
|
|
20
|
+
createdAt
|
|
20
21
|
status
|
|
21
22
|
requester {
|
|
22
23
|
displayName
|
|
@@ -56,14 +57,13 @@ const GET_REQUEST = (0, graphql_1.graphql)(`
|
|
|
56
57
|
`);
|
|
57
58
|
class GetRequest extends core_1.Command {
|
|
58
59
|
async run() {
|
|
59
|
-
(0, utils_1.restrictToDev)(); //TODO: Remove after development is complete
|
|
60
60
|
(0, cmd_1.setMostRecentCommand)(this);
|
|
61
61
|
const configData = (0, config_1.getOrCreateConfigData)(this.config.configDir);
|
|
62
62
|
const client = await (0, apollo_1.getClient)(this, true);
|
|
63
63
|
// Verify id tag was provided
|
|
64
64
|
const { flags } = await this.parse(GetRequest);
|
|
65
65
|
if (!flags.id) {
|
|
66
|
-
this.log("Error: Please provide a
|
|
66
|
+
this.log("Error: Please provide a request ID using the --id flag.");
|
|
67
67
|
this.log("ex. opal request get --id 54052a3e-5375-4392-aeaf-0c6c44c131d4");
|
|
68
68
|
return;
|
|
69
69
|
}
|
|
@@ -75,15 +75,17 @@ class GetRequest extends core_1.Command {
|
|
|
75
75
|
fetchPolicy: "network-only", // to avoid caching
|
|
76
76
|
});
|
|
77
77
|
switch (resp.data.request.__typename) {
|
|
78
|
-
case "RequestResult":
|
|
78
|
+
case "RequestResult": {
|
|
79
79
|
if (flags.verbose) {
|
|
80
80
|
(0, apollo_1.printResponse)(this, resp);
|
|
81
81
|
}
|
|
82
82
|
else {
|
|
83
83
|
(0, displays_1.displayRequestDetails)(this, resp);
|
|
84
84
|
}
|
|
85
|
-
|
|
85
|
+
const url = `${configData[config_1.urlKey]}/requests/sent/${flags.id}`;
|
|
86
|
+
this.log(`\n💡Link to request details: ${chalk_1.default.underline(url)}`);
|
|
86
87
|
return;
|
|
88
|
+
}
|
|
87
89
|
case "RequestNotFoundError":
|
|
88
90
|
this.log(`🚫 Request with id ${flags.id} was not found`);
|
|
89
91
|
return;
|
|
@@ -92,15 +94,18 @@ class GetRequest extends core_1.Command {
|
|
|
92
94
|
}
|
|
93
95
|
}
|
|
94
96
|
}
|
|
95
|
-
GetRequest.hidden = true;
|
|
96
97
|
GetRequest.description = "Lists access requests";
|
|
97
98
|
GetRequest.flags = {
|
|
98
99
|
help: flags_1.SHARED_FLAGS.help,
|
|
99
100
|
id: flags_1.SHARED_FLAGS.id,
|
|
100
101
|
verbose: core_1.Flags.boolean({
|
|
101
102
|
char: "v",
|
|
102
|
-
description: "Enable verbose output",
|
|
103
|
+
description: "Enable verbose output, prints full response in JSON format. Defaults to false.",
|
|
103
104
|
default: false,
|
|
104
105
|
}),
|
|
105
106
|
};
|
|
107
|
+
GetRequest.examples = [
|
|
108
|
+
"opal request get --id 54052a3e-5375-4392-aeaf-0c6c44c131d4",
|
|
109
|
+
"opal request get --id 54052a3e-5375-4392-aeaf-0c6c44c131d4 --verbose",
|
|
110
|
+
];
|
|
106
111
|
exports.default = GetRequest;
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import { Command } from "@oclif/core";
|
|
2
2
|
export default class ListRequests extends Command {
|
|
3
|
-
static hidden: boolean;
|
|
4
3
|
static description: string;
|
|
4
|
+
static examples: string[];
|
|
5
|
+
static aliases: string[];
|
|
5
6
|
static flags: {
|
|
6
7
|
help: import("@oclif/core/lib/interfaces").BooleanFlag<void>;
|
|
7
|
-
|
|
8
|
-
|
|
8
|
+
n: import("@oclif/core/lib/interfaces").OptionFlag<number, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
9
|
+
pending: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
10
|
+
verbose: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
9
11
|
};
|
|
10
12
|
run(): Promise<void>;
|
|
11
13
|
}
|