mirror of
https://github.com/AikidoSec/safe-chain.git
synced 2026-05-26 12:10:49 +00:00
Do not add list of trusted hosts, is security risk
This commit is contained in:
parent
9b102412af
commit
6a94271a10
1 changed files with 1 additions and 7 deletions
|
|
@ -25,18 +25,13 @@ export async function runPip(command, args) {
|
||||||
env.SSL_CERT_FILE = combinedCaPath;
|
env.SSL_CERT_FILE = combinedCaPath;
|
||||||
|
|
||||||
// To counter behavior that is sometimes seen where pip ignores REQUESTS_CA_BUNDLE/SSL_CERT_FILE,
|
// To counter behavior that is sometimes seen where pip ignores REQUESTS_CA_BUNDLE/SSL_CERT_FILE,
|
||||||
// 1. Set additional env vars for pip
|
// We will set additional env vars for pip
|
||||||
// 2. Create a pip config file that specifies the cert and trusted hosts
|
|
||||||
|
|
||||||
env.PIP_CERT = combinedCaPath;
|
env.PIP_CERT = combinedCaPath;
|
||||||
|
|
||||||
// Create a temporary pip config file
|
// Create a temporary pip config file
|
||||||
const tmpDir = os.tmpdir();
|
const tmpDir = os.tmpdir();
|
||||||
const pipConfigPath = path.join(tmpDir, `safe-chain-pip-${Date.now()}.ini`);
|
const pipConfigPath = path.join(tmpDir, `safe-chain-pip-${Date.now()}.ini`);
|
||||||
|
|
||||||
// Trusted hosts: use knownPipRegistries from parsePackageFromUrl
|
|
||||||
const trustedHosts = Array.from(new Set(knownPipRegistries));
|
|
||||||
|
|
||||||
// Proxy settings
|
// Proxy settings
|
||||||
const httpProxy = env.HTTP_PROXY || '';
|
const httpProxy = env.HTTP_PROXY || '';
|
||||||
const httpsProxy = env.HTTPS_PROXY || '';
|
const httpsProxy = env.HTTPS_PROXY || '';
|
||||||
|
|
@ -46,7 +41,6 @@ export async function runPip(command, args) {
|
||||||
pipConfig += `cert = ${combinedCaPath}\n`;
|
pipConfig += `cert = ${combinedCaPath}\n`;
|
||||||
if (httpProxy) pipConfig += `proxy = ${httpProxy}\n`;
|
if (httpProxy) pipConfig += `proxy = ${httpProxy}\n`;
|
||||||
if (httpsProxy) pipConfig += `proxy = ${httpsProxy}\n`;
|
if (httpsProxy) pipConfig += `proxy = ${httpsProxy}\n`;
|
||||||
if (trustedHosts.length) pipConfig += `trusted-host = ${trustedHosts.join(' ')}\n`;
|
|
||||||
|
|
||||||
await fs.writeFile(pipConfigPath, pipConfig);
|
await fs.writeFile(pipConfigPath, pipConfig);
|
||||||
env.PIP_CONFIG_FILE = pipConfigPath;
|
env.PIP_CONFIG_FILE = pipConfigPath;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue