diff --git a/CHANGELOG.md b/CHANGELOG.md index 346e71fcb..03964caf4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -70,6 +70,12 @@ thing itself — a card naming the app, with a Connect button. access that was withdrawn. An app shared across the deployment still says to ask an administrator, since the person reading cannot connect it. +### No-sign-in startup rejects addresses without a host + +With `OPENBOT_SINGLE_USER=true`, an address such as `example.com:3010` in `OPENBOT_PUBLIC_URL`, +`OPENBOT_APP_URL` or `TRUSTED_ORIGINS` now refuses startup. It previously counted as a private +network address and only warned, even though the missing URL scheme left its host unidentified. + ### A reply's tool calls fold into one line A Bot that searched, read two pages and checked Drive before answering drew four lines above its diff --git a/server/src/config.ts b/server/src/config.ts index 337100055..51e29edc8 100644 --- a/server/src/config.ts +++ b/server/src/config.ts @@ -560,6 +560,7 @@ function reachOf(raw: string): Reach { return "public"; } bare = bare.replace(/^\[|\]$/g, "").replace(/\.+$/, ""); + if (!bare) return "public"; if ( bare === "localhost" || diff --git a/server/tests/config.test.ts b/server/tests/config.test.ts index 7e5b1ddbe..4651f8675 100644 --- a/server/tests/config.test.ts +++ b/server/tests/config.test.ts @@ -530,6 +530,15 @@ describe("deployment configuration", () => { { TRUSTED_ORIGINS: "http://localhost:3010,https://openbot.example.com" }, ], ["an address that is not a URL at all", { OPENBOT_PUBLIC_URL: "openbot" }], + [ + "a public URL missing its scheme", + { OPENBOT_PUBLIC_URL: "example.com:3010" }, + ], + ["an app URL missing its scheme", { OPENBOT_APP_URL: "example.com:3010" }], + [ + "a trusted origin missing its scheme", + { TRUSTED_ORIGINS: "http://localhost:3010,example.com:3010" }, + ], ])("refuses no sign-in combined with %s", (_label, published) => { expect(() => loadConfig({ ...withoutSignIn, ...OPEN, ...published }),