UNPKG

@snyk/cli-interface

Version:
26 lines (25 loc) • 1.39 kB
export declare type ChildProcessEnv = { [key: string]: string | undefined; }; /** * Returns a copy of `env` with the user's own proxy and OpenSSL settings restored. * SNYK_* variables are kept, so use this for Snyk's own child processes. * * The CLI replaces HTTP_PROXY, HTTPS_PROXY, NO_PROXY and OPENSSL_CONF, and saves the * user's values as SNYK_SYSTEM_<name>. Each saved value is read from `systemEnv`. * For HTTP_PROXY, HTTPS_PROXY and NO_PROXY, every casing of the name is removed and the * value is written under both the uppercase and the all-lowercase name. An empty value * leaves both deleted. OPENSSL_CONF is written under its uppercase name only. * A missing saved value changes nothing. * * `systemEnv` is where the SNYK_SYSTEM_* values are read from, normally `process.env`. */ export declare function restoreSystemEnv(env: ChildProcessEnv, systemEnv: ChildProcessEnv): ChildProcessEnv; /** * Returns a copy of `env` that is safe for third-party child processes such as build * tools. It calls restoreSystemEnv to restore the user's own proxy and OpenSSL settings, * then removes every SNYK_* variable (any casing), so no Snyk credentials reach the child. * * `systemEnv` is where the SNYK_SYSTEM_* values are read from, normally `process.env`. */ export declare function cleanSnykEnv(env: ChildProcessEnv, systemEnv: ChildProcessEnv): ChildProcessEnv;