Skip to content

Open-source Grok Bot alternative with a virtual machine that bots can use

Desktop: never vouch for a saved http host that holds a comma

AdityaUmale004893330332
diff --git a/electron/server-address.mjs b/electron/server-address.mjs
index ad120e6370..6abd94ee83 100644
--- a/electron/server-address.mjs
+++ b/electron/server-address.mjs
@@ -73,7 +73,8 @@ export function plainHttpServerOrigins(environments) {
for (const env of environments ?? []) {
if (typeof env?.origin !== "string" || !allowedServerOrigin(env.origin)) continue;
const url = new URL(env.origin);
- if (url.protocol === "http:" && !isLoopbackHost(url.hostname)) origins.add(url.origin);
+ // Chromium splits the switch on commas: a host holding one would vouch for a different, public host too.
+ if (url.protocol === "http:" && !isLoopbackHost(url.hostname) && !url.hostname.includes(",")) origins.add(url.origin);
}
return [...origins];
}
diff --git a/electron/server-address.node-test.mjs b/electron/server-address.node-test.mjs
index 2a38f17e1b..05a4f56cfa 100644
--- a/electron/server-address.node-test.mjs
+++ b/electron/server-address.node-test.mjs
@@ -106,6 +106,8 @@ test("only saved servers at a private-network http address are vouched for, so L
{ id: "g", kind: "remote", origin: "http://maus.example.com" },
{ id: "h", kind: "local", dataDir: "/tmp/work" },
{ id: "i", kind: "remote", origin: "http://192.168.1.20:8799" },
+ // Chromium splits the switch on commas, so this would also vouch for the public http://example.com.
+ { id: "j", kind: "remote", origin: "http://example.com,.local" },
];
assert.deepEqual(plainHttpServerOrigins(environments), ["http://192.168.1.20:8799", "http://box.tail1234.ts.net:8799"]);
assert.deepEqual(plainHttpServerOrigins([]), []);