mirror of
https://github.com/diegosouzapw/OmniRoute.git
synced 2026-09-21 22:32:22 +03:00
fix(runtime): eliminate hardcoded 20128 port remnants and make loopback URLs dynamic (#13533)
* fix(runtime): eliminate hardcoded 20128 port remnants and make loopback URLs dynamic
- Make model assessment probe base URL resolve dynamically from getRuntimePorts() / env
- Support dynamic loopback in traffic inspector replay route and MITM handlers
- Make WebSocket live server allowlist dynamically include runtime PORT/DASHBOARD_PORT loopback origins
- Update CLI tools config/apply/letta-settings and tool-detector to adapt to configured runtime port
- Update client UI components (EndpointPageClient, ApiExplorerClient, RelayProxyClient) to use current window origin or dynamic port
- Make resolveOmniRouteBaseUrl, useDisplayBaseUrl, and wellKnown.ts respect configured port
- Update package.json electron:dev wait-on to use ${PORT:-20128}
- Add test coverage for custom port in resolveOmniRouteBaseUrl and liveServerAllowList
- Add changelog fragment for PR #13533
* fix(runtime): complete the truncated fallback comment in wellKnown.ts
Co-authored-by: diegosouzapw <8016841+diegosouzapw@users.noreply.github.com>
---------
Co-authored-by: diegosouzapw <8016841+diegosouzapw@users.noreply.github.com>
This commit is contained in:
@@ -50,3 +50,7 @@ test("resolveOmniRouteBaseUrl ignores blank values", () => {
|
||||
test("resolveOmniRouteBaseUrl uses the default localhost fallback", () => {
|
||||
assert.equal(resolveOmniRouteBaseUrl({}), DEFAULT_OMNIROUTE_BASE_URL);
|
||||
});
|
||||
|
||||
test("resolveOmniRouteBaseUrl uses custom port when PORT env is set", () => {
|
||||
assert.equal(resolveOmniRouteBaseUrl({ PORT: 37128 }), "http://localhost:37128");
|
||||
});
|
||||
|
||||
@@ -66,6 +66,18 @@ describe("buildAllowedOrigins", () => {
|
||||
// Defaults remain.
|
||||
assert.equal(out.has("http://localhost:20128"), true);
|
||||
});
|
||||
|
||||
it("includes dynamic loopback origins when custom PORT is configured", () => {
|
||||
const env = {
|
||||
...EMPTY_ENV,
|
||||
PORT: "37128",
|
||||
};
|
||||
const out = buildAllowedOrigins(env);
|
||||
assert.equal(out.has("http://localhost:37128"), true);
|
||||
assert.equal(out.has("http://127.0.0.1:37128"), true);
|
||||
assert.equal(out.has("http://[::1]:37128"), true);
|
||||
assert.equal(out.has("http://localhost:20128"), true);
|
||||
});
|
||||
});
|
||||
|
||||
describe("buildAllowedHosts", () => {
|
||||
@@ -150,6 +162,11 @@ describe("isOriginAllowed", () => {
|
||||
assert.equal(isOriginAllowed("http://100.96.135.160:20128", env), true);
|
||||
});
|
||||
|
||||
it("does not treat a wildcard host as an allow-all origin policy", () => {
|
||||
const env = { ...EMPTY_ENV, LIVE_WS_ALLOWED_HOSTS: "*" };
|
||||
assert.equal(isOriginAllowed("http://100.90.139.116:37128", env), false);
|
||||
});
|
||||
|
||||
it("does NOT accept a Tailscale Origin when LIVE_WS_ALLOWED_HOSTS is unset", () => {
|
||||
// Critical security invariant: without explicit opt-in, the LAN/Tailscale
|
||||
// surface is closed even though the listener is reachable.
|
||||
|
||||
Reference in New Issue
Block a user