opal-security 3.1.1-beta.d30a46f → 3.1.1-beta.e1a2332
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 +114 -18
- package/lib/commands/login.js +6 -2
- package/lib/commands/request/create.d.ts +1 -2
- package/lib/commands/request/create.js +13 -10
- package/lib/commands/request/get.d.ts +0 -1
- package/lib/commands/request/get.js +1 -4
- package/lib/commands/request/list.d.ts +0 -1
- package/lib/commands/request/list.js +0 -3
- package/lib/commands/whoami.d.ts +8 -0
- package/lib/commands/whoami.js +34 -0
- package/lib/lib/credentials/index.d.ts +2 -1
- package/lib/lib/credentials/index.js +2 -1
- package/lib/lib/requests.d.ts +2 -0
- package/lib/lib/requests.js +24 -12
- package/lib/utils/displays.d.ts +1 -1
- package/lib/utils/displays.js +8 -2
- package/oclif.manifest.json +33 -8
- package/package.json +4 -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.e1a2332 linux-x64 node-v20.19.2
|
|
26
26
|
$ opal --help [COMMAND]
|
|
27
27
|
USAGE
|
|
28
28
|
$ opal COMMAND
|
|
@@ -44,6 +44,9 @@ 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)
|
|
47
50
|
* [`opal resources get`](#opal-resources-get)
|
|
48
51
|
* [`opal set-auth-provider`](#opal-set-auth-provider)
|
|
49
52
|
* [`opal set-custom-header`](#opal-set-custom-header)
|
|
@@ -53,6 +56,7 @@ USAGE
|
|
|
53
56
|
* [`opal ssh copyTo`](#opal-ssh-copyto)
|
|
54
57
|
* [`opal ssh start`](#opal-ssh-start)
|
|
55
58
|
* [`opal version`](#opal-version)
|
|
59
|
+
* [`opal whoami`](#opal-whoami)
|
|
56
60
|
|
|
57
61
|
## `opal autocomplete [SHELL]`
|
|
58
62
|
|
|
@@ -101,7 +105,7 @@ EXAMPLES
|
|
|
101
105
|
$ opal aws:identity
|
|
102
106
|
```
|
|
103
107
|
|
|
104
|
-
_See code: [src/commands/aws/identity.ts](https://github.com/opalsecurity/opal-cli/blob/v3.1.1-beta.
|
|
108
|
+
_See code: [src/commands/aws/identity.ts](https://github.com/opalsecurity/opal-cli/blob/v3.1.1-beta.e1a2332/src/commands/aws/identity.ts)_
|
|
105
109
|
|
|
106
110
|
## `opal clear-auth-provider`
|
|
107
111
|
|
|
@@ -121,7 +125,7 @@ EXAMPLES
|
|
|
121
125
|
$ opal clear-auth-provider
|
|
122
126
|
```
|
|
123
127
|
|
|
124
|
-
_See code: [src/commands/clear-auth-provider.ts](https://github.com/opalsecurity/opal-cli/blob/v3.1.1-beta.
|
|
128
|
+
_See code: [src/commands/clear-auth-provider.ts](https://github.com/opalsecurity/opal-cli/blob/v3.1.1-beta.e1a2332/src/commands/clear-auth-provider.ts)_
|
|
125
129
|
|
|
126
130
|
## `opal curl-example`
|
|
127
131
|
|
|
@@ -138,7 +142,7 @@ DESCRIPTION
|
|
|
138
142
|
Prints out an example cURL command containing the parameters the CLI uses to query the Opal server.
|
|
139
143
|
```
|
|
140
144
|
|
|
141
|
-
_See code: [src/commands/curl-example.ts](https://github.com/opalsecurity/opal-cli/blob/v3.1.1-beta.
|
|
145
|
+
_See code: [src/commands/curl-example.ts](https://github.com/opalsecurity/opal-cli/blob/v3.1.1-beta.e1a2332/src/commands/curl-example.ts)_
|
|
142
146
|
|
|
143
147
|
## `opal groups get`
|
|
144
148
|
|
|
@@ -159,7 +163,7 @@ EXAMPLES
|
|
|
159
163
|
$ opal groups:get --id 54052a3e-5375-4392-aeaf-0c6c44c131d4
|
|
160
164
|
```
|
|
161
165
|
|
|
162
|
-
_See code: [src/commands/groups/get.ts](https://github.com/opalsecurity/opal-cli/blob/v3.1.1-beta.
|
|
166
|
+
_See code: [src/commands/groups/get.ts](https://github.com/opalsecurity/opal-cli/blob/v3.1.1-beta.e1a2332/src/commands/groups/get.ts)_
|
|
163
167
|
|
|
164
168
|
## `opal help [COMMANDS]`
|
|
165
169
|
|
|
@@ -209,7 +213,7 @@ EXAMPLES
|
|
|
209
213
|
$ opal iam-roles:start --id 51f7176b-0464-4a6f-8369-e951e187b398 --profileName "custom-profile"
|
|
210
214
|
```
|
|
211
215
|
|
|
212
|
-
_See code: [src/commands/iam-roles/start.ts](https://github.com/opalsecurity/opal-cli/blob/v3.1.1-beta.
|
|
216
|
+
_See code: [src/commands/iam-roles/start.ts](https://github.com/opalsecurity/opal-cli/blob/v3.1.1-beta.e1a2332/src/commands/iam-roles/start.ts)_
|
|
213
217
|
|
|
214
218
|
## `opal kube-roles start`
|
|
215
219
|
|
|
@@ -240,7 +244,7 @@ EXAMPLES
|
|
|
240
244
|
$ opal kube-roles:start --id 51f7176b-0464-4a6f-8369-e951e187b398 --accessLevelRemoteId "arn:aws:iam::712234975475:role/acme-eks-cluster-admin-role"
|
|
241
245
|
```
|
|
242
246
|
|
|
243
|
-
_See code: [src/commands/kube-roles/start.ts](https://github.com/opalsecurity/opal-cli/blob/v3.1.1-beta.
|
|
247
|
+
_See code: [src/commands/kube-roles/start.ts](https://github.com/opalsecurity/opal-cli/blob/v3.1.1-beta.e1a2332/src/commands/kube-roles/start.ts)_
|
|
244
248
|
|
|
245
249
|
## `opal login`
|
|
246
250
|
|
|
@@ -261,7 +265,7 @@ EXAMPLES
|
|
|
261
265
|
$ opal login
|
|
262
266
|
```
|
|
263
267
|
|
|
264
|
-
_See code: [src/commands/login.ts](https://github.com/opalsecurity/opal-cli/blob/v3.1.1-beta.
|
|
268
|
+
_See code: [src/commands/login.ts](https://github.com/opalsecurity/opal-cli/blob/v3.1.1-beta.e1a2332/src/commands/login.ts)_
|
|
265
269
|
|
|
266
270
|
## `opal logout`
|
|
267
271
|
|
|
@@ -281,7 +285,7 @@ EXAMPLES
|
|
|
281
285
|
$ opal logout
|
|
282
286
|
```
|
|
283
287
|
|
|
284
|
-
_See code: [src/commands/logout.ts](https://github.com/opalsecurity/opal-cli/blob/v3.1.1-beta.
|
|
288
|
+
_See code: [src/commands/logout.ts](https://github.com/opalsecurity/opal-cli/blob/v3.1.1-beta.e1a2332/src/commands/logout.ts)_
|
|
285
289
|
|
|
286
290
|
## `opal postgres-instances start`
|
|
287
291
|
|
|
@@ -318,7 +322,82 @@ EXAMPLES
|
|
|
318
322
|
$ opal postgres-instances:start --id 51f7176b-0464-4a6f-8369-e951e187b398 --accessLevelRemoteId fullaccess --action view
|
|
319
323
|
```
|
|
320
324
|
|
|
321
|
-
_See code: [src/commands/postgres-instances/start.ts](https://github.com/opalsecurity/opal-cli/blob/v3.1.1-beta.
|
|
325
|
+
_See code: [src/commands/postgres-instances/start.ts](https://github.com/opalsecurity/opal-cli/blob/v3.1.1-beta.e1a2332/src/commands/postgres-instances/start.ts)_
|
|
326
|
+
|
|
327
|
+
## `opal request create`
|
|
328
|
+
|
|
329
|
+
Creates an Opal access request via an interactive form
|
|
330
|
+
|
|
331
|
+
```
|
|
332
|
+
USAGE
|
|
333
|
+
$ opal request create [-h] [-a <value>...] [-r <value>] [-d <value>]
|
|
334
|
+
|
|
335
|
+
FLAGS
|
|
336
|
+
-a, --assets=<value>... The ids of the assets (resource, group) to request access to. Append a role ID using a colon
|
|
337
|
+
if needed, e.g. `--assets 123:456`.
|
|
338
|
+
If not provided, an interactive selection flow will be available to select assets to request.
|
|
339
|
+
-d, --duration=<value> The duration of access for the request in minutes. If not provided, you will be prompted.
|
|
340
|
+
-h, --help Show CLI help.
|
|
341
|
+
-r, --reason=<value> The reason for the request, contained in quotes. If not provided, you will be prompted.
|
|
342
|
+
|
|
343
|
+
DESCRIPTION
|
|
344
|
+
Creates an Opal access request via an interactive form
|
|
345
|
+
```
|
|
346
|
+
|
|
347
|
+
_See code: [src/commands/request/create.ts](https://github.com/opalsecurity/opal-cli/blob/v3.1.1-beta.e1a2332/src/commands/request/create.ts)_
|
|
348
|
+
|
|
349
|
+
## `opal request get`
|
|
350
|
+
|
|
351
|
+
Lists access requests
|
|
352
|
+
|
|
353
|
+
```
|
|
354
|
+
USAGE
|
|
355
|
+
$ opal request get [-h] [-i <value>] [-v]
|
|
356
|
+
|
|
357
|
+
FLAGS
|
|
358
|
+
-h, --help Show CLI help.
|
|
359
|
+
-i, --id=<value> The Opal ID of the asset. You can find this from the URL, e.g. https://opal.dev/resources/[ID]
|
|
360
|
+
-v, --verbose Enable verbose output, prints full response in JSON format. Defaults to false.
|
|
361
|
+
|
|
362
|
+
DESCRIPTION
|
|
363
|
+
Lists access requests
|
|
364
|
+
|
|
365
|
+
EXAMPLES
|
|
366
|
+
$ opal request get --id 54052a3e-5375-4392-aeaf-0c6c44c131d4
|
|
367
|
+
|
|
368
|
+
$ opal request get --id 54052a3e-5375-4392-aeaf-0c6c44c131d4 --verbose
|
|
369
|
+
```
|
|
370
|
+
|
|
371
|
+
_See code: [src/commands/request/get.ts](https://github.com/opalsecurity/opal-cli/blob/v3.1.1-beta.e1a2332/src/commands/request/get.ts)_
|
|
372
|
+
|
|
373
|
+
## `opal request list`
|
|
374
|
+
|
|
375
|
+
Lists your n recent outgoing access requests
|
|
376
|
+
|
|
377
|
+
```
|
|
378
|
+
USAGE
|
|
379
|
+
$ opal request list [-h] [-n <value>] [-p] [-v]
|
|
380
|
+
|
|
381
|
+
FLAGS
|
|
382
|
+
-h, --help Show CLI help.
|
|
383
|
+
-n, --n=<value> [default: 10] Defines number of requests to be returned. 1 <= n <= 100.
|
|
384
|
+
-p, --pending Show only pending requests. Defaults to false.
|
|
385
|
+
-v, --verbose Enable verbose output, prints full response in JSON format. Defaults to false.
|
|
386
|
+
|
|
387
|
+
DESCRIPTION
|
|
388
|
+
Lists your n recent outgoing access requests
|
|
389
|
+
|
|
390
|
+
EXAMPLES
|
|
391
|
+
$ opal request list --n 5
|
|
392
|
+
|
|
393
|
+
$ opal request list --n 5 --pending
|
|
394
|
+
|
|
395
|
+
$ opal request list --n 5 --verbose
|
|
396
|
+
|
|
397
|
+
$ opal request list --n 5 --pending --verbose
|
|
398
|
+
```
|
|
399
|
+
|
|
400
|
+
_See code: [src/commands/request/list.ts](https://github.com/opalsecurity/opal-cli/blob/v3.1.1-beta.e1a2332/src/commands/request/list.ts)_
|
|
322
401
|
|
|
323
402
|
## `opal resources get`
|
|
324
403
|
|
|
@@ -339,7 +418,7 @@ EXAMPLES
|
|
|
339
418
|
$ opal resources:get --id 54052a3e-5375-4392-aeaf-0c6c44c131d4
|
|
340
419
|
```
|
|
341
420
|
|
|
342
|
-
_See code: [src/commands/resources/get.ts](https://github.com/opalsecurity/opal-cli/blob/v3.1.1-beta.
|
|
421
|
+
_See code: [src/commands/resources/get.ts](https://github.com/opalsecurity/opal-cli/blob/v3.1.1-beta.e1a2332/src/commands/resources/get.ts)_
|
|
343
422
|
|
|
344
423
|
## `opal set-auth-provider`
|
|
345
424
|
|
|
@@ -365,7 +444,7 @@ EXAMPLES
|
|
|
365
444
|
$ opal set-auth-provider --clientID 1234asdf --issuerUrl https://auth.example.com
|
|
366
445
|
```
|
|
367
446
|
|
|
368
|
-
_See code: [src/commands/set-auth-provider.ts](https://github.com/opalsecurity/opal-cli/blob/v3.1.1-beta.
|
|
447
|
+
_See code: [src/commands/set-auth-provider.ts](https://github.com/opalsecurity/opal-cli/blob/v3.1.1-beta.e1a2332/src/commands/set-auth-provider.ts)_
|
|
369
448
|
|
|
370
449
|
## `opal set-custom-header`
|
|
371
450
|
|
|
@@ -386,7 +465,7 @@ EXAMPLES
|
|
|
386
465
|
$ opal set-custom-header --header 'cf-access-token: $TOKEN'
|
|
387
466
|
```
|
|
388
467
|
|
|
389
|
-
_See code: [src/commands/set-custom-header.ts](https://github.com/opalsecurity/opal-cli/blob/v3.1.1-beta.
|
|
468
|
+
_See code: [src/commands/set-custom-header.ts](https://github.com/opalsecurity/opal-cli/blob/v3.1.1-beta.e1a2332/src/commands/set-custom-header.ts)_
|
|
390
469
|
|
|
391
470
|
## `opal set-token`
|
|
392
471
|
|
|
@@ -406,7 +485,7 @@ EXAMPLES
|
|
|
406
485
|
$ opal set-token
|
|
407
486
|
```
|
|
408
487
|
|
|
409
|
-
_See code: [src/commands/set-token.ts](https://github.com/opalsecurity/opal-cli/blob/v3.1.1-beta.
|
|
488
|
+
_See code: [src/commands/set-token.ts](https://github.com/opalsecurity/opal-cli/blob/v3.1.1-beta.e1a2332/src/commands/set-token.ts)_
|
|
410
489
|
|
|
411
490
|
## `opal set-url [URL]`
|
|
412
491
|
|
|
@@ -430,7 +509,7 @@ EXAMPLES
|
|
|
430
509
|
$ opal set-url
|
|
431
510
|
```
|
|
432
511
|
|
|
433
|
-
_See code: [src/commands/set-url.ts](https://github.com/opalsecurity/opal-cli/blob/v3.1.1-beta.
|
|
512
|
+
_See code: [src/commands/set-url.ts](https://github.com/opalsecurity/opal-cli/blob/v3.1.1-beta.e1a2332/src/commands/set-url.ts)_
|
|
434
513
|
|
|
435
514
|
## `opal ssh copyFrom`
|
|
436
515
|
|
|
@@ -461,7 +540,7 @@ EXAMPLES
|
|
|
461
540
|
$ opal ssh:copyFrom --src instance/dir --dest my/dir --id 51f7176b-0464-4a6f-8369-e951e187b398
|
|
462
541
|
```
|
|
463
542
|
|
|
464
|
-
_See code: [src/commands/ssh/copyFrom.ts](https://github.com/opalsecurity/opal-cli/blob/v3.1.1-beta.
|
|
543
|
+
_See code: [src/commands/ssh/copyFrom.ts](https://github.com/opalsecurity/opal-cli/blob/v3.1.1-beta.e1a2332/src/commands/ssh/copyFrom.ts)_
|
|
465
544
|
|
|
466
545
|
## `opal ssh copyTo`
|
|
467
546
|
|
|
@@ -492,7 +571,7 @@ EXAMPLES
|
|
|
492
571
|
$ opal ssh:copyTo --src my/dir --dest instance/dir --id 51f7176b-0464-4a6f-8369-e951e187b398
|
|
493
572
|
```
|
|
494
573
|
|
|
495
|
-
_See code: [src/commands/ssh/copyTo.ts](https://github.com/opalsecurity/opal-cli/blob/v3.1.1-beta.
|
|
574
|
+
_See code: [src/commands/ssh/copyTo.ts](https://github.com/opalsecurity/opal-cli/blob/v3.1.1-beta.e1a2332/src/commands/ssh/copyTo.ts)_
|
|
496
575
|
|
|
497
576
|
## `opal ssh start`
|
|
498
577
|
|
|
@@ -519,7 +598,7 @@ EXAMPLES
|
|
|
519
598
|
$ opal ssh:start --id 51f7176b-0464-4a6f-8369-e951e187b398
|
|
520
599
|
```
|
|
521
600
|
|
|
522
|
-
_See code: [src/commands/ssh/start.ts](https://github.com/opalsecurity/opal-cli/blob/v3.1.1-beta.
|
|
601
|
+
_See code: [src/commands/ssh/start.ts](https://github.com/opalsecurity/opal-cli/blob/v3.1.1-beta.e1a2332/src/commands/ssh/start.ts)_
|
|
523
602
|
|
|
524
603
|
## `opal version`
|
|
525
604
|
|
|
@@ -540,4 +619,21 @@ FLAG DESCRIPTIONS
|
|
|
540
619
|
```
|
|
541
620
|
|
|
542
621
|
_See code: [@oclif/plugin-version](https://github.com/oclif/plugin-version/blob/v2.2.27/src/commands/version.ts)_
|
|
622
|
+
|
|
623
|
+
## `opal whoami`
|
|
624
|
+
|
|
625
|
+
Describes current url set, organization name, and logged in user if applicable.
|
|
626
|
+
|
|
627
|
+
```
|
|
628
|
+
USAGE
|
|
629
|
+
$ opal whoami [-h]
|
|
630
|
+
|
|
631
|
+
FLAGS
|
|
632
|
+
-h, --help Show CLI help.
|
|
633
|
+
|
|
634
|
+
DESCRIPTION
|
|
635
|
+
Describes current url set, organization name, and logged in user if applicable.
|
|
636
|
+
```
|
|
637
|
+
|
|
638
|
+
_See code: [src/commands/whoami.ts](https://github.com/opalsecurity/opal-cli/blob/v3.1.1-beta.e1a2332/src/commands/whoami.ts)_
|
|
543
639
|
<!-- 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,10 +1,9 @@
|
|
|
1
1
|
import { Command } from "@oclif/core";
|
|
2
2
|
export default class RequestCreate 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
|
+
assets: import("@oclif/core/lib/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
8
7
|
reason: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
9
8
|
duration: import("@oclif/core/lib/interfaces").OptionFlag<number | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
10
9
|
};
|
|
@@ -2,20 +2,20 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const core_1 = require("@oclif/core");
|
|
4
4
|
const apollo_1 = require("../../lib/apollo");
|
|
5
|
+
const cmd_1 = require("../../lib/cmd");
|
|
5
6
|
const flags_1 = require("../../lib/flags");
|
|
6
7
|
const requests_1 = require("../../lib/requests");
|
|
7
8
|
const displays_1 = require("../../utils/displays");
|
|
8
|
-
const utils_1 = require("../../utils/utils");
|
|
9
9
|
class RequestCreate extends core_1.Command {
|
|
10
10
|
async run() {
|
|
11
|
+
(0, cmd_1.setMostRecentCommand)(this);
|
|
11
12
|
await (0, apollo_1.initClient)(this, true);
|
|
12
13
|
const client = await (0, apollo_1.getClient)(this, true);
|
|
13
|
-
(0, utils_1.restrictToDev)(); //TODO: Remove after development is complete
|
|
14
14
|
const { flags } = await this.parse(RequestCreate);
|
|
15
15
|
const metadata = (0, requests_1.initEmptyRequestMetadata)();
|
|
16
|
-
if (flags.
|
|
16
|
+
if (flags.assets) {
|
|
17
17
|
// if IDs are provided, bypass the interactive selection process
|
|
18
|
-
await (0, requests_1.bypassRequestSelection)(this, client, flags.
|
|
18
|
+
await (0, requests_1.bypassRequestSelection)(this, client, flags.assets, metadata);
|
|
19
19
|
}
|
|
20
20
|
else {
|
|
21
21
|
(0, displays_1.headerMessage)(this);
|
|
@@ -36,7 +36,9 @@ class RequestCreate extends core_1.Command {
|
|
|
36
36
|
if (flags.reason) {
|
|
37
37
|
metadata.reason = flags.reason;
|
|
38
38
|
}
|
|
39
|
-
else if (!(metadata.requestDefaults.reasonOptional &&
|
|
39
|
+
else if (!(metadata.requestDefaults.reasonOptional &&
|
|
40
|
+
flags.assets &&
|
|
41
|
+
flags.duration)) {
|
|
40
42
|
await (0, requests_1.promptForReason)(metadata);
|
|
41
43
|
}
|
|
42
44
|
// Step 5: Prompt for expiration
|
|
@@ -48,7 +50,9 @@ class RequestCreate extends core_1.Command {
|
|
|
48
50
|
}
|
|
49
51
|
// Step 6: Display final summary of request
|
|
50
52
|
let canSubmit = true;
|
|
51
|
-
if (!(flags.
|
|
53
|
+
if (!(flags.assets &&
|
|
54
|
+
flags.duration &&
|
|
55
|
+
(metadata.requestDefaults.reasonOptional || flags.reason))) {
|
|
52
56
|
canSubmit = await (0, requests_1.promptRequestSubmission)(this, metadata);
|
|
53
57
|
}
|
|
54
58
|
// Step 7: Prompt for final submission
|
|
@@ -56,14 +60,13 @@ class RequestCreate extends core_1.Command {
|
|
|
56
60
|
await (0, requests_1.submitFinalRequest)(this, client, metadata);
|
|
57
61
|
}
|
|
58
62
|
}
|
|
59
|
-
RequestCreate.hidden = true;
|
|
60
63
|
RequestCreate.description = "Creates an Opal access request via an interactive form";
|
|
61
64
|
RequestCreate.flags = {
|
|
62
65
|
help: flags_1.SHARED_FLAGS.help,
|
|
63
|
-
|
|
64
|
-
char: "
|
|
66
|
+
assets: core_1.Flags.string({
|
|
67
|
+
char: "a",
|
|
65
68
|
multiple: true,
|
|
66
|
-
description: "The
|
|
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`.\
|
|
67
70
|
\n If not provided, an interactive selection flow will be available to select assets to request.",
|
|
68
71
|
}),
|
|
69
72
|
reason: core_1.Flags.string({
|
|
@@ -8,7 +8,6 @@ const cmd_1 = require("../../lib/cmd");
|
|
|
8
8
|
const config_1 = require("../../lib/config");
|
|
9
9
|
const flags_1 = require("../../lib/flags");
|
|
10
10
|
const displays_1 = require("../../utils/displays");
|
|
11
|
-
const utils_1 = require("../../utils/utils");
|
|
12
11
|
const GET_REQUEST = (0, graphql_1.graphql)(`
|
|
13
12
|
query GetRequest(
|
|
14
13
|
$id: RequestId!
|
|
@@ -58,14 +57,13 @@ const GET_REQUEST = (0, graphql_1.graphql)(`
|
|
|
58
57
|
`);
|
|
59
58
|
class GetRequest extends core_1.Command {
|
|
60
59
|
async run() {
|
|
61
|
-
(0, utils_1.restrictToDev)(); //TODO: Remove after development is complete
|
|
62
60
|
(0, cmd_1.setMostRecentCommand)(this);
|
|
63
61
|
const configData = (0, config_1.getOrCreateConfigData)(this.config.configDir);
|
|
64
62
|
const client = await (0, apollo_1.getClient)(this, true);
|
|
65
63
|
// Verify id tag was provided
|
|
66
64
|
const { flags } = await this.parse(GetRequest);
|
|
67
65
|
if (!flags.id) {
|
|
68
|
-
this.log("Error: Please provide a
|
|
66
|
+
this.log("Error: Please provide a request ID using the --id flag.");
|
|
69
67
|
this.log("ex. opal request get --id 54052a3e-5375-4392-aeaf-0c6c44c131d4");
|
|
70
68
|
return;
|
|
71
69
|
}
|
|
@@ -96,7 +94,6 @@ class GetRequest extends core_1.Command {
|
|
|
96
94
|
}
|
|
97
95
|
}
|
|
98
96
|
}
|
|
99
|
-
GetRequest.hidden = true;
|
|
100
97
|
GetRequest.description = "Lists access requests";
|
|
101
98
|
GetRequest.flags = {
|
|
102
99
|
help: flags_1.SHARED_FLAGS.help,
|
|
@@ -6,7 +6,6 @@ const apollo_1 = require("../../lib/apollo");
|
|
|
6
6
|
const cmd_1 = require("../../lib/cmd");
|
|
7
7
|
const flags_1 = require("../../lib/flags");
|
|
8
8
|
const displays_1 = require("../../utils/displays");
|
|
9
|
-
const utils_1 = require("../../utils/utils");
|
|
10
9
|
// Add date filters, search query,
|
|
11
10
|
const GET_REQUESTS = (0, graphql_1.graphql)(`
|
|
12
11
|
query GetRequests($pageSize: Int, $showPendingOnly: Boolean!) {
|
|
@@ -59,7 +58,6 @@ const GET_REQUESTS = (0, graphql_1.graphql)(`
|
|
|
59
58
|
}`);
|
|
60
59
|
class ListRequests extends core_1.Command {
|
|
61
60
|
async run() {
|
|
62
|
-
(0, utils_1.restrictToDev)(); //TODO: Remove after development is complete
|
|
63
61
|
(0, cmd_1.setMostRecentCommand)(this);
|
|
64
62
|
const client = await (0, apollo_1.getClient)(this, true);
|
|
65
63
|
let pageSize = 10;
|
|
@@ -88,7 +86,6 @@ class ListRequests extends core_1.Command {
|
|
|
88
86
|
}
|
|
89
87
|
}
|
|
90
88
|
}
|
|
91
|
-
ListRequests.hidden = true;
|
|
92
89
|
ListRequests.description = "Lists your n recent outgoing access requests";
|
|
93
90
|
ListRequests.examples = [
|
|
94
91
|
"opal request list --n 5",
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const core_1 = require("@oclif/core");
|
|
4
|
+
const config_1 = require("../lib/config");
|
|
5
|
+
const credentials_1 = require("../lib/credentials");
|
|
6
|
+
const flags_1 = require("../lib/flags");
|
|
7
|
+
class WhoAmI extends core_1.Command {
|
|
8
|
+
async run() {
|
|
9
|
+
const opalCreds = await (0, credentials_1.getOpalCredentials)(this, false);
|
|
10
|
+
const organizationName = opalCreds === null || opalCreds === void 0 ? void 0 : opalCreds.organizationName;
|
|
11
|
+
const email = opalCreds === null || opalCreds === void 0 ? void 0 : opalCreds.email;
|
|
12
|
+
const configData = (0, config_1.getOrCreateConfigData)(this.config.configDir);
|
|
13
|
+
const url = configData[config_1.urlKey];
|
|
14
|
+
if (email) {
|
|
15
|
+
this.log(`User: ${email}`);
|
|
16
|
+
}
|
|
17
|
+
if (organizationName) {
|
|
18
|
+
if (organizationName === "unset-org-id") {
|
|
19
|
+
this.log("Authenticated with Opal API Token.");
|
|
20
|
+
}
|
|
21
|
+
else {
|
|
22
|
+
this.log(`Organization: ${organizationName}`);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
if (url) {
|
|
26
|
+
this.log(`Server: ${url}`);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
WhoAmI.description = "Describes current url set, organization name, and logged in user if applicable.";
|
|
31
|
+
WhoAmI.flags = {
|
|
32
|
+
help: flags_1.SHARED_FLAGS.help,
|
|
33
|
+
};
|
|
34
|
+
exports.default = WhoAmI;
|
|
@@ -5,12 +5,13 @@ interface OpalCredentials {
|
|
|
5
5
|
clientIDCandidate?: string;
|
|
6
6
|
secret?: string;
|
|
7
7
|
secretType?: SecretType;
|
|
8
|
+
organizationName?: string;
|
|
8
9
|
}
|
|
9
10
|
export declare enum SecretType {
|
|
10
11
|
Cookie = "COOKIE",
|
|
11
12
|
ApiToken = "API_TOKEN"
|
|
12
13
|
}
|
|
13
|
-
export declare const setOpalCredentials: (command: Command, email: string | undefined, organizationID: string, clientIDCandidate: string | undefined | null, secret: string, secretType: SecretType) => Promise<void>;
|
|
14
|
+
export declare const setOpalCredentials: (command: Command, email: string | undefined, organizationID: string, clientIDCandidate: string | undefined | null, secret: string, secretType: SecretType, organizationName?: string) => Promise<void>;
|
|
14
15
|
export declare const getOpalCredentials: (command: Command, includeAuthSecret?: boolean) => Promise<OpalCredentials>;
|
|
15
16
|
export declare const removeOpalCredentials: (command: Command) => Promise<void>;
|
|
16
17
|
export {};
|
|
@@ -9,13 +9,14 @@ var SecretType;
|
|
|
9
9
|
SecretType["Cookie"] = "COOKIE";
|
|
10
10
|
SecretType["ApiToken"] = "API_TOKEN";
|
|
11
11
|
})(SecretType || (exports.SecretType = SecretType = {}));
|
|
12
|
-
const setOpalCredentials = async (command, email, organizationID, clientIDCandidate, secret, secretType) => {
|
|
12
|
+
const setOpalCredentials = async (command, email, organizationID, clientIDCandidate, secret, secretType, organizationName) => {
|
|
13
13
|
const givenEmail = email || "email-unset";
|
|
14
14
|
const configData = (0, config_1.getOrCreateConfigData)(command.config.configDir);
|
|
15
15
|
configData.creds = {
|
|
16
16
|
clientIDCandidate,
|
|
17
17
|
email,
|
|
18
18
|
organizationID,
|
|
19
|
+
organizationName,
|
|
19
20
|
secretType,
|
|
20
21
|
};
|
|
21
22
|
(0, config_1.writeConfigData)(command.config.configDir, configData);
|
package/lib/lib/requests.d.ts
CHANGED
|
@@ -19,6 +19,7 @@ type RoleNode = {
|
|
|
19
19
|
roleName: string;
|
|
20
20
|
};
|
|
21
21
|
export type RequestMap = Record<string, AppNode>;
|
|
22
|
+
export declare const DISPLAY_LABELS: Partial<Record<EntityType, string>>;
|
|
22
23
|
type DurationOption = {
|
|
23
24
|
durationInMinutes: number;
|
|
24
25
|
label: string;
|
|
@@ -47,6 +48,7 @@ export declare function promptForReason(metadata: RequestMetadata): Promise<void
|
|
|
47
48
|
export declare function promptForExpiration(metadata: RequestMetadata): Promise<void>;
|
|
48
49
|
export declare function promptRequestSubmission(cmd: Command, metadata: RequestMetadata): Promise<boolean>;
|
|
49
50
|
export declare function submitFinalRequest(cmd: Command, client: ApolloClient<NormalizedCacheObject>, metadata: RequestMetadata): Promise<void>;
|
|
51
|
+
export declare function getRequestLink(cmd: Command, id: string): string;
|
|
50
52
|
export declare function bypassRequestSelection(cmd: Command, client: ApolloClient<NormalizedCacheObject>, flagValue: string[], metadata: RequestMetadata): Promise<void>;
|
|
51
53
|
export declare function bypassDuration(cmd: Command, duration: number, metadata: RequestMetadata): void;
|
|
52
54
|
export {};
|
package/lib/lib/requests.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DISPLAY_LABELS = void 0;
|
|
3
4
|
exports.initEmptyRequestMetadata = initEmptyRequestMetadata;
|
|
4
5
|
exports.selectRequestableItems = selectRequestableItems;
|
|
5
6
|
exports.doneSelectingAssets = doneSelectingAssets;
|
|
@@ -8,6 +9,7 @@ exports.promptForReason = promptForReason;
|
|
|
8
9
|
exports.promptForExpiration = promptForExpiration;
|
|
9
10
|
exports.promptRequestSubmission = promptRequestSubmission;
|
|
10
11
|
exports.submitFinalRequest = submitFinalRequest;
|
|
12
|
+
exports.getRequestLink = getRequestLink;
|
|
11
13
|
exports.bypassRequestSelection = bypassRequestSelection;
|
|
12
14
|
exports.bypassDuration = bypassDuration;
|
|
13
15
|
const chalk_1 = require("chalk");
|
|
@@ -15,7 +17,7 @@ const graphql_1 = require("../graphql");
|
|
|
15
17
|
const graphql_2 = require("../graphql/graphql");
|
|
16
18
|
const displays_1 = require("../utils/displays");
|
|
17
19
|
const config_1 = require("./config");
|
|
18
|
-
const { AutoComplete, Select, prompt, Form
|
|
20
|
+
const { AutoComplete, Select, prompt, Form } = require("enquirer");
|
|
19
21
|
function entityTypeFromString(str) {
|
|
20
22
|
const capStr = str === null || str === void 0 ? void 0 : str.toLocaleUpperCase();
|
|
21
23
|
if (capStr === "RESOURCE") {
|
|
@@ -27,6 +29,10 @@ function entityTypeFromString(str) {
|
|
|
27
29
|
// if type unknown, default to resource
|
|
28
30
|
return graphql_2.EntityType.Resource;
|
|
29
31
|
}
|
|
32
|
+
exports.DISPLAY_LABELS = {
|
|
33
|
+
[graphql_2.EntityType.Resource]: "Resource",
|
|
34
|
+
[graphql_2.EntityType.Group]: "Group",
|
|
35
|
+
};
|
|
30
36
|
function initEmptyRequestMetadata() {
|
|
31
37
|
// Initialize with empty defaults
|
|
32
38
|
const requestDefaults = {
|
|
@@ -238,7 +244,7 @@ async function queryAssetRoles(cmd, client, assetType, assetId) {
|
|
|
238
244
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
239
245
|
try {
|
|
240
246
|
switch (assetType) {
|
|
241
|
-
case
|
|
247
|
+
case graphql_2.EntityType.Resource: {
|
|
242
248
|
const resp = await client.query({
|
|
243
249
|
query: RESOURCE_ROLES_QUERY,
|
|
244
250
|
variables: {
|
|
@@ -267,7 +273,7 @@ async function queryAssetRoles(cmd, client, assetType, assetId) {
|
|
|
267
273
|
}
|
|
268
274
|
return;
|
|
269
275
|
}
|
|
270
|
-
case
|
|
276
|
+
case graphql_2.EntityType.Group: {
|
|
271
277
|
const resp = await client.query({
|
|
272
278
|
query: GROUP_ROLES_QUERY,
|
|
273
279
|
variables: {
|
|
@@ -697,7 +703,7 @@ function appRolesFromEdge(edge) {
|
|
|
697
703
|
value: {
|
|
698
704
|
id: edge.node.id + accessLevel.accessLevelRemoteId,
|
|
699
705
|
name: accessLevel.accessLevelName,
|
|
700
|
-
type: graphql_2.EntityType.Resource,
|
|
706
|
+
type: exports.DISPLAY_LABELS[graphql_2.EntityType.Resource],
|
|
701
707
|
toString: () => accessLevel.accessLevelName,
|
|
702
708
|
},
|
|
703
709
|
}));
|
|
@@ -708,7 +714,7 @@ function appRolesFromEdge(edge) {
|
|
|
708
714
|
value: {
|
|
709
715
|
id: edge.node.id,
|
|
710
716
|
name: (_b = edge.alias) !== null && _b !== void 0 ? _b : edge.node.name,
|
|
711
|
-
type: graphql_2.EntityType.Resource,
|
|
717
|
+
type: exports.DISPLAY_LABELS[graphql_2.EntityType.Resource],
|
|
712
718
|
toString: () => { var _a; return (_a = edge.alias) !== null && _a !== void 0 ? _a : edge.node.name; },
|
|
713
719
|
},
|
|
714
720
|
},
|
|
@@ -717,11 +723,11 @@ function appRolesFromEdge(edge) {
|
|
|
717
723
|
case "Group":
|
|
718
724
|
return [
|
|
719
725
|
{
|
|
720
|
-
message: (_c = edge.alias) !== null && _c !== void 0 ? _c : edge.node.name
|
|
726
|
+
message: `${(_c = edge.alias) !== null && _c !== void 0 ? _c : edge.node.name} ${graphql_2.EntityType.Group}`,
|
|
721
727
|
value: {
|
|
722
728
|
id: edge.node.id,
|
|
723
729
|
name: (_d = edge.alias) !== null && _d !== void 0 ? _d : edge.node.name,
|
|
724
|
-
type: graphql_2.EntityType.Group,
|
|
730
|
+
type: exports.DISPLAY_LABELS[graphql_2.EntityType.Group],
|
|
725
731
|
toString: () => { var _a; return (_a = edge.alias) !== null && _a !== void 0 ? _a : edge.node.name; },
|
|
726
732
|
},
|
|
727
733
|
},
|
|
@@ -913,6 +919,7 @@ async function promptForExpiration(metadata) {
|
|
|
913
919
|
const expirationSelect = new AutoComplete({
|
|
914
920
|
name: "expiration",
|
|
915
921
|
message: "When should access expire?",
|
|
922
|
+
hint: "Type to filter",
|
|
916
923
|
type: "list",
|
|
917
924
|
choices: durations,
|
|
918
925
|
pageSize: 15,
|
|
@@ -1052,24 +1059,29 @@ async function submitFinalRequest(cmd, client, metadata) {
|
|
|
1052
1059
|
}
|
|
1053
1060
|
const resp = await createRequest(cmd, client, requestedResources, requestedGroups, metadata.reason, metadata.durationInMinutes);
|
|
1054
1061
|
// Build link to request
|
|
1055
|
-
const configData = (0, config_1.getOrCreateConfigData)(cmd.config.configDir);
|
|
1056
1062
|
if (resp === null || resp === void 0 ? void 0 : resp.id) {
|
|
1057
1063
|
cmd.log("\n🎉 Your Access Request has been submitted!\n");
|
|
1058
1064
|
cmd.log(`${chalk_1.default.bold("ID: ")} ${chalk_1.default.cyan(resp === null || resp === void 0 ? void 0 : resp.id)}`);
|
|
1059
1065
|
if (resp === null || resp === void 0 ? void 0 : resp.status) {
|
|
1060
1066
|
cmd.log((0, displays_1.getStyledStatus)(resp === null || resp === void 0 ? void 0 : resp.status));
|
|
1061
1067
|
}
|
|
1062
|
-
const requestLink =
|
|
1068
|
+
const requestLink = getRequestLink(cmd, resp.id);
|
|
1063
1069
|
cmd.log(`${chalk_1.default.bold("Link:")} ${chalk_1.default.underline(requestLink)}\n`);
|
|
1064
1070
|
}
|
|
1065
1071
|
return;
|
|
1066
1072
|
}
|
|
1073
|
+
function getRequestLink(cmd, id) {
|
|
1074
|
+
const configData = (0, config_1.getOrCreateConfigData)(cmd.config.configDir);
|
|
1075
|
+
return `${configData[config_1.urlKey]}/requests/sent/${id}`;
|
|
1076
|
+
}
|
|
1067
1077
|
async function bypassRequestSelection(cmd, client, flagValue, metadata) {
|
|
1068
1078
|
var _a, _b;
|
|
1069
1079
|
try {
|
|
1070
1080
|
// Query Catalog Item endpoint to identify what the id belongs to (resource or group)
|
|
1071
|
-
for (const
|
|
1072
|
-
const
|
|
1081
|
+
for (const val of flagValue) {
|
|
1082
|
+
const delimiterIndex = val.indexOf(":");
|
|
1083
|
+
const assetId = val.substring(0, delimiterIndex);
|
|
1084
|
+
const roleName = val.substring(delimiterIndex + 1);
|
|
1073
1085
|
const resp = await client.query({
|
|
1074
1086
|
query: CATALOG_ITEM,
|
|
1075
1087
|
variables: {
|
|
@@ -1096,7 +1108,7 @@ async function bypassRequestSelection(cmd, client, flagValue, metadata) {
|
|
|
1096
1108
|
assets: {},
|
|
1097
1109
|
};
|
|
1098
1110
|
}
|
|
1099
|
-
const assetEntry = metadata.requestMap[appId].assets[
|
|
1111
|
+
const assetEntry = metadata.requestMap[appId].assets[assetId];
|
|
1100
1112
|
if (!assetEntry) {
|
|
1101
1113
|
metadata.requestMap[appId].assets[assetId] = {
|
|
1102
1114
|
assetId: assetId,
|
package/lib/utils/displays.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { ApolloQueryResult } from "@apollo/client";
|
|
2
2
|
import type { Command } from "@oclif/core/lib/command";
|
|
3
3
|
import type { GetRequestQuery, GetRequestsQuery } from "../graphql/graphql";
|
|
4
|
-
import type
|
|
4
|
+
import { type RequestMap, type RequestMetadata } from "../lib/requests";
|
|
5
5
|
export declare function headerMessage(cmd: Command): void;
|
|
6
6
|
export declare function treeifyRequestMap(cmd: Command, requestMap: RequestMap): void;
|
|
7
7
|
export declare function displayFinalRequestSummary(cmd: Command, metadata: RequestMetadata): void;
|
package/lib/utils/displays.js
CHANGED
|
@@ -7,6 +7,8 @@ exports.getStyledStatus = getStyledStatus;
|
|
|
7
7
|
exports.displayRequestDetails = displayRequestDetails;
|
|
8
8
|
exports.displayRequestListTable = displayRequestListTable;
|
|
9
9
|
const chalk_1 = require("chalk");
|
|
10
|
+
const terminal_link_1 = require("terminal-link");
|
|
11
|
+
const requests_1 = require("../lib/requests");
|
|
10
12
|
const Table = require("cli-table3");
|
|
11
13
|
const treeify = require("object-treeify").default;
|
|
12
14
|
function headerMessage(cmd) {
|
|
@@ -30,7 +32,7 @@ function treeifyRequestMap(cmd, requestMap) {
|
|
|
30
32
|
for (const [_assetId, assetNode] of Object.entries(appNode.assets)) {
|
|
31
33
|
// If okta/azure asset with no role, change asset name
|
|
32
34
|
const assetName = assetNode.assetName || "No Role (Direct access)";
|
|
33
|
-
const assetKey = `${assetName} ${chalk_1.default.dim(`[${assetNode.type}]`)}`;
|
|
35
|
+
const assetKey = `${assetName} ${chalk_1.default.dim(`[${requests_1.DISPLAY_LABELS[assetNode.type]}]`)}`;
|
|
34
36
|
if (assetNode.roles !== undefined) {
|
|
35
37
|
assetsTree[assetKey] = {};
|
|
36
38
|
for (const [_roleId, roleNode] of Object.entries(assetNode.roles)) {
|
|
@@ -171,8 +173,12 @@ function displayRequestListTable(cmd, requestResp) {
|
|
|
171
173
|
...requestedResources,
|
|
172
174
|
...requestedGroups,
|
|
173
175
|
].join(", ");
|
|
176
|
+
const requestLink = (0, requests_1.getRequestLink)(cmd, request.id);
|
|
177
|
+
const clickableId = (0, terminal_link_1.default)(request.id, requestLink, {
|
|
178
|
+
fallback: false,
|
|
179
|
+
});
|
|
174
180
|
table.push([
|
|
175
|
-
|
|
181
|
+
clickableId,
|
|
176
182
|
status,
|
|
177
183
|
targetUser,
|
|
178
184
|
formattedDuration,
|
package/oclif.manifest.json
CHANGED
|
@@ -316,6 +316,34 @@
|
|
|
316
316
|
"set-url.js"
|
|
317
317
|
]
|
|
318
318
|
},
|
|
319
|
+
"whoami": {
|
|
320
|
+
"aliases": [],
|
|
321
|
+
"args": {},
|
|
322
|
+
"description": "Describes current url set, organization name, and logged in user if applicable.",
|
|
323
|
+
"flags": {
|
|
324
|
+
"help": {
|
|
325
|
+
"char": "h",
|
|
326
|
+
"description": "Show CLI help.",
|
|
327
|
+
"name": "help",
|
|
328
|
+
"allowNo": false,
|
|
329
|
+
"type": "boolean"
|
|
330
|
+
}
|
|
331
|
+
},
|
|
332
|
+
"hasDynamicHelp": false,
|
|
333
|
+
"hiddenAliases": [],
|
|
334
|
+
"id": "whoami",
|
|
335
|
+
"pluginAlias": "opal-security",
|
|
336
|
+
"pluginName": "opal-security",
|
|
337
|
+
"pluginType": "core",
|
|
338
|
+
"strict": true,
|
|
339
|
+
"enableJsonFlag": false,
|
|
340
|
+
"isESM": false,
|
|
341
|
+
"relativePath": [
|
|
342
|
+
"lib",
|
|
343
|
+
"commands",
|
|
344
|
+
"whoami.js"
|
|
345
|
+
]
|
|
346
|
+
},
|
|
319
347
|
"aws:identity": {
|
|
320
348
|
"aliases": [],
|
|
321
349
|
"args": {},
|
|
@@ -606,10 +634,10 @@
|
|
|
606
634
|
"allowNo": false,
|
|
607
635
|
"type": "boolean"
|
|
608
636
|
},
|
|
609
|
-
"
|
|
610
|
-
"char": "
|
|
611
|
-
"description": "The
|
|
612
|
-
"name": "
|
|
637
|
+
"assets": {
|
|
638
|
+
"char": "a",
|
|
639
|
+
"description": "The ids of the assets (resource, group) to request access to. Append a role ID using a colon if needed, e.g. `--assets 123:456`. \n If not provided, an interactive selection flow will be available to select assets to request.",
|
|
640
|
+
"name": "assets",
|
|
613
641
|
"hasDynamicHelp": false,
|
|
614
642
|
"multiple": true,
|
|
615
643
|
"type": "option"
|
|
@@ -632,7 +660,6 @@
|
|
|
632
660
|
}
|
|
633
661
|
},
|
|
634
662
|
"hasDynamicHelp": false,
|
|
635
|
-
"hidden": true,
|
|
636
663
|
"hiddenAliases": [],
|
|
637
664
|
"id": "request:create",
|
|
638
665
|
"pluginAlias": "opal-security",
|
|
@@ -681,7 +708,6 @@
|
|
|
681
708
|
}
|
|
682
709
|
},
|
|
683
710
|
"hasDynamicHelp": false,
|
|
684
|
-
"hidden": true,
|
|
685
711
|
"hiddenAliases": [],
|
|
686
712
|
"id": "request:get",
|
|
687
713
|
"pluginAlias": "opal-security",
|
|
@@ -740,7 +766,6 @@
|
|
|
740
766
|
}
|
|
741
767
|
},
|
|
742
768
|
"hasDynamicHelp": false,
|
|
743
|
-
"hidden": true,
|
|
744
769
|
"hiddenAliases": [],
|
|
745
770
|
"id": "request:list",
|
|
746
771
|
"pluginAlias": "opal-security",
|
|
@@ -1003,5 +1028,5 @@
|
|
|
1003
1028
|
]
|
|
1004
1029
|
}
|
|
1005
1030
|
},
|
|
1006
|
-
"version": "3.1.1-beta.
|
|
1031
|
+
"version": "3.1.1-beta.e1a2332"
|
|
1007
1032
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "opal-security",
|
|
3
3
|
"description": "Opal allows you to centrally manage access to all of your sensitive systems.",
|
|
4
|
-
"version": "3.1.1-beta.
|
|
4
|
+
"version": "3.1.1-beta.e1a2332",
|
|
5
5
|
"author": "Stephen Cobbe",
|
|
6
6
|
"bin": {
|
|
7
7
|
"opal": "./bin/run"
|
|
@@ -29,6 +29,7 @@
|
|
|
29
29
|
"openid-client": "^5.6.5",
|
|
30
30
|
"prettyjson": "^1.2.1",
|
|
31
31
|
"semver": "^7.5.4",
|
|
32
|
+
"terminal-link": "^4.0.0",
|
|
32
33
|
"tslib": "^2.8.1"
|
|
33
34
|
},
|
|
34
35
|
"devDependencies": {
|
|
@@ -63,9 +64,7 @@
|
|
|
63
64
|
"/scripts"
|
|
64
65
|
],
|
|
65
66
|
"homepage": "https://github.com/opalsecurity/opal-cli/",
|
|
66
|
-
"keywords": [
|
|
67
|
-
"oclif"
|
|
68
|
-
],
|
|
67
|
+
"keywords": ["oclif"],
|
|
69
68
|
"license": "MIT",
|
|
70
69
|
"main": "lib/index.js",
|
|
71
70
|
"oclif": {
|
|
@@ -91,7 +90,7 @@
|
|
|
91
90
|
"prepack": "npm run build && oclif manifest && oclif readme",
|
|
92
91
|
"test": "vitest",
|
|
93
92
|
"coverage": "vitest run --coverage",
|
|
94
|
-
"version": "oclif readme && git add README.md",
|
|
93
|
+
"version": "oclif readme && git add README.md && biome check --write",
|
|
95
94
|
"posttest": "biome check",
|
|
96
95
|
"biome-ci": "biome ci --reporter=github",
|
|
97
96
|
"gql-codegen": "graphql-codegen",
|