@p0security/cli 0.11.3 → 0.12.0
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/dist/commands/__tests__/login.test.js +34 -13
- package/dist/commands/__tests__/login.test.js.map +1 -1
- package/dist/commands/__tests__/ssh.test.js +23 -15
- package/dist/commands/__tests__/ssh.test.js.map +1 -1
- package/dist/commands/allow.js +1 -1
- package/dist/commands/allow.js.map +1 -1
- package/dist/commands/aws/role.js +2 -2
- package/dist/commands/aws/role.js.map +1 -1
- package/dist/commands/grant.js +1 -1
- package/dist/commands/grant.js.map +1 -1
- package/dist/commands/index.js +2 -0
- package/dist/commands/index.js.map +1 -1
- package/dist/commands/kubeconfig.js +1 -1
- package/dist/commands/kubeconfig.js.map +1 -1
- package/dist/commands/login.js +10 -5
- package/dist/commands/login.js.map +1 -1
- package/dist/commands/ls.js +3 -4
- package/dist/commands/ls.js.map +1 -1
- package/dist/commands/request.js +1 -1
- package/dist/commands/request.js.map +1 -1
- package/dist/commands/scp.js +1 -1
- package/dist/commands/scp.js.map +1 -1
- package/dist/commands/shared/request.d.ts +1 -0
- package/dist/commands/shared/request.js +9 -1
- package/dist/commands/shared/request.js.map +1 -1
- package/dist/commands/shared/ssh.js +11 -7
- package/dist/commands/shared/ssh.js.map +1 -1
- package/dist/commands/ssh-keygen.d.ts +2 -0
- package/dist/commands/ssh-keygen.js +28 -0
- package/dist/commands/ssh-keygen.js.map +1 -0
- package/dist/commands/ssh.js +1 -1
- package/dist/commands/ssh.js.map +1 -1
- package/dist/common/install.d.ts +3 -0
- package/dist/common/install.js +12 -1
- package/dist/common/install.js.map +1 -1
- package/dist/common/keys.d.ts +1 -0
- package/dist/common/keys.js +4 -3
- package/dist/common/keys.js.map +1 -1
- package/dist/drivers/api.d.ts +10 -0
- package/dist/drivers/api.js +2 -12
- package/dist/drivers/api.js.map +1 -1
- package/dist/drivers/auth.d.ts +1 -4
- package/dist/drivers/auth.js +5 -21
- package/dist/drivers/auth.js.map +1 -1
- package/dist/drivers/config.d.ts +15 -0
- package/dist/drivers/config.js +53 -0
- package/dist/drivers/config.js.map +1 -0
- package/dist/drivers/env.d.ts +1 -1
- package/dist/drivers/env.js +2 -2
- package/dist/drivers/env.js.map +1 -1
- package/dist/drivers/firestore.d.ts +16 -3
- package/dist/drivers/firestore.js +52 -22
- package/dist/drivers/firestore.js.map +1 -1
- package/dist/plugins/aws/ssh.js +4 -4
- package/dist/plugins/aws/ssh.js.map +1 -1
- package/dist/plugins/aws/types.d.ts +15 -15
- package/dist/plugins/azure/install.d.ts +1 -0
- package/dist/plugins/azure/install.js +33 -0
- package/dist/plugins/azure/install.js.map +1 -0
- package/dist/plugins/azure/ssh.d.ts +15 -0
- package/dist/plugins/azure/ssh.js +58 -0
- package/dist/plugins/azure/ssh.js.map +1 -0
- package/dist/plugins/azure/types.d.ts +41 -0
- package/dist/plugins/azure/types.js +3 -0
- package/dist/plugins/azure/types.js.map +1 -0
- package/dist/plugins/google/login.js +6 -4
- package/dist/plugins/google/login.js.map +1 -1
- package/dist/plugins/google/ssh.js +4 -4
- package/dist/plugins/google/ssh.js.map +1 -1
- package/dist/plugins/google/types.d.ts +5 -6
- package/dist/public/favicon.ico +0 -0
- package/dist/types/org.d.ts +3 -0
- package/dist/types/org.js +0 -10
- package/dist/types/org.js.map +1 -1
- package/dist/types/request.d.ts +3 -1
- package/dist/types/ssh.d.ts +5 -4
- package/dist/types/ssh.js +1 -1
- package/dist/types/ssh.js.map +1 -1
- package/dist/util.js +3 -1
- package/dist/util.js.map +1 -1
- package/package.json +2 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ssh-keygen.js","sourceRoot":"","sources":["../../src/commands/ssh-keygen.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA;;;;;;;;;GASG;AACH,yCAA8D;AAGvD,MAAM,gBAAgB,GAAG,CAAC,KAAiB,EAAE,EAAE,CACpD,KAAK,CAAC,OAAO,CACX,YAAY,EACZ,iEAAiE,oBAAa,8HAA8H,EAC5M,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,EAChB,GAAS,EAAE;IACT,MAAM,IAAA,oBAAa,GAAE,CAAC;AACxB,CAAC,CAAA,CACF,CAAC;AARS,QAAA,gBAAgB,oBAQzB"}
|
package/dist/commands/ssh.js
CHANGED
|
@@ -70,7 +70,7 @@ const sshCommand = (yargs) => yargs.command("ssh <destination> [command [argumen
|
|
|
70
70
|
Flags and positionals passed to the underlying ssh implementation.
|
|
71
71
|
The '--' argument must be specified between P0-specific args on the left and SSH_ARGS on the right. Example;
|
|
72
72
|
|
|
73
|
-
$ p0 ssh example-instance --provider gcloud -- -NR '*:8080:localhost:8088' -o 'GatewayPorts yes'`), (0, firestore_1.
|
|
73
|
+
$ p0 ssh example-instance --provider gcloud -- -NR '*:8080:localhost:8088' -o 'GatewayPorts yes'`), (0, firestore_1.fsShutdownGuard)(sshAction));
|
|
74
74
|
exports.sshCommand = sshCommand;
|
|
75
75
|
/** Connect to an SSH backend
|
|
76
76
|
*
|
package/dist/commands/ssh.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ssh.js","sourceRoot":"","sources":["../../src/commands/ssh.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA;;;;;;;;;GASG;AACH,0CAA+C;AAC/C,
|
|
1
|
+
{"version":3,"file":"ssh.js","sourceRoot":"","sources":["../../src/commands/ssh.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA;;;;;;;;;GASG;AACH,0CAA+C;AAC/C,oDAAuD;AACvD,wCAA0C;AAC1C,sCAA8D;AAGvD,MAAM,UAAU,GAAG,CAAC,KAAiB,EAAE,EAAE,CAC9C,KAAK,CAAC,OAAO,CACX,2CAA2C,EAC3C,4BAA4B,EAC5B,CAAC,KAAK,EAAE,EAAE,CACR,KAAK;KACF,UAAU,CAAC,aAAa,EAAE;IACzB,IAAI,EAAE,QAAQ;IACd,YAAY,EAAE,IAAI;CAC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AC,IAAI,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC;QACxB,CAAC,CAAC,EAAE,CAAC;IACP,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;IAE7B,MAAM,EAAE,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,GAAG,MAAM,IAAA,oBAAc,EAC/D,KAAK,EACL,IAAI,EACJ,IAAI,CAAC,WAAW,CACjB,CAAC;IAEF,MAAM,IAAA,cAAQ,EAAC;QACb,KAAK;QACL,OAAO;QACP,OAAO,EAAE,IAAI;QACb,UAAU;QACV,WAAW;KACZ,CAAC,CAAC;AACL,CAAC,CAAA,CAAC"}
|
package/dist/common/install.d.ts
CHANGED
|
@@ -2,10 +2,13 @@ export declare const SupportedPlatforms: readonly ["darwin"];
|
|
|
2
2
|
export type SupportedPlatform = (typeof SupportedPlatforms)[number];
|
|
3
3
|
export declare const AwsItems: readonly ["aws"];
|
|
4
4
|
export type AwsItem = (typeof AwsItems)[number];
|
|
5
|
+
export declare const HomebrewItems: readonly ["brew"];
|
|
6
|
+
export type HomebrewItem = (typeof HomebrewItems)[number];
|
|
5
7
|
export type InstallMetadata = {
|
|
6
8
|
label: string;
|
|
7
9
|
commands: Record<SupportedPlatform, Readonly<string[]>>;
|
|
8
10
|
};
|
|
9
11
|
export declare const AwsInstall: Readonly<Record<AwsItem, InstallMetadata>>;
|
|
12
|
+
export declare const HomebrewInstall: Readonly<Record<HomebrewItem, InstallMetadata>>;
|
|
10
13
|
export declare const guidedInstall: <T extends string, U extends Readonly<Record<T, InstallMetadata>>>(platform: SupportedPlatform, item: T, installData: U) => Promise<void>;
|
|
11
14
|
export declare const ensureInstall: <T extends string, U extends Readonly<Record<T, InstallMetadata>>>(installItems: readonly T[], installData: U) => Promise<boolean>;
|
package/dist/common/install.js
CHANGED
|
@@ -12,7 +12,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
12
12
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
13
|
};
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
exports.ensureInstall = exports.guidedInstall = exports.AwsInstall = exports.AwsItems = exports.SupportedPlatforms = void 0;
|
|
15
|
+
exports.ensureInstall = exports.guidedInstall = exports.HomebrewInstall = exports.AwsInstall = exports.HomebrewItems = exports.AwsItems = exports.SupportedPlatforms = void 0;
|
|
16
16
|
/** Copyright © 2024-present P0 Security
|
|
17
17
|
|
|
18
18
|
This file is part of @p0security/cli
|
|
@@ -32,6 +32,7 @@ const typescript_1 = require("typescript");
|
|
|
32
32
|
const which_1 = __importDefault(require("which"));
|
|
33
33
|
exports.SupportedPlatforms = ["darwin"];
|
|
34
34
|
exports.AwsItems = ["aws"];
|
|
35
|
+
exports.HomebrewItems = ["brew"];
|
|
35
36
|
exports.AwsInstall = {
|
|
36
37
|
aws: {
|
|
37
38
|
label: "AWS CLI v2",
|
|
@@ -44,6 +45,16 @@ exports.AwsInstall = {
|
|
|
44
45
|
},
|
|
45
46
|
},
|
|
46
47
|
};
|
|
48
|
+
exports.HomebrewInstall = {
|
|
49
|
+
brew: {
|
|
50
|
+
label: "Homebrew",
|
|
51
|
+
commands: {
|
|
52
|
+
darwin: [
|
|
53
|
+
'/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"',
|
|
54
|
+
],
|
|
55
|
+
},
|
|
56
|
+
},
|
|
57
|
+
};
|
|
47
58
|
const printToInstall = (toInstall, installMetadata) => {
|
|
48
59
|
(0, stdio_1.print2)("The following items must be installed on your system to continue:");
|
|
49
60
|
for (const item of toInstall) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"install.js","sourceRoot":"","sources":["../../src/common/install.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA;;;;;;;;;GASG;AACH,4CAAkD;AAClD,oCAA+B;AAC/B,mCAAiC;AACjC,2DAA2C;AAC3C,sDAAyB;AACzB,2CAAiC;AACjC,kDAA0B;AAEb,QA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MAAM,IAAI,IAAI,SAAS,EAAE;QAC5B,IAAI,WAAW;YAAE,MAAM,IAAA,qBAAa,EAAC,QAAQ,EAAE,IAAI,EAAE,WAAW,CAAC,CAAC;;YAC7D,oBAAoB,CAAC,QAAQ,EAAE,IAAI,EAAE,WAAW,CAAC,CAAC;KACxD;IAED,MAAM,SAAS,GAAG,MAAM,gBAAgB,CAAC,YAAY,CAAC,CAAC;IAEvD,IAAI,SAAS,CAAC,MAAM,KAAK,CAAC,EAAE;QAC1B,IAAA,cAAM,EAAC,qCAAqC,CAAC,CAAC;QAC9C,OAAO,IAAI,CAAC;KACb;IACD,OAAO,KAAK,CAAC;AACf,CAAC,CAAA,CAAC;AAtCW,QAAA,aAAa,iBAsCxB"}
|
package/dist/common/keys.d.ts
CHANGED
package/dist/common/keys.js
CHANGED
|
@@ -35,7 +35,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
35
35
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
36
36
|
};
|
|
37
37
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
38
|
-
exports.createKeyPair = exports.PRIVATE_KEY_PATH = exports.PUBLIC_KEY_PATH = void 0;
|
|
38
|
+
exports.createKeyPair = exports.PRIVATE_KEY_PATH = exports.PUBLIC_KEY_PATH = exports.P0_KEY_FOLDER = void 0;
|
|
39
39
|
/** Copyright © 2024-present P0 Security
|
|
40
40
|
|
|
41
41
|
This file is part of @p0security/cli
|
|
@@ -50,8 +50,9 @@ const util_1 = require("../util");
|
|
|
50
50
|
const fs = __importStar(require("fs/promises"));
|
|
51
51
|
const node_forge_1 = __importDefault(require("node-forge"));
|
|
52
52
|
const path = __importStar(require("path"));
|
|
53
|
-
exports.
|
|
54
|
-
exports.
|
|
53
|
+
exports.P0_KEY_FOLDER = path.join(util_1.P0_PATH, "ssh");
|
|
54
|
+
exports.PUBLIC_KEY_PATH = path.join(exports.P0_KEY_FOLDER, "id_rsa.pub");
|
|
55
|
+
exports.PRIVATE_KEY_PATH = path.join(exports.P0_KEY_FOLDER, "id_rsa");
|
|
55
56
|
/**
|
|
56
57
|
* Search for a cached key pair, or create a new one if not found
|
|
57
58
|
*/
|
package/dist/common/keys.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"keys.js","sourceRoot":"","sources":["../../src/common/keys.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;GASG;AACH,kCAAkC;AAClC,gDAAkC;AAClC,4DAA+B;AAC/B,2CAA6B;AAEhB,QAAA,
|
|
1
|
+
{"version":3,"file":"keys.js","sourceRoot":"","sources":["../../src/common/keys.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;GASG;AACH,kCAAkC;AAClC,gDAAkC;AAClC,4DAA+B;AAC/B,2CAA6B;AAEhB,QAAA,aAAa,GAAG,IAAI,CAAC,IAAI,CAAC,cAAO,EAAE,KAAK,CAAC,CAAC;AAC1C,QAAA,eAAe,GAAG,IAAI,CAAC,IAAI,CAAC,qBAAa,EAAE,YAAY,CAAC,CAAC;AACzD,QAAA,gBAAgB,GAAG,IAAI,CAAC,IAAI,CAAC,qBAAa,EAAE,QAAQ,CAAC,CAAC;AAEnE;;GAEG;AACI,MAAM,aAAa,GAAG,GAG1B,EAAE;IACH,IACE,CAAC,MAAM,UAAU,CAAC,uBAAe,CAAC,CAAC;QACnC,CAAC,MAAM,UAAU,CAAC,wBAAgB,CAAC,CAAC,EACpC;QACA,MAAM,SAAS,GAAG,MAAM,EAAE,CAAC,QAAQ,CAAC,uBAAe,EAAE,MAAM,CAAC,CAAC;QAC7D,MAAM,UAAU,GAAG,MAAM,EAAE,CAAC,QAAQ,CAAC,wBAAgB,EAAE,MAAM,CAAC,CAAC;QAE/D,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,CAAC;KAClC;SAAM;QACL,MAAM,UAAU,GAAG,oBAAK,CAAC,GAAG,CAAC,GAAG,CAAC,eAAe,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;QACjE,MAAM,UAAU,GAAG,oBAAK,CAAC,GAAG,CAAC,eAAe,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC;QACpE,MAAM,SAAS,GAAG,oBAAK,CAAC,GAAG,CAAC,kBAAkB,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC;QAErE,MAAM,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,uBAAe,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;QACnE,MAAM,EAAE,CAAC,SAAS,CAAC,uBAAe,EAAE,SAAS,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC;QAChE,MAAM,EAAE,CAAC,SAAS,CAAC,wBAAgB,EAAE,UAAU,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC;QAClE,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,CAAC;KAClC;AACH,CAAC,CAAA,CAAC;AAtBW,QAAA,aAAa,iBAsBxB;AAEF,MAAM,UAAU,GAAG,CAAO,IAAY,EAAE,EAAE;IACxC,IAAI;QACF,MAAM,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;QACtB,OAAO,IAAI,CAAC;KACb;IAAC,OAAO,KAAK,EAAE;QACd,OAAO,KAAK,CAAC;KACd;AACH,CAAC,CAAA,CAAC"}
|
package/dist/drivers/api.d.ts
CHANGED
|
@@ -1,3 +1,13 @@
|
|
|
1
|
+
/** Copyright © 2024-present P0 Security
|
|
2
|
+
|
|
3
|
+
This file is part of @p0security/cli
|
|
4
|
+
|
|
5
|
+
@p0security/cli is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 3 of the License.
|
|
6
|
+
|
|
7
|
+
@p0security/cli is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
|
8
|
+
|
|
9
|
+
You should have received a copy of the GNU General Public License along with @p0security/cli. If not, see <https://www.gnu.org/licenses/>.
|
|
10
|
+
**/
|
|
1
11
|
import { Authn } from "../types/identity";
|
|
2
12
|
import yargs from "yargs";
|
|
3
13
|
export declare const fetchCommand: <T>(authn: Authn, args: yargs.ArgumentsCamelCase, argv: string[]) => Promise<T>;
|
package/dist/drivers/api.js
CHANGED
|
@@ -33,19 +33,9 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
33
33
|
};
|
|
34
34
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
35
35
|
exports.baseFetch = exports.fetchCommand = void 0;
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
This file is part of @p0security/cli
|
|
39
|
-
|
|
40
|
-
@p0security/cli is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 3 of the License.
|
|
41
|
-
|
|
42
|
-
@p0security/cli is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
|
43
|
-
|
|
44
|
-
You should have received a copy of the GNU General Public License along with @p0security/cli. If not, see <https://www.gnu.org/licenses/>.
|
|
45
|
-
**/
|
|
46
|
-
const env_1 = require("../drivers/env");
|
|
36
|
+
const config_1 = require("./config");
|
|
47
37
|
const path = __importStar(require("node:path"));
|
|
48
|
-
const tenantUrl = (tenant) => `${
|
|
38
|
+
const tenantUrl = (tenant) => `${(0, config_1.getTenantConfig)().appUrl}/o/${tenant}`;
|
|
49
39
|
const commandUrl = (tenant) => `${tenantUrl(tenant)}/command/`;
|
|
50
40
|
const fetchCommand = (authn, args, argv) => __awaiter(void 0, void 0, void 0, function* () {
|
|
51
41
|
return (0, exports.baseFetch)(authn, commandUrl(authn.identity.org.slug), "POST", JSON.stringify({
|
package/dist/drivers/api.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api.js","sourceRoot":"","sources":["../../src/drivers/api.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"api.js","sourceRoot":"","sources":["../../src/drivers/api.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAWA,qCAA2C;AAC3C,gDAAkC;AAGlC,MAAM,SAAS,GAAG,CAAC,MAAc,EAAE,EAAE,CAAC,GAAG,IAAA,wBAAe,GAAE,CAAC,MAAM,MAAM,MAAM,EAAE,CAAC;AAChF,MAAM,UAAU,GAAG,CAAC,MAAc,EAAE,EAAE,CAAC,GAAG,SAAS,CAAC,MAAM,CAAC,WAAW,CAAC;AAEhE,MAAM,YAAY,GAAG,CAC1B,KAAY,EACZ,IAA8B,EAC9B,IAAc,EACd,EAAE;IACF,OAAA,IAAA,iBAAS,EACP,KAAK,EACL,UAAU,CAAC,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,EACnC,MAAM,EACN,IAAI,CAAC,SAAS,CAAC;QACb,IAAI;QACJ,UAAU,EAAE,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC;KACnC,CAAC,CACH,CAAA;EAAA,CAAC;AAbS,QAAA,YAAY,gBAarB;AAEG,MAAM,SAAS,GAAG,CACvB,KAAY,EACZ,GAAW,EACX,MAAc,EACd,IAAY,EACZ,EAAE;IACF,MAAM,KAAK,GAAG,MAAM,KAAK,CAAC,cAAc,CAAC,IAAI,CAAC,UAAU,EAAE,CAAC;IAE3D,IAAI;QACF,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,GAAG,EAAE;YAChC,MAAM;YACN,OAAO,EAAE;gBACP,aAAa,EAAE,UAAU,KAAK,EAAE;gBAChC,cAAc,EAAE,kBAAkB;aACnC;YACD,IAAI;SACL,CAAC,CAAC;QACH,MAAM,IAAI,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC;QACnC,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QAC9B,IAAI,OAAO,IAAI,IAAI,EAAE;YACnB,MAAM,IAAI,CAAC,KAAK,CAAC;SAClB;QACD,OAAO,IAAS,CAAC;KAClB;IAAC,OAAO,KAAK,EAAE;QACd,IAAI,KAAK,YAAY,SAAS,IAAI,KAAK,CAAC,OAAO,KAAK,cAAc,EAAE;YAClE,MAAM,gDAAgD,GAAG,GAAG,CAAC;SAC9D;aAAM;YACL,MAAM,KAAK,CAAC;SACb;KACF;AACH,CAAC,CAAA,CAAC;AA9BW,QAAA,SAAS,aA8BpB"}
|
package/dist/drivers/auth.d.ts
CHANGED
|
@@ -1,12 +1,9 @@
|
|
|
1
|
-
import { Authn
|
|
1
|
+
import { Authn } from "../types/identity";
|
|
2
2
|
export declare const IDENTITY_FILE_PATH: string;
|
|
3
3
|
export declare const IDENTITY_CACHE_PATH: string;
|
|
4
4
|
export declare const cached: <T>(name: string, loader: () => Promise<T>, options: {
|
|
5
5
|
duration: number;
|
|
6
6
|
}, hasExpired?: ((data: T) => boolean) | undefined) => Promise<T>;
|
|
7
|
-
export declare const loadCredentials: (options?: {
|
|
8
|
-
noRefresh?: boolean;
|
|
9
|
-
}) => Promise<Identity>;
|
|
10
7
|
export declare const authenticate: (options?: {
|
|
11
8
|
noRefresh?: boolean;
|
|
12
9
|
}) => Promise<Authn>;
|
package/dist/drivers/auth.js
CHANGED
|
@@ -32,7 +32,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
32
32
|
});
|
|
33
33
|
};
|
|
34
34
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
35
|
-
exports.authenticate = exports.
|
|
35
|
+
exports.authenticate = exports.cached = exports.IDENTITY_CACHE_PATH = exports.IDENTITY_FILE_PATH = void 0;
|
|
36
36
|
/** Copyright © 2024-present P0 Security
|
|
37
37
|
|
|
38
38
|
This file is part of @p0security/cli
|
|
@@ -47,7 +47,6 @@ const login_1 = require("../commands/login");
|
|
|
47
47
|
const util_1 = require("../util");
|
|
48
48
|
const firestore_1 = require("./firestore");
|
|
49
49
|
const stdio_1 = require("./stdio");
|
|
50
|
-
const auth_1 = require("firebase/auth");
|
|
51
50
|
const fs = __importStar(require("fs/promises"));
|
|
52
51
|
const path = __importStar(require("path"));
|
|
53
52
|
exports.IDENTITY_FILE_PATH = path.join(util_1.P0_PATH, "identity.json");
|
|
@@ -88,7 +87,7 @@ const cached = (name, loader, options, hasExpired) => __awaiter(void 0, void 0,
|
|
|
88
87
|
}
|
|
89
88
|
});
|
|
90
89
|
exports.cached = cached;
|
|
91
|
-
const
|
|
90
|
+
const loadCredentialsWithAutoLogin = (options) => __awaiter(void 0, void 0, void 0, function* () {
|
|
92
91
|
try {
|
|
93
92
|
const buffer = yield fs.readFile(exports.IDENTITY_FILE_PATH);
|
|
94
93
|
const identity = JSON.parse(buffer.toString());
|
|
@@ -96,7 +95,7 @@ const loadCredentials = (options) => __awaiter(void 0, void 0, void 0, function*
|
|
|
96
95
|
identity.credential.expires_at < Date.now() * 1e-3) {
|
|
97
96
|
yield (0, login_1.login)({ org: identity.org.slug }, { skipAuthenticate: true });
|
|
98
97
|
(0, stdio_1.print2)("\u200B"); // Force a new line
|
|
99
|
-
return (
|
|
98
|
+
return loadCredentialsWithAutoLogin({ noRefresh: true });
|
|
100
99
|
}
|
|
101
100
|
return identity;
|
|
102
101
|
}
|
|
@@ -107,24 +106,9 @@ const loadCredentials = (options) => __awaiter(void 0, void 0, void 0, function*
|
|
|
107
106
|
throw error;
|
|
108
107
|
}
|
|
109
108
|
});
|
|
110
|
-
exports.loadCredentials = loadCredentials;
|
|
111
109
|
const authenticate = (options) => __awaiter(void 0, void 0, void 0, function* () {
|
|
112
|
-
|
|
113
|
-
const
|
|
114
|
-
const { credential } = identity;
|
|
115
|
-
// TODO: Move to map lookup
|
|
116
|
-
const provider = new auth_1.OAuthProvider(identity.org.ssoProvider === "google"
|
|
117
|
-
? auth_1.SignInMethod.GOOGLE
|
|
118
|
-
: identity.org.providerId);
|
|
119
|
-
const firebaseCredential = provider.credential({
|
|
120
|
-
accessToken: credential.access_token,
|
|
121
|
-
idToken: credential.id_token,
|
|
122
|
-
});
|
|
123
|
-
firestore_1.auth.tenantId = identity.org.tenantId;
|
|
124
|
-
const userCredential = yield (0, auth_1.signInWithCredential)(firestore_1.auth, firebaseCredential);
|
|
125
|
-
if (!((_b = userCredential === null || userCredential === void 0 ? void 0 : userCredential.user) === null || _b === void 0 ? void 0 : _b.email)) {
|
|
126
|
-
throw "Can not sign in: this user has previously signed in with a different identity provider.\nPlease contact support@p0.dev to enable this user.";
|
|
127
|
-
}
|
|
110
|
+
const identity = yield loadCredentialsWithAutoLogin(options);
|
|
111
|
+
const userCredential = yield (0, firestore_1.authenticateToFirebase)(identity);
|
|
128
112
|
return { userCredential, identity };
|
|
129
113
|
});
|
|
130
114
|
exports.authenticate = authenticate;
|
package/dist/drivers/auth.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth.js","sourceRoot":"","sources":["../../src/drivers/auth.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;GASG;AACH,6CAA0C;AAE1C,kCAAkC;AAClC,
|
|
1
|
+
{"version":3,"file":"auth.js","sourceRoot":"","sources":["../../src/drivers/auth.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;GASG;AACH,6CAA0C;AAE1C,kCAAkC;AAClC,2CAAqD;AACrD,mCAAiC;AACjC,gDAAkC;AAClC,2CAA6B;AAEhB,QAAA,kBAAkB,GAAG,IAAI,CAAC,IAAI,CAAC,cAAO,EAAE,eAAe,CAAC,CAAC;AACzD,QAAA,mBAAmB,GAAG,IAAI,CAAC,I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E,CAAC,CAAC;SAC1D;QACD,OAAO,QAAQ,CAAC;KACjB;IAAC,OAAO,KAAU,EAAE;QACnB,IAAI,CAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,IAAI,MAAK,QAAQ,EAAE;YAC5B,MAAM,yDAAyD,CAAC;SACjE;QACD,MAAM,KAAK,CAAC;KACb;AACH,CAAC,CAAA,CAAC;AAEK,MAAM,YAAY,GAAG,CAAO,OAElC,EAAkB,EAAE;IACnB,MAAM,QAAQ,GAAG,MAAM,4BAA4B,CAAC,OAAO,CAAC,CAAC;IAC7D,MAAM,cAAc,GAAG,MAAM,IAAA,kCAAsB,EAAC,QAAQ,CAAC,CAAC;IAE9D,OAAO,EAAE,cAAc,EAAE,QAAQ,EAAE,CAAC;AACtC,CAAC,CAAA,CAAC;AAPW,QAAA,YAAY,gBAOvB"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/** Copyright © 2024-present P0 Security
|
|
2
|
+
|
|
3
|
+
This file is part of @p0security/cli
|
|
4
|
+
|
|
5
|
+
@p0security/cli is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 3 of the License.
|
|
6
|
+
|
|
7
|
+
@p0security/cli is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
|
8
|
+
|
|
9
|
+
You should have received a copy of the GNU General Public License along with @p0security/cli. If not, see <https://www.gnu.org/licenses/>.
|
|
10
|
+
**/
|
|
11
|
+
import { Config } from "../types/org";
|
|
12
|
+
export declare const CONFIG_FILE_PATH: string;
|
|
13
|
+
export declare function getTenantConfig(): Config;
|
|
14
|
+
export declare function saveConfig(orgId: string): Promise<void>;
|
|
15
|
+
export declare function loadConfig(): Promise<Config>;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.loadConfig = exports.saveConfig = exports.getTenantConfig = exports.CONFIG_FILE_PATH = void 0;
|
|
16
|
+
const util_1 = require("../util");
|
|
17
|
+
const env_1 = require("./env");
|
|
18
|
+
const firestore_1 = require("./firestore");
|
|
19
|
+
const stdio_1 = require("./stdio");
|
|
20
|
+
const firestore_2 = require("firebase/firestore");
|
|
21
|
+
const promises_1 = __importDefault(require("fs/promises"));
|
|
22
|
+
const path_1 = __importDefault(require("path"));
|
|
23
|
+
exports.CONFIG_FILE_PATH = path_1.default.join(util_1.P0_PATH, "config.json");
|
|
24
|
+
let tenantConfig;
|
|
25
|
+
function getTenantConfig() {
|
|
26
|
+
return tenantConfig;
|
|
27
|
+
}
|
|
28
|
+
exports.getTenantConfig = getTenantConfig;
|
|
29
|
+
function saveConfig(orgId) {
|
|
30
|
+
var _a;
|
|
31
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
32
|
+
const orgDoc = yield (0, firestore_2.getDoc)((0, firestore_1.bootstrapDoc)(`orgs/${orgId}`));
|
|
33
|
+
const orgData = orgDoc.data();
|
|
34
|
+
if (!orgData)
|
|
35
|
+
throw "Could not find organization";
|
|
36
|
+
const config = (_a = orgData.config) !== null && _a !== void 0 ? _a : env_1.bootstrapConfig;
|
|
37
|
+
(0, stdio_1.print2)(`Saving config to ${exports.CONFIG_FILE_PATH}.`);
|
|
38
|
+
const dir = path_1.default.dirname(exports.CONFIG_FILE_PATH);
|
|
39
|
+
yield promises_1.default.mkdir(dir, { recursive: true });
|
|
40
|
+
yield promises_1.default.writeFile(exports.CONFIG_FILE_PATH, JSON.stringify(config), { mode: "600" });
|
|
41
|
+
tenantConfig = config;
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
exports.saveConfig = saveConfig;
|
|
45
|
+
function loadConfig() {
|
|
46
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
47
|
+
const buffer = yield promises_1.default.readFile(exports.CONFIG_FILE_PATH);
|
|
48
|
+
tenantConfig = JSON.parse(buffer.toString());
|
|
49
|
+
return tenantConfig;
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
exports.loadConfig = loadConfig;
|
|
53
|
+
//# sourceMappingURL=config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/drivers/config.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAWA,kCAAkC;AAClC,+BAAwC;AACxC,2CAA2C;AAC3C,mCAAiC;AACjC,kDAA4C;AAC5C,2DAA6B;AAC7B,gDAAwB;AAEX,QAAA,gBAAgB,GAAG,cAAI,CAAC,IAAI,CAAC,cAAO,EAAE,aAAa,CAAC,CAAC;AAElE,IAAI,YAAoB,CAAC;AAEzB,SAAgB,eAAe;IAC7B,OAAO,YAAY,CAAC;AACtB,CAAC;AAFD,0CAEC;AAED,SAAsB,UAAU,CAAC,KAAa;;;QAC5C,MAAM,MAAM,GAAG,MAAM,IAAA,kBAAM,EACzB,IAAA,wBAAY,EAAC,QAAQ,KAAK,EAAE,CAAC,CAC9B,CAAC;QACF,MAAM,OAAO,GAAG,MAAM,CAAC,IAAI,EAAE,CAAC;QAE9B,IAAI,CAAC,OAAO;YAAE,MAAM,6BAA6B,CAAC;QAElD,MAAM,MAAM,GAAG,MAAA,OAAO,CAAC,MAAM,mCAAI,qBAAe,CAAC;QAEjD,IAAA,cAAM,EAAC,oBAAoB,wBAAgB,GAAG,CAAC,CAAC;QAEhD,MAAM,GAAG,GAAG,cAAI,CAAC,OAAO,CAAC,wBAAgB,CAAC,CAAC;QAC3C,MAAM,kBAAE,CAAC,KAAK,CAAC,GAAG,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;QACzC,MAAM,kBAAE,CAAC,SAAS,CAAC,wBAAgB,EAAE,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC;QAE9E,YAAY,GAAG,MAAM,CAAC;;CACvB;AAjBD,gCAiBC;AAED,SAAsB,UAAU;;QAC9B,MAAM,MAAM,GAAG,MAAM,kBAAE,CAAC,QAAQ,CAAC,wBAAgB,CAAC,CAAC;QACnD,YAAY,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC,CAAC;QAC7C,OAAO,YAAY,CAAC;IACtB,CAAC;CAAA;AAJD,gCAIC"}
|
package/dist/drivers/env.d.ts
CHANGED
package/dist/drivers/env.js
CHANGED
|
@@ -4,7 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.
|
|
7
|
+
exports.bootstrapConfig = void 0;
|
|
8
8
|
/** Copyright © 2024-present P0 Security
|
|
9
9
|
|
|
10
10
|
This file is part of @p0security/cli
|
|
@@ -18,7 +18,7 @@ You should have received a copy of the GNU General Public License along with @p0
|
|
|
18
18
|
const dotenv_1 = __importDefault(require("dotenv"));
|
|
19
19
|
dotenv_1.default.config();
|
|
20
20
|
const { env } = process;
|
|
21
|
-
exports.
|
|
21
|
+
exports.bootstrapConfig = {
|
|
22
22
|
fs: {
|
|
23
23
|
// Falls back to public production Firestore credentials
|
|
24
24
|
apiKey: (_a = env.P0_FS_API_KEY) !== null && _a !== void 0 ? _a : "AIzaSyCaL-Ik_l_5tdmgNUNZ4Nv6NuR4o5_PPfs",
|
package/dist/drivers/env.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"env.js","sourceRoot":"","sources":["../../src/drivers/env.ts"],"names":[],"mappings":";;;;;;;AAAA;;;;;;;;;GASG;AACH,oDAA4B;AAE5B,gBAAM,CAAC,MAAM,EAAE,CAAC;AAEhB,MAAM,EAAE,GAAG,EAAE,GAAG,OAAO,CAAC;AAEX,QAAA,
|
|
1
|
+
{"version":3,"file":"env.js","sourceRoot":"","sources":["../../src/drivers/env.ts"],"names":[],"mappings":";;;;;;;AAAA;;;;;;;;;GASG;AACH,oDAA4B;AAE5B,gBAAM,CAAC,MAAM,EAAE,CAAC;AAEhB,MAAM,EAAE,GAAG,EAAE,GAAG,OAAO,CAAC;AAEX,QAAA,eAAe,GAAG;IAC7B,EAAE,EAAE;QACF,wDAAwD;QACxD,MAAM,EAAE,MAAA,GAAG,CAAC,aAAa,mCAAI,yCAAyC;QACtE,UAAU,EAAE,MAAA,GAAG,CAAC,iBAAiB,mCAAI,yBAAyB;QAC9D,SAAS,EAAE,MAAA,GAAG,CAAC,gBAAgB,mCAAI,SAAS;QAC5C,aAAa,EAAE,MAAA,GAAG,CAAC,oBAAoB,mCAAI,qBAAqB;QAChE,iBAAiB,EAAE,MAAA,GAAG,CAAC,yBAAyB,mCAAI,cAAc;QAClE,KAAK,EAAE,MAAA,GAAG,CAAC,YAAY,mCAAI,2CAA2C;KACvE;IACD,MAAM,EAAE;QACN,QAAQ,EACN,MAAA,GAAG,CAAC,wBAAwB,mCAC5B,0EAA0E;QAC5E,4EAA4E;QAC5E,qFAAqF;QACrF,YAAY,EACV,MAAA,GAAG,CAAC,4BAA4B,mCAAI,qCAAqC;KAC5E;IACD,MAAM,EAAE,MAAA,GAAG,CAAC,UAAU,mCAAI,oBAAoB;IAC9C,WAAW,EAAE,MAAA,GAAG,CAAC,MAAM,mCAAI,YAAY;CACxC,CAAC"}
|
|
@@ -1,10 +1,23 @@
|
|
|
1
|
+
/** Copyright © 2024-present P0 Security
|
|
2
|
+
|
|
3
|
+
This file is part of @p0security/cli
|
|
4
|
+
|
|
5
|
+
@p0security/cli is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 3 of the License.
|
|
6
|
+
|
|
7
|
+
@p0security/cli is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
|
8
|
+
|
|
9
|
+
You should have received a copy of the GNU General Public License along with @p0security/cli. If not, see <https://www.gnu.org/licenses/>.
|
|
10
|
+
**/
|
|
11
|
+
import { Identity } from "../types/identity";
|
|
12
|
+
import { UserCredential } from "firebase/auth";
|
|
1
13
|
import { CollectionReference, DocumentReference } from "firebase/firestore";
|
|
2
|
-
export declare
|
|
3
|
-
export declare
|
|
14
|
+
export declare function initializeFirebase(): Promise<void>;
|
|
15
|
+
export declare function authenticateToFirebase(identity: Identity): Promise<UserCredential>;
|
|
4
16
|
export declare const collection: <T>(path: string, ...pathSegments: string[]) => CollectionReference<T, import("@firebase/firestore").DocumentData>;
|
|
5
17
|
export declare const doc: <T>(path: string) => DocumentReference<T, import("@firebase/firestore").DocumentData>;
|
|
18
|
+
export declare const bootstrapDoc: <T>(path: string) => DocumentReference<T, import("@firebase/firestore").DocumentData>;
|
|
6
19
|
/** Ensures that Firestore is shutdown at command termination
|
|
7
20
|
*
|
|
8
21
|
* This prevents Firestore from holding the command on execution completion or failure.
|
|
9
22
|
*/
|
|
10
|
-
export declare const
|
|
23
|
+
export declare const fsShutdownGuard: <P, T>(cb: (args: P) => Promise<T>) => (args: P) => Promise<void>;
|
|
@@ -9,46 +9,76 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
This file is part of @p0security/cli
|
|
16
|
-
|
|
17
|
-
@p0security/cli is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 3 of the License.
|
|
18
|
-
|
|
19
|
-
@p0security/cli is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
|
20
|
-
|
|
21
|
-
You should have received a copy of the GNU General Public License along with @p0security/cli. If not, see <https://www.gnu.org/licenses/>.
|
|
22
|
-
**/
|
|
12
|
+
exports.fsShutdownGuard = exports.bootstrapDoc = exports.doc = exports.collection = exports.authenticateToFirebase = exports.initializeFirebase = void 0;
|
|
13
|
+
const config_1 = require("./config");
|
|
23
14
|
const env_1 = require("./env");
|
|
24
15
|
const app_1 = require("firebase/app");
|
|
25
16
|
const auth_1 = require("firebase/auth");
|
|
26
17
|
const firestore_1 = require("firebase/firestore");
|
|
27
|
-
|
|
28
|
-
const
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
18
|
+
const bootstrapApp = (0, app_1.initializeApp)(env_1.bootstrapConfig.fs, "bootstrapApp");
|
|
19
|
+
const bootstrapFirestore = (0, firestore_1.getFirestore)(bootstrapApp);
|
|
20
|
+
let app;
|
|
21
|
+
let firestore;
|
|
22
|
+
function initializeFirebase() {
|
|
23
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
24
|
+
if (!firestore) {
|
|
25
|
+
const tenantConfig = yield (0, config_1.loadConfig)();
|
|
26
|
+
app = (0, app_1.initializeApp)(tenantConfig.fs, "authFirebase");
|
|
27
|
+
firestore = (0, firestore_1.getFirestore)(app);
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
exports.initializeFirebase = initializeFirebase;
|
|
32
|
+
function authenticateToFirebase(identity) {
|
|
33
|
+
var _a;
|
|
34
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
35
|
+
const { credential } = identity;
|
|
36
|
+
const tenantId = identity.org.tenantId;
|
|
37
|
+
yield initializeFirebase();
|
|
38
|
+
// TODO: Move to map lookup
|
|
39
|
+
const provider = new auth_1.OAuthProvider(identity.org.ssoProvider === "google"
|
|
40
|
+
? auth_1.SignInMethod.GOOGLE
|
|
41
|
+
: identity.org.providerId);
|
|
42
|
+
const firebaseCredential = provider.credential({
|
|
43
|
+
accessToken: credential.access_token,
|
|
44
|
+
idToken: credential.id_token,
|
|
45
|
+
});
|
|
46
|
+
const auth = (0, auth_1.getAuth)(app);
|
|
47
|
+
auth.tenantId = tenantId;
|
|
48
|
+
const userCredential = yield (0, auth_1.signInWithCredential)(auth, firebaseCredential);
|
|
49
|
+
if (!((_a = userCredential === null || userCredential === void 0 ? void 0 : userCredential.user) === null || _a === void 0 ? void 0 : _a.email)) {
|
|
50
|
+
throw "Can not sign in: this user has previously signed in with a different identity provider.\nPlease contact support@p0.dev to enable this user.";
|
|
51
|
+
}
|
|
52
|
+
return userCredential;
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
exports.authenticateToFirebase = authenticateToFirebase;
|
|
33
56
|
const collection = (path, ...pathSegments) => {
|
|
34
|
-
return (0, firestore_1.collection)(
|
|
57
|
+
return (0, firestore_1.collection)(firestore, path, ...pathSegments);
|
|
35
58
|
};
|
|
36
59
|
exports.collection = collection;
|
|
37
60
|
const doc = (path) => {
|
|
38
|
-
return (0, firestore_1.doc)(
|
|
61
|
+
return (0, firestore_1.doc)(firestore, path);
|
|
39
62
|
};
|
|
40
63
|
exports.doc = doc;
|
|
64
|
+
const bootstrapDoc = (path) => {
|
|
65
|
+
return (0, firestore_1.doc)(bootstrapFirestore, path);
|
|
66
|
+
};
|
|
67
|
+
exports.bootstrapDoc = bootstrapDoc;
|
|
41
68
|
/** Ensures that Firestore is shutdown at command termination
|
|
42
69
|
*
|
|
43
70
|
* This prevents Firestore from holding the command on execution completion or failure.
|
|
44
71
|
*/
|
|
45
|
-
const
|
|
72
|
+
const fsShutdownGuard = (cb) => (args) => __awaiter(void 0, void 0, void 0, function* () {
|
|
46
73
|
try {
|
|
47
74
|
yield cb(args);
|
|
48
75
|
}
|
|
49
76
|
finally {
|
|
50
|
-
|
|
77
|
+
if (bootstrapFirestore)
|
|
78
|
+
void (0, firestore_1.terminate)(bootstrapFirestore);
|
|
79
|
+
if (firestore)
|
|
80
|
+
void (0, firestore_1.terminate)(firestore);
|
|
51
81
|
}
|
|
52
82
|
});
|
|
53
|
-
exports.
|
|
83
|
+
exports.fsShutdownGuard = fsShutdownGuard;
|
|
54
84
|
//# sourceMappingURL=firestore.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"firestore.js","sourceRoot":"","sources":["../../src/drivers/firestore.ts"],"names":[],"mappings":";;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"firestore.js","sourceRoot":"","sources":["../../src/drivers/firestore.ts"],"names":[],"mappings":";;;;;;;;;;;;AAWA,qCAAsC;AACtC,+BAAwC;AACxC,sCAA0D;AAC1D,wCAMuB;AACvB,kDAQ4B;AAE5B,MAAM,YAAY,GAAG,IAAA,mBAAa,EAAC,qBAAe,CAAC,EAAE,EAAE,cAAc,CAAC,CAAC;AACvE,MAAM,kBAAkB,GAAG,IAAA,wBAAY,EAAC,YAAY,CAAC,CAAC;AAEtD,IAAI,GAAgB,CAAC;AACrB,IAAI,SAAoB,CAAC;AAEzB,SAAsB,kBAAkB;;QACtC,IAAI,CAAC,SAAS,EAAE;YACd,MAAM,YAAY,GAAG,MAAM,IAAA,mBAAU,GAAE,CAAC;YACxC,GAAG,GAAG,IAAA,mBAAa,EAAC,YAAY,CA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AG,GAAG,CAAI,IAAY,EAAE,EAAE;IACrC,OAAO,IAAA,eAAK,EAAC,SAAS,EAAE,IAAI,CAAyB,CAAC;AACxD,CAAC,CAAC;AAFW,QAAA,GAAG,OAEd;AAEK,MAAM,YAAY,GAAG,CAAI,IAAY,EAAE,EAAE;IAC9C,OAAO,IAAA,eAAK,EAAC,kBAAkB,EAAE,IAAI,CAAyB,CAAC;AACjE,CAAC,CAAC;AAFW,QAAA,YAAY,gBAEvB;AAEF;;;GAGG;AACI,MAAM,eAAe,GAC1B,CAAO,EAA2B,EAAE,EAAE,CACtC,CAAO,IAAO,EAAE,EAAE;IAChB,IAAI;QACF,MAAM,EAAE,CAAC,IAAI,CAAC,CAAC;KAChB;YAAS;QACR,IAAI,kBAAkB;YAAE,KAAK,IAAA,qBAAS,EAAC,kBAAkB,CAAC,CAAC;QAC3D,IAAI,SAAS;YAAE,KAAK,IAAA,qBAAS,EAAC,SAAS,CAAC,CAAC;KAC1C;AACH,CAAC,CAAA,CAAC;AATS,QAAA,eAAe,mBASxB"}
|
package/dist/plugins/aws/ssh.js
CHANGED
|
@@ -89,10 +89,10 @@ exports.awsSshProvider = {
|
|
|
89
89
|
},
|
|
90
90
|
requestToSsh: (request) => {
|
|
91
91
|
const { permission, generated } = request;
|
|
92
|
-
const {
|
|
93
|
-
const { idcId, idcRegion } =
|
|
94
|
-
const {
|
|
95
|
-
const {
|
|
92
|
+
const { resource, region } = permission;
|
|
93
|
+
const { idcId, idcRegion, instanceId, accountId } = resource;
|
|
94
|
+
const { linuxUserName, resource: generatedResource } = generated;
|
|
95
|
+
const { name } = generatedResource;
|
|
96
96
|
const common = { linuxUserName, accountId, region, id: instanceId };
|
|
97
97
|
return !idcId || !idcRegion
|
|
98
98
|
? Object.assign(Object.assign({}, common), { role: name, type: "aws", access: "role" }) : Object.assign(Object.assign({}, common), { idc: { id: idcId, region: idcRegion }, permissionSet: name, type: "aws", access: "idc" });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"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
58
|
-
|
|
56
|
+
export type AwsSshPermission = CommonSshPermissionSpec & {
|
|
57
|
+
provider: "aws";
|
|
58
|
+
region: string;
|
|
59
|
+
alias: string;
|
|
60
|
+
resource: {
|
|
61
|
+
account: string;
|
|
59
62
|
accountId: string;
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
};
|
|
67
|
-
};
|
|
63
|
+
arn: string;
|
|
64
|
+
idcId: string;
|
|
65
|
+
idcRegion: string;
|
|
66
|
+
instanceId: string;
|
|
67
|
+
name: string;
|
|
68
|
+
userName: string;
|
|
68
69
|
};
|
|
69
|
-
type: "session";
|
|
70
70
|
};
|
|
71
71
|
export type AwsSshGenerated = {
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
linuxUserName: string;
|
|
72
|
+
resource: {
|
|
73
|
+
name: string;
|
|
75
74
|
};
|
|
75
|
+
linuxUserName: string;
|
|
76
76
|
};
|
|
77
77
|
export type AwsSshPermissionSpec = PermissionSpec<"ssh", AwsSshPermission, AwsSshGenerated>;
|
|
78
78
|
export type AwsSsh = CliPermissionSpec<AwsSshPermissionSpec, undefined>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const ensureAzInstall: () => Promise<boolean>;
|