mirror of
https://github.com/AikidoSec/safe-chain.git
synced 2026-05-26 12:10:49 +00:00
Cleanup pt2
This commit is contained in:
parent
e8a4fbcd76
commit
b03c1f6817
3 changed files with 13 additions and 23 deletions
|
|
@ -147,6 +147,7 @@ export async function runPip(command, args) {
|
|||
await fs.writeFile(pipConfigPath, pipConfig);
|
||||
env.PIP_CONFIG_FILE = pipConfigPath;
|
||||
cleanupConfigPath = pipConfigPath;
|
||||
|
||||
} else if (fsSync.existsSync(env.PIP_CONFIG_FILE)) {
|
||||
ui.writeVerbose("Safe-chain: Merging user provided PIP_CONFIG_FILE with safe-chain certificate and proxy settings.");
|
||||
const userConfig = env.PIP_CONFIG_FILE;
|
||||
|
|
@ -166,9 +167,7 @@ export async function runPip(command, args) {
|
|||
|
||||
// Proxy
|
||||
if (typeof parsed.global.proxy !== "undefined") {
|
||||
ui.writeWarning(
|
||||
"Safe-chain: User defined proxy found in PIP_CONFIG_FILE. It will be overwritten in the temporary config.",
|
||||
);
|
||||
ui.writeWarning("Safe-chain: User defined proxy found in PIP_CONFIG_FILE. It will be overwritten in the temporary config.");
|
||||
}
|
||||
if (proxy) {
|
||||
parsed.global.proxy = proxy;
|
||||
|
|
|
|||
|
|
@ -24,10 +24,7 @@ describe("runPipCommand environment variable handling", () => {
|
|||
// Capture the config file content before the function cleans it up
|
||||
if (options.env.PIP_CONFIG_FILE) {
|
||||
try {
|
||||
capturedConfigContent = await fs.readFile(
|
||||
options.env.PIP_CONFIG_FILE,
|
||||
"utf-8",
|
||||
);
|
||||
capturedConfigContent = await fs.readFile(options.env.PIP_CONFIG_FILE, "utf-8");
|
||||
} catch {
|
||||
// Ignore if file doesn't exist or can't be read
|
||||
}
|
||||
|
|
@ -211,7 +208,7 @@ describe("runPipCommand environment variable handling", () => {
|
|||
"install",
|
||||
"certifi",
|
||||
"--index-url",
|
||||
"https://test.pypi.org/simple"
|
||||
"https://test.pypi.org/simple",
|
||||
]);
|
||||
assert.strictEqual(res.status, 0);
|
||||
// Env vars should be set unconditionally
|
||||
|
|
|
|||
|
|
@ -386,10 +386,7 @@ describe("npmInterceptor minimum package age", async () => {
|
|||
},
|
||||
});
|
||||
|
||||
const modifiedBody = await runModifyNpmInfoRequest(
|
||||
packageUrl,
|
||||
originalBody,
|
||||
);
|
||||
const modifiedBody = await runModifyNpmInfoRequest(packageUrl, originalBody);
|
||||
const modifiedJson = JSON.parse(modifiedBody);
|
||||
|
||||
// All versions should remain unchanged since lodash is excluded
|
||||
|
|
@ -449,10 +446,7 @@ describe("npmInterceptor minimum package age", async () => {
|
|||
},
|
||||
});
|
||||
|
||||
const modifiedBody = await runModifyNpmInfoRequest(
|
||||
packageUrl,
|
||||
originalBody,
|
||||
);
|
||||
const modifiedBody = await runModifyNpmInfoRequest(packageUrl, originalBody);
|
||||
const modifiedJson = JSON.parse(modifiedBody);
|
||||
|
||||
// All versions should remain for excluded scoped package
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue