Skip to content

Commit 2190a96

Browse files
authored
fix(cli): ensure host is set when starting dev server (#3843)
1 parent cbde4c1 commit 2190a96

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

.changeset/clean-spoons-push.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
"@rnx-kit/cli": patch
3+
---
4+
5+
Ensure `host` is set to `localhost` by default when starting the dev server,
6+
otherwise it will listen to external connections.

packages/cli/src/start.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,12 @@ export async function rnxStart(
5858
}
5959
}
6060

61+
// CVE-2025-11953: Ensure `host` is set to `localhost` by default, otherwise
62+
// it will listen to external connections.
63+
if (!args.host) {
64+
args.host = "127.0.0.1";
65+
}
66+
6167
// load Metro configuration, applying overrides from the command line
6268
const metroConfig = await loadMetroConfig(ctx, {
6369
...args,
@@ -109,7 +115,7 @@ export async function rnxStart(
109115

110116
// create middleware -- a collection of plugins which handle incoming
111117
// http(s) requests, routing them to static pages or JS functions.
112-
const host = args.host?.length ? args.host : "localhost";
118+
const host = args.host;
113119
const devServerUrl = `${scheme}://${host}:${port}`;
114120
const devServer = createDevServerMiddleware({ host, port, watchFolders });
115121

0 commit comments

Comments
 (0)