From bc9ada06f7a7897fe4cf66f2e6f834d61c9cbc62 Mon Sep 17 00:00:00 2001 From: p1neappleXpress Date: Sat, 26 Sep 2026 19:49:57 +0300 Subject: [PATCH] main: keep the cupsonline room list out of the KDF context The room list is created by the exit when it starts and handed to clients as --cupsonline-url, so the client derived the context from it while the exit, which has no URL, used "http://#": different keys and no handshake over real cups.online in --transports mode. It is skipped like a missing URL now, which is also what upstream exits derive. Co-Authored-By: Claude Opus 5.5 --- logging_flags_test.go | 5 +++++ main.go | 12 ++++++++++-- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/logging_flags_test.go b/logging_flags_test.go index ce53aae..4231fdb 100644 --- a/logging_flags_test.go +++ b/logging_flags_test.go @@ -46,6 +46,11 @@ func TestPickSessionContext(t *testing.T) { {"highest-priority transport URL", "", "http://#", specs, "https://docs/doc"}, {"no URL anywhere keeps the old default", "", "http://#", specs[:1], "http://#"}, {"legacy single transport", "", "http://#", []transportSpec{{Type: "yandex", Priority: 100, URL: "http://#"}}, "http://#"}, + {"cupsonline rooms are not a context", "", "http://#", []transportSpec{ + {Type: "cupsonline", Priority: 100, URL: "WyIxYzE0NGQwZS1lMDQw"}, + {Type: "yandex", Priority: 50, URL: "https://docs/doc"}, + }, "https://docs/doc"}, + {"cupsonline alone", "", "http://#", []transportSpec{{Type: "cupsonline", Priority: 100, URL: "WyIxYzE0NGQwZS1lMDQw"}}, "http://#"}, } for _, c := range cases { if got := pickSessionContext(c.explicit, c.url, c.specs); got != c.want { diff --git a/main.go b/main.go index 55f3a18..cba432d 100644 --- a/main.go +++ b/main.go @@ -144,9 +144,14 @@ func isNumber(s string) bool { // // explicit --session-context, if non-empty // --url globalURL, if set and not the placeholder -// transports URL of the highest-priority transport that has one +// transports URL of the highest-priority transport that has one, +// cupsonline aside // fallback the placeholder "http://#" // +// A cupsonline "URL" is the room list the exit creates when it starts and +// prints for clients, so the exit cannot know it beforehand; letting it +// into the context gave the two sides different keys. +// // This is what the OpenFlux-Android client derives for a Session profile, // and the fallback is what older builds used whenever --url was unset, so a // node without any document URL (direct, oneme) keeps its old key. @@ -160,7 +165,10 @@ func pickSessionContext(explicit, globalURL string, specs []transportSpec) strin } best := -1 for i, s := range specs { - if s.URL != "" && s.URL != placeholder && (best < 0 || s.Priority > specs[best].Priority) { + if s.Type == "cupsonline" || s.URL == "" || s.URL == placeholder { + continue + } + if best < 0 || s.Priority > specs[best].Priority { best = i } }