Skip to content

Commit ab62ef2

Browse files
fix(config): a public name starting 127. is not loopback for OPENBOT_SINGLE_USER (#744)
Signed-off-by: Charan Rathore <180254320+charan-rathore@users.noreply.github.com> Co-authored-by: David McKay <david@copilotkit.ai>
1 parent 34a29bf commit ab62ef2

3 files changed

Lines changed: 35 additions & 1 deletion

File tree

‎CHANGELOG.md‎

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,23 @@ Newest first. `Unreleased` is what is on `main` and not yet tagged.
88

99
## Unreleased
1010

11+
- `OPENBOT_SINGLE_USER` is now refused with a public name that starts with `127.`, such as
12+
`https://127.example.com` or `https://127.0.0.1.nip.io`. The check for a loopback address matched
13+
any host beginning `127.`, so a public address like that read as this machine and the no-sign-in
14+
administrator was allowed on it. Only a full 127.x.x.x address counts as loopback now.
15+
- A cancellation the native host never collected is now dropped instead of being reported as
16+
pending forever. Every timed-out, stopped or revoked host operation queues a cancel for the desktop
17+
worker, and only that worker ever removed it: a worker that stopped polling left the entry in
18+
memory for the life of the process, so the Host access panel showed an operation that could never
19+
finish. A desktop that reconnects within the operation timeout is still told to stop.
20+
- A Bot's shell now honours a Stop that landed before the command was spawned, not only one that
21+
arrives afterwards. A person who pressed Stop in the window between the request reaching the
22+
computer and the command starting got no answer until that command finished on its own.
23+
- A file download refused because the computer's response carried no usable byte length now releases
24+
the connection before reporting the refusal. The unread body could be as large as the whole
25+
download budget, so a computer reached through a proxy that re-chunks left a transfer running and a
26+
connection checked out of the pool on every attempt.
27+
1128
- A conversation title cut at 60 characters no longer ends in half an emoji. `slice` counts UTF-16
1229
code units and an emoji is two of them, so a title cut between the halves rendered a replacement
1330
character in the sidebar and the picker, where the character itself should have been.

‎server/src/config.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -528,7 +528,7 @@ function reachOf(raw: string): Reach {
528528
bare === "localhost" ||
529529
bare === "::1" ||
530530
bare === "0:0:0:0:0:0:0:1" ||
531-
/^127\./.test(bare)
531+
/^127(\.\d{1,3}){3}$/.test(bare)
532532
) {
533533
return "loopback";
534534
}

‎server/tests/config.test.ts‎

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -566,6 +566,23 @@ describe("deployment configuration", () => {
566566
).toThrow("OPENBOT_SINGLE_USER");
567567
});
568568

569+
// A name that merely starts with 127. is a public name, not loopback. Only a whole 127.x.x.x
570+
// address is.
571+
test.each([
572+
[
573+
"a public name starting 127.",
574+
{ OPENBOT_PUBLIC_URL: "https://127.example.com" },
575+
],
576+
[
577+
"a wildcard DNS name that starts 127.",
578+
{ TRUSTED_ORIGINS: "https://127.0.0.1.nip.io" },
579+
],
580+
])("refuses no sign-in on %s", (_label, published) => {
581+
expect(() =>
582+
loadConfig({ ...withoutSignIn, ...OPEN, ...published }),
583+
).toThrow("OPENBOT_SINGLE_USER");
584+
});
585+
569586
// The local workflow the flag exists for, and the two addresses the quick start hands out.
570587
test.each([
571588
{},

0 commit comments

Comments
 (0)