fix(desktop): fetch join policies through native networking#2862
fix(desktop): fetch join policies through native networking#2862johnmatthewtennant wants to merge 5 commits into
Conversation
45113e5 to
238526f
Compare
There was a problem hiding this comment.
🤖 hey @johnmatthewtennant — I like the direction here, native networking is clearly the right escape hatch for a CORS-restricted relay, and the redirect refusal + credential rejection are nice hardening on top. Two things I'd want changed before this goes in, plus a few smaller notes inline.
Blocking, both left as inline comments:
- the native command buffers the whole response body from an arbitrary user-entered relay (
response.json()) transportdefaults to"webview"— the broken path is the default a new caller gets
Non-blocking notes:
desktop/src/shared/api/invites.test.mjs still only exercises the webview branch (every getJoinPolicy call in it omits the transport arg). Worth one native-transport case that pins the command name fetch_join_policy, the relayUrl arg shape, and the mapping — the two branches aren't symmetric (webview unwraps raw.policy, native returns the already-unwrapped policy), and right now nothing on the TS side locks that down.
The reported bug still reproduces for invite-URL joins against the same relay, since getJoinPolicy on the invite path, acceptJoinPolicy, and claimInvite all stay on webview fetch. I get why (the description says as much) — could you file a follow-up issue and link it here so the remaining half doesn't get lost?
Nothing here looks wrong to me on the parts I didn't comment on: 404/non-success/malformed-JSON semantics match the old flow, and I ran the URL builder against .. traversal, %2F-encoded segments, IPv6 hosts, uppercase schemes, and bare ws:///foo — all either rejected or normalized sanely.
…unity-policy-fetch * origin/main: Fix formatting in README.md diagram (block#2284) fix(desktop): make Linux AppImage GStreamer work on non-Debian distros (block#2176) refactor(desktop): remove Agent directory section from Agents page (block#2290) fix(desktop): enable arboard Wayland backend so Linux copies reach the Wayland clipboard (block#2904) fix(desktop): supervise and re-arm relay-mesh runtime (block#2823) fix(agents): run live Databricks discovery instead of the fallback list (block#2890) fix(desktop): retire prepend mode on every reader wheel (block#2913) fix(desktop): consolidate prepend scroll correction (block#2855) docs(buzz-acp): correct agent key generation instructions (block#2875) fix(desktop): track concurrent agent turns up to the harness maximum (block#2882) docs(contributing): trim to goose-scale minimal intake surface (block#2780) fix(relay): preserve reconnect backoff (block#2759)
Summary
Adding an existing community by relay URL could fail with
Community rejected: Load failedeven when its WebSocket endpoint was reachable. The Add Community flow fetched/api/join-policyfrom the WebView, so a relay without a matching CORS allowance blocked the policy request before the app could join it.This bug fix:
404, non-success status, malformed JSON, and absent-policy behavior.Public relays using Buzz's default permissive CORS configuration are not known to be affected.
Related issue
Related to #2872.
Testing
End-to-end red/green requires access to a relay with a restrictive CORS configuration and a Buzz identity authorized to join it.
Red:
mainFrom a clean checkout of
main:In Buzz Desktop:
Observed result:
Green: this PR
From a clean checkout of this branch:
Repeat the same steps above.
Observed result:
Supporting checks: