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 <noreply@anthropic.com>
This commit is contained in:
p1neappleXpress
2026-09-26 19:49:57 +03:00
co-authored by Claude Opus 5.5
parent f62f1913a2
commit bc9ada06f7
2 changed files with 15 additions and 2 deletions
+5
View File
@@ -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 {
+10 -2
View File
@@ -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
}
}