@p0security/cli 0.13.3 → 0.13.4
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/drivers/config.d.ts +5 -3
- package/dist/drivers/config.js +27 -25
- package/dist/drivers/config.js.map +1 -1
- package/dist/drivers/env.d.ts +1 -1
- package/dist/drivers/env.js +7 -1
- package/dist/drivers/env.js.map +1 -1
- package/dist/plugins/azure/auth.js +6 -3
- package/dist/plugins/azure/auth.js.map +1 -1
- package/dist/plugins/google/login.js +3 -3
- package/dist/plugins/google/login.js.map +1 -1
- package/dist/types/org.d.ts +19 -2
- package/package.json +1 -1
package/dist/drivers/config.d.ts
CHANGED
|
@@ -10,6 +10,8 @@ You should have received a copy of the GNU General Public License along with @p0
|
|
|
10
10
|
**/
|
|
11
11
|
import { Config } from "../types/org";
|
|
12
12
|
export declare const CONFIG_FILE_PATH: string;
|
|
13
|
-
export declare
|
|
14
|
-
|
|
15
|
-
export declare
|
|
13
|
+
export declare const getTenantConfig: () => Config;
|
|
14
|
+
/** Use only if the organization is configured with Google login to P0 */
|
|
15
|
+
export declare const getGoogleTenantConfig: () => import("../types/org").GoogleApplicationConfig;
|
|
16
|
+
export declare const saveConfig: (orgId: string) => Promise<void>;
|
|
17
|
+
export declare const loadConfig: () => Promise<Config>;
|
package/dist/drivers/config.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.loadConfig = exports.saveConfig = exports.getTenantConfig = exports.CONFIG_FILE_PATH = void 0;
|
|
15
|
+
exports.loadConfig = exports.saveConfig = exports.getGoogleTenantConfig = exports.getTenantConfig = exports.CONFIG_FILE_PATH = void 0;
|
|
16
16
|
const util_1 = require("../util");
|
|
17
17
|
const env_1 = require("./env");
|
|
18
18
|
const firestore_1 = require("./firestore");
|
|
@@ -22,32 +22,34 @@ const promises_1 = __importDefault(require("fs/promises"));
|
|
|
22
22
|
const path_1 = __importDefault(require("path"));
|
|
23
23
|
exports.CONFIG_FILE_PATH = path_1.default.join(util_1.P0_PATH, "config.json");
|
|
24
24
|
let tenantConfig;
|
|
25
|
-
|
|
26
|
-
return tenantConfig;
|
|
27
|
-
}
|
|
25
|
+
const getTenantConfig = () => tenantConfig;
|
|
28
26
|
exports.getTenantConfig = getTenantConfig;
|
|
29
|
-
|
|
27
|
+
/** Use only if the organization is configured with Google login to P0 */
|
|
28
|
+
const getGoogleTenantConfig = () => {
|
|
29
|
+
if ("google" in tenantConfig) {
|
|
30
|
+
return tenantConfig;
|
|
31
|
+
}
|
|
32
|
+
throw "Login failed!\nThis organization is configured to use Google login but the required OAuth client parameters are missing.\nPlease contact support@p0.dev to properly configure your organization login.";
|
|
33
|
+
};
|
|
34
|
+
exports.getGoogleTenantConfig = getGoogleTenantConfig;
|
|
35
|
+
const saveConfig = (orgId) => __awaiter(void 0, void 0, void 0, function* () {
|
|
30
36
|
var _a;
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
});
|
|
43
|
-
}
|
|
37
|
+
const orgDoc = yield (0, firestore_2.getDoc)((0, firestore_1.bootstrapDoc)(`orgs/${orgId}`));
|
|
38
|
+
const orgData = orgDoc.data();
|
|
39
|
+
if (!orgData)
|
|
40
|
+
throw "Could not find organization";
|
|
41
|
+
const config = (_a = orgData.config) !== null && _a !== void 0 ? _a : env_1.bootstrapConfig;
|
|
42
|
+
(0, stdio_1.print2)(`Saving config to ${exports.CONFIG_FILE_PATH}.`);
|
|
43
|
+
const dir = path_1.default.dirname(exports.CONFIG_FILE_PATH);
|
|
44
|
+
yield promises_1.default.mkdir(dir, { recursive: true });
|
|
45
|
+
yield promises_1.default.writeFile(exports.CONFIG_FILE_PATH, JSON.stringify(config), { mode: "600" });
|
|
46
|
+
tenantConfig = config;
|
|
47
|
+
});
|
|
44
48
|
exports.saveConfig = saveConfig;
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
});
|
|
51
|
-
}
|
|
49
|
+
const loadConfig = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
50
|
+
const buffer = yield promises_1.default.readFile(exports.CONFIG_FILE_PATH);
|
|
51
|
+
tenantConfig = JSON.parse(buffer.toString());
|
|
52
|
+
return tenantConfig;
|
|
53
|
+
});
|
|
52
54
|
exports.loadConfig = loadConfig;
|
|
53
55
|
//# sourceMappingURL=config.js.map
|
|
@@ -1 +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;
|
|
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;AAElB,MAAM,eAAe,GAAG,GAAG,EAAE,CAAC,YAAY,CAAC;AAArC,QAAA,eAAe,mBAAsB;AAElD,yEAAyE;AAClE,MAAM,qBAAqB,GAAG,GAAG,EAAE;IACxC,IA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,7 +32,13 @@ exports.bootstrapConfig = {
|
|
|
32
32
|
clientId: (_g = env.P0_GOOGLE_OIDC_CLIENT_ID) !== null && _g !== void 0 ? _g : "228132571547-kilcq1er15hlbl6mitghttnacp7u58l8.apps.googleusercontent.com",
|
|
33
33
|
// Despite the name, this is not actually "secret" in any sense of the word.
|
|
34
34
|
// Instead, the client is protected by requiring PKCE and defining the redirect URIs.
|
|
35
|
-
|
|
35
|
+
// PKCE achieves similar security guarantees for public clients with an on-the-fly
|
|
36
|
+
// generated secret (the code verifier) as the static secret does for confidential clients.
|
|
37
|
+
// See also: https://auth0.com/docs/get-started/authentication-and-authorization-flow/authorization-code-flow-with-pkce
|
|
38
|
+
// In the PKCE flow the client secret is an optional parameter, however, Google's
|
|
39
|
+
// implementation requires it. That's why the "secret" is present here.
|
|
40
|
+
// This "secret" is only used if the organization uses Google Workspace to log in to P0.
|
|
41
|
+
publicClientSecretForPkce: (_h = env.P0_GOOGLE_OIDC_CLIENT_SECRET) !== null && _h !== void 0 ? _h : "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",
|
|
36
42
|
},
|
|
37
43
|
appUrl: (_j = env.P0_APP_URL) !== null && _j !== void 0 ? _j : "https://api.p0.app",
|
|
38
44
|
environment: (_k = env.P0_ENV) !== null && _k !== void 0 ? _k : "production",
|
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,eAAe,GAAG;IAC7B,EAAE,EAAE;QACF,wDAAwD;QACxD,MAAM,EAAE,MAAA,GAAG,CAAC,aAAa,mCAAI,yCAAyC;QACtE,UAAU,EAAE,MAAA,GAAG,CAAC,iBAAiB,mCAAI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B,mCAAI,qCAAqC;KAC5E;IACD,MAAM,EAAE,MAAA,GAAG,CAAC,UAAU,mCAAI,oBAAoB;IAC9C,WAAW,EAAE,MAAA,GAAG,CAAC,MAAM,mCAAI,YAAY;CACxC,CAAC"}
|
|
@@ -34,7 +34,10 @@ const knownAccountSetErrors = [
|
|
|
34
34
|
message: "Failed to set the active Azure subscription. Please try again.",
|
|
35
35
|
},
|
|
36
36
|
];
|
|
37
|
-
const normalizeAzureCliError = (error, normalizedErrors) => {
|
|
37
|
+
const normalizeAzureCliError = (error, normalizedErrors, options) => {
|
|
38
|
+
if (options.debug) {
|
|
39
|
+
(0, stdio_1.print2)(error);
|
|
40
|
+
}
|
|
38
41
|
for (const { pattern, message } of normalizedErrors) {
|
|
39
42
|
if (pattern.test(error.stderr)) {
|
|
40
43
|
throw message;
|
|
@@ -89,7 +92,7 @@ const performLogin = (subscriptionId, { debug }) => __awaiter(void 0, void 0, vo
|
|
|
89
92
|
}
|
|
90
93
|
}
|
|
91
94
|
catch (error) {
|
|
92
|
-
throw normalizeAzureCliError(error, knownLoginErrors);
|
|
95
|
+
throw normalizeAzureCliError(error, knownLoginErrors, { debug });
|
|
93
96
|
}
|
|
94
97
|
});
|
|
95
98
|
const performSetAccount = (subscriptionId, { debug }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
@@ -104,7 +107,7 @@ const performSetAccount = (subscriptionId, { debug }) => __awaiter(void 0, void
|
|
|
104
107
|
}
|
|
105
108
|
}
|
|
106
109
|
catch (error) {
|
|
107
|
-
throw normalizeAzureCliError(error, knownAccountSetErrors);
|
|
110
|
+
throw normalizeAzureCliError(error, knownAccountSetErrors, { debug });
|
|
108
111
|
}
|
|
109
112
|
});
|
|
110
113
|
const getUserPrincipalName = ({ debug }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth.js","sourceRoot":"","sources":["../../../src/plugins/azure/auth.ts"],"names":[],"mappings":";;;;;;;;;;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AAG,IAAA,sCAA8B,GAAE,CAAC;QAC3D,MAAM,iBAAiB,GAAG,MAAM,IAAA,WAAI,EAAC,OAAO,EAAE,IAAI,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;QACrE,IAAI,KAAK,EAAE;YACT,IAAA,cAAM,EAAC,8BAA8B,CAAC,CAAC;YACvC,IAAA,cAAM,EAAC,iBAAiB,CAAC,MAAM,CAAC,CAAC;YACjC,IAAA,cAAM,EAAC,iBAAiB,CAAC,MAAM,CAAC,CAAC;SAClC;QACD,OAAO,iBAAiB,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC;KACxC;IAAC,OAAO,KAAU,EAAE;QACnB,MAAM,wCAAwC,KAAK,GAAG,CAAC;KACxD;AACH,CAAC,CAAA,CAAC;AAEK,MAAM,OAAO,GAAG,CACrB,cAAsB,EACtB,UAA+B,EAAE,EACjC,EAAE;IACF,MAAM,EAAE,KAAK,EAAE,GAAG,OAAO,CAAC;IAC1B,IAAI,KAAK;QAAE,IAAA,cAAM,EAAC,wBAAwB,CAAC,CAAC;IAE5C,qEAAqE;IACrE,kDAAkD;IAClD,MAAM,aAAa,CAAC,OAAO,CAAC,CAAC;IAE7B,MAAM,YAAY,CAAC,cAAc,EAAE,OAAO,CAAC,CAAC;IAE5C,MAAM,iBAAiB,CAAC,cAAc,EAAE,OAAO,CAAC,CAAC;IAEjD,OAAO,MAAM,oBAAoB,CAAC,OAAO,CAAC,CAAC;AAC7C,CAAC,CAAA,CAAC;AAhBW,QAAA,OAAO,WAgBlB"}
|
|
@@ -35,7 +35,7 @@ const GOOGLE_OIDC_REDIRECT_PORT = 52700;
|
|
|
35
35
|
const GOOGLE_OIDC_REDIRECT_URL = `http://127.0.0.1:${GOOGLE_OIDC_REDIRECT_PORT}`;
|
|
36
36
|
const PKCE_LENGTH = 128;
|
|
37
37
|
const requestAuth = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
38
|
-
const tenantConfig = (0, config_1.
|
|
38
|
+
const tenantConfig = (0, config_1.getGoogleTenantConfig)();
|
|
39
39
|
const pkceChallenge = (yield import("pkce-challenge")).default;
|
|
40
40
|
const pkce = yield pkceChallenge(PKCE_LENGTH);
|
|
41
41
|
const authBody = {
|
|
@@ -55,10 +55,10 @@ ${url}`);
|
|
|
55
55
|
return pkce;
|
|
56
56
|
});
|
|
57
57
|
const requestToken = (code, pkce) => __awaiter(void 0, void 0, void 0, function* () {
|
|
58
|
-
const tenantConfig = (0, config_1.
|
|
58
|
+
const tenantConfig = (0, config_1.getGoogleTenantConfig)();
|
|
59
59
|
const body = {
|
|
60
60
|
client_id: tenantConfig.google.clientId,
|
|
61
|
-
client_secret: tenantConfig.google.
|
|
61
|
+
client_secret: tenantConfig.google.publicClientSecretForPkce,
|
|
62
62
|
code,
|
|
63
63
|
code_verifier: pkce.code_verifier,
|
|
64
64
|
grant_type: "authorization_code",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"login.js","sourceRoot":"","sources":["../../../src/plugins/google/login.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA;;;;;;;;;GASG;AACH,iDAAsD;AACtD,qDAA8D;AAC9D,8CAAiE;AACjE,
|
|
1
|
+
{"version":3,"file":"login.js","sourceRoot":"","sources":["../../../src/plugins/google/login.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA;;;;;;;;;GASG;AACH,iDAAsD;AACtD,qDAA8D;AAC9D,8CAAiE;AACjE,iDAA6D;AAC7D,+CAA6C;AAE7C,gDAAwB;AAOxB,MAAM,eAAe,GAAG,8CAA8C,CAAC;AACvE,MAAM,wBAAwB,GAAG,qCAAqC,CAAC;AACvE,MAAM,yBAAyB,GAAG,KAAK,CAAC;AACxC,MAAM,wBAAwB,GAAG,oBAAoB,yBAAyB,EAAE,CAAC;AACjF,MAAM,WAAW,GAAG,GAAG,CAAC;AAExB,MAAM,WAAW,GAAG,GAAS,EAAE;IAC7B,MAAM,YAAY,GAAG,IAAA,8BAAqB,GAAE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Q,CAAC,CAAC;IAC/C,OAAO,CAAC,MAAM,KAAK,CAAC,IAAI,EAAE,CAAkB,CAAC;AAC/C,CAAC,CAAA,CAAC;AAEK,MAAM,WAAW,GAAG,GAAS,EAAE;IACpC,OAAO,MAAM,IAAA,2BAAkB,EAC7B,GAAS,EAAE,kDAAC,OAAA,MAAM,WAAW,EAAE,CAAA,GAAA,EAC/B,CAAO,IAAI,EAAE,KAAK,EAAE,EAAE,kDAAC,OAAA,MAAM,YAAY,CAAC,KAAK,CAAC,IAAI,EAAE,IAAI,CAAC,CAAA,GAAA,EAC3D,EAAE,IAAI,EAAE,yBAAyB,EAAE,CACpC,CAAC;AACJ,CAAC,CAAA,CAAC;AANW,QAAA,WAAW,eAMtB"}
|
package/dist/types/org.d.ts
CHANGED
|
@@ -8,8 +8,25 @@ This file is part of @p0security/cli
|
|
|
8
8
|
|
|
9
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
10
|
**/
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
type ApplicationConfig = {
|
|
12
|
+
fs: {
|
|
13
|
+
apiKey: string;
|
|
14
|
+
authDomain: string;
|
|
15
|
+
projectId: string;
|
|
16
|
+
storageBucket: string;
|
|
17
|
+
messagingSenderId: string;
|
|
18
|
+
appId: string;
|
|
19
|
+
};
|
|
20
|
+
appUrl: string;
|
|
21
|
+
environment: string;
|
|
22
|
+
};
|
|
23
|
+
export type GoogleApplicationConfig = ApplicationConfig & {
|
|
24
|
+
google: {
|
|
25
|
+
clientId: string;
|
|
26
|
+
publicClientSecretForPkce: string;
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
export type Config = ApplicationConfig | GoogleApplicationConfig;
|
|
13
30
|
type BaseOrgData = {
|
|
14
31
|
clientId: string;
|
|
15
32
|
providerId: string;
|