@p0security/cli 0.11.1 → 0.11.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__/login.test.js +17 -0
- package/dist/commands/__tests__/login.test.js.map +1 -1
- package/dist/commands/__tests__/ls.test.js +4 -3
- package/dist/commands/__tests__/ls.test.js.map +1 -1
- package/dist/commands/__tests__/ssh.test.js +10 -5
- package/dist/commands/__tests__/ssh.test.js.map +1 -1
- package/dist/commands/kubeconfig.js +3 -2
- package/dist/commands/kubeconfig.js.map +1 -1
- package/dist/commands/login.js +11 -0
- package/dist/commands/login.js.map +1 -1
- package/dist/commands/ls.js +4 -6
- package/dist/commands/ls.js.map +1 -1
- package/dist/commands/shared/request.js +2 -2
- package/dist/commands/shared/request.js.map +1 -1
- package/dist/drivers/__mocks__/stdio.d.ts +14 -0
- package/dist/drivers/__mocks__/stdio.js +26 -0
- package/dist/drivers/__mocks__/stdio.js.map +1 -0
- package/dist/drivers/ansi.d.ts +8 -0
- package/dist/drivers/ansi.js +25 -0
- package/dist/drivers/ansi.js.map +1 -0
- package/dist/drivers/auth.d.ts +1 -0
- package/dist/drivers/auth.js +8 -4
- package/dist/drivers/auth.js.map +1 -1
- package/dist/drivers/stdio.d.ts +6 -5
- package/dist/drivers/stdio.js +50 -7
- package/dist/drivers/stdio.js.map +1 -1
- package/dist/plugins/aws/ssh.js +45 -23
- package/dist/plugins/aws/ssh.js.map +1 -1
- package/dist/plugins/aws/types.d.ts +6 -4
- package/dist/plugins/google/ssh-key.js +9 -1
- package/dist/plugins/google/ssh-key.js.map +1 -1
- package/dist/plugins/google/ssh.js +61 -28
- package/dist/plugins/google/ssh.js.map +1 -1
- package/dist/plugins/ssh/index.js +62 -88
- package/dist/plugins/ssh/index.js.map +1 -1
- package/dist/types/ssh.d.ts +28 -13
- package/package.json +3 -3
package/dist/types/ssh.d.ts
CHANGED
|
@@ -21,19 +21,18 @@ export type CliPermissionSpec<P extends PluginSshRequest, C extends object | und
|
|
|
21
21
|
export declare const SupportedSshProviders: readonly ["aws", "gcloud"];
|
|
22
22
|
export type SupportedSshProvider = (typeof SupportedSshProviders)[number];
|
|
23
23
|
export type SshProvider<PR extends PluginSshRequest = PluginSshRequest, O extends object | undefined = undefined, SR extends SshRequest = SshRequest, C extends object | undefined = undefined> = {
|
|
24
|
-
requestToSsh: (request: CliPermissionSpec<PR, O>) => SR;
|
|
25
|
-
/** Converts a backend request to a CLI request */
|
|
26
|
-
toCliRequest: (request: Request<PR>, options?: {
|
|
27
|
-
debug?: boolean;
|
|
28
|
-
}) => Promise<Request<CliSshRequest>>;
|
|
29
|
-
ensureInstall: () => Promise<void>;
|
|
30
24
|
/** Logs in the user to the cloud provider */
|
|
31
25
|
cloudProviderLogin: (authn: Authn, request: SR) => Promise<C>;
|
|
32
|
-
/**
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
|
|
36
|
-
|
|
26
|
+
/** Callback to ensure that this provider's CLI utils are installed */
|
|
27
|
+
ensureInstall: () => Promise<void>;
|
|
28
|
+
/** A human-readable name for this CSP */
|
|
29
|
+
friendlyName: string;
|
|
30
|
+
/** Friendly message to ask the user to log in to the CSP */
|
|
31
|
+
loginRequiredMessage?: string;
|
|
32
|
+
/** Regex match for error string indicating that CSP login is required */
|
|
33
|
+
loginRequiredPattern?: RegExp;
|
|
34
|
+
/** Amount of time, in ms, to wait between granting access and giving up on attempting an SSH connection */
|
|
35
|
+
propagationTimeoutMs: number;
|
|
37
36
|
/** Arguments for a pre-test command to verify access propagation prior
|
|
38
37
|
* to actually logging in the user to the ssh session.
|
|
39
38
|
* This must return arguments for a non-interactive command - meaning the `command`
|
|
@@ -42,7 +41,23 @@ export type SshProvider<PR extends PluginSshRequest = PluginSshRequest, O extend
|
|
|
42
41
|
* the actual ssh/scp command.
|
|
43
42
|
*/
|
|
44
43
|
preTestAccessPropagationArgs: (cmdArgs: CommandArgs) => CommandArgs | undefined;
|
|
45
|
-
|
|
46
|
-
|
|
44
|
+
/** Returns the command and its arguments that are going to be injected as the ssh ProxyCommand option */
|
|
45
|
+
proxyCommand: (request: SR) => string[];
|
|
46
|
+
/** Each element in the returned array is a command that can be run to reproduce the
|
|
47
|
+
* steps of logging in the user to the ssh session. */
|
|
48
|
+
reproCommands: (request: SR) => string[] | undefined;
|
|
49
|
+
/** Unwraps this provider's types */
|
|
50
|
+
requestToSsh: (request: CliPermissionSpec<PR, O>) => SR;
|
|
51
|
+
/** Regex matches for error strings indicating that the provider has not yet fully provisioned node acces */
|
|
52
|
+
unprovisionedAccessPatterns: readonly {
|
|
53
|
+
/** If the error matches this string, indicates that access is not provisioned */
|
|
54
|
+
readonly pattern: RegExp;
|
|
55
|
+
/** Maximum amount of time to wait for provisioning after encountering this error */
|
|
56
|
+
readonly validationWindowMs?: number;
|
|
57
|
+
}[];
|
|
58
|
+
/** Converts a backend request to a CLI request */
|
|
59
|
+
toCliRequest: (request: Request<PR>, options?: {
|
|
60
|
+
debug?: boolean;
|
|
61
|
+
}) => Promise<Request<CliSshRequest>>;
|
|
47
62
|
};
|
|
48
63
|
export type SshRequest = AwsSshRequest | GcpSshRequest;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@p0security/cli",
|
|
3
|
-
"version": "0.11.
|
|
3
|
+
"version": "0.11.2",
|
|
4
4
|
"description": "Execute infra CLI commands with P0 grants",
|
|
5
5
|
"main": "index.ts",
|
|
6
6
|
"repository": {
|
|
@@ -65,8 +65,8 @@
|
|
|
65
65
|
"eslint-plugin-promise": "^6.1.1",
|
|
66
66
|
"jest": "^29.7.0",
|
|
67
67
|
"prettier": "^3.2.4",
|
|
68
|
-
"ts-
|
|
69
|
-
"ts-
|
|
68
|
+
"ts-jest": "^29.1.2",
|
|
69
|
+
"ts-node": "^10.9.2"
|
|
70
70
|
},
|
|
71
71
|
"scripts": {
|
|
72
72
|
"build": "tsc && cp -r public dist/",
|