mirror of
https://github.com/AikidoSec/safe-chain.git
synced 2026-05-26 12:10:49 +00:00
Simplify setting certificates
This commit is contained in:
parent
b886bb1cfe
commit
70dc89c3e8
4 changed files with 77 additions and 16 deletions
|
|
@ -1,13 +1,20 @@
|
|||
import { ui } from "../../environment/userInteraction.js";
|
||||
import { safeSpawn } from "../../utils/safeSpawn.js";
|
||||
import { mergeSafeChainProxyEnvironmentVariables } from "../../registryProxy/registryProxy.js";
|
||||
|
||||
import { getCaCertPath } from "../../registryProxy/certUtils.js";
|
||||
|
||||
export async function runPip(command, args) {
|
||||
try {
|
||||
const result = await safeSpawn(command, args, {
|
||||
const env = mergeSafeChainProxyEnvironmentVariables(process.env);
|
||||
|
||||
// Pass --cert with our CA to pip so it trusts our MITM for known registries.
|
||||
// pip will append this to its default CA bundle, so it still validates
|
||||
// non-registry HTTPS (GitHub, custom mirrors) against system CAs.
|
||||
const finalArgs = [...args, "--cert", getCaCertPath()];
|
||||
|
||||
const result = await safeSpawn(command, finalArgs, {
|
||||
stdio: "inherit",
|
||||
env: mergeSafeChainProxyEnvironmentVariables(process.env),
|
||||
env,
|
||||
});
|
||||
return { status: result.status };
|
||||
} catch (error) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue