opal-security 2.3.0 → 2.3.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 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/2.3.0 darwin-arm64 node-v18.19.0
25
+ opal-security/2.3.2 darwin-arm64 node-v18.19.0
26
26
  $ opal --help [COMMAND]
27
27
  USAGE
28
28
  $ opal COMMAND
@@ -99,7 +99,7 @@ EXAMPLES
99
99
  $ opal aws:identity
100
100
  ```
101
101
 
102
- _See code: [src/commands/aws/identity.ts](https://github.com/opalsecurity/opal-cli/blob/v2.3.0/src/commands/aws/identity.ts)_
102
+ _See code: [src/commands/aws/identity.ts](https://github.com/opalsecurity/opal-cli/blob/v2.3.2/src/commands/aws/identity.ts)_
103
103
 
104
104
  ## `opal curl-example`
105
105
 
@@ -116,7 +116,7 @@ DESCRIPTION
116
116
  Prints out an example cURL command containing the parameters the CLI uses to query the Opal server.
117
117
  ```
118
118
 
119
- _See code: [src/commands/curl-example.ts](https://github.com/opalsecurity/opal-cli/blob/v2.3.0/src/commands/curl-example.ts)_
119
+ _See code: [src/commands/curl-example.ts](https://github.com/opalsecurity/opal-cli/blob/v2.3.2/src/commands/curl-example.ts)_
120
120
 
121
121
  ## `opal help [COMMANDS]`
122
122
 
@@ -166,7 +166,7 @@ EXAMPLES
166
166
  $ opal iam-roles:start --id 51f7176b-0464-4a6f-8369-e951e187b398 --profileName "custom-profile"
167
167
  ```
168
168
 
169
- _See code: [src/commands/iam-roles/start.ts](https://github.com/opalsecurity/opal-cli/blob/v2.3.0/src/commands/iam-roles/start.ts)_
169
+ _See code: [src/commands/iam-roles/start.ts](https://github.com/opalsecurity/opal-cli/blob/v2.3.2/src/commands/iam-roles/start.ts)_
170
170
 
171
171
  ## `opal kube-roles:start`
172
172
 
@@ -197,7 +197,7 @@ EXAMPLES
197
197
  $ opal kube-roles:start --id 51f7176b-0464-4a6f-8369-e951e187b398 --accessLevelRemoteId "arn:aws:iam::712234975475:role/acme-eks-cluster-admin-role"
198
198
  ```
199
199
 
200
- _See code: [src/commands/kube-roles/start.ts](https://github.com/opalsecurity/opal-cli/blob/v2.3.0/src/commands/kube-roles/start.ts)_
200
+ _See code: [src/commands/kube-roles/start.ts](https://github.com/opalsecurity/opal-cli/blob/v2.3.2/src/commands/kube-roles/start.ts)_
201
201
 
202
202
  ## `opal login`
203
203
 
@@ -218,7 +218,7 @@ EXAMPLES
218
218
  $ opal login
219
219
  ```
220
220
 
221
- _See code: [src/commands/login.ts](https://github.com/opalsecurity/opal-cli/blob/v2.3.0/src/commands/login.ts)_
221
+ _See code: [src/commands/login.ts](https://github.com/opalsecurity/opal-cli/blob/v2.3.2/src/commands/login.ts)_
222
222
 
223
223
  ## `opal logout`
224
224
 
@@ -238,7 +238,7 @@ EXAMPLES
238
238
  $ opal logout
239
239
  ```
240
240
 
241
- _See code: [src/commands/logout.ts](https://github.com/opalsecurity/opal-cli/blob/v2.3.0/src/commands/logout.ts)_
241
+ _See code: [src/commands/logout.ts](https://github.com/opalsecurity/opal-cli/blob/v2.3.2/src/commands/logout.ts)_
242
242
 
243
243
  ## `opal migrate-creds`
244
244
 
@@ -255,7 +255,7 @@ DESCRIPTION
255
255
  Migrates credentials from old keystore to new store. Should only need to be run once
256
256
  ```
257
257
 
258
- _See code: [src/commands/migrate-creds.ts](https://github.com/opalsecurity/opal-cli/blob/v2.3.0/src/commands/migrate-creds.ts)_
258
+ _See code: [src/commands/migrate-creds.ts](https://github.com/opalsecurity/opal-cli/blob/v2.3.2/src/commands/migrate-creds.ts)_
259
259
 
260
260
  ## `opal postgres-instances:start`
261
261
 
@@ -293,7 +293,7 @@ EXAMPLES
293
293
  $ opal postgres-instances:start --id 51f7176b-0464-4a6f-8369-e951e187b398 --accessLevelRemoteId fullaccess --action view
294
294
  ```
295
295
 
296
- _See code: [src/commands/postgres-instances/start.ts](https://github.com/opalsecurity/opal-cli/blob/v2.3.0/src/commands/postgres-instances/start.ts)_
296
+ _See code: [src/commands/postgres-instances/start.ts](https://github.com/opalsecurity/opal-cli/blob/v2.3.2/src/commands/postgres-instances/start.ts)_
297
297
 
298
298
  ## `opal resources:get`
299
299
 
@@ -314,7 +314,7 @@ EXAMPLES
314
314
  $ opal resources:get --id 54052a3e-5375-4392-aeaf-0c6c44c131d4
315
315
  ```
316
316
 
317
- _See code: [src/commands/resources/get.ts](https://github.com/opalsecurity/opal-cli/blob/v2.3.0/src/commands/resources/get.ts)_
317
+ _See code: [src/commands/resources/get.ts](https://github.com/opalsecurity/opal-cli/blob/v2.3.2/src/commands/resources/get.ts)_
318
318
 
319
319
  ## `opal set-custom-header`
320
320
 
@@ -335,7 +335,7 @@ EXAMPLES
335
335
  $ opal set-custom-header --header 'cf-access-token: $TOKEN'
336
336
  ```
337
337
 
338
- _See code: [src/commands/set-custom-header.ts](https://github.com/opalsecurity/opal-cli/blob/v2.3.0/src/commands/set-custom-header.ts)_
338
+ _See code: [src/commands/set-custom-header.ts](https://github.com/opalsecurity/opal-cli/blob/v2.3.2/src/commands/set-custom-header.ts)_
339
339
 
340
340
  ## `opal set-token`
341
341
 
@@ -355,7 +355,7 @@ EXAMPLES
355
355
  $ opal set-token
356
356
  ```
357
357
 
358
- _See code: [src/commands/set-token.ts](https://github.com/opalsecurity/opal-cli/blob/v2.3.0/src/commands/set-token.ts)_
358
+ _See code: [src/commands/set-token.ts](https://github.com/opalsecurity/opal-cli/blob/v2.3.2/src/commands/set-token.ts)_
359
359
 
360
360
  ## `opal set-url [URL]`
361
361
 
@@ -379,7 +379,7 @@ EXAMPLES
379
379
  $ opal set-url
380
380
  ```
381
381
 
382
- _See code: [src/commands/set-url.ts](https://github.com/opalsecurity/opal-cli/blob/v2.3.0/src/commands/set-url.ts)_
382
+ _See code: [src/commands/set-url.ts](https://github.com/opalsecurity/opal-cli/blob/v2.3.2/src/commands/set-url.ts)_
383
383
 
384
384
  ## `opal ssh:copyFrom`
385
385
 
@@ -410,7 +410,7 @@ EXAMPLES
410
410
  $ opal ssh:copyFrom --src instance/dir --dest my/dir --id 51f7176b-0464-4a6f-8369-e951e187b398
411
411
  ```
412
412
 
413
- _See code: [src/commands/ssh/copyFrom.ts](https://github.com/opalsecurity/opal-cli/blob/v2.3.0/src/commands/ssh/copyFrom.ts)_
413
+ _See code: [src/commands/ssh/copyFrom.ts](https://github.com/opalsecurity/opal-cli/blob/v2.3.2/src/commands/ssh/copyFrom.ts)_
414
414
 
415
415
  ## `opal ssh:copyTo`
416
416
 
@@ -441,7 +441,7 @@ EXAMPLES
441
441
  $ opal ssh:copyTo --src my/dir --dest instance/dir --id 51f7176b-0464-4a6f-8369-e951e187b398
442
442
  ```
443
443
 
444
- _See code: [src/commands/ssh/copyTo.ts](https://github.com/opalsecurity/opal-cli/blob/v2.3.0/src/commands/ssh/copyTo.ts)_
444
+ _See code: [src/commands/ssh/copyTo.ts](https://github.com/opalsecurity/opal-cli/blob/v2.3.2/src/commands/ssh/copyTo.ts)_
445
445
 
446
446
  ## `opal ssh:start`
447
447
 
@@ -468,7 +468,7 @@ EXAMPLES
468
468
  $ opal ssh:start --id 51f7176b-0464-4a6f-8369-e951e187b398
469
469
  ```
470
470
 
471
- _See code: [src/commands/ssh/start.ts](https://github.com/opalsecurity/opal-cli/blob/v2.3.0/src/commands/ssh/start.ts)_
471
+ _See code: [src/commands/ssh/start.ts](https://github.com/opalsecurity/opal-cli/blob/v2.3.2/src/commands/ssh/start.ts)_
472
472
 
473
473
  ## `opal version`
474
474
 
@@ -488,5 +488,5 @@ FLAG DESCRIPTIONS
488
488
  Additionally shows the architecture, node version, operating system, and versions of plugins that the CLI is using.
489
489
  ```
490
490
 
491
- _See code: [@oclif/plugin-version](https://github.com/oclif/plugin-version/blob/v2.0.11/src/commands/version.ts)_
491
+ _See code: [@oclif/plugin-version](https://github.com/oclif/plugin-version/blob/v2.0.12/src/commands/version.ts)_
492
492
  <!-- commandsstop -->
@@ -58,23 +58,21 @@ class Login extends core_1.Command {
58
58
  async run() {
59
59
  var _a, _b, _c, _d, _e, _f, _g;
60
60
  try {
61
- await (0, apollo_1.initClient)(this);
61
+ await (0, apollo_1.initClient)(this, false);
62
62
  const { flags } = await this.parse(Login);
63
63
  const configDir = this.config.configDir;
64
64
  const configData = (0, config_1.getOrCreateConfigData)(configDir);
65
65
  let email = flags.email;
66
66
  let organizationID;
67
67
  let clientIdCandidate;
68
- const existingCreds = await (0, credentials_1.getOpalCredentials)(this);
69
- if (existingCreds.accessToken) {
70
- // Only use the previous email + organizationID if email isn't explicitly specified.
71
- if (!email) {
72
- email = existingCreds.email;
73
- organizationID = existingCreds.organizationID;
74
- clientIdCandidate = existingCreds.clientIDCandidate;
75
- }
76
- await (0, credentials_1.removeOpalCredentials)(this);
68
+ const existingCreds = await (0, credentials_1.getOpalCredentials)(this, false);
69
+ // Only use the previous email + organizationID if email isn't explicitly specified.
70
+ if (!email) {
71
+ email = existingCreds.email;
72
+ organizationID = existingCreds.organizationID;
73
+ clientIdCandidate = existingCreds.clientIDCandidate;
77
74
  }
75
+ await (0, credentials_1.removeOpalCredentials)(this);
78
76
  this.log('Welcome to Opal! ⚡️\n');
79
77
  this.log('Connecting to Opal server URL:', configData[config_1.urlKey]);
80
78
  this.log('If this is incorrect, please run `opal set-url --help`\n');
@@ -11,7 +11,7 @@ class SetToken extends core_1.Command {
11
11
  async run() {
12
12
  var _a, _b, _c;
13
13
  try {
14
- await (0, apollo_1.initClient)(this);
14
+ await (0, apollo_1.initClient)(this, false);
15
15
  const { apiToken } = await inquirer.prompt([
16
16
  {
17
17
  name: 'apiToken',
@@ -23,7 +23,7 @@ class SetToken extends core_1.Command {
23
23
  // Overwrite previously-stored credentials from keychain if they exist
24
24
  let email;
25
25
  let organizationID;
26
- const existingCreds = await (0, credentials_1.getOpalCredentials)(this);
26
+ const existingCreds = await (0, credentials_1.getOpalCredentials)(this, false);
27
27
  await (0, credentials_1.setOpalCredentials)(this, existingCreds === null || existingCreds === void 0 ? void 0 : existingCreds.email, (existingCreds === null || existingCreds === void 0 ? void 0 : existingCreds.organizationID) || 'unset-org-id', existingCreds === null || existingCreds === void 0 ? void 0 : existingCreds.clientIDCandidate, apiToken || '');
28
28
  // "Representative" authenticated call to check the log-in worked as expected.
29
29
  const { resp: authCheckResp, error: authCheckErr } = await (0, handler_1.runQuery)({
@@ -3,4 +3,4 @@ import { Command } from '@oclif/core';
3
3
  export declare let client: ApolloClient<NormalizedCacheObject> | null;
4
4
  export declare const printResponse: (command: Command, resp: any) => void;
5
5
  export declare const handleError: (command: Command, err: any, resp?: any) => void;
6
- export declare const initClient: (command: Command) => Promise<void>;
6
+ export declare const initClient: (command: Command, fetchAccessToken?: boolean) => Promise<void>;
package/lib/lib/apollo.js CHANGED
@@ -52,11 +52,11 @@ const handleError = (command, err, resp) => {
52
52
  process.exit(1);
53
53
  };
54
54
  exports.handleError = handleError;
55
- const initClient = async (command) => {
55
+ const initClient = async (command, fetchAccessToken = true) => {
56
56
  const configDir = command.config.configDir;
57
57
  const currentCLIVersion = command.config.version;
58
58
  const configData = (0, config_1.getOrCreateConfigData)(configDir);
59
- const opalCreds = await (0, credentials_1.getOpalCredentials)(command);
59
+ const opalCreds = await (0, credentials_1.getOpalCredentials)(command, fetchAccessToken);
60
60
  const accessToken = opalCreds === null || opalCreds === void 0 ? void 0 : opalCreds.accessToken;
61
61
  const organizationID = opalCreds === null || opalCreds === void 0 ? void 0 : opalCreds.organizationID;
62
62
  const httpsAgent = new https.Agent({
@@ -6,6 +6,6 @@ interface OpalCredentials {
6
6
  accessToken?: string;
7
7
  }
8
8
  export declare const setOpalCredentials: (command: Command, email: string | undefined, organizationID: string, clientIDCandidate: string | undefined | null, accessToken: string) => Promise<void>;
9
- export declare const getOpalCredentials: (command: Command) => Promise<OpalCredentials>;
9
+ export declare const getOpalCredentials: (command: Command, includeAccessToken?: boolean) => Promise<OpalCredentials>;
10
10
  export declare const removeOpalCredentials: (command: Command) => Promise<void>;
11
11
  export {};
@@ -21,9 +21,12 @@ const setOpalCredentials = async (command, email, organizationID, clientIDCandid
21
21
  }
22
22
  };
23
23
  exports.setOpalCredentials = setOpalCredentials;
24
- const getOpalCredentials = async (command) => {
24
+ const getOpalCredentials = async (command, includeAccessToken = true) => {
25
25
  var _a, _b;
26
26
  let creds = (_b = (_a = (0, config_1.getOrCreateConfigData)(command.config.configDir)) === null || _a === void 0 ? void 0 : _a.creds) !== null && _b !== void 0 ? _b : {};
27
+ if (!includeAccessToken) {
28
+ return creds;
29
+ }
27
30
  let accessToken = null;
28
31
  if (process.platform === "darwin") {
29
32
  accessToken = await (0, keychain_1.getTokenFromKeychain)((creds === null || creds === void 0 ? void 0 : creds.email) || 'email-unset');
@@ -427,6 +427,46 @@
427
427
  "start.js"
428
428
  ]
429
429
  },
430
+ "resources:get": {
431
+ "aliases": [],
432
+ "args": {},
433
+ "description": "Get resource info for a particular resource.",
434
+ "examples": [
435
+ "opal resources:get --id 54052a3e-5375-4392-aeaf-0c6c44c131d4"
436
+ ],
437
+ "flags": {
438
+ "help": {
439
+ "char": "h",
440
+ "description": "Show CLI help.",
441
+ "name": "help",
442
+ "allowNo": false,
443
+ "type": "boolean"
444
+ },
445
+ "id": {
446
+ "char": "i",
447
+ "description": "The Opal ID of the resource. You can find this from the URL, e.g. https://opal.dev/resources/[ID]",
448
+ "name": "id",
449
+ "hasDynamicHelp": false,
450
+ "multiple": false,
451
+ "type": "option"
452
+ }
453
+ },
454
+ "hasDynamicHelp": false,
455
+ "hiddenAliases": [],
456
+ "id": "resources:get",
457
+ "pluginAlias": "opal-security",
458
+ "pluginName": "opal-security",
459
+ "pluginType": "core",
460
+ "strict": true,
461
+ "enableJsonFlag": false,
462
+ "isESM": false,
463
+ "relativePath": [
464
+ "lib",
465
+ "commands",
466
+ "resources",
467
+ "get.js"
468
+ ]
469
+ },
430
470
  "postgres-instances:start": {
431
471
  "aliases": [],
432
472
  "args": {},
@@ -505,46 +545,6 @@
505
545
  "start.js"
506
546
  ]
507
547
  },
508
- "resources:get": {
509
- "aliases": [],
510
- "args": {},
511
- "description": "Get resource info for a particular resource.",
512
- "examples": [
513
- "opal resources:get --id 54052a3e-5375-4392-aeaf-0c6c44c131d4"
514
- ],
515
- "flags": {
516
- "help": {
517
- "char": "h",
518
- "description": "Show CLI help.",
519
- "name": "help",
520
- "allowNo": false,
521
- "type": "boolean"
522
- },
523
- "id": {
524
- "char": "i",
525
- "description": "The Opal ID of the resource. You can find this from the URL, e.g. https://opal.dev/resources/[ID]",
526
- "name": "id",
527
- "hasDynamicHelp": false,
528
- "multiple": false,
529
- "type": "option"
530
- }
531
- },
532
- "hasDynamicHelp": false,
533
- "hiddenAliases": [],
534
- "id": "resources:get",
535
- "pluginAlias": "opal-security",
536
- "pluginName": "opal-security",
537
- "pluginType": "core",
538
- "strict": true,
539
- "enableJsonFlag": false,
540
- "isESM": false,
541
- "relativePath": [
542
- "lib",
543
- "commands",
544
- "resources",
545
- "get.js"
546
- ]
547
- },
548
548
  "ssh:copyFrom": {
549
549
  "aliases": [],
550
550
  "args": {},
@@ -752,5 +752,5 @@
752
752
  ]
753
753
  }
754
754
  },
755
- "version": "2.3.0"
755
+ "version": "2.3.2"
756
756
  }
package/package.json CHANGED
@@ -1,21 +1,18 @@
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": "2.3.0",
4
+ "version": "2.3.2",
5
5
  "author": "Stephen Cobbe",
6
6
  "bin": {
7
7
  "opal": "./bin/run"
8
8
  },
9
9
  "bugs": "https://github.com/opalsecurity/opal-cli/issues",
10
10
  "dependencies": {
11
- "@apollo/client": "^3.9.1",
12
- "@graphql-codegen/cli": "^2.16.5",
13
- "@graphql-codegen/near-operation-file-preset": "^1.18.6",
14
- "@graphql-codegen/typescript": "^1.21.1",
15
- "@graphql-codegen/typescript-oclif": "^1.17.9",
11
+ "@apollo/client": "^3.9.5",
12
+ "@oclif/core": "^3.19.3",
16
13
  "@oclif/plugin-autocomplete": "^1.4.6",
17
14
  "@oclif/plugin-help": "^5.2.20",
18
- "@oclif/plugin-version": "^2.0.11",
15
+ "@oclif/plugin-version": "^2.0.12",
19
16
  "@types/prettyjson": "0.0.29",
20
17
  "argon2": "^0.31.2",
21
18
  "chalk": "^2.4.2",
@@ -34,7 +31,10 @@
34
31
  "tslib": "^1.14.1"
35
32
  },
36
33
  "devDependencies": {
37
- "@oclif/core": "^3.18.2",
34
+ "@graphql-codegen/cli": "^5.0.2",
35
+ "@graphql-codegen/near-operation-file-preset": "^3.0.0",
36
+ "@graphql-codegen/typescript": "^4.0.5",
37
+ "@graphql-codegen/typescript-oclif": "^3.0.0",
38
38
  "@oclif/test": "^3",
39
39
  "@types/chai": "^4.2.16",
40
40
  "@types/inquirer": "^8.2.10",
@@ -43,15 +43,17 @@
43
43
  "@types/mocha": "^5.2.7",
44
44
  "@types/node": "^18.11.9",
45
45
  "@types/semver": "^7.3.8",
46
- "@typescript-eslint/eslint-plugin": "^5.31.0",
46
+ "@typescript-eslint/eslint-plugin": "^7.0.2",
47
+ "better-npm-audit": "^3.7.3",
47
48
  "chai": "^4.3.4",
48
- "eslint": "^8.17.0",
49
- "eslint-config-oclif": "^5.0.0",
50
- "eslint-config-oclif-typescript": "^3.0.41",
49
+ "eslint-config-oclif": "^5.0.2",
50
+ "eslint-config-oclif-typescript": "^3.0.48",
51
+ "eslint-plugin-simple-import-sort": "^12.0.0",
52
+ "eslint-plugin-unused-imports": "^3.1.0",
51
53
  "globby": "^10.0.2",
52
54
  "mocha": "^10.0.0",
53
55
  "nyc": "^15.1.0",
54
- "oclif": "^4.4.2",
56
+ "oclif": "^4.4.16",
55
57
  "ts-node": "^8.10.2",
56
58
  "typescript": "^5.3.3"
57
59
  },