@p0security/cli 0.5.1 → 0.5.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/dist/commands/__tests__/ssh.test.js +4 -8
- package/dist/commands/index.js +0 -2
- package/dist/commands/ssh.js +4 -4
- package/dist/plugins/aws/__mocks__/assumeRole.js +1 -0
- package/dist/plugins/aws/assumeRole.js +1 -0
- package/dist/plugins/aws/types.d.ts +1 -0
- package/dist/plugins/ssh/types.d.ts +2 -6
- package/package.json +1 -1
|
@@ -40,14 +40,10 @@ const mockSsm = ssm_1.ssm;
|
|
|
40
40
|
const mockPrint1 = stdio_1.print1;
|
|
41
41
|
const mockPrint2 = stdio_1.print2;
|
|
42
42
|
(0, firestore_1.mockGetDoc)({
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
type: "aws",
|
|
48
|
-
identifier: "test-account",
|
|
49
|
-
},
|
|
50
|
-
],
|
|
43
|
+
"iam-write": {
|
|
44
|
+
["aws:test-account"]: {
|
|
45
|
+
state: "installed",
|
|
46
|
+
},
|
|
51
47
|
},
|
|
52
48
|
});
|
|
53
49
|
mockSsm.mockResolvedValue({});
|
package/dist/commands/index.js
CHANGED
|
@@ -21,7 +21,6 @@ const login_1 = require("./login");
|
|
|
21
21
|
const ls_1 = require("./ls");
|
|
22
22
|
const request_1 = require("./request");
|
|
23
23
|
const ssh_1 = require("./ssh");
|
|
24
|
-
const lodash_1 = require("lodash");
|
|
25
24
|
const typescript_1 = require("typescript");
|
|
26
25
|
const yargs_1 = __importDefault(require("yargs"));
|
|
27
26
|
const helpers_1 = require("yargs/helpers");
|
|
@@ -36,7 +35,6 @@ exports.cli = commands
|
|
|
36
35
|
.reduce((m, c) => c(m), (0, yargs_1.default)((0, helpers_1.hideBin)(process.argv)))
|
|
37
36
|
.middleware(version_1.checkVersion)
|
|
38
37
|
.strict()
|
|
39
|
-
.version(lodash_1.VERSION)
|
|
40
38
|
.demandCommand(1)
|
|
41
39
|
.fail((message, error, yargs) => {
|
|
42
40
|
if (error)
|
package/dist/commands/ssh.js
CHANGED
|
@@ -80,11 +80,11 @@ const sshCommand = (yargs) => yargs.command("ssh <destination> [command [argumen
|
|
|
80
80
|
}), (0, firestore_1.guard)(ssh));
|
|
81
81
|
exports.sshCommand = sshCommand;
|
|
82
82
|
const validateSshInstall = (authn) => __awaiter(void 0, void 0, void 0, function* () {
|
|
83
|
-
var _a
|
|
83
|
+
var _a;
|
|
84
84
|
const configDoc = yield (0, firestore_2.getDoc)((0, firestore_1.doc)(`o/${authn.identity.org.tenantId}/integrations/ssh`));
|
|
85
|
-
const
|
|
86
|
-
|
|
87
|
-
if (
|
|
85
|
+
const configItems = (_a = configDoc.data()) === null || _a === void 0 ? void 0 : _a["iam-write"];
|
|
86
|
+
const items = Object.entries(configItems !== null && configItems !== void 0 ? configItems : {}).filter(([key, value]) => value.state == "installed" && key.startsWith("aws"));
|
|
87
|
+
if (items.length === 0) {
|
|
88
88
|
throw "This organization is not configured for SSH access via the P0 CLI";
|
|
89
89
|
}
|
|
90
90
|
});
|
|
@@ -15,6 +15,7 @@ const assumeRoleWithSaml = () => __awaiter(void 0, void 0, void 0, function* ()
|
|
|
15
15
|
AWS_ACCESS_KEY_ID: "test-access-key-id",
|
|
16
16
|
AWS_SECRET_ACCESS_KEY: "test-secret-access-key",
|
|
17
17
|
AWS_SESSION_TOKEN: "test-session-token",
|
|
18
|
+
AWS_SECURITY_TOKEN: "test-session-token",
|
|
18
19
|
});
|
|
19
20
|
});
|
|
20
21
|
exports.assumeRoleWithSaml = assumeRoleWithSaml;
|
|
@@ -38,6 +38,7 @@ const stsAssume = (params) => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
38
38
|
AWS_ACCESS_KEY_ID: stsCredentials.AccessKeyId,
|
|
39
39
|
AWS_SECRET_ACCESS_KEY: stsCredentials.SecretAccessKey,
|
|
40
40
|
AWS_SESSION_TOKEN: stsCredentials.SessionToken,
|
|
41
|
+
AWS_SECURITY_TOKEN: stsCredentials.SessionToken,
|
|
41
42
|
};
|
|
42
43
|
});
|
|
43
44
|
/** Assumes an AWS role via SAML login */
|
|
@@ -9,14 +9,10 @@ This file is part of @p0security/cli
|
|
|
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
11
|
declare type SshItemConfig = {
|
|
12
|
-
|
|
13
|
-
identifier: string;
|
|
12
|
+
label?: string;
|
|
14
13
|
state: string;
|
|
15
|
-
type: "aws" | "gcloud";
|
|
16
14
|
};
|
|
17
15
|
export declare type SshConfig = {
|
|
18
|
-
|
|
19
|
-
items: SshItemConfig[];
|
|
20
|
-
};
|
|
16
|
+
"iam-write": Record<string, SshItemConfig>;
|
|
21
17
|
};
|
|
22
18
|
export {};
|