mirror of
https://github.com/AikidoSec/safe-chain.git
synced 2026-05-26 12:10:49 +00:00
Another try
This commit is contained in:
parent
0106767c35
commit
2810a87cd0
2 changed files with 10 additions and 13 deletions
|
|
@ -168,7 +168,16 @@ function loadCa() {
|
|||
}
|
||||
|
||||
const { privateKey, certificate } = generateCa();
|
||||
|
||||
// Ensure directory exists before writing files
|
||||
try {
|
||||
fs.mkdirSync(certFolder, { recursive: true });
|
||||
} catch (error) {
|
||||
// Directory might already exist or there's a permission issue
|
||||
if (/** @type {any} */(error).code !== 'EEXIST') {
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
// Write files and ensure they're flushed to disk
|
||||
const keyFd = fs.openSync(keyPath, 'w');
|
||||
|
|
|
|||
|
|
@ -9,23 +9,11 @@ import {
|
|||
import { getCaCertPath } from "./certUtils.js";
|
||||
import { setEcoSystem, ECOSYSTEM_JS, ECOSYSTEM_PY } from "../config/settings.js";
|
||||
import fs from "fs";
|
||||
import path from "path";
|
||||
import os from "os";
|
||||
|
||||
describe("registryProxy.mitm", () => {
|
||||
let proxy, proxyHost, proxyPort;
|
||||
|
||||
before(async () => {
|
||||
// Clean up any existing CA certificates to ensure fresh generation with new extensions
|
||||
const certFolder = path.join(os.homedir(), ".safe-chain", "certs");
|
||||
try {
|
||||
if (fs.existsSync(certFolder)) {
|
||||
fs.rmSync(certFolder, { recursive: true, force: true });
|
||||
}
|
||||
} catch (error) {
|
||||
// Ignore errors during cleanup
|
||||
}
|
||||
|
||||
proxy = createSafeChainProxy();
|
||||
await proxy.startServer();
|
||||
const envVars = mergeSafeChainProxyEnvironmentVariables([]);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue