opal-security 3.1.1-beta.b652df3 → 3.1.1-beta.d30a46f

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -22,7 +22,7 @@ $ npm install -g opal-security
22
22
  $ opal COMMAND
23
23
  running command...
24
24
  $ opal (--version)
25
- opal-security/3.1.1-beta.b652df3 linux-x64 node-v20.19.2
25
+ opal-security/3.1.1-beta.d30a46f linux-x64 node-v20.19.2
26
26
  $ opal --help [COMMAND]
27
27
  USAGE
28
28
  $ opal COMMAND
@@ -53,7 +53,6 @@ USAGE
53
53
  * [`opal ssh copyTo`](#opal-ssh-copyto)
54
54
  * [`opal ssh start`](#opal-ssh-start)
55
55
  * [`opal version`](#opal-version)
56
- * [`opal whoami`](#opal-whoami)
57
56
 
58
57
  ## `opal autocomplete [SHELL]`
59
58
 
@@ -102,7 +101,7 @@ EXAMPLES
102
101
  $ opal aws:identity
103
102
  ```
104
103
 
105
- _See code: [src/commands/aws/identity.ts](https://github.com/opalsecurity/opal-cli/blob/v3.1.1-beta.b652df3/src/commands/aws/identity.ts)_
104
+ _See code: [src/commands/aws/identity.ts](https://github.com/opalsecurity/opal-cli/blob/v3.1.1-beta.d30a46f/src/commands/aws/identity.ts)_
106
105
 
107
106
  ## `opal clear-auth-provider`
108
107
 
@@ -122,7 +121,7 @@ EXAMPLES
122
121
  $ opal clear-auth-provider
123
122
  ```
124
123
 
125
- _See code: [src/commands/clear-auth-provider.ts](https://github.com/opalsecurity/opal-cli/blob/v3.1.1-beta.b652df3/src/commands/clear-auth-provider.ts)_
124
+ _See code: [src/commands/clear-auth-provider.ts](https://github.com/opalsecurity/opal-cli/blob/v3.1.1-beta.d30a46f/src/commands/clear-auth-provider.ts)_
126
125
 
127
126
  ## `opal curl-example`
128
127
 
@@ -139,7 +138,7 @@ DESCRIPTION
139
138
  Prints out an example cURL command containing the parameters the CLI uses to query the Opal server.
140
139
  ```
141
140
 
142
- _See code: [src/commands/curl-example.ts](https://github.com/opalsecurity/opal-cli/blob/v3.1.1-beta.b652df3/src/commands/curl-example.ts)_
141
+ _See code: [src/commands/curl-example.ts](https://github.com/opalsecurity/opal-cli/blob/v3.1.1-beta.d30a46f/src/commands/curl-example.ts)_
143
142
 
144
143
  ## `opal groups get`
145
144
 
@@ -160,7 +159,7 @@ EXAMPLES
160
159
  $ opal groups:get --id 54052a3e-5375-4392-aeaf-0c6c44c131d4
161
160
  ```
162
161
 
163
- _See code: [src/commands/groups/get.ts](https://github.com/opalsecurity/opal-cli/blob/v3.1.1-beta.b652df3/src/commands/groups/get.ts)_
162
+ _See code: [src/commands/groups/get.ts](https://github.com/opalsecurity/opal-cli/blob/v3.1.1-beta.d30a46f/src/commands/groups/get.ts)_
164
163
 
165
164
  ## `opal help [COMMANDS]`
166
165
 
@@ -210,7 +209,7 @@ EXAMPLES
210
209
  $ opal iam-roles:start --id 51f7176b-0464-4a6f-8369-e951e187b398 --profileName "custom-profile"
211
210
  ```
212
211
 
213
- _See code: [src/commands/iam-roles/start.ts](https://github.com/opalsecurity/opal-cli/blob/v3.1.1-beta.b652df3/src/commands/iam-roles/start.ts)_
212
+ _See code: [src/commands/iam-roles/start.ts](https://github.com/opalsecurity/opal-cli/blob/v3.1.1-beta.d30a46f/src/commands/iam-roles/start.ts)_
214
213
 
215
214
  ## `opal kube-roles start`
216
215
 
@@ -241,7 +240,7 @@ EXAMPLES
241
240
  $ opal kube-roles:start --id 51f7176b-0464-4a6f-8369-e951e187b398 --accessLevelRemoteId "arn:aws:iam::712234975475:role/acme-eks-cluster-admin-role"
242
241
  ```
243
242
 
244
- _See code: [src/commands/kube-roles/start.ts](https://github.com/opalsecurity/opal-cli/blob/v3.1.1-beta.b652df3/src/commands/kube-roles/start.ts)_
243
+ _See code: [src/commands/kube-roles/start.ts](https://github.com/opalsecurity/opal-cli/blob/v3.1.1-beta.d30a46f/src/commands/kube-roles/start.ts)_
245
244
 
246
245
  ## `opal login`
247
246
 
@@ -262,7 +261,7 @@ EXAMPLES
262
261
  $ opal login
263
262
  ```
264
263
 
265
- _See code: [src/commands/login.ts](https://github.com/opalsecurity/opal-cli/blob/v3.1.1-beta.b652df3/src/commands/login.ts)_
264
+ _See code: [src/commands/login.ts](https://github.com/opalsecurity/opal-cli/blob/v3.1.1-beta.d30a46f/src/commands/login.ts)_
266
265
 
267
266
  ## `opal logout`
268
267
 
@@ -282,7 +281,7 @@ EXAMPLES
282
281
  $ opal logout
283
282
  ```
284
283
 
285
- _See code: [src/commands/logout.ts](https://github.com/opalsecurity/opal-cli/blob/v3.1.1-beta.b652df3/src/commands/logout.ts)_
284
+ _See code: [src/commands/logout.ts](https://github.com/opalsecurity/opal-cli/blob/v3.1.1-beta.d30a46f/src/commands/logout.ts)_
286
285
 
287
286
  ## `opal postgres-instances start`
288
287
 
@@ -319,7 +318,7 @@ EXAMPLES
319
318
  $ opal postgres-instances:start --id 51f7176b-0464-4a6f-8369-e951e187b398 --accessLevelRemoteId fullaccess --action view
320
319
  ```
321
320
 
322
- _See code: [src/commands/postgres-instances/start.ts](https://github.com/opalsecurity/opal-cli/blob/v3.1.1-beta.b652df3/src/commands/postgres-instances/start.ts)_
321
+ _See code: [src/commands/postgres-instances/start.ts](https://github.com/opalsecurity/opal-cli/blob/v3.1.1-beta.d30a46f/src/commands/postgres-instances/start.ts)_
323
322
 
324
323
  ## `opal resources get`
325
324
 
@@ -340,7 +339,7 @@ EXAMPLES
340
339
  $ opal resources:get --id 54052a3e-5375-4392-aeaf-0c6c44c131d4
341
340
  ```
342
341
 
343
- _See code: [src/commands/resources/get.ts](https://github.com/opalsecurity/opal-cli/blob/v3.1.1-beta.b652df3/src/commands/resources/get.ts)_
342
+ _See code: [src/commands/resources/get.ts](https://github.com/opalsecurity/opal-cli/blob/v3.1.1-beta.d30a46f/src/commands/resources/get.ts)_
344
343
 
345
344
  ## `opal set-auth-provider`
346
345
 
@@ -366,7 +365,7 @@ EXAMPLES
366
365
  $ opal set-auth-provider --clientID 1234asdf --issuerUrl https://auth.example.com
367
366
  ```
368
367
 
369
- _See code: [src/commands/set-auth-provider.ts](https://github.com/opalsecurity/opal-cli/blob/v3.1.1-beta.b652df3/src/commands/set-auth-provider.ts)_
368
+ _See code: [src/commands/set-auth-provider.ts](https://github.com/opalsecurity/opal-cli/blob/v3.1.1-beta.d30a46f/src/commands/set-auth-provider.ts)_
370
369
 
371
370
  ## `opal set-custom-header`
372
371
 
@@ -387,7 +386,7 @@ EXAMPLES
387
386
  $ opal set-custom-header --header 'cf-access-token: $TOKEN'
388
387
  ```
389
388
 
390
- _See code: [src/commands/set-custom-header.ts](https://github.com/opalsecurity/opal-cli/blob/v3.1.1-beta.b652df3/src/commands/set-custom-header.ts)_
389
+ _See code: [src/commands/set-custom-header.ts](https://github.com/opalsecurity/opal-cli/blob/v3.1.1-beta.d30a46f/src/commands/set-custom-header.ts)_
391
390
 
392
391
  ## `opal set-token`
393
392
 
@@ -407,7 +406,7 @@ EXAMPLES
407
406
  $ opal set-token
408
407
  ```
409
408
 
410
- _See code: [src/commands/set-token.ts](https://github.com/opalsecurity/opal-cli/blob/v3.1.1-beta.b652df3/src/commands/set-token.ts)_
409
+ _See code: [src/commands/set-token.ts](https://github.com/opalsecurity/opal-cli/blob/v3.1.1-beta.d30a46f/src/commands/set-token.ts)_
411
410
 
412
411
  ## `opal set-url [URL]`
413
412
 
@@ -431,7 +430,7 @@ EXAMPLES
431
430
  $ opal set-url
432
431
  ```
433
432
 
434
- _See code: [src/commands/set-url.ts](https://github.com/opalsecurity/opal-cli/blob/v3.1.1-beta.b652df3/src/commands/set-url.ts)_
433
+ _See code: [src/commands/set-url.ts](https://github.com/opalsecurity/opal-cli/blob/v3.1.1-beta.d30a46f/src/commands/set-url.ts)_
435
434
 
436
435
  ## `opal ssh copyFrom`
437
436
 
@@ -462,7 +461,7 @@ EXAMPLES
462
461
  $ opal ssh:copyFrom --src instance/dir --dest my/dir --id 51f7176b-0464-4a6f-8369-e951e187b398
463
462
  ```
464
463
 
465
- _See code: [src/commands/ssh/copyFrom.ts](https://github.com/opalsecurity/opal-cli/blob/v3.1.1-beta.b652df3/src/commands/ssh/copyFrom.ts)_
464
+ _See code: [src/commands/ssh/copyFrom.ts](https://github.com/opalsecurity/opal-cli/blob/v3.1.1-beta.d30a46f/src/commands/ssh/copyFrom.ts)_
466
465
 
467
466
  ## `opal ssh copyTo`
468
467
 
@@ -493,7 +492,7 @@ EXAMPLES
493
492
  $ opal ssh:copyTo --src my/dir --dest instance/dir --id 51f7176b-0464-4a6f-8369-e951e187b398
494
493
  ```
495
494
 
496
- _See code: [src/commands/ssh/copyTo.ts](https://github.com/opalsecurity/opal-cli/blob/v3.1.1-beta.b652df3/src/commands/ssh/copyTo.ts)_
495
+ _See code: [src/commands/ssh/copyTo.ts](https://github.com/opalsecurity/opal-cli/blob/v3.1.1-beta.d30a46f/src/commands/ssh/copyTo.ts)_
497
496
 
498
497
  ## `opal ssh start`
499
498
 
@@ -520,7 +519,7 @@ EXAMPLES
520
519
  $ opal ssh:start --id 51f7176b-0464-4a6f-8369-e951e187b398
521
520
  ```
522
521
 
523
- _See code: [src/commands/ssh/start.ts](https://github.com/opalsecurity/opal-cli/blob/v3.1.1-beta.b652df3/src/commands/ssh/start.ts)_
522
+ _See code: [src/commands/ssh/start.ts](https://github.com/opalsecurity/opal-cli/blob/v3.1.1-beta.d30a46f/src/commands/ssh/start.ts)_
524
523
 
525
524
  ## `opal version`
526
525
 
@@ -541,21 +540,4 @@ FLAG DESCRIPTIONS
541
540
  ```
542
541
 
543
542
  _See code: [@oclif/plugin-version](https://github.com/oclif/plugin-version/blob/v2.2.27/src/commands/version.ts)_
544
-
545
- ## `opal whoami`
546
-
547
- Describes current url set, organization name, and logged in user if applicabled.
548
-
549
- ```
550
- USAGE
551
- $ opal whoami [-h]
552
-
553
- FLAGS
554
- -h, --help Show CLI help.
555
-
556
- DESCRIPTION
557
- Describes current url set, organization name, and logged in user if applicabled.
558
- ```
559
-
560
- _See code: [src/commands/whoami.ts](https://github.com/opalsecurity/opal-cli/blob/v3.1.1-beta.b652df3/src/commands/whoami.ts)_
561
543
  <!-- commandsstop -->
@@ -88,14 +88,12 @@ class Login extends core_1.Command {
88
88
  const configData = (0, config_1.getOrCreateConfigData)(configDir);
89
89
  let email = flags.email;
90
90
  let organizationId;
91
- let organizationName;
92
91
  let clientIDCandidate;
93
92
  const existingCreds = await (0, credentials_1.getOpalCredentials)(this, false);
94
93
  // Only use the previous email + organizationID if email isn't explicitly specified.
95
94
  if (!email) {
96
95
  email = existingCreds.email;
97
96
  organizationId = existingCreds.organizationID;
98
- organizationName = existingCreds.organizationName;
99
97
  clientIDCandidate = existingCreds.clientIDCandidate;
100
98
  }
101
99
  await (0, credentials_1.removeOpalCredentials)(this);
@@ -151,7 +149,6 @@ class Login extends core_1.Command {
151
149
  if (signInOrganizations && signInOrganizations.length > 0) {
152
150
  if (signInOrganizations.length === 1) {
153
151
  organizationId = signInOrganizations[0].organizationId;
154
- organizationName = signInOrganizations[0].organizationName;
155
152
  clientIDCandidate = signInOrganizations[0].cliClientId;
156
153
  }
157
154
  else {
@@ -167,7 +164,6 @@ class Login extends core_1.Command {
167
164
  },
168
165
  ]);
169
166
  organizationId = responses.signInOrganization.organizationId;
170
- organizationName = responses.signInOrganization.organizationName;
171
167
  clientIDCandidate = responses.signInOrganization.cliClientId;
172
168
  }
173
169
  }
@@ -242,10 +238,10 @@ class Login extends core_1.Command {
242
238
  if (tokenExchangeError) {
243
239
  this.log("WARN: Failed to exchange access token for session in Opal. Falling back to using access token for authenticating requests\n");
244
240
  // TODO: consider adding a warn line recommending upgrading Opal to version XYZ, once accompanying PR is pushed to prod
245
- await (0, credentials_1.setOpalCredentials)(this, email, organizationId !== null && organizationId !== void 0 ? organizationId : "", clientIDCandidate, (tokenSet === null || tokenSet === void 0 ? void 0 : tokenSet.access_token) || "", credentials_1.SecretType.ApiToken, organizationName);
241
+ await (0, credentials_1.setOpalCredentials)(this, email, organizationId !== null && organizationId !== void 0 ? organizationId : "", clientIDCandidate, (tokenSet === null || tokenSet === void 0 ? void 0 : tokenSet.access_token) || "", credentials_1.SecretType.ApiToken);
246
242
  }
247
243
  else {
248
- await (0, credentials_1.setOpalCredentials)(this, email, organizationId !== null && organizationId !== void 0 ? organizationId : "", clientIDCandidate, apollo_1.cookieStr, credentials_1.SecretType.Cookie, organizationName);
244
+ await (0, credentials_1.setOpalCredentials)(this, email, organizationId !== null && organizationId !== void 0 ? organizationId : "", clientIDCandidate, apollo_1.cookieStr, credentials_1.SecretType.Cookie);
249
245
  }
250
246
  // "Representative" authenticated call to check the log-in worked as expected.
251
247
  const { resp: authCheckResp, error: authCheckErr } = await (0, handler_1.runQueryDeprecated)({
@@ -4,7 +4,7 @@ export default class RequestCreate extends Command {
4
4
  static description: string;
5
5
  static flags: {
6
6
  help: import("@oclif/core/lib/interfaces").BooleanFlag<void>;
7
- assets: import("@oclif/core/lib/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
7
+ id: import("@oclif/core/lib/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
8
8
  reason: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
9
9
  duration: import("@oclif/core/lib/interfaces").OptionFlag<number | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
10
10
  };
@@ -13,9 +13,9 @@ class RequestCreate extends core_1.Command {
13
13
  (0, utils_1.restrictToDev)(); //TODO: Remove after development is complete
14
14
  const { flags } = await this.parse(RequestCreate);
15
15
  const metadata = (0, requests_1.initEmptyRequestMetadata)();
16
- if (flags.assets) {
16
+ if (flags.id) {
17
17
  // if IDs are provided, bypass the interactive selection process
18
- await (0, requests_1.bypassRequestSelection)(this, client, flags.assets, metadata);
18
+ await (0, requests_1.bypassRequestSelection)(this, client, flags.id, metadata);
19
19
  }
20
20
  else {
21
21
  (0, displays_1.headerMessage)(this);
@@ -36,9 +36,7 @@ class RequestCreate extends core_1.Command {
36
36
  if (flags.reason) {
37
37
  metadata.reason = flags.reason;
38
38
  }
39
- else if (!(metadata.requestDefaults.reasonOptional &&
40
- flags.assets &&
41
- flags.duration)) {
39
+ else if (!(metadata.requestDefaults.reasonOptional && flags.id && flags.duration)) {
42
40
  await (0, requests_1.promptForReason)(metadata);
43
41
  }
44
42
  // Step 5: Prompt for expiration
@@ -50,9 +48,7 @@ class RequestCreate extends core_1.Command {
50
48
  }
51
49
  // Step 6: Display final summary of request
52
50
  let canSubmit = true;
53
- if (!(flags.assets &&
54
- flags.duration &&
55
- (metadata.requestDefaults.reasonOptional || flags.reason))) {
51
+ if (!(flags.id && flags.reason && flags.duration)) {
56
52
  canSubmit = await (0, requests_1.promptRequestSubmission)(this, metadata);
57
53
  }
58
54
  // Step 7: Prompt for final submission
@@ -64,10 +60,10 @@ RequestCreate.hidden = true;
64
60
  RequestCreate.description = "Creates an Opal access request via an interactive form";
65
61
  RequestCreate.flags = {
66
62
  help: flags_1.SHARED_FLAGS.help,
67
- assets: core_1.Flags.string({
68
- char: "a",
63
+ id: core_1.Flags.string({
64
+ char: "i",
69
65
  multiple: true,
70
- description: "The ids of the assets (resource, group) to request access to. Append a role ID using a colon if needed, e.g. `--assets 123:456`.\
66
+ description: "The id of the asset (resource, group) to request access to. Append a role ID using a colon if needed, e.g. `--id 123:456`.\
71
67
  \n If not provided, an interactive selection flow will be available to select assets to request.",
72
68
  }),
73
69
  reason: core_1.Flags.string({
@@ -5,13 +5,12 @@ interface OpalCredentials {
5
5
  clientIDCandidate?: string;
6
6
  secret?: string;
7
7
  secretType?: SecretType;
8
- organizationName?: string;
9
8
  }
10
9
  export declare enum SecretType {
11
10
  Cookie = "COOKIE",
12
11
  ApiToken = "API_TOKEN"
13
12
  }
14
- export declare const setOpalCredentials: (command: Command, email: string | undefined, organizationID: string, clientIDCandidate: string | undefined | null, secret: string, secretType: SecretType, organizationName?: string) => Promise<void>;
13
+ export declare const setOpalCredentials: (command: Command, email: string | undefined, organizationID: string, clientIDCandidate: string | undefined | null, secret: string, secretType: SecretType) => Promise<void>;
15
14
  export declare const getOpalCredentials: (command: Command, includeAuthSecret?: boolean) => Promise<OpalCredentials>;
16
15
  export declare const removeOpalCredentials: (command: Command) => Promise<void>;
17
16
  export {};
@@ -9,14 +9,13 @@ var SecretType;
9
9
  SecretType["Cookie"] = "COOKIE";
10
10
  SecretType["ApiToken"] = "API_TOKEN";
11
11
  })(SecretType || (exports.SecretType = SecretType = {}));
12
- const setOpalCredentials = async (command, email, organizationID, clientIDCandidate, secret, secretType, organizationName) => {
12
+ const setOpalCredentials = async (command, email, organizationID, clientIDCandidate, secret, secretType) => {
13
13
  const givenEmail = email || "email-unset";
14
14
  const configData = (0, config_1.getOrCreateConfigData)(command.config.configDir);
15
15
  configData.creds = {
16
16
  clientIDCandidate,
17
17
  email,
18
18
  organizationID,
19
- organizationName,
20
19
  secretType,
21
20
  };
22
21
  (0, config_1.writeConfigData)(command.config.configDir, configData);
@@ -19,7 +19,6 @@ type RoleNode = {
19
19
  roleName: string;
20
20
  };
21
21
  export type RequestMap = Record<string, AppNode>;
22
- export declare const DISPLAY_LABELS: Partial<Record<EntityType, string>>;
23
22
  type DurationOption = {
24
23
  durationInMinutes: number;
25
24
  label: string;
@@ -1,6 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.DISPLAY_LABELS = void 0;
4
3
  exports.initEmptyRequestMetadata = initEmptyRequestMetadata;
5
4
  exports.selectRequestableItems = selectRequestableItems;
6
5
  exports.doneSelectingAssets = doneSelectingAssets;
@@ -16,7 +15,7 @@ const graphql_1 = require("../graphql");
16
15
  const graphql_2 = require("../graphql/graphql");
17
16
  const displays_1 = require("../utils/displays");
18
17
  const config_1 = require("./config");
19
- const { AutoComplete, Select, prompt, Form } = require("enquirer");
18
+ const { AutoComplete, Select, prompt, Form, confirm } = require("enquirer");
20
19
  function entityTypeFromString(str) {
21
20
  const capStr = str === null || str === void 0 ? void 0 : str.toLocaleUpperCase();
22
21
  if (capStr === "RESOURCE") {
@@ -28,10 +27,6 @@ function entityTypeFromString(str) {
28
27
  // if type unknown, default to resource
29
28
  return graphql_2.EntityType.Resource;
30
29
  }
31
- exports.DISPLAY_LABELS = {
32
- [graphql_2.EntityType.Resource]: "Resource",
33
- [graphql_2.EntityType.Group]: "Group",
34
- };
35
30
  function initEmptyRequestMetadata() {
36
31
  // Initialize with empty defaults
37
32
  const requestDefaults = {
@@ -243,7 +238,7 @@ async function queryAssetRoles(cmd, client, assetType, assetId) {
243
238
  var _a, _b, _c, _d, _e, _f, _g, _h;
244
239
  try {
245
240
  switch (assetType) {
246
- case graphql_2.EntityType.Resource: {
241
+ case "Resource": {
247
242
  const resp = await client.query({
248
243
  query: RESOURCE_ROLES_QUERY,
249
244
  variables: {
@@ -272,7 +267,7 @@ async function queryAssetRoles(cmd, client, assetType, assetId) {
272
267
  }
273
268
  return;
274
269
  }
275
- case graphql_2.EntityType.Group: {
270
+ case "Group": {
276
271
  const resp = await client.query({
277
272
  query: GROUP_ROLES_QUERY,
278
273
  variables: {
@@ -702,7 +697,7 @@ function appRolesFromEdge(edge) {
702
697
  value: {
703
698
  id: edge.node.id + accessLevel.accessLevelRemoteId,
704
699
  name: accessLevel.accessLevelName,
705
- type: exports.DISPLAY_LABELS[graphql_2.EntityType.Resource],
700
+ type: graphql_2.EntityType.Resource,
706
701
  toString: () => accessLevel.accessLevelName,
707
702
  },
708
703
  }));
@@ -713,7 +708,7 @@ function appRolesFromEdge(edge) {
713
708
  value: {
714
709
  id: edge.node.id,
715
710
  name: (_b = edge.alias) !== null && _b !== void 0 ? _b : edge.node.name,
716
- type: exports.DISPLAY_LABELS[graphql_2.EntityType.Resource],
711
+ type: graphql_2.EntityType.Resource,
717
712
  toString: () => { var _a; return (_a = edge.alias) !== null && _a !== void 0 ? _a : edge.node.name; },
718
713
  },
719
714
  },
@@ -722,11 +717,11 @@ function appRolesFromEdge(edge) {
722
717
  case "Group":
723
718
  return [
724
719
  {
725
- message: `${(_c = edge.alias) !== null && _c !== void 0 ? _c : edge.node.name} ${graphql_2.EntityType.Group}`,
720
+ message: (_c = edge.alias) !== null && _c !== void 0 ? _c : edge.node.name,
726
721
  value: {
727
722
  id: edge.node.id,
728
723
  name: (_d = edge.alias) !== null && _d !== void 0 ? _d : edge.node.name,
729
- type: exports.DISPLAY_LABELS[graphql_2.EntityType.Group],
724
+ type: graphql_2.EntityType.Group,
730
725
  toString: () => { var _a; return (_a = edge.alias) !== null && _a !== void 0 ? _a : edge.node.name; },
731
726
  },
732
727
  },
@@ -918,7 +913,6 @@ async function promptForExpiration(metadata) {
918
913
  const expirationSelect = new AutoComplete({
919
914
  name: "expiration",
920
915
  message: "When should access expire?",
921
- hint: "Type to filter",
922
916
  type: "list",
923
917
  choices: durations,
924
918
  pageSize: 15,
@@ -1074,10 +1068,8 @@ async function bypassRequestSelection(cmd, client, flagValue, metadata) {
1074
1068
  var _a, _b;
1075
1069
  try {
1076
1070
  // Query Catalog Item endpoint to identify what the id belongs to (resource or group)
1077
- for (const val of flagValue) {
1078
- const delimiterIndex = val.indexOf(":");
1079
- const assetId = val.substring(0, delimiterIndex);
1080
- const roleName = val.substring(delimiterIndex + 1);
1071
+ for (const id of flagValue) {
1072
+ const [assetId, roleName] = id.split(":");
1081
1073
  const resp = await client.query({
1082
1074
  query: CATALOG_ITEM,
1083
1075
  variables: {
@@ -1104,7 +1096,7 @@ async function bypassRequestSelection(cmd, client, flagValue, metadata) {
1104
1096
  assets: {},
1105
1097
  };
1106
1098
  }
1107
- const assetEntry = metadata.requestMap[appId].assets[assetId];
1099
+ const assetEntry = metadata.requestMap[appId].assets[id];
1108
1100
  if (!assetEntry) {
1109
1101
  metadata.requestMap[appId].assets[assetId] = {
1110
1102
  assetId: assetId,
@@ -1,7 +1,7 @@
1
1
  import type { ApolloQueryResult } from "@apollo/client";
2
2
  import type { Command } from "@oclif/core/lib/command";
3
3
  import type { GetRequestQuery, GetRequestsQuery } from "../graphql/graphql";
4
- import { type RequestMap, type RequestMetadata } from "../lib/requests";
4
+ import type { RequestMap, RequestMetadata } from "../lib/requests";
5
5
  export declare function headerMessage(cmd: Command): void;
6
6
  export declare function treeifyRequestMap(cmd: Command, requestMap: RequestMap): void;
7
7
  export declare function displayFinalRequestSummary(cmd: Command, metadata: RequestMetadata): void;
@@ -7,7 +7,6 @@ exports.getStyledStatus = getStyledStatus;
7
7
  exports.displayRequestDetails = displayRequestDetails;
8
8
  exports.displayRequestListTable = displayRequestListTable;
9
9
  const chalk_1 = require("chalk");
10
- const requests_1 = require("../lib/requests");
11
10
  const Table = require("cli-table3");
12
11
  const treeify = require("object-treeify").default;
13
12
  function headerMessage(cmd) {
@@ -31,7 +30,7 @@ function treeifyRequestMap(cmd, requestMap) {
31
30
  for (const [_assetId, assetNode] of Object.entries(appNode.assets)) {
32
31
  // If okta/azure asset with no role, change asset name
33
32
  const assetName = assetNode.assetName || "No Role (Direct access)";
34
- const assetKey = `${assetName} ${chalk_1.default.dim(`[${requests_1.DISPLAY_LABELS[assetNode.type]}]`)}`;
33
+ const assetKey = `${assetName} ${chalk_1.default.dim(`[${assetNode.type}]`)}`;
35
34
  if (assetNode.roles !== undefined) {
36
35
  assetsTree[assetKey] = {};
37
36
  for (const [_roleId, roleNode] of Object.entries(assetNode.roles)) {
@@ -316,34 +316,6 @@
316
316
  "set-url.js"
317
317
  ]
318
318
  },
319
- "whoami": {
320
- "aliases": [],
321
- "args": {},
322
- "description": "Describes current url set, organization name, and logged in user if applicabled.",
323
- "flags": {
324
- "help": {
325
- "char": "h",
326
- "description": "Show CLI help.",
327
- "name": "help",
328
- "allowNo": false,
329
- "type": "boolean"
330
- }
331
- },
332
- "hasDynamicHelp": false,
333
- "hiddenAliases": [],
334
- "id": "whoami",
335
- "pluginAlias": "opal-security",
336
- "pluginName": "opal-security",
337
- "pluginType": "core",
338
- "strict": true,
339
- "enableJsonFlag": false,
340
- "isESM": false,
341
- "relativePath": [
342
- "lib",
343
- "commands",
344
- "whoami.js"
345
- ]
346
- },
347
319
  "aws:identity": {
348
320
  "aliases": [],
349
321
  "args": {},
@@ -634,10 +606,10 @@
634
606
  "allowNo": false,
635
607
  "type": "boolean"
636
608
  },
637
- "assets": {
638
- "char": "a",
639
- "description": "The ids of the assets (resource, group) to request access to. Append a role ID using a colon if needed, e.g. `--assets 123:456`. \n If not provided, an interactive selection flow will be available to select assets to request.",
640
- "name": "assets",
609
+ "id": {
610
+ "char": "i",
611
+ "description": "The id of the asset (resource, group) to request access to. Append a role ID using a colon if needed, e.g. `--id 123:456`. \n If not provided, an interactive selection flow will be available to select assets to request.",
612
+ "name": "id",
641
613
  "hasDynamicHelp": false,
642
614
  "multiple": true,
643
615
  "type": "option"
@@ -1031,5 +1003,5 @@
1031
1003
  ]
1032
1004
  }
1033
1005
  },
1034
- "version": "3.1.1-beta.b652df3"
1006
+ "version": "3.1.1-beta.d30a46f"
1035
1007
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "opal-security",
3
3
  "description": "Opal allows you to centrally manage access to all of your sensitive systems.",
4
- "version": "3.1.1-beta.b652df3",
4
+ "version": "3.1.1-beta.d30a46f",
5
5
  "author": "Stephen Cobbe",
6
6
  "bin": {
7
7
  "opal": "./bin/run"
@@ -1,8 +0,0 @@
1
- import { Command } from "@oclif/core";
2
- export default class WhoAmI extends Command {
3
- static description: string;
4
- static flags: {
5
- help: import("@oclif/core/lib/interfaces").BooleanFlag<void>;
6
- };
7
- run(): Promise<void>;
8
- }
@@ -1,34 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const core_1 = require("@oclif/core");
4
- const config_1 = require("../lib/config");
5
- const credentials_1 = require("../lib/credentials");
6
- const flags_1 = require("../lib/flags");
7
- class WhoAmI extends core_1.Command {
8
- async run() {
9
- const opalCreds = await (0, credentials_1.getOpalCredentials)(this, false);
10
- const organizationName = opalCreds === null || opalCreds === void 0 ? void 0 : opalCreds.organizationName;
11
- const email = opalCreds === null || opalCreds === void 0 ? void 0 : opalCreds.email;
12
- const configData = (0, config_1.getOrCreateConfigData)(this.config.configDir);
13
- const url = configData[config_1.urlKey];
14
- if (email) {
15
- this.log(`User: ${email}`);
16
- }
17
- if (organizationName) {
18
- if (organizationName === "unset-org-id") {
19
- this.log("Authenticated with Opal API Token.");
20
- }
21
- else {
22
- this.log(`Organization: ${organizationName}`);
23
- }
24
- }
25
- if (url) {
26
- this.log(`Server: ${url}`);
27
- }
28
- }
29
- }
30
- WhoAmI.description = "Describes current url set, organization name, and logged in user if applicabled.";
31
- WhoAmI.flags = {
32
- help: flags_1.SHARED_FLAGS.help,
33
- };
34
- exports.default = WhoAmI;