mirror of
https://github.com/AikidoSec/safe-chain.git
synced 2026-05-26 12:10:49 +00:00
Allow the safe-chain to act as a regular http proxy too (besides the CONNECT tunneling implementation)
This commit is contained in:
parent
5eedbfb57f
commit
8ed2330a3c
2 changed files with 60 additions and 7 deletions
|
|
@ -1,6 +1,7 @@
|
|||
import * as http from "http";
|
||||
import { tunnelRequest } from "./tunnelRequestHandler.js";
|
||||
import { mitmConnect } from "./mitmRequestHandler.js";
|
||||
import { handleHttpProxyRequest } from "./plainHttpProxy.js";
|
||||
import { getCaCertPath } from "./certUtils.js";
|
||||
import { auditChanges } from "../scanning/audit/index.js";
|
||||
import { knownRegistries, parsePackageFromUrl } from "./parsePackageFromUrl.js";
|
||||
|
|
@ -54,13 +55,7 @@ export function mergeSafeChainProxyEnvironmentVariables(env) {
|
|||
}
|
||||
|
||||
function createProxyServer() {
|
||||
const server = http.createServer((_, res) => {
|
||||
res.writeHead(400, "Bad Request");
|
||||
res.write(
|
||||
"Safe-chain proxy: Direct http not supported. Only CONNECT requests are allowed."
|
||||
);
|
||||
res.end();
|
||||
});
|
||||
const server = http.createServer(handleHttpProxyRequest);
|
||||
|
||||
return server;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue