opal-security 3.1.3 → 3.2.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 +163 -28
- package/lib/commands/groups/get.js +1 -2
- package/lib/commands/login.js +14 -3
- package/lib/commands/request/create.d.ts +8 -1
- package/lib/commands/request/create.js +90 -25
- package/lib/commands/request/get.d.ts +7 -2
- package/lib/commands/request/get.js +53 -7
- package/lib/commands/request/list.d.ts +9 -2
- package/lib/commands/request/list.js +55 -8
- package/lib/commands/whoami.d.ts +8 -0
- package/lib/commands/whoami.js +34 -0
- package/lib/graphql/gql.d.ts +62 -2
- package/lib/graphql/gql.js +13 -1
- package/lib/graphql/graphql.d.ts +502 -117
- package/lib/graphql/graphql.js +2737 -158
- package/lib/labels.d.ts +3 -0
- package/lib/labels.js +37 -0
- 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/request/api/index.d.ts +6 -0
- package/lib/lib/request/api/index.js +20 -0
- package/lib/lib/request/api/mutations/create-request.d.ts +8 -0
- package/lib/lib/request/api/mutations/create-request.js +159 -0
- package/lib/lib/request/api/queries/apps.d.ts +4 -0
- package/lib/lib/request/api/queries/apps.js +73 -0
- package/lib/lib/request/api/queries/assets.d.ts +6 -0
- package/lib/lib/request/api/queries/assets.js +136 -0
- package/lib/lib/request/api/queries/request-defaults.d.ts +5 -0
- package/lib/lib/request/api/queries/request-defaults.js +51 -0
- package/lib/lib/request/api/queries/requests.d.ts +4 -0
- package/lib/lib/request/api/queries/requests.js +163 -0
- package/lib/lib/request/api/queries/roles.d.ts +5 -0
- package/lib/lib/request/api/queries/roles.js +239 -0
- package/lib/lib/request/displays.d.ts +12 -0
- package/lib/lib/request/displays.js +223 -0
- package/lib/lib/request/prompts/apps-prompt.d.ts +4 -0
- package/lib/lib/request/prompts/apps-prompt.js +35 -0
- package/lib/lib/request/prompts/asset-prompt.d.ts +5 -0
- package/lib/lib/request/prompts/asset-prompt.js +81 -0
- package/lib/lib/request/prompts/duration-prompt.d.ts +2 -0
- package/lib/lib/request/prompts/duration-prompt.js +122 -0
- package/lib/lib/request/prompts/index.d.ts +8 -0
- package/lib/lib/request/prompts/index.js +20 -0
- package/lib/lib/request/prompts/reason-prompt.d.ts +2 -0
- package/lib/lib/request/prompts/reason-prompt.js +20 -0
- package/lib/lib/request/prompts/role-prompt.d.ts +4 -0
- package/lib/lib/request/prompts/role-prompt.js +44 -0
- package/lib/lib/request/prompts/validate-prompt.d.ts +4 -0
- package/lib/lib/request/prompts/validate-prompt.js +29 -0
- package/lib/lib/request/request-utils.d.ts +15 -0
- package/lib/lib/request/request-utils.js +467 -0
- package/lib/lib/request/types.d.ts +55 -0
- package/lib/lib/request/types.js +15 -0
- package/lib/lib/util.d.ts +1 -0
- package/lib/lib/util.js +16 -0
- package/lib/types.d.ts +19 -3
- package/lib/types.js +18 -2
- package/oclif.manifest.json +207 -67
- package/package.json +5 -5
- package/lib/lib/requests.d.ts +0 -22
- package/lib/lib/requests.js +0 -274
- package/lib/utils/displays.d.ts +0 -5
- package/lib/utils/displays.js +0 -65
- package/lib/utils/utils.d.ts +0 -1
- package/lib/utils/utils.js +0 -18
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.
|
|
25
|
+
opal-security/3.2.2 darwin-arm64 node-v18.20.4
|
|
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.
|
|
109
|
+
_See code: [src/commands/aws/identity.ts](https://github.com/opalsecurity/opal-cli/blob/v3.2.2/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.
|
|
129
|
+
_See code: [src/commands/clear-auth-provider.ts](https://github.com/opalsecurity/opal-cli/blob/v3.2.2/src/commands/clear-auth-provider.ts)_
|
|
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.
|
|
146
|
+
_See code: [src/commands/curl-example.ts](https://github.com/opalsecurity/opal-cli/blob/v3.2.2/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.
|
|
167
|
+
_See code: [src/commands/groups/get.ts](https://github.com/opalsecurity/opal-cli/blob/v3.2.2/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.
|
|
217
|
+
_See code: [src/commands/iam-roles/start.ts](https://github.com/opalsecurity/opal-cli/blob/v3.2.2/src/commands/iam-roles/start.ts)_
|
|
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.
|
|
248
|
+
_See code: [src/commands/kube-roles/start.ts](https://github.com/opalsecurity/opal-cli/blob/v3.2.2/src/commands/kube-roles/start.ts)_
|
|
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.
|
|
269
|
+
_See code: [src/commands/login.ts](https://github.com/opalsecurity/opal-cli/blob/v3.2.2/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.
|
|
289
|
+
_See code: [src/commands/logout.ts](https://github.com/opalsecurity/opal-cli/blob/v3.2.2/src/commands/logout.ts)_
|
|
285
290
|
|
|
286
291
|
## `opal postgres-instances start`
|
|
287
292
|
|
|
@@ -289,21 +294,22 @@ Starts a session to connect to a Postgres database.
|
|
|
289
294
|
|
|
290
295
|
```
|
|
291
296
|
USAGE
|
|
292
|
-
$ opal postgres-instances start [-h] [-i <value>] [-a <value>] [-s <value>] [-r] [--action psql|view]
|
|
297
|
+
$ opal postgres-instances start [-h] [-i <value>] [-a <value>] [-s <value>] [-r] [--action open|psql|view]
|
|
293
298
|
|
|
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.
|
|
301
306
|
-s, --sessionId=<value> The Opal ID of the session to connect to. Uses an existing session that was created
|
|
302
307
|
via the web flow.
|
|
303
308
|
--action=<option> Method of connecting to the database.
|
|
309
|
+
- open: Open external database app
|
|
304
310
|
- psql: Start psql session in shell
|
|
305
311
|
- view: View connection configuration details
|
|
306
|
-
<options: psql|view>
|
|
312
|
+
<options: open|psql|view>
|
|
307
313
|
|
|
308
314
|
DESCRIPTION
|
|
309
315
|
Starts a session to connect to a Postgres database.
|
|
@@ -318,7 +324,119 @@ EXAMPLES
|
|
|
318
324
|
$ opal postgres-instances:start --id 51f7176b-0464-4a6f-8369-e951e187b398 --accessLevelRemoteId fullaccess --action view
|
|
319
325
|
```
|
|
320
326
|
|
|
321
|
-
_See code: [src/commands/postgres-instances/start.ts](https://github.com/opalsecurity/opal-cli/blob/v3.
|
|
327
|
+
_See code: [src/commands/postgres-instances/start.ts](https://github.com/opalsecurity/opal-cli/blob/v3.2.2/src/commands/postgres-instances/start.ts)_
|
|
328
|
+
|
|
329
|
+
## `opal request create`
|
|
330
|
+
|
|
331
|
+
Creates an Opal access request via an interactive form
|
|
332
|
+
|
|
333
|
+
```
|
|
334
|
+
USAGE
|
|
335
|
+
$ opal request create [-h] [-a <value>...] [-r <value>] [-d <value>] [-t <value>] [-b <value>]
|
|
336
|
+
|
|
337
|
+
FLAGS
|
|
338
|
+
-a, --assets=<value>... The ids of the assets (resource, group) to request access to. Append a role name using a
|
|
339
|
+
colon if needed, e.g. `--assets 123:456`.
|
|
340
|
+
If not provided, an interactive selection flow will be available to select assets to request.
|
|
341
|
+
-b, --bundle=<value> A bundle ID to create a new request based on the assets in the bundle.
|
|
342
|
+
-d, --duration=<value> The duration of access for the request in minutes. Pass in a 0 value for permanent access. If
|
|
343
|
+
not provided, you will be prompted.
|
|
344
|
+
-h, --help Show CLI help.
|
|
345
|
+
-r, --reason=<value> The reason for the request, contained in quotes. If not provided, you will be prompted.
|
|
346
|
+
-t, --template=<value> A request ID of a previously finished request (cancelled/denied/approved) to create a new
|
|
347
|
+
request based on the completed request.
|
|
348
|
+
|
|
349
|
+
DESCRIPTION
|
|
350
|
+
Creates an Opal access request via an interactive form
|
|
351
|
+
```
|
|
352
|
+
|
|
353
|
+
_See code: [src/commands/request/create.ts](https://github.com/opalsecurity/opal-cli/blob/v3.2.2/src/commands/request/create.ts)_
|
|
354
|
+
|
|
355
|
+
## `opal request get`
|
|
356
|
+
|
|
357
|
+
Fetch details of an access request by request ID
|
|
358
|
+
|
|
359
|
+
```
|
|
360
|
+
USAGE
|
|
361
|
+
$ opal request get [-h] [-i <value>] [-v]
|
|
362
|
+
|
|
363
|
+
FLAGS
|
|
364
|
+
-h, --help Show CLI help.
|
|
365
|
+
-i, --id=<value> The Opal ID of the asset. You can find this from the URL, e.g. https://opal.dev/resources/[ID]
|
|
366
|
+
-v, --verbose Enable verbose output, prints full response in JSON format. Defaults to false.
|
|
367
|
+
|
|
368
|
+
DESCRIPTION
|
|
369
|
+
Fetch details of an access request by request ID
|
|
370
|
+
|
|
371
|
+
EXAMPLES
|
|
372
|
+
$ opal request get --id 54052a3e-5375-4392-aeaf-0c6c44c131d4
|
|
373
|
+
|
|
374
|
+
$ opal request get --id 54052a3e-5375-4392-aeaf-0c6c44c131d4 --verbose
|
|
375
|
+
```
|
|
376
|
+
|
|
377
|
+
_See code: [src/commands/request/get.ts](https://github.com/opalsecurity/opal-cli/blob/v3.2.2/src/commands/request/get.ts)_
|
|
378
|
+
|
|
379
|
+
## `opal request list`
|
|
380
|
+
|
|
381
|
+
Lists your n recent outgoing access requests
|
|
382
|
+
|
|
383
|
+
```
|
|
384
|
+
USAGE
|
|
385
|
+
$ opal request list [-h] [-n <value>] [-p] [-v]
|
|
386
|
+
|
|
387
|
+
FLAGS
|
|
388
|
+
-h, --help Show CLI help.
|
|
389
|
+
-n, --n=<value> [default: 10] Defines number of requests to be returned. 1 <= n <= 100.
|
|
390
|
+
-p, --pending Show only pending requests. Defaults to false.
|
|
391
|
+
-v, --verbose Enable verbose output, prints full response in JSON format. Defaults to false.
|
|
392
|
+
|
|
393
|
+
DESCRIPTION
|
|
394
|
+
Lists your n recent outgoing access requests
|
|
395
|
+
|
|
396
|
+
ALIASES
|
|
397
|
+
$ opal request ls
|
|
398
|
+
|
|
399
|
+
EXAMPLES
|
|
400
|
+
$ opal request list --n 5
|
|
401
|
+
|
|
402
|
+
$ opal request list --n 5 --pending
|
|
403
|
+
|
|
404
|
+
$ opal request list --n 5 --verbose
|
|
405
|
+
|
|
406
|
+
$ opal request list --n 5 --pending --verbose
|
|
407
|
+
```
|
|
408
|
+
|
|
409
|
+
_See code: [src/commands/request/list.ts](https://github.com/opalsecurity/opal-cli/blob/v3.2.2/src/commands/request/list.ts)_
|
|
410
|
+
|
|
411
|
+
## `opal request ls`
|
|
412
|
+
|
|
413
|
+
Lists your n recent outgoing access requests
|
|
414
|
+
|
|
415
|
+
```
|
|
416
|
+
USAGE
|
|
417
|
+
$ opal request ls [-h] [-n <value>] [-p] [-v]
|
|
418
|
+
|
|
419
|
+
FLAGS
|
|
420
|
+
-h, --help Show CLI help.
|
|
421
|
+
-n, --n=<value> [default: 10] Defines number of requests to be returned. 1 <= n <= 100.
|
|
422
|
+
-p, --pending Show only pending requests. Defaults to false.
|
|
423
|
+
-v, --verbose Enable verbose output, prints full response in JSON format. Defaults to false.
|
|
424
|
+
|
|
425
|
+
DESCRIPTION
|
|
426
|
+
Lists your n recent outgoing access requests
|
|
427
|
+
|
|
428
|
+
ALIASES
|
|
429
|
+
$ opal request ls
|
|
430
|
+
|
|
431
|
+
EXAMPLES
|
|
432
|
+
$ opal request list --n 5
|
|
433
|
+
|
|
434
|
+
$ opal request list --n 5 --pending
|
|
435
|
+
|
|
436
|
+
$ opal request list --n 5 --verbose
|
|
437
|
+
|
|
438
|
+
$ opal request list --n 5 --pending --verbose
|
|
439
|
+
```
|
|
322
440
|
|
|
323
441
|
## `opal resources get`
|
|
324
442
|
|
|
@@ -330,7 +448,7 @@ USAGE
|
|
|
330
448
|
|
|
331
449
|
FLAGS
|
|
332
450
|
-h, --help Show CLI help.
|
|
333
|
-
-i, --id=<value> The Opal ID of the
|
|
451
|
+
-i, --id=<value> The Opal ID of the asset. You can find this from the URL, e.g. https://opal.dev/resources/[ID]
|
|
334
452
|
|
|
335
453
|
DESCRIPTION
|
|
336
454
|
Get resource info for a particular resource.
|
|
@@ -339,7 +457,7 @@ EXAMPLES
|
|
|
339
457
|
$ opal resources:get --id 54052a3e-5375-4392-aeaf-0c6c44c131d4
|
|
340
458
|
```
|
|
341
459
|
|
|
342
|
-
_See code: [src/commands/resources/get.ts](https://github.com/opalsecurity/opal-cli/blob/v3.
|
|
460
|
+
_See code: [src/commands/resources/get.ts](https://github.com/opalsecurity/opal-cli/blob/v3.2.2/src/commands/resources/get.ts)_
|
|
343
461
|
|
|
344
462
|
## `opal set-auth-provider`
|
|
345
463
|
|
|
@@ -365,7 +483,7 @@ EXAMPLES
|
|
|
365
483
|
$ opal set-auth-provider --clientID 1234asdf --issuerUrl https://auth.example.com
|
|
366
484
|
```
|
|
367
485
|
|
|
368
|
-
_See code: [src/commands/set-auth-provider.ts](https://github.com/opalsecurity/opal-cli/blob/v3.
|
|
486
|
+
_See code: [src/commands/set-auth-provider.ts](https://github.com/opalsecurity/opal-cli/blob/v3.2.2/src/commands/set-auth-provider.ts)_
|
|
369
487
|
|
|
370
488
|
## `opal set-custom-header`
|
|
371
489
|
|
|
@@ -386,7 +504,7 @@ EXAMPLES
|
|
|
386
504
|
$ opal set-custom-header --header 'cf-access-token: $TOKEN'
|
|
387
505
|
```
|
|
388
506
|
|
|
389
|
-
_See code: [src/commands/set-custom-header.ts](https://github.com/opalsecurity/opal-cli/blob/v3.
|
|
507
|
+
_See code: [src/commands/set-custom-header.ts](https://github.com/opalsecurity/opal-cli/blob/v3.2.2/src/commands/set-custom-header.ts)_
|
|
390
508
|
|
|
391
509
|
## `opal set-token`
|
|
392
510
|
|
|
@@ -406,7 +524,7 @@ EXAMPLES
|
|
|
406
524
|
$ opal set-token
|
|
407
525
|
```
|
|
408
526
|
|
|
409
|
-
_See code: [src/commands/set-token.ts](https://github.com/opalsecurity/opal-cli/blob/v3.
|
|
527
|
+
_See code: [src/commands/set-token.ts](https://github.com/opalsecurity/opal-cli/blob/v3.2.2/src/commands/set-token.ts)_
|
|
410
528
|
|
|
411
529
|
## `opal set-url [URL]`
|
|
412
530
|
|
|
@@ -430,7 +548,7 @@ EXAMPLES
|
|
|
430
548
|
$ opal set-url
|
|
431
549
|
```
|
|
432
550
|
|
|
433
|
-
_See code: [src/commands/set-url.ts](https://github.com/opalsecurity/opal-cli/blob/v3.
|
|
551
|
+
_See code: [src/commands/set-url.ts](https://github.com/opalsecurity/opal-cli/blob/v3.2.2/src/commands/set-url.ts)_
|
|
434
552
|
|
|
435
553
|
## `opal ssh copyFrom`
|
|
436
554
|
|
|
@@ -442,7 +560,7 @@ USAGE
|
|
|
442
560
|
|
|
443
561
|
FLAGS
|
|
444
562
|
-h, --help Show CLI help.
|
|
445
|
-
-i, --id=<value> The Opal ID of the
|
|
563
|
+
-i, --id=<value> The Opal ID of the asset. You can find this from the URL, e.g.
|
|
446
564
|
https://opal.dev/resources/[ID]
|
|
447
565
|
-s, --sessionId=<value> The Opal ID of the session to connect to. Uses an existing session that was created via the
|
|
448
566
|
web flow.
|
|
@@ -461,7 +579,7 @@ EXAMPLES
|
|
|
461
579
|
$ opal ssh:copyFrom --src instance/dir --dest my/dir --id 51f7176b-0464-4a6f-8369-e951e187b398
|
|
462
580
|
```
|
|
463
581
|
|
|
464
|
-
_See code: [src/commands/ssh/copyFrom.ts](https://github.com/opalsecurity/opal-cli/blob/v3.
|
|
582
|
+
_See code: [src/commands/ssh/copyFrom.ts](https://github.com/opalsecurity/opal-cli/blob/v3.2.2/src/commands/ssh/copyFrom.ts)_
|
|
465
583
|
|
|
466
584
|
## `opal ssh copyTo`
|
|
467
585
|
|
|
@@ -473,7 +591,7 @@ USAGE
|
|
|
473
591
|
|
|
474
592
|
FLAGS
|
|
475
593
|
-h, --help Show CLI help.
|
|
476
|
-
-i, --id=<value> The Opal ID of the
|
|
594
|
+
-i, --id=<value> The Opal ID of the asset. You can find this from the URL, e.g.
|
|
477
595
|
https://opal.dev/resources/[ID]
|
|
478
596
|
-s, --sessionId=<value> The Opal ID of the session to connect to. Uses an existing session that was created via the
|
|
479
597
|
web flow.
|
|
@@ -492,7 +610,7 @@ EXAMPLES
|
|
|
492
610
|
$ opal ssh:copyTo --src my/dir --dest instance/dir --id 51f7176b-0464-4a6f-8369-e951e187b398
|
|
493
611
|
```
|
|
494
612
|
|
|
495
|
-
_See code: [src/commands/ssh/copyTo.ts](https://github.com/opalsecurity/opal-cli/blob/v3.
|
|
613
|
+
_See code: [src/commands/ssh/copyTo.ts](https://github.com/opalsecurity/opal-cli/blob/v3.2.2/src/commands/ssh/copyTo.ts)_
|
|
496
614
|
|
|
497
615
|
## `opal ssh start`
|
|
498
616
|
|
|
@@ -504,7 +622,7 @@ USAGE
|
|
|
504
622
|
|
|
505
623
|
FLAGS
|
|
506
624
|
-h, --help Show CLI help.
|
|
507
|
-
-i, --id=<value> The Opal ID of the
|
|
625
|
+
-i, --id=<value> The Opal ID of the asset. You can find this from the URL, e.g.
|
|
508
626
|
https://opal.dev/resources/[ID]
|
|
509
627
|
-r, --refresh Starts a new session even if one already exists. Useful if a session is about to expire.
|
|
510
628
|
-s, --sessionId=<value> The Opal ID of the session to connect to. Uses an existing session that was created via the
|
|
@@ -519,7 +637,7 @@ EXAMPLES
|
|
|
519
637
|
$ opal ssh:start --id 51f7176b-0464-4a6f-8369-e951e187b398
|
|
520
638
|
```
|
|
521
639
|
|
|
522
|
-
_See code: [src/commands/ssh/start.ts](https://github.com/opalsecurity/opal-cli/blob/v3.
|
|
640
|
+
_See code: [src/commands/ssh/start.ts](https://github.com/opalsecurity/opal-cli/blob/v3.2.2/src/commands/ssh/start.ts)_
|
|
523
641
|
|
|
524
642
|
## `opal version`
|
|
525
643
|
|
|
@@ -540,4 +658,21 @@ FLAG DESCRIPTIONS
|
|
|
540
658
|
```
|
|
541
659
|
|
|
542
660
|
_See code: [@oclif/plugin-version](https://github.com/oclif/plugin-version/blob/v2.2.27/src/commands/version.ts)_
|
|
661
|
+
|
|
662
|
+
## `opal whoami`
|
|
663
|
+
|
|
664
|
+
Describes current url set, organization name, and logged in user if applicable.
|
|
665
|
+
|
|
666
|
+
```
|
|
667
|
+
USAGE
|
|
668
|
+
$ opal whoami [-h]
|
|
669
|
+
|
|
670
|
+
FLAGS
|
|
671
|
+
-h, --help Show CLI help.
|
|
672
|
+
|
|
673
|
+
DESCRIPTION
|
|
674
|
+
Describes current url set, organization name, and logged in user if applicable.
|
|
675
|
+
```
|
|
676
|
+
|
|
677
|
+
_See code: [src/commands/whoami.ts](https://github.com/opalsecurity/opal-cli/blob/v3.2.2/src/commands/whoami.ts)_
|
|
543
678
|
<!-- commandsstop -->
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const core_1 = require("@oclif/core");
|
|
4
|
-
const parseAndCheckHttpResponse_1 = require("@apollo/client/link/http/parseAndCheckHttpResponse");
|
|
5
4
|
const graphql_1 = require("../../graphql");
|
|
6
5
|
const apollo_1 = require("../../lib/apollo");
|
|
7
6
|
const cmd_1 = require("../../lib/cmd");
|
|
@@ -64,7 +63,7 @@ class GetGroup extends core_1.Command {
|
|
|
64
63
|
(0, apollo_1.printResponse)(this, resp);
|
|
65
64
|
}
|
|
66
65
|
catch (error) {
|
|
67
|
-
return (0,
|
|
66
|
+
return (0, apollo_1.handleError)(this, error);
|
|
68
67
|
}
|
|
69
68
|
}
|
|
70
69
|
}
|
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
|
}
|
|
@@ -214,12 +218,19 @@ class Login extends core_1.Command {
|
|
|
214
218
|
token_endpoint_auth_method: "none",
|
|
215
219
|
application_type: "native",
|
|
216
220
|
});
|
|
221
|
+
// Add the mfa:skip scope to the scopes according to appropriate org settings
|
|
222
|
+
// This scope is evaluated in Auth0 "MFA Rule" Action to skip or enabled MFA
|
|
223
|
+
let scopes = "openid email profile";
|
|
224
|
+
if (!(signInResp === null || signInResp === void 0 ? void 0 : signInResp.data.signIn.forceExtraStep)) {
|
|
225
|
+
scopes += " mfa:skip";
|
|
226
|
+
}
|
|
217
227
|
const handle = await client.deviceAuthorization({
|
|
218
228
|
audience: "https://opal.dev",
|
|
219
|
-
scope:
|
|
229
|
+
scope: scopes,
|
|
220
230
|
});
|
|
221
231
|
this.log("\nYou are being redirected to your browser to authenticate.\n");
|
|
222
232
|
this.log(` User Code: ${handle.user_code}\n`);
|
|
233
|
+
this.log("If your browser doesn't open, go to:", handle.verification_uri_complete, "\n");
|
|
223
234
|
// Wait before opening the browser window to ensure the user has time to
|
|
224
235
|
// see the User Code.
|
|
225
236
|
await (0, util_1.sleep)(1000);
|
|
@@ -238,10 +249,10 @@ class Login extends core_1.Command {
|
|
|
238
249
|
if (tokenExchangeError) {
|
|
239
250
|
this.log("WARN: Failed to exchange access token for session in Opal. Falling back to using access token for authenticating requests\n");
|
|
240
251
|
// 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);
|
|
252
|
+
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
253
|
}
|
|
243
254
|
else {
|
|
244
|
-
await (0, credentials_1.setOpalCredentials)(this, email, organizationId !== null && organizationId !== void 0 ? organizationId : "", clientIDCandidate, apollo_1.cookieStr, credentials_1.SecretType.Cookie);
|
|
255
|
+
await (0, credentials_1.setOpalCredentials)(this, email, organizationId !== null && organizationId !== void 0 ? organizationId : "", clientIDCandidate, apollo_1.cookieStr, credentials_1.SecretType.Cookie, organizationName);
|
|
245
256
|
}
|
|
246
257
|
// "Representative" authenticated call to check the log-in worked as expected.
|
|
247
258
|
const { resp: authCheckResp, error: authCheckErr } = await (0, handler_1.runQueryDeprecated)({
|
|
@@ -1,6 +1,13 @@
|
|
|
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
|
+
template: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
10
|
+
bundle: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
11
|
+
};
|
|
5
12
|
run(): Promise<void>;
|
|
6
13
|
}
|
|
@@ -2,36 +2,101 @@
|
|
|
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
|
|
6
|
-
const
|
|
7
|
-
const
|
|
5
|
+
const cmd_1 = require("../../lib/cmd");
|
|
6
|
+
const flags_1 = require("../../lib/flags");
|
|
7
|
+
const displays_1 = require("../../lib/request/displays");
|
|
8
|
+
const prompts_1 = require("../../lib/request/prompts");
|
|
9
|
+
const request_utils_1 = require("../../lib/request/request-utils");
|
|
8
10
|
class RequestCreate extends core_1.Command {
|
|
9
11
|
async run() {
|
|
12
|
+
var _a;
|
|
13
|
+
(0, cmd_1.setMostRecentCommand)(this);
|
|
10
14
|
await (0, apollo_1.initClient)(this, true);
|
|
11
15
|
const client = await (0, apollo_1.getClient)(this, true);
|
|
12
|
-
|
|
13
|
-
const
|
|
14
|
-
(
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
await (0,
|
|
19
|
-
|
|
16
|
+
const { flags } = await this.parse(RequestCreate);
|
|
17
|
+
const metadata = (0, request_utils_1.initEmptyRequestMetadata)();
|
|
18
|
+
if (flags.template) {
|
|
19
|
+
await (0, request_utils_1.duplicateRequestTemplate)(this, client, flags.template, metadata);
|
|
20
|
+
}
|
|
21
|
+
if (flags.bundle) {
|
|
22
|
+
await (0, request_utils_1.copyBundleAssets)(this, client, flags.bundle, metadata.requestMap);
|
|
23
|
+
}
|
|
24
|
+
if (flags.assets) {
|
|
25
|
+
// if IDs are provided, bypass the interactive selection process
|
|
26
|
+
await (0, request_utils_1.bypassRequestSelection)(this, client, flags.assets, metadata);
|
|
27
|
+
}
|
|
28
|
+
else if (!flags.template && !flags.bundle) {
|
|
20
29
|
(0, displays_1.headerMessage)(this);
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
30
|
+
let shouldProceed = false;
|
|
31
|
+
while (!shouldProceed) {
|
|
32
|
+
// Step 1: Select first round of assets from an app
|
|
33
|
+
await (0, prompts_1.selectRequestableItems)(this, client, metadata.requestMap);
|
|
34
|
+
// Step 2: Display the selected items in a tree format
|
|
35
|
+
(0, displays_1.headerMessage)(this);
|
|
36
|
+
(0, displays_1.treeifyRequestMap)(this, metadata.requestMap);
|
|
37
|
+
// Step 3: Prompt to add more items, repeat 1-3 if needed
|
|
38
|
+
shouldProceed = await (0, prompts_1.doneSelectingAssets)();
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
// Step 4: Set Request Defaults
|
|
42
|
+
await (0, request_utils_1.setRequestDefaults)(this, client, metadata);
|
|
43
|
+
// Step 5: Prompt for request reason
|
|
44
|
+
if (flags.reason) {
|
|
45
|
+
metadata.reason = flags.reason;
|
|
46
|
+
}
|
|
47
|
+
else if (!(metadata.requestDefaults.reasonOptional &&
|
|
48
|
+
flags.assets &&
|
|
49
|
+
flags.duration) &&
|
|
50
|
+
!flags.template) {
|
|
51
|
+
await (0, prompts_1.promptForReason)(metadata);
|
|
52
|
+
}
|
|
53
|
+
// Step 6: Prompt for expiration
|
|
54
|
+
if (flags.duration !== undefined) {
|
|
55
|
+
(0, request_utils_1.bypassDuration)(this, flags.duration, metadata);
|
|
56
|
+
}
|
|
57
|
+
else if (!flags.template) {
|
|
58
|
+
await (0, prompts_1.promptForDuration)(metadata);
|
|
59
|
+
}
|
|
60
|
+
else {
|
|
61
|
+
(0, request_utils_1.bypassDuration)(this, (_a = metadata.durationInMinutes) !== null && _a !== void 0 ? _a : 0, metadata);
|
|
62
|
+
}
|
|
63
|
+
// Step 7: Display final summary of request
|
|
64
|
+
let canSubmit = true;
|
|
65
|
+
if (!((flags.assets || flags.bundle) &&
|
|
66
|
+
flags.duration !== undefined &&
|
|
67
|
+
(metadata.requestDefaults.reasonOptional || flags.reason)) &&
|
|
68
|
+
!flags.template) {
|
|
69
|
+
canSubmit = await (0, prompts_1.promptRequestSubmission)(this, metadata);
|
|
70
|
+
}
|
|
71
|
+
// Step 8: Prompt for final submission
|
|
72
|
+
if (canSubmit)
|
|
73
|
+
await (0, request_utils_1.submitFinalRequest)(this, client, metadata);
|
|
33
74
|
}
|
|
34
75
|
}
|
|
35
|
-
RequestCreate.
|
|
36
|
-
RequestCreate.
|
|
76
|
+
RequestCreate.description = "Creates an Opal access request via an interactive form";
|
|
77
|
+
RequestCreate.flags = {
|
|
78
|
+
help: flags_1.SHARED_FLAGS.help,
|
|
79
|
+
assets: core_1.Flags.string({
|
|
80
|
+
char: "a",
|
|
81
|
+
multiple: true,
|
|
82
|
+
description: "The ids of the assets (resource, group) to request access to. Append a role name using a colon if needed, e.g. `--assets 123:456`.\
|
|
83
|
+
\n If not provided, an interactive selection flow will be available to select assets to request.",
|
|
84
|
+
}),
|
|
85
|
+
reason: core_1.Flags.string({
|
|
86
|
+
char: "r",
|
|
87
|
+
description: "The reason for the request, contained in quotes. If not provided, you will be prompted.",
|
|
88
|
+
}),
|
|
89
|
+
duration: core_1.Flags.integer({
|
|
90
|
+
char: "d",
|
|
91
|
+
description: "The duration of access for the request in minutes. Pass in a 0 value for permanent access. If not provided, you will be prompted.",
|
|
92
|
+
}),
|
|
93
|
+
template: core_1.Flags.string({
|
|
94
|
+
char: "t",
|
|
95
|
+
description: "A request ID of a previously finished request (cancelled/denied/approved) to create a new request based on the completed request.",
|
|
96
|
+
}),
|
|
97
|
+
bundle: core_1.Flags.string({
|
|
98
|
+
char: "b",
|
|
99
|
+
description: "A bundle ID to create a new request based on the assets in the bundle.",
|
|
100
|
+
}),
|
|
101
|
+
};
|
|
37
102
|
exports.default = RequestCreate;
|
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
import { Command } from "@oclif/core";
|
|
2
|
-
export default class
|
|
3
|
-
static hidden: boolean;
|
|
2
|
+
export default class GetRequest extends Command {
|
|
4
3
|
static description: string;
|
|
4
|
+
static flags: {
|
|
5
|
+
help: import("@oclif/core/lib/interfaces").BooleanFlag<void>;
|
|
6
|
+
id: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
7
|
+
verbose: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
8
|
+
};
|
|
9
|
+
static examples: string[];
|
|
5
10
|
run(): Promise<void>;
|
|
6
11
|
}
|