Skip to content

Commit e8bb273

Browse files
fix(config): reject hostless addresses in single-user mode (#795)
Co-authored-by: David McKay <davidmckayv@users.noreply.github.com> Co-authored-by: David McKay <david@copilotkit.ai>
1 parent aa93210 commit e8bb273

3 files changed

Lines changed: 16 additions & 0 deletions

File tree

‎CHANGELOG.md‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,12 @@ thing itself — a card naming the app, with a Connect button.
8282
access that was withdrawn. An app shared across the deployment still says to ask an administrator,
8383
since the person reading cannot connect it.
8484

85+
### No-sign-in startup rejects addresses without a host
86+
87+
With `OPENBOT_SINGLE_USER=true`, an address such as `example.com:3010` in `OPENBOT_PUBLIC_URL`,
88+
`OPENBOT_APP_URL` or `TRUSTED_ORIGINS` now refuses startup. It previously counted as a private
89+
network address and only warned, even though the missing URL scheme left its host unidentified.
90+
8591
### A reply's tool calls fold into one line
8692

8793
A Bot that searched, read two pages and checked Drive before answering drew four lines above its

‎server/src/config.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -560,6 +560,7 @@ function reachOf(raw: string): Reach {
560560
return "public";
561561
}
562562
bare = bare.replace(/^\[|\]$/g, "").replace(/\.+$/, "");
563+
if (!bare) return "public";
563564

564565
if (
565566
bare === "localhost" ||

‎server/tests/config.test.ts‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -530,6 +530,15 @@ describe("deployment configuration", () => {
530530
{ TRUSTED_ORIGINS: "http://localhost:3010,https://openbot.example.com" },
531531
],
532532
["an address that is not a URL at all", { OPENBOT_PUBLIC_URL: "openbot" }],
533+
[
534+
"a public URL missing its scheme",
535+
{ OPENBOT_PUBLIC_URL: "example.com:3010" },
536+
],
537+
["an app URL missing its scheme", { OPENBOT_APP_URL: "example.com:3010" }],
538+
[
539+
"a trusted origin missing its scheme",
540+
{ TRUSTED_ORIGINS: "http://localhost:3010,example.com:3010" },
541+
],
533542
])("refuses no sign-in combined with %s", (_label, published) => {
534543
expect(() =>
535544
loadConfig({ ...withoutSignIn, ...OPEN, ...published }),

0 commit comments

Comments
 (0)