opal-security 3.0.0 → 3.0.1-beta.cbf0332
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 +59 -44
- package/bin/run +1 -1
- package/lib/commands/aws/identity.d.ts +1 -1
- package/lib/commands/aws/identity.js +2 -2
- package/lib/commands/clear-auth-provider.d.ts +1 -1
- package/lib/commands/clear-auth-provider.js +3 -3
- package/lib/commands/curl-example.d.ts +1 -1
- package/lib/commands/curl-example.js +2 -2
- package/lib/commands/iam-roles/start.d.ts +1 -1
- package/lib/commands/iam-roles/start.js +14 -14
- package/lib/commands/kube-roles/start.d.ts +1 -1
- package/lib/commands/kube-roles/start.js +10 -10
- package/lib/commands/login.d.ts +1 -1
- package/lib/commands/login.js +71 -63
- package/lib/commands/logout.d.ts +1 -1
- package/lib/commands/logout.js +3 -3
- package/lib/commands/postgres-instances/start.d.ts +1 -1
- package/lib/commands/postgres-instances/start.js +35 -34
- package/lib/commands/request/create.d.ts +6 -0
- package/lib/commands/request/create.js +34 -0
- package/lib/commands/request/get.d.ts +6 -0
- package/lib/commands/request/get.js +13 -0
- package/lib/commands/request/list.d.ts +7 -0
- package/lib/commands/request/list.js +14 -0
- package/lib/commands/resources/get.d.ts +1 -1
- package/lib/commands/resources/get.js +6 -4
- package/lib/commands/set-auth-provider.d.ts +1 -1
- package/lib/commands/set-auth-provider.js +6 -4
- package/lib/commands/set-custom-header.d.ts +1 -1
- package/lib/commands/set-custom-header.js +5 -3
- package/lib/commands/set-token.d.ts +1 -1
- package/lib/commands/set-token.js +26 -19
- package/lib/commands/set-url.d.ts +1 -1
- package/lib/commands/set-url.js +13 -12
- package/lib/commands/ssh/copyFrom.d.ts +1 -1
- package/lib/commands/ssh/copyFrom.js +13 -13
- package/lib/commands/ssh/copyTo.d.ts +1 -1
- package/lib/commands/ssh/copyTo.js +13 -13
- package/lib/commands/ssh/start.d.ts +1 -1
- package/lib/commands/ssh/start.js +14 -15
- package/lib/graphql/fragment-masking.d.ts +19 -0
- package/lib/graphql/fragment-masking.js +21 -0
- package/lib/graphql/gql.d.ts +36 -0
- package/lib/graphql/gql.js +12 -0
- package/lib/graphql/graphql.d.ts +11413 -0
- package/lib/graphql/graphql.js +1491 -0
- package/lib/graphql/index.d.ts +2 -0
- package/lib/graphql/index.js +5 -0
- package/lib/handler.d.ts +5 -5
- package/lib/handler.js +7 -7
- package/lib/index.d.ts +1 -1
- package/lib/lib/apollo.d.ts +3 -2
- package/lib/lib/apollo.js +59 -46
- package/lib/lib/aws.js +15 -12
- package/lib/lib/cmd.d.ts +4 -6
- package/lib/lib/cmd.js +11 -11
- package/lib/lib/config.js +14 -14
- package/lib/lib/credentials/index.d.ts +1 -1
- package/lib/lib/credentials/index.js +6 -6
- package/lib/lib/credentials/keychain.js +5 -5
- package/lib/lib/credentials/localEncryption.d.ts +2 -2
- package/lib/lib/credentials/localEncryption.js +33 -24
- package/lib/lib/flags.js +9 -9
- package/lib/lib/requests.d.ts +19 -0
- package/lib/lib/requests.js +118 -0
- package/lib/lib/resources.d.ts +2 -2
- package/lib/lib/resources.js +29 -23
- package/lib/lib/sessions.d.ts +2 -2
- package/lib/lib/sessions.js +18 -17
- package/lib/lib/ssh.d.ts +1 -1
- package/lib/lib/ssh.js +8 -8
- package/lib/lib/util.d.ts +0 -1
- package/lib/lib/util.js +13 -13
- package/lib/types.d.ts +1787 -1787
- package/lib/utils/displays.d.ts +4 -0
- package/lib/utils/displays.js +60 -0
- package/lib/utils/utils.d.ts +1 -0
- package/lib/utils/utils.js +18 -0
- package/oclif.manifest.json +70 -3
- package/package.json +25 -29
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { RequestMap } from "../lib/requests";
|
|
2
|
+
export declare function headerMessage(): void;
|
|
3
|
+
export declare function treeifyRequestMap(requestMap: RequestMap): string;
|
|
4
|
+
export declare function displayFinalRequestSummary(requestMap: RequestMap, reason: string, expiration: string): void;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.headerMessage = headerMessage;
|
|
4
|
+
exports.treeifyRequestMap = treeifyRequestMap;
|
|
5
|
+
exports.displayFinalRequestSummary = displayFinalRequestSummary;
|
|
6
|
+
const treeify = require("object-treeify");
|
|
7
|
+
const Table = require("cli-table3");
|
|
8
|
+
const tableStyle = {
|
|
9
|
+
top: "═",
|
|
10
|
+
"top-mid": "╤",
|
|
11
|
+
"top-left": "╔",
|
|
12
|
+
"top-right": "╗",
|
|
13
|
+
bottom: "═",
|
|
14
|
+
"bottom-mid": "╧",
|
|
15
|
+
"bottom-left": "╚",
|
|
16
|
+
"bottom-right": "╝",
|
|
17
|
+
left: "║",
|
|
18
|
+
"left-mid": "╟",
|
|
19
|
+
mid: "─",
|
|
20
|
+
"mid-mid": "┼",
|
|
21
|
+
right: "║",
|
|
22
|
+
"right-mid": "╢",
|
|
23
|
+
middle: "│",
|
|
24
|
+
};
|
|
25
|
+
function headerMessage() {
|
|
26
|
+
console.clear();
|
|
27
|
+
console.log("============================================================");
|
|
28
|
+
console.log("Opal Access Request ✏️");
|
|
29
|
+
console.log("Press Ctrl+C to cancel at any time.\n");
|
|
30
|
+
}
|
|
31
|
+
function treeifyRequestMap(requestMap) {
|
|
32
|
+
const requestTree = {};
|
|
33
|
+
for (const [appName, appNode] of requestMap.entries()) {
|
|
34
|
+
const appKey = `🔧${appName}`;
|
|
35
|
+
requestTree[appKey] = {};
|
|
36
|
+
for (const [assetName, assetNode] of appNode.assets.entries()) {
|
|
37
|
+
const assetKey = `📦${assetName}`;
|
|
38
|
+
if (assetNode.roles !== undefined) {
|
|
39
|
+
requestTree[appKey][assetKey] = {};
|
|
40
|
+
for (const [roleName, _] of assetNode.roles.entries()) {
|
|
41
|
+
requestTree[appKey][assetKey][roleName] = null;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
else {
|
|
45
|
+
requestTree[appKey][assetKey] = null;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
return String(treeify(requestTree));
|
|
50
|
+
}
|
|
51
|
+
function displayFinalRequestSummary(requestMap, reason, expiration) {
|
|
52
|
+
headerMessage();
|
|
53
|
+
console.log("Final Summary of Request\n");
|
|
54
|
+
const requestedAssets = treeifyRequestMap(requestMap);
|
|
55
|
+
const table = new Table({
|
|
56
|
+
chars: tableStyle,
|
|
57
|
+
});
|
|
58
|
+
table.push(["Requested Assets", requestedAssets], ["Reason", reason], ["Expiration", expiration]);
|
|
59
|
+
console.log(table.toString());
|
|
60
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function restrictToDev(): void;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.restrictToDev = restrictToDev;
|
|
4
|
+
/*
|
|
5
|
+
Use restrictToDev function in the run functions of commands still in development-
|
|
6
|
+
|
|
7
|
+
static hidden = true; # Use this in tandem with restrictToDev function to hide from help menu.
|
|
8
|
+
async run() {
|
|
9
|
+
restrictToDev();
|
|
10
|
+
...
|
|
11
|
+
}
|
|
12
|
+
*/
|
|
13
|
+
function restrictToDev() {
|
|
14
|
+
if (process.env.NODE_ENV !== "development") {
|
|
15
|
+
console.error("Command still under development. Please look out for product announcements for official release.");
|
|
16
|
+
process.exit(1);
|
|
17
|
+
}
|
|
18
|
+
}
|
package/oclif.manifest.json
CHANGED
|
@@ -527,12 +527,11 @@
|
|
|
527
527
|
"type": "boolean"
|
|
528
528
|
},
|
|
529
529
|
"action": {
|
|
530
|
-
"description": "Method of connecting to the database.\n-
|
|
530
|
+
"description": "Method of connecting to the database.\n- psql: Start psql session in shell\n- view: View connection configuration details",
|
|
531
531
|
"name": "action",
|
|
532
532
|
"hasDynamicHelp": false,
|
|
533
533
|
"multiple": false,
|
|
534
534
|
"options": [
|
|
535
|
-
"open",
|
|
536
535
|
"psql",
|
|
537
536
|
"view"
|
|
538
537
|
],
|
|
@@ -555,6 +554,74 @@
|
|
|
555
554
|
"start.js"
|
|
556
555
|
]
|
|
557
556
|
},
|
|
557
|
+
"request:create": {
|
|
558
|
+
"aliases": [],
|
|
559
|
+
"args": {},
|
|
560
|
+
"description": "Opens an Opal access request",
|
|
561
|
+
"flags": {},
|
|
562
|
+
"hasDynamicHelp": false,
|
|
563
|
+
"hidden": true,
|
|
564
|
+
"hiddenAliases": [],
|
|
565
|
+
"id": "request:create",
|
|
566
|
+
"pluginAlias": "opal-security",
|
|
567
|
+
"pluginName": "opal-security",
|
|
568
|
+
"pluginType": "core",
|
|
569
|
+
"strict": true,
|
|
570
|
+
"enableJsonFlag": false,
|
|
571
|
+
"isESM": false,
|
|
572
|
+
"relativePath": [
|
|
573
|
+
"lib",
|
|
574
|
+
"commands",
|
|
575
|
+
"request",
|
|
576
|
+
"create.js"
|
|
577
|
+
]
|
|
578
|
+
},
|
|
579
|
+
"request:get": {
|
|
580
|
+
"aliases": [],
|
|
581
|
+
"args": {},
|
|
582
|
+
"description": "Lists access requests",
|
|
583
|
+
"flags": {},
|
|
584
|
+
"hasDynamicHelp": false,
|
|
585
|
+
"hidden": true,
|
|
586
|
+
"hiddenAliases": [],
|
|
587
|
+
"id": "request:get",
|
|
588
|
+
"pluginAlias": "opal-security",
|
|
589
|
+
"pluginName": "opal-security",
|
|
590
|
+
"pluginType": "core",
|
|
591
|
+
"strict": true,
|
|
592
|
+
"enableJsonFlag": false,
|
|
593
|
+
"isESM": false,
|
|
594
|
+
"relativePath": [
|
|
595
|
+
"lib",
|
|
596
|
+
"commands",
|
|
597
|
+
"request",
|
|
598
|
+
"get.js"
|
|
599
|
+
]
|
|
600
|
+
},
|
|
601
|
+
"request:list": {
|
|
602
|
+
"aliases": [
|
|
603
|
+
"request:ls"
|
|
604
|
+
],
|
|
605
|
+
"args": {},
|
|
606
|
+
"description": "Lists access requests",
|
|
607
|
+
"flags": {},
|
|
608
|
+
"hasDynamicHelp": false,
|
|
609
|
+
"hidden": true,
|
|
610
|
+
"hiddenAliases": [],
|
|
611
|
+
"id": "request:list",
|
|
612
|
+
"pluginAlias": "opal-security",
|
|
613
|
+
"pluginName": "opal-security",
|
|
614
|
+
"pluginType": "core",
|
|
615
|
+
"strict": true,
|
|
616
|
+
"enableJsonFlag": false,
|
|
617
|
+
"isESM": false,
|
|
618
|
+
"relativePath": [
|
|
619
|
+
"lib",
|
|
620
|
+
"commands",
|
|
621
|
+
"request",
|
|
622
|
+
"list.js"
|
|
623
|
+
]
|
|
624
|
+
},
|
|
558
625
|
"resources:get": {
|
|
559
626
|
"aliases": [],
|
|
560
627
|
"args": {},
|
|
@@ -802,5 +869,5 @@
|
|
|
802
869
|
]
|
|
803
870
|
}
|
|
804
871
|
},
|
|
805
|
-
"version": "3.0.
|
|
872
|
+
"version": "3.0.1-beta.cbf0332"
|
|
806
873
|
}
|
package/package.json
CHANGED
|
@@ -1,26 +1,25 @@
|
|
|
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.0.
|
|
4
|
+
"version": "3.0.1-beta.cbf0332",
|
|
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.
|
|
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",
|
|
18
|
+
"cli-table3": "^0.6.5",
|
|
19
19
|
"graphql": "^15.5.0",
|
|
20
20
|
"inquirer": "^8.2.6",
|
|
21
21
|
"inquirer-autocomplete-prompt": "^2.0.1",
|
|
22
22
|
"keychain": "^1.5.0",
|
|
23
|
-
"keytar": "^7.7.0",
|
|
24
23
|
"lodash": "^4.17.21",
|
|
25
24
|
"moment": "^2.30.1",
|
|
26
25
|
"node-fetch": "^2.6.7",
|
|
@@ -28,34 +27,27 @@
|
|
|
28
27
|
"openid-client": "^5.6.5",
|
|
29
28
|
"prettyjson": "^1.2.1",
|
|
30
29
|
"semver": "^7.5.4",
|
|
31
|
-
"tslib": "^
|
|
30
|
+
"tslib": "^2.8.1"
|
|
32
31
|
},
|
|
33
32
|
"devDependencies": {
|
|
33
|
+
"@biomejs/biome": "1.9.4",
|
|
34
34
|
"@graphql-codegen/cli": "^5.0.2",
|
|
35
|
-
"@graphql-codegen/
|
|
36
|
-
"@
|
|
37
|
-
"@graphql-codegen/typescript-oclif": "^3.0.0",
|
|
38
|
-
"@oclif/test": "^3",
|
|
39
|
-
"@types/chai": "^4.2.16",
|
|
35
|
+
"@graphql-codegen/client-preset": "^4.8.0",
|
|
36
|
+
"@oclif/test": "^4.1.12",
|
|
40
37
|
"@types/inquirer": "^8.2.10",
|
|
41
38
|
"@types/keychain": "^1.4.4",
|
|
42
39
|
"@types/lodash": "^4.14.169",
|
|
43
|
-
"@types/
|
|
44
|
-
"@types/
|
|
40
|
+
"@types/node": "^22.14.0",
|
|
41
|
+
"@types/prettyjson": "0.0.29",
|
|
45
42
|
"@types/semver": "^7.3.8",
|
|
46
|
-
"@typescript-eslint/eslint-plugin": "^7.0.2",
|
|
47
43
|
"better-npm-audit": "^3.7.3",
|
|
48
|
-
"
|
|
49
|
-
"
|
|
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",
|
|
44
|
+
"get-graphql-schema": "^2.1.2",
|
|
45
|
+
"nock": "^14.0.2",
|
|
55
46
|
"nyc": "^15.1.0",
|
|
56
47
|
"oclif": "^4.8.0",
|
|
57
48
|
"ts-node": "^8.10.2",
|
|
58
|
-
"typescript": "^5.
|
|
49
|
+
"typescript": "^5.8.2",
|
|
50
|
+
"vitest": "^3.1.1"
|
|
59
51
|
},
|
|
60
52
|
"engines": {
|
|
61
53
|
"node": ">=18.0.0"
|
|
@@ -80,23 +72,27 @@
|
|
|
80
72
|
"@oclif/plugin-help",
|
|
81
73
|
"@oclif/plugin-autocomplete",
|
|
82
74
|
"@oclif/plugin-version"
|
|
83
|
-
]
|
|
75
|
+
],
|
|
76
|
+
"macos": {
|
|
77
|
+
"identifier": "dev.opal.cli"
|
|
78
|
+
},
|
|
79
|
+
"topicSeparator": " "
|
|
84
80
|
},
|
|
85
81
|
"repository": {
|
|
86
82
|
"type": "git",
|
|
87
83
|
"url": "https://github.com/opalsecurity/opal-cli.git"
|
|
88
84
|
},
|
|
89
|
-
"resolutions": {
|
|
90
|
-
"agent-base": "^6.0.1",
|
|
91
|
-
"ansi-regex": "5.0.1"
|
|
92
|
-
},
|
|
93
85
|
"scripts": {
|
|
94
86
|
"build": "rm -rf lib && tsc -b",
|
|
95
87
|
"postpack": "rm -f oclif.manifest.json",
|
|
96
|
-
"posttest": "eslint . --ext .ts --config .eslintrc",
|
|
97
88
|
"prepack": "npm run build && oclif manifest && oclif readme",
|
|
98
|
-
"test": "
|
|
99
|
-
"
|
|
89
|
+
"test": "vitest",
|
|
90
|
+
"coverage": "vitest run --coverage",
|
|
91
|
+
"version": "oclif readme && git add README.md",
|
|
92
|
+
"posttest": "biome check",
|
|
93
|
+
"biome-ci": "biome ci --reporter=github",
|
|
94
|
+
"gql-codegen": "graphql-codegen",
|
|
95
|
+
"get-gql-schema": "get-graphql-schema http://localhost:3000/query > schema.graphql && biome check --write schema.graphql"
|
|
100
96
|
},
|
|
101
97
|
"types": "lib/index.d.ts"
|
|
102
98
|
}
|