Skip to content

Commit 9fac9f9

Browse files
fix(run-e2e): drop vulnerable ip package (#2525)
2 parents 9a74a2b + d49ded9 commit 9fac9f9

3 files changed

Lines changed: 9 additions & 11 deletions

File tree

‎automation/run-e2e/lib/ci.mjs‎

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import c from "ansi-colors";
22
import findFreePort from "find-free-port";
3-
import nodeIp from "ip";
43
import { execSync } from "node:child_process";
54
import { createServer } from "node:net";
5+
import { networkInterfaces } from "node:os";
66
import { fileURLToPath } from "node:url";
77
import p from "node:path";
88
import sh from "shelljs";
@@ -34,6 +34,13 @@ const HOST_NETWORK = ["1", "true"].includes(String(process.env.E2E_HOST_NETWORK)
3434
const HOST_NETWORK_RUNTIME_PORT = 8080;
3535
const HOST_NETWORK_ADMIN_PORT = 8090;
3636

37+
// First external IPv4 address of this machine, so containers can reach the host.
38+
function getHostIpAddress() {
39+
return Object.values(networkInterfaces())
40+
.flat()
41+
.find(iface => iface?.family === "IPv4" && !iface.internal)?.address;
42+
}
43+
3744
export async function ci() {
3845
console.log(c.cyan("Run e2e tests in CI environment"));
3946

@@ -64,7 +71,7 @@ export async function ci() {
6471
ip = "127.0.0.1";
6572
} else {
6673
freePort = await findFreePort(3000);
67-
ip = nodeIp.address();
74+
ip = getHostIpAddress();
6875
}
6976

7077
if (!ip) {

‎automation/run-e2e/package.json‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727
"cross-zip": "^4.0.1",
2828
"enquirer": "^2.4.1",
2929
"find-free-port": "^2.0.0",
30-
"ip": "^2.0.1",
3130
"node-fetch": "^3.3.2",
3231
"shelljs": "^0.10.0",
3332
"yargs-parser": "^22.0.0"

‎pnpm-lock.yaml‎

Lines changed: 0 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)