opal-security 2.3.4 → 3.0.1-beta.4262451

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.
Files changed (69) hide show
  1. package/README.md +67 -38
  2. package/lib/commands/aws/identity.d.ts +1 -1
  3. package/lib/commands/aws/identity.js +2 -2
  4. package/lib/commands/{migrate-creds.d.ts → clear-auth-provider.d.ts} +3 -2
  5. package/lib/commands/clear-auth-provider.js +28 -0
  6. package/lib/commands/curl-example.d.ts +1 -1
  7. package/lib/commands/curl-example.js +10 -3
  8. package/lib/commands/iam-roles/start.d.ts +1 -1
  9. package/lib/commands/iam-roles/start.js +14 -14
  10. package/lib/commands/kube-roles/start.d.ts +1 -1
  11. package/lib/commands/kube-roles/start.js +10 -10
  12. package/lib/commands/login.d.ts +2 -1
  13. package/lib/commands/login.js +134 -74
  14. package/lib/commands/logout.d.ts +1 -1
  15. package/lib/commands/logout.js +3 -3
  16. package/lib/commands/postgres-instances/start.d.ts +1 -1
  17. package/lib/commands/postgres-instances/start.js +35 -34
  18. package/lib/commands/resources/get.d.ts +1 -1
  19. package/lib/commands/resources/get.js +6 -4
  20. package/lib/commands/set-auth-provider.d.ts +11 -0
  21. package/lib/commands/set-auth-provider.js +44 -0
  22. package/lib/commands/set-custom-header.d.ts +1 -1
  23. package/lib/commands/set-custom-header.js +5 -3
  24. package/lib/commands/set-token.d.ts +1 -1
  25. package/lib/commands/set-token.js +26 -19
  26. package/lib/commands/set-url.d.ts +1 -1
  27. package/lib/commands/set-url.js +13 -12
  28. package/lib/commands/ssh/copyFrom.d.ts +1 -1
  29. package/lib/commands/ssh/copyFrom.js +13 -13
  30. package/lib/commands/ssh/copyTo.d.ts +1 -1
  31. package/lib/commands/ssh/copyTo.js +13 -13
  32. package/lib/commands/ssh/start.d.ts +1 -1
  33. package/lib/commands/ssh/start.js +14 -15
  34. package/lib/graphql/fragment-masking.d.ts +19 -0
  35. package/lib/graphql/fragment-masking.js +21 -0
  36. package/lib/graphql/gql.d.ts +36 -0
  37. package/lib/graphql/gql.js +12 -0
  38. package/lib/graphql/graphql.d.ts +11413 -0
  39. package/lib/graphql/graphql.js +1491 -0
  40. package/lib/graphql/index.d.ts +2 -0
  41. package/lib/graphql/index.js +5 -0
  42. package/lib/handler.d.ts +5 -5
  43. package/lib/handler.js +7 -7
  44. package/lib/index.d.ts +1 -1
  45. package/lib/lib/apollo.d.ts +4 -2
  46. package/lib/lib/apollo.js +107 -55
  47. package/lib/lib/aws.js +15 -12
  48. package/lib/lib/cmd.d.ts +4 -6
  49. package/lib/lib/cmd.js +11 -11
  50. package/lib/lib/config.js +14 -15
  51. package/lib/lib/credentials/index.d.ts +9 -4
  52. package/lib/lib/credentials/index.js +26 -15
  53. package/lib/lib/credentials/keychain.d.ts +3 -3
  54. package/lib/lib/credentials/keychain.js +12 -12
  55. package/lib/lib/credentials/localEncryption.d.ts +3 -3
  56. package/lib/lib/credentials/localEncryption.js +40 -31
  57. package/lib/lib/flags.js +9 -9
  58. package/lib/lib/resources.d.ts +2 -2
  59. package/lib/lib/resources.js +29 -23
  60. package/lib/lib/sessions.d.ts +2 -2
  61. package/lib/lib/sessions.js +18 -17
  62. package/lib/lib/ssh.d.ts +1 -1
  63. package/lib/lib/ssh.js +8 -8
  64. package/lib/lib/util.d.ts +0 -1
  65. package/lib/lib/util.js +13 -13
  66. package/lib/types.d.ts +1787 -1787
  67. package/oclif.manifest.json +56 -7
  68. package/package.json +23 -29
  69. package/lib/commands/migrate-creds.js +0 -48
@@ -1,5 +1,36 @@
1
1
  {
2
2
  "commands": {
3
+ "clear-auth-provider": {
4
+ "aliases": [],
5
+ "args": {},
6
+ "description": "Clears the custom Issuer URL and Client ID set by set-airgap-auth, returning to the default.",
7
+ "examples": [
8
+ "$ opal clear-auth-provider"
9
+ ],
10
+ "flags": {
11
+ "help": {
12
+ "char": "h",
13
+ "description": "Show CLI help.",
14
+ "name": "help",
15
+ "allowNo": false,
16
+ "type": "boolean"
17
+ }
18
+ },
19
+ "hasDynamicHelp": false,
20
+ "hiddenAliases": [],
21
+ "id": "clear-auth-provider",
22
+ "pluginAlias": "opal-security",
23
+ "pluginName": "opal-security",
24
+ "pluginType": "core",
25
+ "strict": true,
26
+ "enableJsonFlag": false,
27
+ "isESM": false,
28
+ "relativePath": [
29
+ "lib",
30
+ "commands",
31
+ "clear-auth-provider.js"
32
+ ]
33
+ },
3
34
  "curl-example": {
4
35
  "aliases": [],
5
36
  "args": {},
@@ -97,10 +128,13 @@
97
128
  "logout.js"
98
129
  ]
99
130
  },
100
- "migrate-creds": {
131
+ "set-auth-provider": {
101
132
  "aliases": [],
102
133
  "args": {},
103
- "description": "Migrates credentials from old keystore to new store. Should only need to be run once",
134
+ "description": "Sets the Issuer URL and Client ID of the Auth Provider that the CLI will authenticate with.\n Only use this if you are running a self-hosted, air-gapped instance of Opal that uses a custom Auth Provider.\n\n Note - you will need an OIDC provider that supports the device_code grant.\n ",
135
+ "examples": [
136
+ "$ opal set-auth-provider --clientID 1234asdf --issuerUrl https://auth.example.com"
137
+ ],
104
138
  "flags": {
105
139
  "help": {
106
140
  "char": "h",
@@ -108,11 +142,27 @@
108
142
  "name": "help",
109
143
  "allowNo": false,
110
144
  "type": "boolean"
145
+ },
146
+ "clientID": {
147
+ "description": "Client ID of your Auth Provider",
148
+ "name": "clientID",
149
+ "required": true,
150
+ "hasDynamicHelp": false,
151
+ "multiple": false,
152
+ "type": "option"
153
+ },
154
+ "issuerUrl": {
155
+ "description": "Issuer URL of your Auth Provider",
156
+ "name": "issuerUrl",
157
+ "required": true,
158
+ "hasDynamicHelp": false,
159
+ "multiple": false,
160
+ "type": "option"
111
161
  }
112
162
  },
113
163
  "hasDynamicHelp": false,
114
164
  "hiddenAliases": [],
115
- "id": "migrate-creds",
165
+ "id": "set-auth-provider",
116
166
  "pluginAlias": "opal-security",
117
167
  "pluginName": "opal-security",
118
168
  "pluginType": "core",
@@ -122,7 +172,7 @@
122
172
  "relativePath": [
123
173
  "lib",
124
174
  "commands",
125
- "migrate-creds.js"
175
+ "set-auth-provider.js"
126
176
  ]
127
177
  },
128
178
  "set-custom-header": {
@@ -477,12 +527,11 @@
477
527
  "type": "boolean"
478
528
  },
479
529
  "action": {
480
- "description": "Method of connecting to the database.\n- open: Open external database app\n- psql: Start psql session in shell\n- view: View connection configuration details",
530
+ "description": "Method of connecting to the database.\n- psql: Start psql session in shell\n- view: View connection configuration details",
481
531
  "name": "action",
482
532
  "hasDynamicHelp": false,
483
533
  "multiple": false,
484
534
  "options": [
485
- "open",
486
535
  "psql",
487
536
  "view"
488
537
  ],
@@ -752,5 +801,5 @@
752
801
  ]
753
802
  }
754
803
  },
755
- "version": "2.3.4"
804
+ "version": "3.0.1-beta.4262451"
756
805
  }
package/package.json CHANGED
@@ -1,26 +1,24 @@
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.4",
4
+ "version": "3.0.1-beta.4262451",
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.5",
11
+ "@apollo/client": "^3.13.5",
12
12
  "@oclif/core": "^3.19.3",
13
13
  "@oclif/plugin-autocomplete": "^1.4.6",
14
14
  "@oclif/plugin-help": "^5.2.20",
15
15
  "@oclif/plugin-version": "^2.0.12",
16
- "@types/prettyjson": "0.0.29",
17
16
  "argon2": "^0.40.1",
18
17
  "chalk": "^2.4.2",
19
18
  "graphql": "^15.5.0",
20
19
  "inquirer": "^8.2.6",
21
20
  "inquirer-autocomplete-prompt": "^2.0.1",
22
21
  "keychain": "^1.5.0",
23
- "keytar": "^7.7.0",
24
22
  "lodash": "^4.17.21",
25
23
  "moment": "^2.30.1",
26
24
  "node-fetch": "^2.6.7",
@@ -28,34 +26,27 @@
28
26
  "openid-client": "^5.6.5",
29
27
  "prettyjson": "^1.2.1",
30
28
  "semver": "^7.5.4",
31
- "tslib": "^1.14.1"
29
+ "tslib": "^2.8.1"
32
30
  },
33
31
  "devDependencies": {
32
+ "@biomejs/biome": "1.9.4",
34
33
  "@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
- "@oclif/test": "^3",
39
- "@types/chai": "^4.2.16",
34
+ "@graphql-codegen/client-preset": "^4.8.0",
35
+ "@oclif/test": "^4.1.12",
40
36
  "@types/inquirer": "^8.2.10",
41
37
  "@types/keychain": "^1.4.4",
42
38
  "@types/lodash": "^4.14.169",
43
- "@types/mocha": "^5.2.7",
44
- "@types/node": "^18.11.9",
39
+ "@types/node": "^22.14.0",
40
+ "@types/prettyjson": "0.0.29",
45
41
  "@types/semver": "^7.3.8",
46
- "@typescript-eslint/eslint-plugin": "^7.0.2",
47
42
  "better-npm-audit": "^3.7.3",
48
- "chai": "^4.3.4",
49
- "eslint-config-oclif": "^5.0.2",
50
- "eslint-config-oclif-typescript": "^3.1.4",
51
- "eslint-plugin-simple-import-sort": "^12.0.0",
52
- "eslint-plugin-unused-imports": "^3.1.0",
53
- "globby": "^10.0.2",
54
- "mocha": "^10.0.0",
43
+ "get-graphql-schema": "^2.1.2",
44
+ "nock": "^14.0.2",
55
45
  "nyc": "^15.1.0",
56
46
  "oclif": "^4.8.0",
57
47
  "ts-node": "^8.10.2",
58
- "typescript": "^5.3.3"
48
+ "typescript": "^5.8.2",
49
+ "vitest": "^3.1.1"
59
50
  },
60
51
  "engines": {
61
52
  "node": ">=18.0.0"
@@ -80,23 +71,26 @@
80
71
  "@oclif/plugin-help",
81
72
  "@oclif/plugin-autocomplete",
82
73
  "@oclif/plugin-version"
83
- ]
74
+ ],
75
+ "macos": {
76
+ "identifier": "dev.opal.cli"
77
+ }
84
78
  },
85
79
  "repository": {
86
80
  "type": "git",
87
81
  "url": "https://github.com/opalsecurity/opal-cli.git"
88
82
  },
89
- "resolutions": {
90
- "agent-base": "^6.0.1",
91
- "ansi-regex": "5.0.1"
92
- },
93
83
  "scripts": {
94
84
  "build": "rm -rf lib && tsc -b",
95
85
  "postpack": "rm -f oclif.manifest.json",
96
- "posttest": "eslint . --ext .ts --config .eslintrc",
97
86
  "prepack": "npm run build && oclif manifest && oclif readme",
98
- "test": "nyc --extension .ts mocha --forbid-only \"test/**/*.test.ts\"",
99
- "version": "oclif readme && git add README.md"
87
+ "test": "vitest",
88
+ "coverage": "vitest run --coverage",
89
+ "version": "oclif readme && git add README.md",
90
+ "posttest": "biome check",
91
+ "biome-ci": "biome ci --reporter=github",
92
+ "gql-codegen": "graphql-codegen",
93
+ "get-gql-schema": "get-graphql-schema http://localhost:3000/query > schema.graphql && biome check --write schema.graphql"
100
94
  },
101
95
  "types": "lib/index.d.ts"
102
96
  }
@@ -1,48 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const core_1 = require("@oclif/core");
4
- const keytar = require("keytar");
5
- const credentials_1 = require("../lib/credentials");
6
- const flags_1 = require("../lib/flags");
7
- const OPAL_KEYTAR_CREDS_KEY = 'opal';
8
- /**
9
- * This command helps users migrate from the old credential store w/ keytar to the new credential store
10
- * It should only be recommended to users on OSX, since keytar does not reliably work on linux/WSL
11
- *
12
- * TODO: delete this after some time has passed, and users have likely migrated their credentials over
13
- */
14
- const removeKeytarCreds = async () => {
15
- const keyContents = await keytar.findCredentials(OPAL_KEYTAR_CREDS_KEY);
16
- keyContents === null || keyContents === void 0 ? void 0 : keyContents.forEach(credential => keytar.deletePassword(OPAL_KEYTAR_CREDS_KEY, credential.account));
17
- };
18
- const getKeytarCreds = async () => {
19
- const keyContents = await keytar.findCredentials(OPAL_KEYTAR_CREDS_KEY);
20
- if (!keyContents[0]) {
21
- return undefined;
22
- }
23
- const { account, password } = keyContents[0];
24
- const parts = account.split('|') || [];
25
- return {
26
- email: parts[0],
27
- organizationID: parts[1],
28
- clientIDCandidate: parts[2],
29
- accessToken: password
30
- };
31
- };
32
- class MigrateCreds extends core_1.Command {
33
- async run() {
34
- const creds = await getKeytarCreds();
35
- if (!creds) {
36
- this.log("No credentials found in system keystore that need to be migrated");
37
- return;
38
- }
39
- (0, credentials_1.setOpalCredentials)(this, creds.email, creds.organizationID, creds.clientIDCandidate, creds.accessToken);
40
- await removeKeytarCreds();
41
- this.log("Successfully migrated credentials from system keystore to new store. You should now be able to use the CLI normally, without re-authenticating");
42
- }
43
- }
44
- MigrateCreds.description = 'Migrates credentials from old keystore to new store. Should only need to be run once';
45
- MigrateCreds.flags = {
46
- help: flags_1.SHARED_FLAGS.help,
47
- };
48
- exports.default = MigrateCreds;